Class JavaClassfileVersion
java.lang.Object
org.codehaus.plexus.languages.java.version.JavaClassfileVersion
Reads the bytecode of a Java class to detect the major, minor and Java
version that was compiled.
- Author:
- Jorge Solórzano
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanReturns if the classfile use preview features.JavaVersion of the class file version detected.intReturns the major version of the parsed classfile.intReturns the minor version of the parsed classfile.static JavaClassfileVersionof(byte[] bytes) Reads the bytecode of a Java class file and returns theJavaClassfileVersion.static JavaClassfileVersionReads the bytecode of a Java class file and returns theJavaClassfileVersion.toString()Returns a String representation of the Java class file version, e.g.
-
Method Details
-
of
Reads the bytecode of a Java class file and returns theJavaClassfileVersion.- Parameters:
bytes-byte[]of the Java class file- Returns:
- the
JavaClassfileVersionof the byte array
-
of
Reads the bytecode of a Java class file and returns theJavaClassfileVersion.- Parameters:
path-Pathof the Java class file- Returns:
- the
JavaClassfileVersionof the path java class
-
javaVersion
JavaVersion of the class file version detected.- Returns:
- JavaVersion based on the major version of the class file.
-
majorVersion
public int majorVersion()Returns the major version of the parsed classfile.- Returns:
- the major classfile version
-
minorVersion
public int minorVersion()Returns the minor version of the parsed classfile.- Returns:
- the minor classfile version
-
isPreview
public boolean isPreview()Returns if the classfile use preview features.- Returns:
trueif the classfile use preview features.
-
toString
-
hashCode
-
equals
-