equal
deleted
inserted
replaced
55 * 1.6: no changes |
55 * 1.6: no changes |
56 * 1.7: diamond syntax, try-with-resources, etc. |
56 * 1.7: diamond syntax, try-with-resources, etc. |
57 * 1.8: lambda expressions and default methods |
57 * 1.8: lambda expressions and default methods |
58 * 9: modules, small cleanups to 1.7 and 1.8 changes |
58 * 9: modules, small cleanups to 1.7 and 1.8 changes |
59 * 10: local-variable type inference (var) |
59 * 10: local-variable type inference (var) |
|
60 * 11: to be determined changes |
60 */ |
61 */ |
61 |
62 |
62 /** |
63 /** |
63 * The original version. |
64 * The original version. |
64 * |
65 * |
160 * Additions in this release include local-variable type inference |
161 * Additions in this release include local-variable type inference |
161 * ({@code var}). |
162 * ({@code var}). |
162 * |
163 * |
163 * @since 10 |
164 * @since 10 |
164 */ |
165 */ |
165 RELEASE_10; |
166 RELEASE_10, |
|
167 |
|
168 /** |
|
169 * The version recognized by the Java Platform, Standard Edition |
|
170 * 11. |
|
171 * |
|
172 * @since 11 |
|
173 */ |
|
174 RELEASE_11; |
166 |
175 |
167 // Note that when adding constants for newer releases, the |
176 // Note that when adding constants for newer releases, the |
168 // behavior of latest() and latestSupported() must be updated too. |
177 // behavior of latest() and latestSupported() must be updated too. |
169 |
178 |
170 /** |
179 /** |
171 * Returns the latest source version that can be modeled. |
180 * Returns the latest source version that can be modeled. |
172 * |
181 * |
173 * @return the latest source version that can be modeled |
182 * @return the latest source version that can be modeled |
174 */ |
183 */ |
175 public static SourceVersion latest() { |
184 public static SourceVersion latest() { |
176 return RELEASE_10; |
185 return RELEASE_11; |
177 } |
186 } |
178 |
187 |
179 private static final SourceVersion latestSupported = getLatestSupported(); |
188 private static final SourceVersion latestSupported = getLatestSupported(); |
180 |
189 |
181 private static SourceVersion getLatestSupported() { |
190 private static SourceVersion getLatestSupported() { |
182 try { |
191 try { |
183 String specVersion = System.getProperty("java.specification.version"); |
192 String specVersion = System.getProperty("java.specification.version"); |
184 |
193 |
185 switch (specVersion) { |
194 switch (specVersion) { |
|
195 case "11": |
|
196 return RELEASE_11; |
186 case "10": |
197 case "10": |
187 return RELEASE_10; |
198 return RELEASE_10; |
188 case "9": |
199 case "9": |
189 return RELEASE_9; |
200 return RELEASE_9; |
190 case "1.8": |
201 case "1.8": |