aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java4
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java8
2 files changed, 7 insertions, 5 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index 3c41f834..d4c63da3 100644
--- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -478,7 +478,8 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
setGeneratedBy(oRef, source);
TypeReference typeReference = createTypeReference(type, p);
-
+ setGeneratedBy(typeReference, source);
+
InstanceOfExpression instanceOf = new InstanceOfExpression(oRef, typeReference);
instanceOf.sourceStart = pS; instanceOf.sourceEnd = pE;
setGeneratedBy(instanceOf, source);
@@ -705,7 +706,6 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
setGeneratedBy(otherRef, source);
TypeReference typeReference = createTypeReference(type, p);
-
setGeneratedBy(typeReference, source);
InstanceOfExpression instanceOf = new InstanceOfExpression(otherRef, typeReference);
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 821415d2..244f7d38 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -24,6 +24,7 @@ package lombok.javac.handlers;
import static lombok.javac.Javac.*;
import java.lang.annotation.Annotation;
+import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -87,11 +88,12 @@ public class JavacHandlerUtil {
}
}
- private static Map<JCTree, JCTree> generatedNodes = new WeakHashMap<JCTree, JCTree>();
+ private static Map<JCTree, WeakReference<JCTree>> generatedNodes = new WeakHashMap<JCTree, WeakReference<JCTree>>();
public static JCTree getGeneratedBy(JCTree node) {
synchronized (generatedNodes) {
- return generatedNodes.get(node);
+ WeakReference<JCTree> ref = generatedNodes.get(node);
+ return ref == null ? null : ref.get();
}
}
@@ -109,7 +111,7 @@ public class JavacHandlerUtil {
public static <T extends JCTree> T setGeneratedBy(T node, JCTree source) {
synchronized (generatedNodes) {
if (source == null) generatedNodes.remove(node);
- else generatedNodes.put(node, source);
+ else generatedNodes.put(node, new WeakReference<JCTree>(source));
}
return node;
}