Github user jwagenleitner commented on a diff in the pull request: https://github.com/apache/groovy/pull/219#discussion_r61764947 --- Diff: src/main/org/codehaus/groovy/reflection/ClassInfo.java --- @@ -35,13 +36,13 @@ * * @author Alex.Tkachman */ -public class ClassInfo { +public class ClassInfo implements Finalizable { private final LazyCachedClassRef cachedClassRef; private final LazyClassLoaderRef artifactClassLoader; private final LockableObject lock = new LockableObject(); public final int hash = -1; - private final Class klazz; + private final WeakReference<Class<?>> klazz; --- End diff -- That's the question I've struggled with too. My assumption here is that only the Groovy Runtime should ever ask for ClassInfo objects and in most places I can find they do so either with a Class or an instance of the Class which I think would mean it wouldn't have been collected. But it's been difficult for me to be certain that the case can never happen. Best I can think of is maybe check if the ref is null and throw a `GroovyBugError`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---