< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java

Print this page
@@ -96,19 +96,28 @@
      public static final int ENUM         = 1<<14;
  
      /** Added in SE8, represents constructs implicitly declared in source. */
      public static final int MANDATED     = 1<<15;
  
+     /** Marks a type as a primitive class. We can't reuse the class file encoding (ACC_PRIMITIVE)
+      * since the latter shares its value (0x800) with ACC_STRICT (javac speak: STRICT_FP) and while
+      * STRICT_FP is not a valid flag for a class in the class file level, javac's ASTs flag a class
+      * as being STRICT_FP so as to propagate the FP strictness to methods of the class thereby causing
+      * a clash */
+     public static final int PRIMITIVE_CLASS  = 1<<16;
+ 
      public static final int StandardFlags = 0x0fff;
  
      // Because the following access flags are overloaded with other
      // bit positions, we translate them when reading and writing class
      // files into unique bits positions: ACC_SYNTHETIC <-> SYNTHETIC,
      // for example.
-     public static final int ACC_SUPER    = 0x0020;
+     public static final int ACC_IDENTITY = 0x0020;
+     public static final int ACC_VALUE    = 0x0040;
      public static final int ACC_BRIDGE   = 0x0040;
      public static final int ACC_VARARGS  = 0x0080;
+     public static final int ACC_PRIMITIVE = 0x0800;
      public static final int ACC_MODULE   = 0x8000;
  
      /*****************************************
       * Internal compiler flags (no bits in the lower 16).
       *****************************************/

@@ -120,15 +129,39 @@
      /** Flag is set for a variable symbol if the variable's definition
       *  has an initializer part.
       */
      public static final int HASINIT          = 1<<18;
  
+     /** Flag is set for a class symbol if it defines one or more non-empty
+      *  instance initializer block(s). This is relevenat only for class symbols
+      *  that originate from source types. For binary types the instance initializer
+      *  blocks are "normalized" into the constructors.
+      */
+     public static final int HASINITBLOCK         = 1<<18;
+ 
+     /** Flag is set for a method symbol if it is an empty no-arg ctor.
+      *  i.e. one that simply returns (jlO) or merely chains to a super's
+      *  no-arg ctor
+      */
+     public static final int EMPTYNOARGCONSTR         = 1<<18;
+ 
+     /** Flag is set for a class or interface whose instances have identity
+      * i.e. class/interface declarations that are expressly declared with
+      * the modifier `identity' or (b) any concrete class not declared with the
+      * modifier `value' (c) abstract class not declared `value' but meets various
+      * stipulations (d) older class files with ACC_SUPER bit set
+      */
+     public static final int IDENTITY_TYPE            = 1<<19;
+ 
      /** Flag is set for compiler-generated anonymous method symbols
       *  that `own' an initializer block.
       */
      public static final int BLOCK            = 1<<20;
  
+     /** Marks a type as a value class */
+     public static final int VALUE_CLASS      = 1<<20;
+ 
      /** Flag is set for ClassSymbols that are being compiled from source.
       */
      public static final int FROM_SOURCE      = 1<<21; //ClassSymbols
  
      /** Flag is set for nested classes that do not access instance members

@@ -393,12 +426,12 @@
  
      /** Modifier masks.
       */
      public static final int
          AccessFlags                       = PUBLIC | PROTECTED | PRIVATE,
-         LocalClassFlags                   = FINAL | ABSTRACT | STRICTFP | ENUM | SYNTHETIC,
-         StaticLocalFlags                  = LocalClassFlags | STATIC | INTERFACE,
+         LocalClassFlags                   = FINAL | ABSTRACT | STRICTFP | ENUM | SYNTHETIC | ACC_IDENTITY,
+         StaticLocalClassFlags             = LocalClassFlags | STATIC | INTERFACE,
          MemberClassFlags                  = LocalClassFlags | INTERFACE | AccessFlags,
          MemberStaticClassFlags            = MemberClassFlags | STATIC,
          ClassFlags                        = LocalClassFlags | INTERFACE | PUBLIC | ANNOTATION,
          InterfaceVarFlags                 = FINAL | STATIC | PUBLIC,
          VarFlags                          = AccessFlags | FINAL | STATIC |

@@ -406,17 +439,20 @@
          ConstructorFlags                  = AccessFlags,
          InterfaceMethodFlags              = ABSTRACT | PUBLIC,
          MethodFlags                       = AccessFlags | ABSTRACT | STATIC | NATIVE |
                                              SYNCHRONIZED | FINAL | STRICTFP,
          RecordMethodFlags                 = AccessFlags | ABSTRACT | STATIC |
-                                             SYNCHRONIZED | FINAL | STRICTFP;
+                                             SYNCHRONIZED | FINAL | STRICTFP,
+         AdjustedClassFlags                = ClassFlags | ACC_PRIMITIVE | ACC_VALUE;
      public static final long
-         ExtendedStandardFlags             = (long)StandardFlags | DEFAULT | SEALED | NON_SEALED,
-         ExtendedMemberClassFlags          = (long)MemberClassFlags | SEALED | NON_SEALED,
-         ExtendedMemberStaticClassFlags    = (long) MemberStaticClassFlags | SEALED | NON_SEALED,
-         ExtendedClassFlags                = (long)ClassFlags | SEALED | NON_SEALED,
-         ModifierFlags                     = ((long)StandardFlags & ~INTERFACE) | DEFAULT | SEALED | NON_SEALED,
+         ExtendedStandardFlags             = (long)StandardFlags | DEFAULT | SEALED | NON_SEALED | PRIMITIVE_CLASS | VALUE_CLASS,
+         ExtendedMemberClassFlags          = (long)MemberClassFlags | SEALED | NON_SEALED | PRIMITIVE_CLASS | VALUE_CLASS,
+         ExtendedMemberStaticClassFlags    = (long) MemberStaticClassFlags | SEALED | NON_SEALED | PRIMITIVE_CLASS | VALUE_CLASS,
+         ExtendedClassFlags                = (long)ClassFlags | SEALED | NON_SEALED | PRIMITIVE_CLASS | VALUE_CLASS,
+         ExtendedLocalClassFlags           = (long) LocalClassFlags | PRIMITIVE_CLASS | VALUE_CLASS,
+         ExtendedStaticLocalClassFlags     = (long) StaticLocalClassFlags | PRIMITIVE_CLASS | VALUE_CLASS,
+         ModifierFlags                     = ((long)StandardFlags & ~INTERFACE) | DEFAULT | SEALED | NON_SEALED | PRIMITIVE_CLASS | VALUE_CLASS,
          InterfaceMethodMask               = ABSTRACT | PRIVATE | STATIC | PUBLIC | STRICTFP | DEFAULT,
          AnnotationTypeElementMask         = ABSTRACT | PUBLIC,
          LocalVarFlags                     = FINAL | PARAMETER,
          ReceiverParamFlags                = PARAMETER;
  

@@ -438,10 +474,12 @@
              if (0 != (flags & SYNCHRONIZED))
                                            modifiers.add(Modifier.SYNCHRONIZED);
              if (0 != (flags & NATIVE))    modifiers.add(Modifier.NATIVE);
              if (0 != (flags & STRICTFP))  modifiers.add(Modifier.STRICTFP);
              if (0 != (flags & DEFAULT))   modifiers.add(Modifier.DEFAULT);
+             if (0 != (flags & PRIMITIVE_CLASS))     modifiers.add(Modifier.PRIMITIVE);
+             if (0 != (flags & VALUE_CLASS))     modifiers.add(Modifier.VALUE);
              modifiers = Collections.unmodifiableSet(modifiers);
              modifierSets.put(flags, modifiers);
          }
          return modifiers;
      }

@@ -479,14 +517,24 @@
          BRIDGE(Flags.BRIDGE),
          SYNTHETIC(Flags.SYNTHETIC),
          ANNOTATION(Flags.ANNOTATION),
          DEPRECATED(Flags.DEPRECATED),
          HASINIT(Flags.HASINIT),
+         HASINITBLOCK(Flags.HASINITBLOCK),
+         EMPTYNOARGCONSTR(Flags.EMPTYNOARGCONSTR),
+         IDENTITY_TYPE(Flags.IDENTITY_TYPE) {
+             @Override
+             public String toString() {
+                 return "identity";
+             }
+         },
          BLOCK(Flags.BLOCK),
          FROM_SOURCE(Flags.FROM_SOURCE),
          ENUM(Flags.ENUM),
          MANDATED(Flags.MANDATED),
+         PRIMITIVE(Flags.PRIMITIVE_CLASS),
+         VALUE(Flags.VALUE_CLASS),
          NOOUTERTHIS(Flags.NOOUTERTHIS),
          EXISTS(Flags.EXISTS),
          COMPOUND(Flags.COMPOUND),
          CLASS_SEEN(Flags.CLASS_SEEN),
          SOURCE_SEEN(Flags.SOURCE_SEEN),
< prev index next >