Package org.sonar.plugins.java.api
Interface JavaVersion
-
- All Known Implementing Classes:
JavaVersionImpl
@Beta public interface JavaVersion
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 Modifier and Type Field Description static String
SOURCE_VERSION
Key of the java version used for sources
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
asInt()
get java version as integerboolean
isJava12Compatible()
Test if java version of the project is greater than or equal to 12.boolean
isJava6Compatible()
Test if java version of the project is greater than or equal to 6.boolean
isJava7Compatible()
Test if java version of the project is greater than or equal to 7.boolean
isJava8Compatible()
Test if java version of the project is greater than or equal to 8.boolean
isNotSet()
Test if java version has been set for the analysis.String
java6CompatibilityMessage()
Default compatibility message with java 6String
java7CompatibilityMessage()
Default compatibility message with java 7String
java8CompatibilityMessage()
Default compatibility message with java 8
-
-
-
Field Detail
-
SOURCE_VERSION
static final String SOURCE_VERSION
Key of the java version used for sources- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
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
-
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.
-
-