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.
    • 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.