aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-07-28 07:16:12 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-07-28 07:16:12 +0200
commitd0d2dd6f5d1b9bd33e9e127f8d66b3387f487271 (patch)
treee1f91d98cd441e31b1a38519dabeb43977b0eb0c /src/core
parent4dbe3802fda3b317bb82bca80d7c69f58b239cfd (diff)
downloadlombok-d0d2dd6f5d1b9bd33e9e127f8d66b3387f487271.tar.gz
lombok-d0d2dd6f5d1b9bd33e9e127f8d66b3387f487271.tar.bz2
lombok-d0d2dd6f5d1b9bd33e9e127f8d66b3387f487271.zip
Some work on actually making lombok work on JDK8's javac.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/javac/JavacAST.java2
-rw-r--r--src/core/lombok/javac/JavacNode.java9
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java12
3 files changed, 18 insertions, 5 deletions
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java
index 1f3b04a4..e49d8ac8 100644
--- a/src/core/lombok/javac/JavacAST.java
+++ b/src/core/lombok/javac/JavacAST.java
@@ -375,7 +375,7 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
if (pos == null) pos = astObject.pos();
}
if (pos != null && attemptToRemoveErrorsInRange) {
- removeFromDeferredDiagnostics(pos.getStartPosition(), pos.getEndPosition(top.endPositions));
+ removeFromDeferredDiagnostics(pos.getStartPosition(), node.getEndPosition(pos));
}
try {
switch (kind) {
diff --git a/src/core/lombok/javac/JavacNode.java b/src/core/lombok/javac/JavacNode.java
index 30a470a9..6eef36eb 100644
--- a/src/core/lombok/javac/JavacNode.java
+++ b/src/core/lombok/javac/JavacNode.java
@@ -51,6 +51,15 @@ public class JavacNode extends lombok.core.LombokNode<JavacAST, JavacNode, JCTre
super(ast, node, children, kind);
}
+ public int getEndPosition(DiagnosticPosition pos) {
+ JCCompilationUnit cu = (JCCompilationUnit) top().get();
+ return Javac.getEndPosition(pos, cu);
+ }
+
+ public int getEndPosition() {
+ return getEndPosition(node);
+ }
+
/**
* Visits this node and all child nodes depth-first, calling the provided visitor's visit methods.
*/
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index d0673c57..c245d506 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -44,6 +44,7 @@ import lombok.core.AnnotationValues.AnnotationValue;
import lombok.core.TransformationsUtil;
import lombok.core.TypeResolver;
import lombok.experimental.Accessors;
+import lombok.javac.Javac;
import lombok.javac.JavacNode;
import lombok.javac.JavacTreeMaker;
@@ -1275,17 +1276,20 @@ public class JavacHandlerUtil {
*
* in 'SETTER' mode, stripping works similarly to 'GETTER' mode, except {@code param} are copied and stripped from the original and {@code @return} are skipped.
*/
+ @SuppressWarnings("unchecked")
public static void copyJavadoc(JavacNode from, JCTree to, CopyJavadoc copyMode) {
if (copyMode == null) copyMode = CopyJavadoc.VERBATIM;
try {
JCCompilationUnit cu = ((JCCompilationUnit) from.top().get());
- if (cu.docComments != null) {
- String javadoc = cu.docComments.get(from.get());
+ Object dc = Javac.getDocComments(cu);
+ if (dc instanceof Map) {
+ Map<JCTree, String> docComments = (Map<JCTree, String>) dc;
+ String javadoc = docComments.get(from.get());
if (javadoc != null) {
String[] filtered = copyMode.split(javadoc);
- cu.docComments.put(to, filtered[0]);
- cu.docComments.put(from.get(), filtered[1]);
+ docComments.put(to, filtered[0]);
+ docComments.put(from.get(), filtered[1]);
}
}
} catch (Exception ignore) {}