Package org.sonar.plugins.java.api
Interface JavaVersion
- All Known Implementing Classes:
JavaVersionImpl
Represents the java version used by the project under analysis.
Designed to be used by checks to determine if they should report issue depending on java version.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionint
asInt()
get java version as integerboolean
Test if java version of the project is greater than or equal to 10.boolean
Test if java version of the project is greater than or equal to 12.boolean
Test if java version of the project is greater than or equal to 14.boolean
Test if java version of the project is greater than or equal to 15.boolean
Test if java version of the project is greater than or equal to 16.boolean
Test if java version of the project is greater than or equal to 6.boolean
Test if java version of the project is greater than or equal to 7.boolean
Test if java version of the project is greater than or equal to 8.boolean
Test if java version of the project is greater than or equal to 9.boolean
isNotSet()
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 8
-
Field Details
-
SOURCE_VERSION
Key of the java version used for sources- See Also:
- Constant Field Values
-
-
Method Details
-
isJava6Compatible
boolean isJava6Compatible()Test if java version of the project is greater than or equal to 6.- Returns:
- true if java version used is >= 6
-
isJava7Compatible
boolean isJava7Compatible()Test if java version of the project is greater than or equal to 7.- Returns:
- true if java version used is >= 7
-
isJava8Compatible
boolean isJava8Compatible()Test if java version of the project is greater than or equal to 8.- Returns:
- true if java version used is >= 8
-
isJava9Compatible
boolean isJava9Compatible()Test 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- Returns:
- true if java version used is >= 9
- Since:
- SonarJava 6.15
-
isJava10Compatible
boolean isJava10Compatible()Test 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- Returns:
- true if java version used is >= 10
- Since:
- SonarJava 6.15
-
isJava12Compatible
boolean isJava12Compatible()Test 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- Returns:
- true if java version used is >= 12
- Since:
- SonarJava 5.12: Support of Java 12
-
isJava14Compatible
boolean isJava14Compatible()Test 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- Returns:
- true if java version used is >= 14
- Since:
- SonarJava 6.15
-
isJava15Compatible
boolean isJava15Compatible()Test 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- Returns:
- true if java version used is >= 15
- Since:
- SonarJava 6.12: Support of Java 15
-
isJava16Compatible
boolean isJava16Compatible()Test 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- Returns:
- true if java version used is >= 16
- Since:
- SonarJava 7.1: Support of Java 16
-
asInt
int asInt()get java version as integer- Returns:
- an int representing the java version
-
isNotSet
boolean isNotSet()Test if java version has been set for the analysis.- Returns:
- false if set, true otherwise.
-
java6CompatibilityMessage
String java6CompatibilityMessage()Default compatibility message with java 6- Returns:
- empty string if java version is properly set, default message otherwise.
-
java7CompatibilityMessage
String java7CompatibilityMessage()Default compatibility message with java 7- Returns:
- empty string if java version is properly set, default message otherwise.
-
java8CompatibilityMessage
String java8CompatibilityMessage()Default compatibility message with java 8- Returns:
- empty string if java version is properly set, default message otherwise.
-