langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JDK9Wrappers.java
equal
deleted
inserted
replaced
250 throw new Abort(ex); |
250 throw new Abort(ex); |
251 } |
251 } |
252 } |
252 } |
253 } |
253 } |
254 } |
254 } |
|
255 |
|
256 |
|
257 /** |
|
258 * Helper class for new method in jdk.internal.misc.VM. |
|
259 */ |
|
260 public static final class VMHelper { |
|
261 public static final String VM_CLASSNAME = "jdk.internal.misc.VM"; |
|
262 |
|
263 @SuppressWarnings("unchecked") |
|
264 public static String[] getRuntimeArguments() { |
|
265 try { |
|
266 init(); |
|
267 Object result = getRuntimeArgumentsMethod.invoke(null); |
|
268 return (String[])result; |
|
269 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException |
|
270 | SecurityException ex) { |
|
271 throw new Abort(ex); |
|
272 } |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------------------- |
|
276 |
|
277 private static Class<?> vmClass = null; |
|
278 private static Method getRuntimeArgumentsMethod = null; |
|
279 |
|
280 private static void init() { |
|
281 if (vmClass == null) { |
|
282 try { |
|
283 vmClass = Class.forName(VM_CLASSNAME, false, null); |
|
284 getRuntimeArgumentsMethod = vmClass.getDeclaredMethod("getRuntimeArguments"); |
|
285 } catch (ClassNotFoundException | NoSuchMethodException | SecurityException ex) { |
|
286 throw new Abort(ex); |
|
287 } |
|
288 } |
|
289 } |
|
290 } |
255 } |
291 } |