/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/** This is the second phase of Enter, in which classes are completed
* by entering their members into the class scope using
* MemberEnter.complete(). See Enter for an overview.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
*/
final static boolean checkClash = true;
private final boolean skipAnnotations;
return instance;
}
}
/** A queue for classes whose members still need to be entered into the
* symbol table.
*/
/** Set to true only when the first of a set of classes is
* processed from the halfcompleted queue.
*/
boolean isFirst = true;
/** A flag to disable completion from time to time during member
* enter, as we only need to look up types. This avoids
* unnecessarily deep recursion.
*/
boolean completionEnabled = true;
/* ---------- Processing import clauses ----------------
*/
/** Import all classes of a class or package on demand.
* @param pos Position to be used for error reporting.
* @param tsym The class or package the members of which are imported.
* @param toScope The (import) scope in which imported classes
* are entered.
*/
final TypeSymbol tsym,
// Check that packages imported from exist (JLS ???).
// If we can't find java.lang, exit immediately.
throw new FatalError(msg);
} else {
}
}
}
/** Import all static members of a class or package on demand.
* @param pos Position to be used for error reporting.
* @param tsym The class or package the members of which are imported.
* @param toScope The (import) scope in which imported classes
* are entered.
*/
final TypeSymbol tsym,
// enter imported types immediately
new Object() {
return;
// also import inherited names
importFrom(t.tsym);
}
}
}.importFrom(tsym);
// enter non-types before annotations that might use them
}
return;
// also import inherited names
importFrom(t.tsym);
}
}
}
public void enterAnnotation() {
}
});
}
// is the sym accessible everywhere in packge?
switch (flags) {
default:
case PUBLIC:
return true;
case PRIVATE:
return false;
case 0:
case PROTECTED:
}
}
/** Import statics types of a given name. Non-types are handled in Attr.
* @param pos Position to be used for error reporting.
* @param tsym The class from which the name is imported.
* @param name The (simple) name being imported.
* @param env The environment containing the named import
* scope to add to.
*/
final TypeSymbol tsym,
return;
}
// enter imported types immediately
new Object() {
return;
// also import inherited names
importFrom(t.tsym);
e = e.next()) {
}
}
}.importFrom(tsym);
// enter non-types before annotations that might use them
boolean found = false;
}
return;
// also import inherited names
importFrom(t.tsym);
e = e.next()) {
found = true;
}
}
}
public void enterAnnotation() {
try {
if (!found) {
}
} finally {
}
}
});
}
/** Import given class.
* @param pos Position to be used for error reporting.
* @param tsym The class to be imported.
* @param env The environment containing the named import
* scope to add to.
*/
}
/** Construct method type from method signature.
* @param typarams The method's type parameters.
* @param params The method's value parameters.
* @param res The method's result type,
* null if it is a constructor.
* @param thrown The method's thrown exceptions.
* @param env The method's (local) environment.
*/
// Enter and attribute type parameters.
// Enter and attribute value parameters.
}
// Attribute result type, if one is given.
// Attribute thrown exceptions.
}
}
/* ********************************************************************
* Visitor methods for member enter
*********************************************************************/
/** Visitor argument: the current environment
*/
/** Enter field and method definitions and process import
* clauses, catching any completion failure exceptions.
*/
try {
} catch (CompletionFailure ex) {
} finally {
}
}
/** Enter members from a list of trees.
*/
}
/** Enter members for a class.
*/
}
}
/** Add the implicit members for an enum type
* to the symbol table.
*/
// public static T[] values() { return ???; }
null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
null);
// public static T valueOf(String name) { return ???; }
null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
null);
// the remaining members are for bootstrapping only
// public final int ordinal() { return ???; }
null,
null);
// public final String name() { return ???; }
null,
null);
// public int compareTo(E other) { return ???; }
MethodSymbol compareTo = new
}
// we must have already processed this toplevel
return;
}
// check that no class exists with same fully qualified name as
// toplevel package
"pkg.clashes.with.class.of.same.name",
p);
}
p = p.owner;
}
}
// process package annotations
// Import-on-demand java.lang.
// Process all import clauses.
}
// process the non-static imports and the static imports of types.
TypeSymbol p;
// Create a local environment pointing to this tree to disable
// effects of other imports in Resolve.findGlobalType
// Attribute qualifying package or class.
p = attr.
// Import on demand.
if (tree.staticImport)
else
} else {
// Named type import.
if (tree.staticImport) {
} else {
}
}
}
try {
// Compute the method type
localEnv);
} finally {
}
// Set m.params
}
// mark the method varargs, if necessary
}
}
/** Create a fresh environment for method bodies.
* @param tree The method definition.
* @param env The environment current outside of the method definition.
*/
return localEnv;
}
}
try {
} else {
}
} finally {
}
//if we are entering a varargs parameter, we need to replace its type
//(a plain array type) with the more precise VarargsType --- we need
//to do it this way because varargs is represented in the tree as a modifier
//on the parameter declaration, and not as a distinct type of array node.
}
VarSymbol v =
v.flags_field |= HASINIT;
}
}
}
}
/** Create a fresh environment for a variable's initializer.
* If the variable is a field, the owner of the environment's scope
* is be the variable itself, otherwise the owner is the method
* enclosing the variable definition.
*
* @param tree The variable definition.
* @param env The environment current outside of the variable definition.
*/
}
return localEnv;
}
/** Default member enter visitor method: do nothing
*/
}
}
return mEnv;
}
return iEnv;
}
/* ********************************************************************
* Type completion
*********************************************************************/
try {
// To prevent deep recursion, suppress completion of some
// types.
completionEnabled = false;
} finally {
completionEnabled = true;
}
}
/* ********************************************************************
* Annotation processing
*********************************************************************/
/** Queue annotations for later processing. */
final Symbol s) {
if (annotations.isEmpty()) return;
}
public void enterAnnotation() {
try {
if (s.attributes_field != null &&
s.attributes_field.nonEmpty() &&
"already.annotated",
kindName(s), s);
} finally {
}
}
});
}
/**
* Check if a list of annotations contains a reference to
* java.lang.Deprecated.
**/
return true;
}
return false;
}
/** Enter a set of annotations. */
Symbol s) {
if (!skipAnnotations)
env);
if (c == null) continue;
// Note: @Deprecated has no effect on local variables and parameters
if (!c.type.isErroneous()
// Internally to java.lang.invoke, a @PolymorphicSignature annotation
// acts like a classfile attribute.
if (!c.type.isErroneous() &&
if (!target.hasMethodHandles()) {
// Somebody is compiling JDK7 source code to a JDK6 target.
// Make it an error, since it is unlikely but important.
"wrong.target.for.polymorphic.signature.definition",
}
// Pull the flag through for better diagnostics, even on a bad target.
}
}
}
/** Queue processing of an attribute default value. */
final MethodSymbol m) {
m + " default " + defaultValue;
}
public void enterAnnotation() {
try {
} finally {
}
}
});
}
/** Enter a default value for an attribute method. */
final MethodSymbol m) {
localEnv);
}
/* ********************************************************************
* Source completer
*********************************************************************/
/** Complete entering a class.
* @param sym The symbol of the class to be completed.
*/
// Suppress some (recursive) MemberEnter invocations
if (!completionEnabled) {
// Re-install same completer for next time around and return.
return;
}
isFirst = false;
try {
// Save class environment for later member enter (2) processing.
// Mark class as not yet attributed.
c.flags_field |= UNATTRIBUTED;
// If this is a toplevel-class, make sure any preceding import
// clauses have been seen.
}
// create an environment for evaluating the base clauses
// Determine supertype.
true, false, false)
: syms.objectType;
// Determine interfaces.
// add interface Comparable<T>
// add interface Serializable
}
interfaces.append(i);
} else {
if (all_interfaces == null)
}
}
} else {
}
}
}
}
// Annotations.
// In general, we cannot fully process annotations yet, but we
// can attribute the annotation types and then check to see if the
// @Deprecated annotation is present.
c.flags_field |= DEPRECATED;
// Add default constructor if needed.
long ctorFlags = 0;
boolean based = false;
based = true;
}
}
}
}
// If this is a class, enter symbols for this and super into
// current scope.
ct.supertype_field, c);
}
}
// check that no package exists with same fully qualified name,
// but admit classes in the unnamed package which have the same
// name as a top-level package.
if (checkClash &&
{
}
} catch (CompletionFailure ex) {
} finally {
}
// Enter all member fields and methods of a set of half completed
// classes in a second phase.
if (wasFirst) {
try {
while (halfcompleted.nonEmpty()) {
}
} finally {
isFirst = true;
}
// commit pending annotations
}
}
//import already entered local classes into base scope
}
}
//import current type-parameters into base scope
localEnv.baseClause = true;
return localEnv;
}
/** Enter member fields and methods of a class
* @param env the environment current for the class block.
*/
try {
} finally {
}
}
/** Generate a base clause for an enum type.
* @param pos The position for trees and diagnostics, if any
* @param c The class symbol of the enum
*/
return result;
}
return t;
public Type getModelType() {
return modelType;
}
};
}
// where
boolean interfaceExpected;
this.originalType = originalType;
this.interfaceExpected = interfaceExpected;
}
return result;
}
}
}
} else {
}
}
} else {
boolean prev = interfaceExpected;
try {
interfaceExpected = false;
} finally {
}
}
}
} else {
return actuals;
}
};
}
}
return typarams_field;
}
};
return c;
}
if (n == 1) {
} else {
for (int i = n; i > 0; i--) {
}
}
}
}
/* ***************************************************************************
* tree building
****************************************************************************/
/** Generate default constructor for given class. For classes different
* from java.lang.Object, this is:
*
* c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
* super(x_0, ..., x_n)
* }
*
* or, if based == true:
*
* c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
* x_0.super(x_1, ..., x_n)
* }
*
* @param make The tree factory.
* @param c The class owning the default constructor.
* @param argtypes The parameter types of the constructor.
* @param thrown The thrown exceptions of the constructor.
* @param based Is first parameter a this$n?
*/
ClassSymbol c,
long flags,
boolean based) {
target.compilerBootstrap(c))) {
// constructors of true enums are private
} else
null,
null);
return result;
}
/** Generate call to superclass constructor. This is:
*
* super(id_0, ..., id_n)
*
* or, if based == true
*
* id_0.super(id_1,...,id_n)
*
* where id_0, ..., id_n are the names of the given parameters.
*
* @param make The tree factory
* @param params The parameters that need to be passed to super
* @param typarams The type parameters that need to be passed to super
* @param based Is first parameter a this$n?
*/
boolean based) {
if (based) {
} else {
}
}
}