MCPcopy Create free account
hub / github.com/antlr/codebuff / getJLA

Method getJLA

corpus/java/training/guava/base/Throwables.java:417–437  ·  view source on GitHub ↗

Returns the JavaLangAccess class that is present in all Sun JDKs. It is not whitelisted for AppEngine, and not present in non-Sun JDKs.

()

Source from the content-addressed store, hash-verified

415 * AppEngine, and not present in non-Sun JDKs.
416 */
417 @GwtIncompatible // java.lang.reflect
418 @Nullable
419 private static Object getJLA() {
420 try {
421 /*
422 * We load sun.misc.* classes using reflection since Android doesn't support these classes and
423 * would result in compilation failure if we directly refer to these classes.
424 */
425 Class<?> sharedSecrets = Class.forName(SHARED_SECRETS_CLASSNAME, false, null);
426 Method langAccess = sharedSecrets.getMethod("getJavaLangAccess");
427 return langAccess.invoke(null);
428 } catch (ThreadDeath death) {
429 throw death;
430 } catch (Throwable t) {
431 /*
432 * This is not one of AppEngine's whitelisted classes, so even in Sun JDKs, this can fail with
433 * a NoClassDefFoundError. Other apps might deny access to sun.misc packages.
434 */
435 return null;
436 }
437 }
438
439 /**
440 * Returns the Method that can be used to resolve an individual StackTraceElement, or null if that

Callers 1

ThrowablesClass · 0.95

Calls 1

invokeMethod · 0.45

Tested by

no test coverage detected