41 * 42 * @author Joseph D. Darcy 43 * @author Scott Seligman 44 * @author Peter von der Ahé 45 * @since 1.6 46 */ 47 public enum SourceVersion { 48 /* 49 * Summary of language evolution 50 * 1.1: nested classes 51 * 1.2: strictfp 52 * 1.3: no changes 53 * 1.4: assert 54 * 1.5: annotations, generics, autoboxing, var-args... 55 * 1.6: no changes 56 * 1.7: diamond syntax, try-with-resources, etc. 57 * 1.8: lambda expressions and default methods 58 * 9: modules, small cleanups to 1.7 and 1.8 changes 59 * 10: local-variable type inference (var) 60 * 11: local-variable syntax for lambda parameters 61 * 12: no changes (switch expressions were in preview) 62 * 13: no changes (switch expressions and text blocks in preview) 63 * 14: TBD 64 */ 65 66 /** 67 * The original version. 68 * 69 * The language described in 70 * <cite>The Java™ Language Specification, First Edition</cite>. 71 */ 72 RELEASE_0, 73 74 /** 75 * The version recognized by the Java Platform 1.1. 76 * 77 * The language is {@code RELEASE_0} augmented with nested classes as described in the 1.1 update to 78 * <cite>The Java™ Language Specification, First Edition</cite>. 79 */ 80 RELEASE_1, 81 82 /** 83 * The version recognized by the Java 2 Platform, Standard Edition, 181 182 /** 183 * The version recognized by the Java Platform, Standard Edition 184 * 12. 185 * 186 * @since 12 187 */ 188 RELEASE_12, 189 190 /** 191 * The version recognized by the Java Platform, Standard Edition 192 * 13. 193 * 194 * @since 13 195 */ 196 RELEASE_13, 197 198 /** 199 * The version recognized by the Java Platform, Standard Edition 200 * 14. 201 * 202 * @since 14 203 */ 204 RELEASE_14; 205 206 // Note that when adding constants for newer releases, the 207 // behavior of latest() and latestSupported() must be updated too. 208 209 /** 210 * Returns the latest source version that can be modeled. 211 * 212 * @return the latest source version that can be modeled 213 */ 214 public static SourceVersion latest() { 215 return RELEASE_14; 216 } 217 218 private static final SourceVersion latestSupported = getLatestSupported(); 219 220 /* | 41 * 42 * @author Joseph D. Darcy 43 * @author Scott Seligman 44 * @author Peter von der Ahé 45 * @since 1.6 46 */ 47 public enum SourceVersion { 48 /* 49 * Summary of language evolution 50 * 1.1: nested classes 51 * 1.2: strictfp 52 * 1.3: no changes 53 * 1.4: assert 54 * 1.5: annotations, generics, autoboxing, var-args... 55 * 1.6: no changes 56 * 1.7: diamond syntax, try-with-resources, etc. 57 * 1.8: lambda expressions and default methods 58 * 9: modules, small cleanups to 1.7 and 1.8 changes 59 * 10: local-variable type inference (var) 60 * 11: local-variable syntax for lambda parameters 61 * 12: no changes (switch expressions in preview) 62 * 13: no changes (switch expressions and text blocks in preview) 63 * 14: switch expressions 64 */ 65 66 /** 67 * The original version. 68 * 69 * The language described in 70 * <cite>The Java™ Language Specification, First Edition</cite>. 71 */ 72 RELEASE_0, 73 74 /** 75 * The version recognized by the Java Platform 1.1. 76 * 77 * The language is {@code RELEASE_0} augmented with nested classes as described in the 1.1 update to 78 * <cite>The Java™ Language Specification, First Edition</cite>. 79 */ 80 RELEASE_1, 81 82 /** 83 * The version recognized by the Java 2 Platform, Standard Edition, 181 182 /** 183 * The version recognized by the Java Platform, Standard Edition 184 * 12. 185 * 186 * @since 12 187 */ 188 RELEASE_12, 189 190 /** 191 * The version recognized by the Java Platform, Standard Edition 192 * 13. 193 * 194 * @since 13 195 */ 196 RELEASE_13, 197 198 /** 199 * The version recognized by the Java Platform, Standard Edition 200 * 14. 201 * 202 * Additions in this release include switch expressions. 203 * 204 * @since 14 205 */ 206 RELEASE_14; 207 208 // Note that when adding constants for newer releases, the 209 // behavior of latest() and latestSupported() must be updated too. 210 211 /** 212 * Returns the latest source version that can be modeled. 213 * 214 * @return the latest source version that can be modeled 215 */ 216 public static SourceVersion latest() { 217 return RELEASE_14; 218 } 219 220 private static final SourceVersion latestSupported = getLatestSupported(); 221 222 /* |