aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/eclipse/EclipseAST.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-28 05:45:08 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-28 05:45:08 +0200
commitdc7d0cacf5c12201fb51a8758e3fcca385cc583c (patch)
treec9298c0939c5b33cf61dc8d14acdbd193f963066 /src/lombok/eclipse/EclipseAST.java
parentcd866b852ce1bf4390e98a58cdf491fa9828839f (diff)
downloadlombok-dc7d0cacf5c12201fb51a8758e3fcca385cc583c.tar.gz
lombok-dc7d0cacf5c12201fb51a8758e3fcca385cc583c.tar.bz2
lombok-dc7d0cacf5c12201fb51a8758e3fcca385cc583c.zip
AptProblem is not available when eclipse is run on java 1.5, and AptProblem is not neccessarily the proper target anyway. Rolled our own DefaultProblem subclass for problem reporting.
Diffstat (limited to 'src/lombok/eclipse/EclipseAST.java')
-rw-r--r--src/lombok/eclipse/EclipseAST.java45
1 files changed, 39 insertions, 6 deletions
diff --git a/src/lombok/eclipse/EclipseAST.java b/src/lombok/eclipse/EclipseAST.java
index df0020bc..d202613b 100644
--- a/src/lombok/eclipse/EclipseAST.java
+++ b/src/lombok/eclipse/EclipseAST.java
@@ -10,11 +10,11 @@ import lombok.core.AST;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.compiler.CompilationResult;
-import org.eclipse.jdt.internal.compiler.apt.dispatch.AptProblem;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.eclipse.jdt.internal.compiler.ast.Block;
import org.eclipse.jdt.internal.compiler.ast.Clinit;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
@@ -22,7 +22,9 @@ import org.eclipse.jdt.internal.compiler.ast.ImportReference;
import org.eclipse.jdt.internal.compiler.ast.Initializer;
import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Statement;
+import org.eclipse.jdt.internal.compiler.ast.TryStatement;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.util.Util;
@@ -117,18 +119,53 @@ public class EclipseAST extends AST<ASTNode> {
? Util.searchColumnNumber(result.getLineSeparatorPositions(), lineNumber,sourceStart)
: 0;
- CategorizedProblem ecProblem = new AptProblem(null,
+ CategorizedProblem ecProblem = new LombokProblem(
fileNameArray, message, 0, new String[0],
isWarning ? ProblemSeverities.Warning : ProblemSeverities.Error,
sourceStart, sourceEnd, lineNumber, columnNumber);
ast.compilationResult.record(ecProblem, null);
}
+ private static class LombokProblem extends DefaultProblem {
+ private static final String MARKER_ID = "org.eclipse.jdt.apt.pluggable.core.compileProblem"; //$NON-NLS-1$
+
+ public LombokProblem(char[] originatingFileName, String message, int id,
+ String[] stringArguments, int severity,
+ int startPosition, int endPosition, int line, int column) {
+ super(originatingFileName, message, id, stringArguments, severity, startPosition, endPosition, line, column);
+ }
+
+ @Override public int getCategoryID() {
+ return CAT_UNSPECIFIED;
+ }
+
+ @Override public String getMarkerType() {
+ return MARKER_ID;
+ }
+ }
+
public final class Node extends AST<ASTNode>.Node {
Node(ASTNode node, Collection<Node> children, Kind kind) {
super(node, children, kind);
}
+ public void rebuild() {
+ super.rebuild();
+ System.out.println("REBUILD COMPLETE");
+ AbstractMethodDeclaration me = (AbstractMethodDeclaration) get();
+ for ( Statement outer : me.statements ) {
+ System.out.println("OUTER: "+ outer);
+ if ( outer instanceof TryStatement ) {
+ TryStatement ts = (TryStatement)outer;
+ Block tb = ((TryStatement) outer).tryBlock;
+ for ( Statement inner : tb.statements ) {
+ System.out.println("INNER: " + inner);
+ }
+ }
+ }
+ System.out.println("/REBUILD COMPLETE");
+ }
+
public void traverse(EclipseASTVisitor visitor) {
switch ( getKind() ) {
case COMPILATION_UNIT:
@@ -459,8 +496,4 @@ public class EclipseAST extends AST<ASTNode> {
@Override protected Collection<Class<? extends ASTNode>> getStatementTypes() {
return Collections.<Class<? extends ASTNode>>singleton(Statement.class);
}
-
- @Override protected Node buildStatement(Object node) {
- return buildStatement((Statement)node);
- }
}