aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/JavacHandlerUtil.java
diff options
context:
space:
mode:
authorJan Lahoda <lahoda@gmail.com>2012-07-11 00:49:00 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2012-07-11 00:50:46 +0200
commit6bf2b9299d2f1bcc00b8a0f253aae8fd4fcb6baa (patch)
tree131497420666c913322672b826d138559a9fd1fa /src/core/lombok/javac/handlers/JavacHandlerUtil.java
parent0befce2072c811fe6cc4177d43c581f00bc2d578 (diff)
downloadlombok-6bf2b9299d2f1bcc00b8a0f253aae8fd4fcb6baa.tar.gz
lombok-6bf2b9299d2f1bcc00b8a0f253aae8fd4fcb6baa.tar.bz2
lombok-6bf2b9299d2f1bcc00b8a0f253aae8fd4fcb6baa.zip
Made lombok more stable in netbeans based on some smart observations by Jan Lahoda of team Netbeans.
Diffstat (limited to 'src/core/lombok/javac/handlers/JavacHandlerUtil.java')
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 6dc97fd4..308e0325 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -68,6 +68,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
+import com.sun.tools.javac.util.Options;
/**
* Container for static utility methods useful to handlers written for javac.
@@ -92,6 +93,16 @@ public class JavacHandlerUtil {
private static Map<JCTree, WeakReference<JCTree>> generatedNodes = new WeakHashMap<JCTree, WeakReference<JCTree>>();
+ /**
+ * Contributed by Jan Lahoda; many lombok transformations should not be run (or a lite version should be run) when the netbeans editor
+ * is running javac on the open source file to find inline errors and such. As class files are compiled separately this does not affect
+ * actual runtime behaviour or file output of the netbeans IDE.
+ */
+ public static boolean inNetbeansEditor(JavacNode node) {
+ Options options = Options.instance(node.getContext());
+ return (options.keySet().contains("ide") && !options.keySet().contains("backgroundCompilation"));
+ }
+
public static JCTree getGeneratedBy(JCTree node) {
synchronized (generatedNodes) {
WeakReference<JCTree> ref = generatedNodes.get(node);