public class CompileUtil extends Object
| Constructor and Description |
|---|
CompileUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getGeneratedAnnotationClassName()
Determine the correct 'Generated' annotation class name based on the current Java runtime.
|
static String |
getGeneratedAnnotationClassName(int javaMajorVersion)
Determine the correct 'Generated' annotation class name based on the Java major version.
|
static int |
getMajorJavaVersion(String versionString)
Determine the major version of the Java runtime based on a version string.
|
public static String getGeneratedAnnotationClassName()
public static String getGeneratedAnnotationClassName(int javaMajorVersion)
@javax.annotation.Generated annotation to mark a generated class.
Java 9 and beyond uses @javax.annotation.processing.Generated
Both annotations are SOURCE level retention, so they are only present in the source code and no
record of them is compiled into the binary. Thus, the determination of which one to use is
based only on the Java version used to compile, not the -source or -target settings.javaMajorVersion - The Java version in integer form. Use '8' for 1.8.public static int getMajorJavaVersion(String versionString)
versionString - As returned from SystemProperties.getProperty("java.version")Copyright © 2021. All rights reserved.