aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/lombok/eclipse/TransformEclipseAST.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java
index f7b6976f..59a0709e 100644
--- a/src/core/lombok/eclipse/TransformEclipseAST.java
+++ b/src/core/lombok/eclipse/TransformEclipseAST.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2019 The Project Lombok Authors.
+ * Copyright (C) 2009-2020 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,8 @@ package lombok.eclipse;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.Map;
import java.util.WeakHashMap;
import lombok.ConfigurationKeys;
@@ -64,7 +66,7 @@ public class TransformEclipseAST {
public static boolean disableLombok = false;
private static final HistogramTracker lombokTracker;
- private static WeakHashMap<CompilationUnitDeclaration, Boolean> completlyHandled = new WeakHashMap<CompilationUnitDeclaration, Boolean>();
+ private static Map<CompilationUnitDeclaration, State> transformationStates = Collections.synchronizedMap(new WeakHashMap<CompilationUnitDeclaration, State>());
static {
String v = System.getProperty("lombok.histogram");
@@ -143,14 +145,14 @@ public class TransformEclipseAST {
* @return <code>true</code> if this AST was already handled by lombok.
*/
public static boolean alreadyTransformed(CompilationUnitDeclaration ast) {
- Boolean state = completlyHandled.get(ast);
- if (state != null) {
- if (state) return true;
+ State state = transformationStates.get(ast);
+
+ if (state == State.FULL) return true;
+ if (state == State.DIET) {
if (!EclipseAST.isComplete(ast)) return true;
-
- completlyHandled.put(ast, Boolean.TRUE);
+ transformationStates.put(ast, State.FULL);
} else {
- completlyHandled.put(ast, Boolean.FALSE);
+ transformationStates.put(ast, State.DIET);
}
return false;
}
@@ -270,4 +272,9 @@ public class TransformEclipseAST {
nextPriority = Math.min(nextPriority, handlers.handleAnnotation(top, annotationNode, annotation, priority));
}
}
+
+ private static enum State {
+ DIET,
+ FULL
+ }
}