Package com.strobel.assembler.metadata
Enum CompilerTarget
- java.lang.Object
-
- java.lang.Enum<CompilerTarget>
-
- com.strobel.assembler.metadata.CompilerTarget
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CompilerTarget>
public enum CompilerTarget extends java.lang.Enum<CompilerTarget>
-
-
Field Summary
Fields Modifier and Type Field Description static CompilerTargetDEFAULTintmajorVersionprivate static CompilerTargetMAXprivate static CompilerTargetMINprivate static CompilerTargetMIN_DEFAULTintminorVersionjava.lang.Stringnameprivate static java.util.Map<java.lang.String,CompilerTarget>tabprivate static CompilerTarget[]VALUES
-
Constructor Summary
Constructors Modifier Constructor Description privateCompilerTarget(java.lang.String name, int majorVersion, int minorVersion)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallApiModulesAreRoots()All modules that export an API are roots when compiling code in the unnamed module and targeting 11 or newer.booleanarrayBinaryCompatibility()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.booleanboxWithConstructors()For bootstrapping, we use J2SE1.4's wrapper class constructors to implement boxing.booleanclassLiteralsNoInit()Although we may not have support for class literals, should we avoid initializing the class that the literal refers to? See 4468823booleangenerateCLDCStackMap()Return true if CLDC-style stack maps need to be generated.booleangenerateEmptyAfterBig()Do we generate "empty" stack map slots after double and long?booleangenerateStackMapTable()Beginning in -target 6, we generate stack map attribute in compact format.booleanhasClassLiterals()Does the VM have direct support for class literals?booleanhasEnclosingMethodAttribute()In J2SE1.5.0, we introduced the "EnclosingMethod" attribute for improved reflection support.booleanhasInitCause()Although we may not have support for class literals, when we throw a NoClassDefFoundError, should we initialize its cause?booleanhasInvokeDynamic()Does the VM support an invokedynamic instruction?booleanhasIterable()For bootstrapping, we use J2SE1.4's java.util.Collection instead of java.lang.Iterable.booleanhasMethodHandles()Does the VM support polymorphic method handle invocation? Affects the linkage information output to the classfile.booleanhasMethodParameters()Does the target VM expect MethodParameters attributes?booleanhasNestmateAccess()Does the target VM support nestmate access?booleanhasSealedClasses()Does the target VM support sealed typesbooleanhasStringConcatFactory()Does the target JDK contain StringConcatFactory class?booleanhasVirtualPrivateInvoke()Does the target VM support virtual private invocations?booleaninitializeFieldsBeforeSuper()Beginning in 1.4, we take advantage of the possibility of emitting code to initialize fields before calling the superclass constructor.booleaninterfaceFieldsBinaryCompatibility()Beginning after 1.2, we follow the binary compatibility rules for interface fields.booleaninterfaceObjectOverridesBinaryCompatibility()Beginning in -target 1.5, we follow the binary compatibility rules for interface methods that redefine Object methods.booleanisPackageInfoSynthetic()Beginning in -target 6, package-info classes are marked synthetic.static CompilerTargetlookup(int majorVersion, int minorVersion)static CompilerTargetlookup(java.lang.String name)static CompilerTargetMAX()static CompilerTargetMIN()java.lang.StringmultiReleaseValue()Value of platform release used to access multi-release jar filesbooleanobeyBinaryCompatibility()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.private static intparse(java.lang.String s, int start, int end)booleanrequiresIProxy()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.booleanruntimeUseNestAccess()language runtime uses nest-based access.charsyntheticNameChar()Return the character to be used in constructing synthetic identifiers, where not specified by the JLS.private static CompilerTargettryParseVersion(java.lang.String s)booleanuseAnnotationFlag()booleanuseBridgeFlag()booleanuseEnumFlag()booleanuseInnerCacheClass()Sometimes we need to create a field to cache a value like a class literal of the assertions flag.booleanusePrivateSyntheticFields()Beginning in -target 1.5, we make synthetic variables package-private instead of private.booleanuseStringBuilder()Beginning in 1.5, we have an unsynchronized version of StringBuffer called StringBuilder that can be used by the compiler for string concatenation.booleanuseSyntheticFlag()Beginning in 1.5, we have flag bits we can use instead of marker attributes.booleanuseVarargsFlag()static CompilerTargetvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static CompilerTarget[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JDK1_1
public static final CompilerTarget JDK1_1
-
JDK1_2
public static final CompilerTarget JDK1_2
-
JDK1_3
public static final CompilerTarget JDK1_3
-
JDK1_4
public static final CompilerTarget JDK1_4
J2SE1.4 = Merlin.
-
JDK1_5
public static final CompilerTarget JDK1_5
Tiger.
-
JDK1_6
public static final CompilerTarget JDK1_6
JDK 6.
-
JDK1_7
public static final CompilerTarget JDK1_7
JDK 7.
-
JDK1_8
public static final CompilerTarget JDK1_8
JDK 8.
-
JDK9
public static final CompilerTarget JDK9
JDK 9.
-
JDK10
public static final CompilerTarget JDK10
JDK 10.
-
JDK11
public static final CompilerTarget JDK11
JDK 11.
-
JDK12
public static final CompilerTarget JDK12
JDK 12.
-
JDK13
public static final CompilerTarget JDK13
JDK 13.
-
JDK14
public static final CompilerTarget JDK14
JDK 14.
-
JDK15
public static final CompilerTarget JDK15
JDK 15.
-
JDK16
public static final CompilerTarget JDK16
JDK 16.
-
JDK17
public static final CompilerTarget JDK17
JDK 16.
-
-
Field Detail
-
VALUES
private static final CompilerTarget[] VALUES
-
MIN
private static final CompilerTarget MIN
-
MIN_DEFAULT
private static final CompilerTarget MIN_DEFAULT
-
MAX
private static final CompilerTarget MAX
-
tab
private static final java.util.Map<java.lang.String,CompilerTarget> tab
-
name
public final java.lang.String name
-
majorVersion
public final int majorVersion
-
minorVersion
public final int minorVersion
-
DEFAULT
public static final CompilerTarget DEFAULT
-
-
Method Detail
-
values
public static CompilerTarget[] 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 (CompilerTarget c : CompilerTarget.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CompilerTarget 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 namejava.lang.NullPointerException- if the argument is null
-
MIN
public static CompilerTarget MIN()
-
MAX
public static CompilerTarget MAX()
-
lookup
public static CompilerTarget lookup(java.lang.String name)
-
lookup
public static CompilerTarget lookup(int majorVersion, int minorVersion)
-
tryParseVersion
@Nullable private static CompilerTarget tryParseVersion(java.lang.String s)
-
parse
private static int parse(java.lang.String s, int start, int end)
-
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 necessary 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.5, 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.5 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 stack map 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" stack map 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 forhasInvokedynamic, 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.
-
hasMethodParameters
public boolean hasMethodParameters()
Does the target VM expect MethodParameters attributes?
-
hasStringConcatFactory
public boolean hasStringConcatFactory()
Does the target JDK contain StringConcatFactory class?
-
multiReleaseValue
public java.lang.String multiReleaseValue()
Value of platform release used to access multi-release jar files
-
allApiModulesAreRoots
public boolean allApiModulesAreRoots()
All modules that export an API are roots when compiling code in the unnamed module and targeting 11 or newer.
-
hasNestmateAccess
public boolean hasNestmateAccess()
Does the target VM support nestmate access?
-
runtimeUseNestAccess
public boolean runtimeUseNestAccess()
language runtime uses nest-based access. e.g. lambda and string concat spin dynamic proxy class as a nestmate of the target class
-
hasVirtualPrivateInvoke
public boolean hasVirtualPrivateInvoke()
Does the target VM support virtual private invocations?
-
hasSealedClasses
public boolean hasSealedClasses()
Does the target VM support sealed types
-
-