Open adam-thorpe opened 5 years ago
Reproduced locally. Investigating...
This test is invalid.
ClassLoader loader = new SimpleClassLoader();
WeakReference<Class<?>> c = new WeakReference(loader.loadClass("C")); <<< line 49
if (c.get() == null) throw new AssertionError();
if (c.get().getClassLoader() != loader) throw new AssertionError();
if (readAnn) System.out.println(c.get().getAnnotations()[0]);
if (c.get() == null) throw new AssertionError();
System.gc();
System.gc();
if (c.get() == null) throw new AssertionError(); <<< Failing line 56
Line 49 creates a weak reference to the Class
object for C
. It then runs two GCs, which clear the weak reference to the Class
object because there are no strong references to the object, as designed.
Failure link
4baf3d7e4
6e99760b
965d0c0df3
Optional info
Failure output (captured from console output)