Enum CompilationTarget

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      JDK1_1  
      JDK1_2  
      JDK1_3  
      JDK1_4
      J2SE1.4 = Merlin.
      JDK1_4_1
      The following are undocumented transitional targets that we had used to test VM fixes in update releases.
      JDK1_4_2  
      JDK1_5
      Tiger.
      JDK1_6
      JDK 6.
      JDK1_7
      JDK 7.
      JSR14
      Support for the JSR14 prototype compiler (targeting 1.4 VMs augmented with a few support classes).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private CompilationTarget​(java.lang.String name, int majorVersion, int minorVersion)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean arrayBinaryCompatibility()
      Starting in 1.5, the compiler uses an array type as the qualifier for method calls (such as clone) where required by the language and VM spec.
      boolean boxWithConstructors()
      For bootstrapping, we use J2SE1.4's wrapper class constructors to implement boxing.
      boolean classLiteralsNoInit()
      Although we may not have support for class literals, should we avoid initializing the class that the literal refers to? See 4468823
      boolean generateCLDCStackmap()
      Return true if cldc-style stack maps need to be generated.
      boolean generateEmptyAfterBig()
      Do we generate "empty" stackmap slots after double and long?
      boolean generateStackMapTable()
      Beginning in -target 6, we generate stackmap attribute in compact format.
      boolean hasClassLiterals()
      Does the VM have direct support for class literals?
      boolean hasEnclosingMethodAttribute()
      In J2SE1.5.0, we introduced the "EnclosingMethod" attribute for improved reflection support.
      boolean hasInitCause()
      Although we may not have support for class literals, when we throw a NoClassDefFoundError, should we initialize its cause?
      boolean hasInvokedynamic()
      Does the VM support an invokedynamic instruction?
      boolean hasIterable()
      For bootstrapping, we use J2SE1.4's java.util.Collection instead of java.lang.Iterable.
      boolean hasMethodHandles()
      Does the VM support polymorphic method handle invocation? Affects the linkage information output to the classfile.
      boolean initializeFieldsBeforeSuper()
      Beginning in 1.4, we take advantage of the possibility of emitting code to initialize fields before calling the superclass constructor.
      boolean interfaceFieldsBinaryCompatibility()
      Beginning after 1.2, we follow the binary compatibility rules for interface fields.
      boolean interfaceObjectOverridesBinaryCompatibility()
      Beginning in -target 1.5, we follow the binary compatibility rules for interface methods that redefine Object methods.
      boolean isPackageInfoSynthetic()
      Beginning in -target 6, package-info classes are marked synthetic.
      static CompilationTarget lookup​(java.lang.String name)  
      static CompilationTarget MAX()  
      static CompilationTarget MIN()  
      boolean obeyBinaryCompatibility()
      Beginning with -target 1.2 we obey the JLS rules for binary compatibility, emitting as the qualifying type of a reference to a method or field the type of the qualifier.
      boolean requiresIproxy()
      In -target 1.1 and earlier, the compiler is required to emit synthetic method definitions in abstract classes for interface methods that are not overridden.
      char syntheticNameChar()
      Return the character to be used in constructing synthetic identifiers, where not specified by the JLS.
      boolean useAnnotationFlag()  
      boolean useBridgeFlag()  
      boolean useEnumFlag()  
      boolean useInnerCacheClass()
      Sometimes we need to create a field to cache a value like a class literal of the assertions flag.
      boolean usePrivateSyntheticFields()
      Beginning in -target 1.4.2, we make synthetic variables package-private instead of private.
      boolean useStringBuilder()
      Beginning in 1.5, we have an unsynchronized version of StringBuffer called StringBuilder that can be used by the compiler for string concatenation.
      boolean useSyntheticFlag()
      Beginning in 1.5, we have flag bits we can use instead of marker attributes.
      boolean useVarargsFlag()  
      static CompilationTarget valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static CompilationTarget[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • JSR14

        public static final CompilationTarget JSR14
        Support for the JSR14 prototype compiler (targeting 1.4 VMs augmented with a few support classes). This is a transitional option that will not be supported in the product.
      • JDK1_4_1

        public static final CompilationTarget JDK1_4_1
        The following are undocumented transitional targets that we had used to test VM fixes in update releases. We do not promise to retain support for them.
    • Constructor Detail

      • CompilationTarget

        private CompilationTarget​(java.lang.String name,
                                  int majorVersion,
                                  int minorVersion)
    • Method Detail

      • values

        public static CompilationTarget[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CompilationTarget c : CompilationTarget.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CompilationTarget valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • requiresIproxy

        public boolean requiresIproxy()
        In -target 1.1 and earlier, the compiler is required to emit synthetic method definitions in abstract classes for interface methods that are not overridden. We call them "Miranda" methods.
      • initializeFieldsBeforeSuper

        public boolean initializeFieldsBeforeSuper()
        Beginning in 1.4, we take advantage of the possibility of emitting code to initialize fields before calling the superclass constructor. This is allowed by the VM spec, but the verifier refused to allow it until 1.4. This is necesary to translate some code involving inner classes. See, for example, 4030374.
      • obeyBinaryCompatibility

        public boolean obeyBinaryCompatibility()
        Beginning with -target 1.2 we obey the JLS rules for binary compatibility, emitting as the qualifying type of a reference to a method or field the type of the qualifier. In earlier targets we use as the qualifying type the class in which the member was found. The following methods named *binaryCompatibility() indicate places where we vary from this general rule.
      • arrayBinaryCompatibility

        public boolean arrayBinaryCompatibility()
        Starting in 1.5, the compiler uses an array type as the qualifier for method calls (such as clone) where required by the language and VM spec. Earlier versions of the compiler qualified them by Object.
      • interfaceFieldsBinaryCompatibility

        public boolean interfaceFieldsBinaryCompatibility()
        Beginning after 1.2, we follow the binary compatibility rules for interface fields. The 1.2 VMs had bugs handling interface fields when compiled using binary compatibility (see 4400598), so this is an accommodation to them.
      • interfaceObjectOverridesBinaryCompatibility

        public boolean interfaceObjectOverridesBinaryCompatibility()
        Beginning in -target 1.5, we follow the binary compatibility rules for interface methods that redefine Object methods. Earlier VMs had bugs handling such methods compiled using binary compatibility (see 4392595, 4398791, 4392595, 4400415). The VMs were fixed during or soon after 1.4. See 4392595.
      • usePrivateSyntheticFields

        public boolean usePrivateSyntheticFields()
        Beginning in -target 1.4.2, we make synthetic variables package-private instead of private. This is to prevent the necessity of access methods, which effectively relax the protection of the field but bloat the class files and affect execution.
      • useInnerCacheClass

        public boolean useInnerCacheClass()
        Sometimes we need to create a field to cache a value like a class literal of the assertions flag. In -target 1.4.2 and later we create a new synthetic class for this instead of using the outermost class. See 4401576.
      • generateCLDCStackmap

        public boolean generateCLDCStackmap()
        Return true if cldc-style stack maps need to be generated.
      • generateStackMapTable

        public boolean generateStackMapTable()
        Beginning in -target 6, we generate stackmap attribute in compact format.
      • isPackageInfoSynthetic

        public boolean isPackageInfoSynthetic()
        Beginning in -target 6, package-info classes are marked synthetic.
      • generateEmptyAfterBig

        public boolean generateEmptyAfterBig()
        Do we generate "empty" stackmap slots after double and long?
      • useStringBuilder

        public boolean useStringBuilder()
        Beginning in 1.5, we have an unsynchronized version of StringBuffer called StringBuilder that can be used by the compiler for string concatenation.
      • useSyntheticFlag

        public boolean useSyntheticFlag()
        Beginning in 1.5, we have flag bits we can use instead of marker attributes.
      • useEnumFlag

        public boolean useEnumFlag()
      • useAnnotationFlag

        public boolean useAnnotationFlag()
      • useVarargsFlag

        public boolean useVarargsFlag()
      • useBridgeFlag

        public boolean useBridgeFlag()
      • syntheticNameChar

        public char syntheticNameChar()
        Return the character to be used in constructing synthetic identifiers, where not specified by the JLS.
      • hasClassLiterals

        public boolean hasClassLiterals()
        Does the VM have direct support for class literals?
      • hasInvokedynamic

        public boolean hasInvokedynamic()
        Does the VM support an invokedynamic instruction?
      • hasMethodHandles

        public boolean hasMethodHandles()
        Does the VM support polymorphic method handle invocation? Affects the linkage information output to the classfile. An alias for hasInvokedynamic, since all the JSR 292 features appear together.
      • classLiteralsNoInit

        public boolean classLiteralsNoInit()
        Although we may not have support for class literals, should we avoid initializing the class that the literal refers to? See 4468823
      • hasInitCause

        public boolean hasInitCause()
        Although we may not have support for class literals, when we throw a NoClassDefFoundError, should we initialize its cause?
      • boxWithConstructors

        public boolean boxWithConstructors()
        For bootstrapping, we use J2SE1.4's wrapper class constructors to implement boxing.
      • hasIterable

        public boolean hasIterable()
        For bootstrapping, we use J2SE1.4's java.util.Collection instead of java.lang.Iterable.
      • hasEnclosingMethodAttribute

        public boolean hasEnclosingMethodAttribute()
        In J2SE1.5.0, we introduced the "EnclosingMethod" attribute for improved reflection support.