Package org.sonar.java.model
Class JavaVersionImpl
java.lang.Object
org.sonar.java.model.JavaVersionImpl
- All Implemented Interfaces:
JavaVersion
-
Field Summary
FieldsFields inherited from interface org.sonar.plugins.java.api.JavaVersion
SOURCE_VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintasInt()get java version as integerstatic JavaVersionfromString(String javaVersion) booleanTest if java version of the project is greater than or equal to 10.booleanTest if java version of the project is greater than or equal to 12.booleanTest if java version of the project is greater than or equal to 14.booleanTest if java version of the project is greater than or equal to 15.booleanTest if java version of the project is greater than or equal to 16.booleanTest if java version of the project is greater than or equal to 6.booleanTest if java version of the project is greater than or equal to 7.booleanTest if java version of the project is greater than or equal to 8.booleanTest if java version of the project is greater than or equal to 9.booleanisNotSet()Test if java version has been set for the analysis.Default compatibility message with java 6Default compatibility message with java 7Default compatibility message with java 8toString()
-
Field Details
-
MAX_SUPPORTED
public static final int MAX_SUPPORTED- See Also:
-
-
Constructor Details
-
JavaVersionImpl
public JavaVersionImpl() -
JavaVersionImpl
public JavaVersionImpl(int javaVersion)
-
-
Method Details
-
fromString
-
isJava6Compatible
public boolean isJava6Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 6.- Specified by:
isJava6Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 6
-
isJava7Compatible
public boolean isJava7Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 7.- Specified by:
isJava7Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 7
-
isJava8Compatible
public boolean isJava8Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 8.- Specified by:
isJava8Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 8
-
isJava9Compatible
public boolean isJava9Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 9. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set- Specified by:
isJava9Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 9
-
isJava10Compatible
public boolean isJava10Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 10. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set- Specified by:
isJava10Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 10
-
isJava12Compatible
public boolean isJava12Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 12. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set- Specified by:
isJava12Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 12
-
isJava14Compatible
public boolean isJava14Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 14. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set- Specified by:
isJava14Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 14
-
isJava15Compatible
public boolean isJava15Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 15. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set- Specified by:
isJava15Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 15
-
isJava16Compatible
public boolean isJava16Compatible()Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 16. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set- Specified by:
isJava16Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 16
-
java6CompatibilityMessage
Description copied from interface:JavaVersionDefault compatibility message with java 6- Specified by:
java6CompatibilityMessagein interfaceJavaVersion- Returns:
- empty string if java version is properly set, default message otherwise.
-
java7CompatibilityMessage
Description copied from interface:JavaVersionDefault compatibility message with java 7- Specified by:
java7CompatibilityMessagein interfaceJavaVersion- Returns:
- empty string if java version is properly set, default message otherwise.
-
java8CompatibilityMessage
Description copied from interface:JavaVersionDefault compatibility message with java 8- Specified by:
java8CompatibilityMessagein interfaceJavaVersion- Returns:
- empty string if java version is properly set, default message otherwise.
-
asInt
public int asInt()Description copied from interface:JavaVersionget java version as integer- Specified by:
asIntin interfaceJavaVersion- Returns:
- an int representing the java version
-
isNotSet
public boolean isNotSet()Description copied from interface:JavaVersionTest if java version has been set for the analysis.- Specified by:
isNotSetin interfaceJavaVersion- Returns:
- false if set, true otherwise.
-
toString
-