< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
Print this page
import com.sun.tools.javac.code.Kinds.KindName;
import com.sun.tools.javac.code.Kinds.KindSelector;
import com.sun.tools.javac.code.Scope.*;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.*;
+ import com.sun.tools.javac.code.Type.ClassType.Flavor;
import com.sun.tools.javac.main.Option.PkgInfo;
import com.sun.tools.javac.resources.CompilerProperties.Errors;
import com.sun.tools.javac.resources.CompilerProperties.Warnings;
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.tree.JCTree.*;
JavaFileManager fileManager;
PkgInfo pkginfoOpt;
TypeEnvs typeEnvs;
Modules modules;
JCDiagnostic.Factory diags;
+ boolean allowPrimitiveClasses;
private final Todo todo;
public static Enter instance(Context context) {
Enter instance = context.get(enterKey);
fileManager = context.get(JavaFileManager.class);
Options options = Options.instance(context);
pkginfoOpt = PkgInfo.get(options);
typeEnvs = TypeEnvs.instance(context);
+ Source source = Source.instance(context);
+ allowPrimitiveClasses = Source.Feature.PRIMITIVE_CLASSES.allowedInSource(source) && options.isSet("enablePrimitiveClasses");
}
/** Accessor for typeEnvs
*/
public Env<AttrContext> getEnv(TypeSymbol sym) {
c.members_field = WriteableScope.create(c);
c.isPermittedExplicit = tree.permitting.nonEmpty();
c.clearAnnotationMetadata();
ClassType ct = (ClassType)c.type;
+ if (allowPrimitiveClasses) {
+ ct.flavor = ct.flavor.metamorphose((c.flags_field & PRIMITIVE_CLASS) != 0);
+ }
+
if (owner.kind != PCK && (c.flags_field & STATIC) == 0) {
// We are seeing a local or inner class.
// Set outer_field of this class to closest enclosing class
// which contains this class in a non-static context
// (its "enclosing instance class"), provided such a class exists.
}
// Enter type parameters.
ct.typarams_field = classEnter(tree.typarams, localEnv);
ct.allparams_field = null;
+ if (allowPrimitiveClasses && ct.isPrimitiveClass()) {
+ if (ct.projection != null) {
+ ct.projection.typarams_field = ct.typarams_field;
+ ct.projection.allparams_field = ct.allparams_field;
+ }
+ }
// install further completer for this type.
c.completer = typeEnter;
// Add non-local class to uncompleted, to make sure it will be
< prev index next >