< prev index next >

langtools/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java

Print this page




 142      */
 143     RELEASE_8,
 144 
 145     /**
 146      * The version recognized by the Java Platform, Standard Edition
 147      * 9.
 148      *
 149      * Additions in this release include modules and removal of a
 150      * single underscore from the set of legal identifier names.
 151      *
 152      * @since 9
 153      */
 154      RELEASE_9,
 155 
 156     /**
 157      * The version recognized by the Java Platform, Standard Edition
 158      * 10.
 159      *
 160      * @since 10
 161      */
 162      RELEASE_10;







 163 
 164     // Note that when adding constants for newer releases, the
 165     // behavior of latest() and latestSupported() must be updated too.
 166 
 167     /**
 168      * Returns the latest source version that can be modeled.
 169      *
 170      * @return the latest source version that can be modeled
 171      */
 172     public static SourceVersion latest() {
 173         return RELEASE_10;
 174     }
 175 
 176     private static final SourceVersion latestSupported = getLatestSupported();
 177 
 178     private static SourceVersion getLatestSupported() {
 179         try {
 180             String specVersion = System.getProperty("java.specification.version");
 181 
 182             switch (specVersion) {


 183                 case "10":
 184                     return RELEASE_10;
 185                 case "9":
 186                 case "1.9":
 187                     return RELEASE_9;
 188                 case "1.8":
 189                     return RELEASE_8;
 190                 case "1.7":
 191                     return RELEASE_7;
 192                 case "1.6":
 193                     return RELEASE_6;
 194             }
 195         } catch (SecurityException se) {}
 196 
 197         return RELEASE_5;
 198     }
 199 
 200     /**
 201      * Returns the latest source version fully supported by the
 202      * current execution environment.  {@code RELEASE_5} or later must




 142      */
 143     RELEASE_8,
 144 
 145     /**
 146      * The version recognized by the Java Platform, Standard Edition
 147      * 9.
 148      *
 149      * Additions in this release include modules and removal of a
 150      * single underscore from the set of legal identifier names.
 151      *
 152      * @since 9
 153      */
 154      RELEASE_9,
 155 
 156     /**
 157      * The version recognized by the Java Platform, Standard Edition
 158      * 10.
 159      *
 160      * @since 10
 161      */
 162      RELEASE_10,
 163 
 164     /**
 165      * The version recogtnized by the Java Platform, Standard Edition
 166      * 11.
 167      * @since 11
 168      */
 169      RELEASE_11;
 170 
 171     // Note that when adding constants for newer releases, the
 172     // behavior of latest() and latestSupported() must be updated too.
 173 
 174     /**
 175      * Returns the latest source version that can be modeled.
 176      *
 177      * @return the latest source version that can be modeled
 178      */
 179     public static SourceVersion latest() {
 180         return RELEASE_11;
 181     }
 182 
 183     private static final SourceVersion latestSupported = getLatestSupported();
 184 
 185     private static SourceVersion getLatestSupported() {
 186         try {
 187             String specVersion = System.getProperty("java.specification.version");
 188 
 189             switch (specVersion) {
 190                 case "11":
 191                     return RELEASE_11;
 192                 case "10":
 193                     return RELEASE_10;
 194                 case "9":
 195                 case "1.9":
 196                     return RELEASE_9;
 197                 case "1.8":
 198                     return RELEASE_8;
 199                 case "1.7":
 200                     return RELEASE_7;
 201                 case "1.6":
 202                     return RELEASE_6;
 203             }
 204         } catch (SecurityException se) {}
 205 
 206         return RELEASE_5;
 207     }
 208 
 209     /**
 210      * Returns the latest source version fully supported by the
 211      * current execution environment.  {@code RELEASE_5} or later must


< prev index next >