use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class CommentCollectingParser method compilationUnit.
@Override
public JCCompilationUnit compilationUnit() {
JCCompilationUnit result = super.compilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
JCCompilationUnit_comments.set(result, comments);
}
return result;
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class CommentCollectingParser method parseCompilationUnit.
public JCCompilationUnit parseCompilationUnit() {
JCCompilationUnit result = super.parseCompilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
JCCompilationUnit_comments.set(result, comments);
}
return result;
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class CommentCollectingParser method parseCompilationUnit.
public JCCompilationUnit parseCompilationUnit() {
JCCompilationUnit result = super.parseCompilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner) lexer).getComments();
JCCompilationUnit_comments.set(result, comments);
}
return result;
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class JavacAST method removeFromDeferredDiagnostics.
public void removeFromDeferredDiagnostics(int startPos, int endPos) {
JCCompilationUnit self = (JCCompilationUnit) top().get();
new CompilerMessageSuppressor(getContext()).removeAllBetween(self.sourcefile, startPos, endPos);
}
use of com.sun.tools.javac.tree.JCTree.JCCompilationUnit in project lombok by rzwitserloot.
the class JavacAST method printMessage.
/** Supply either a position or a node (in that case, position of the node is used) */
void printMessage(Diagnostic.Kind kind, String message, JavacNode node, DiagnosticPosition pos, boolean attemptToRemoveErrorsInRange) {
JavaFileObject oldSource = null;
JavaFileObject newSource = null;
JCTree astObject = node == null ? null : node.get();
JCCompilationUnit top = (JCCompilationUnit) top().get();
newSource = top.sourcefile;
if (newSource != null) {
oldSource = log.useSource(newSource);
if (pos == null)
pos = astObject.pos();
}
if (pos != null && attemptToRemoveErrorsInRange) {
removeFromDeferredDiagnostics(pos.getStartPosition(), node.getEndPosition(pos));
}
try {
switch(kind) {
case ERROR:
increaseErrorCount(messager);
boolean prev = log.multipleErrors;
log.multipleErrors = true;
try {
log.error(pos, "proc.messager", message);
} finally {
log.multipleErrors = prev;
}
break;
default:
case WARNING:
log.warning(pos, "proc.messager", message);
break;
}
} finally {
if (oldSource != null)
log.useSource(oldSource);
}
}
Aggregations