1 /* |
1 /* |
2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
122 * The version recognized by the Java Platform, Standard Edition |
122 * The version recognized by the Java Platform, Standard Edition |
123 * 7. |
123 * 7. |
124 * |
124 * |
125 * @since 1.7 |
125 * @since 1.7 |
126 */ |
126 */ |
127 RELEASE_7; |
127 RELEASE_7, |
|
128 |
|
129 /** |
|
130 * The version recognized by the Java Platform, Standard Edition |
|
131 * 8. |
|
132 * |
|
133 * @since 1.8 |
|
134 */ |
|
135 RELEASE_8; |
128 |
136 |
129 // Note that when adding constants for newer releases, the |
137 // Note that when adding constants for newer releases, the |
130 // behavior of latest() and latestSupported() must be updated too. |
138 // behavior of latest() and latestSupported() must be updated too. |
131 |
139 |
132 /** |
140 /** |
133 * Returns the latest source version that can be modeled. |
141 * Returns the latest source version that can be modeled. |
134 * |
142 * |
135 * @return the latest source version that can be modeled |
143 * @return the latest source version that can be modeled |
136 */ |
144 */ |
137 public static SourceVersion latest() { |
145 public static SourceVersion latest() { |
138 return RELEASE_7; |
146 return RELEASE_8; |
139 } |
147 } |
140 |
148 |
141 private static final SourceVersion latestSupported = getLatestSupported(); |
149 private static final SourceVersion latestSupported = getLatestSupported(); |
142 |
150 |
143 private static SourceVersion getLatestSupported() { |
151 private static SourceVersion getLatestSupported() { |
144 try { |
152 try { |
145 String specVersion = System.getProperty("java.specification.version"); |
153 String specVersion = System.getProperty("java.specification.version"); |
146 if ("1.7".equals(specVersion)) |
154 |
|
155 if ("1.8".equals(specVersion)) |
|
156 return RELEASE_8; |
|
157 else if("1.7".equals(specVersion)) |
147 return RELEASE_7; |
158 return RELEASE_7; |
148 else if ("1.6".equals(specVersion)) |
159 else if("1.6".equals(specVersion)) |
149 return RELEASE_6; |
160 return RELEASE_6; |
150 } catch (SecurityException se) {} |
161 } catch (SecurityException se) {} |
151 |
162 |
152 return RELEASE_5; |
163 return RELEASE_5; |
153 } |
164 } |