| @@ -117,6 +117,14 @@ public final · 116 unmodified lines |
| 117 | 117 | java.lang.reflect.GenericDeclaration, |
| 118 | 118 | java.lang.reflect.Type, |
| 119 | 119 | java.lang.reflect.AnnotatedElement { |
| 120 | + |
| 121 | + // [Inferno] < |
| 122 | + /** A field that is used by jvm to store internal data */ |
| 123 | + private transient Object classData; |
| 124 | + /** A field that is used by jvm to store internal data */ |
| 125 | + private transient Object arrayName; |
| 126 | + // [Inferno] > |
| 127 | + |
| 120 | 128 | private static final int ANNOTATION= 0x00002000; |
| 121 | 129 | private static final int ENUM = 0x00004000; |
| 122 | 130 | private static final int SYNTHETIC = 0x00001000; |
| @@ -254,16 +262,19 @@ public final · 131 unmodified lines |
| 254 | 262 | ClassLoader loader) |
| 255 | 263 | throws ClassNotFoundException |
| 256 | 264 | { |
| 257 | | − if (loader == null) { |
| 258 | | − SecurityManager sm = System.getSecurityManager(); |
| 259 | | − if (sm != null) { |
| 260 | | − ClassLoader ccl = ClassLoader.getCallerClassLoader(); |
| 261 | | − if (ccl != null) { |
| 262 | | − sm.checkPermission( |
| 263 | | − SecurityConstants.GET_CLASSLOADER_PERMISSION); |
| 264 | | − } |
| 265 | | − } |
| 266 | | − } |
| 265 | + // [Inferno] < |
| 266 | + //if (loader == null) { |
| 267 | + // SecurityManager sm = System.getSecurityManager(); |
| 268 | + // if (sm != null) { |
| 269 | + // ClassLoader ccl = ClassLoader.getCallerClassLoader(); |
| 270 | + // if (ccl != null) { |
| 271 | + // sm.checkPermission( |
| 272 | + // SecurityConstants.GET_CLASSLOADER_PERMISSION); |
| 273 | + // } |
| 274 | + // } |
| 275 | + //} |
| 276 | + // [Inferno] = |
| 277 | + // [Inferno] > |
| 267 | 278 | return forName0(name, initialize, loader); |
| 268 | 279 | } |
| 269 | 280 | |
| @@ -328,57 +339,61 @@ public final · 58 unmodified lines |
| 328 | 339 | return newInstance0(); |
| 329 | 340 | } |
| 330 | 341 | |
| 331 | | − private T newInstance0() |
| 332 | | − throws InstantiationException, IllegalAccessException |
| 333 | | − { |
| 334 | | − // NOTE: the following code may not be strictly correct under |
| 335 | | − // the current Java memory model. |
| 336 | | − |
| 337 | | − // Constructor lookup |
| 338 | | − if (cachedConstructor == null) { |
| 339 | | − if (this == Class.class) { |
| 340 | | − throw new IllegalAccessException( |
| 341 | | − "Can not call newInstance() on the Class for java.lang.Class" |
| 342 | | − ); |
| 343 | | − } |
| 344 | | − try { |
| 345 | | − Class<?>[] empty = {}; |
| 346 | | − final Constructor<T> c = getConstructor0(empty, Member.DECLARED); |
| 347 | | − // Disable accessibility checks on the constructor |
| 348 | | − // since we have to do the security check here anyway |
| 349 | | − // (the stack depth is wrong for the Constructor's |
| 350 | | − // security check to work) |
| 351 | | − java.security.AccessController.doPrivileged( |
| 352 | | − new java.security.PrivilegedAction<Void>() { |
| 353 | | − public Void run() { |
| 354 | | − c.setAccessible(true); |
| 355 | | − return null; |
| 356 | | − } |
| 357 | | − }); |
| 358 | | − cachedConstructor = c; |
| 359 | | − } catch (NoSuchMethodException e) { |
| 360 | | − throw new InstantiationException(getName()); |
| 361 | | − } |
| 362 | | − } |
| 363 | | − Constructor<T> tmpConstructor = cachedConstructor; |
| 364 | | − // Security check (same as in java.lang.reflect.Constructor) |
| 365 | | − int modifiers = tmpConstructor.getModifiers(); |
| 366 | | − if (!Reflection.quickCheckMemberAccess(this, modifiers)) { |
| 367 | | − Class<?> caller = Reflection.getCallerClass(3); |
| 368 | | − if (newInstanceCallerCache != caller) { |
| 369 | | − Reflection.ensureMemberAccess(caller, this, null, modifiers); |
| 370 | | − newInstanceCallerCache = caller; |
| 371 | | − } |
| 372 | | − } |
| 373 | | − // Run constructor |
| 374 | | − try { |
| 375 | | − return tmpConstructor.newInstance((Object[])null); |
| 376 | | − } catch (InvocationTargetException e) { |
| 377 | | − Unsafe.getUnsafe().throwException(e.getTargetException()); |
| 378 | | − // Not reached |
| 379 | | − return null; |
| 380 | | − } |
| 381 | | − } |
| 342 | + // [Inferno] < |
| 343 | + //private T newInstance0() |
| 344 | + // throws InstantiationException, IllegalAccessException |
| 345 | + //{ |
| 346 | + // // NOTE: the following code may not be strictly correct under |
| 347 | + // // the current Java memory model. |
| 348 | +// |
| 349 | + // // Constructor lookup |
| 350 | + // if (cachedConstructor == null) { |
| 351 | + // if (this == Class.class) { |
| 352 | + // throw new IllegalAccessException( |
| 353 | + // "Can not call newInstance() on the Class for java.lang.Class" |
| 354 | + // ); |
| 355 | + // } |
| 356 | + // try { |
| 357 | + // Class<?>[] empty = {}; |
| 358 | + // final Constructor<T> c = getConstructor0(empty, Member.DECLARED); |
| 359 | + // // Disable accessibility checks on the constructor |
| 360 | + // // since we have to do the security check here anyway |
| 361 | + // // (the stack depth is wrong for the Constructor's |
| 362 | + // // security check to work) |
| 363 | + // java.security.AccessController.doPrivileged( |
| 364 | + // new java.security.PrivilegedAction<Void>() { |
| 365 | + // public Void run() { |
| 366 | + // c.setAccessible(true); |
| 367 | + // return null; |
| 368 | + // } |
| 369 | + // }); |
| 370 | + // cachedConstructor = c; |
| 371 | + // } catch (NoSuchMethodException e) { |
| 372 | + // throw new InstantiationException(getName()); |
| 373 | + // } |
| 374 | + // } |
| 375 | + // Constructor<T> tmpConstructor = cachedConstructor; |
| 376 | + // // Security check (same as in java.lang.reflect.Constructor) |
| 377 | + // int modifiers = tmpConstructor.getModifiers(); |
| 378 | + // if (!Reflection.quickCheckMemberAccess(this, modifiers)) { |
| 379 | + // Class<?> caller = Reflection.getCallerClass(3); |
| 380 | + // if (newInstanceCallerCache != caller) { |
| 381 | + // Reflection.ensureMemberAccess(caller, this, null, modifiers); |
| 382 | + // newInstanceCallerCache = caller; |
| 383 | + // } |
| 384 | + // } |
| 385 | + // // Run constructor |
| 386 | + // try { |
| 387 | + // return tmpConstructor.newInstance((Object[])null); |
| 388 | + // } catch (InvocationTargetException e) { |
| 389 | + // Unsafe.getUnsafe().throwException(e.getTargetException()); |
| 390 | + // // Not reached |
| 391 | + // return null; |
| 392 | + // } |
| 393 | + //} |
| 394 | + // [Inferno] = |
| 395 | + private native T newInstance0(); |
| 396 | + // [Inferno] > |
| 382 | 397 | private volatile transient Constructor<T> cachedConstructor; |
| 383 | 398 | private volatile transient Class<?> newInstanceCallerCache; |
| 384 | 399 | |