aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-06-13 00:33:14 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-06-13 00:33:14 +0200
commit5fd82596f6e80c71da1012e423419eed5c293ac2 (patch)
tree81d6215024f6dccab3ae8eb80ded6a548b508cee /src/core/lombok/javac
parent5a3e9bd8049469169410107011ad0e26b3b629e3 (diff)
downloadlombok-5fd82596f6e80c71da1012e423419eed5c293ac2.tar.gz
lombok-5fd82596f6e80c71da1012e423419eed5c293ac2.tar.bz2
lombok-5fd82596f6e80c71da1012e423419eed5c293ac2.zip
Added some very limited reporting when OutOfMemorErrors occur during
parse tree builder under javac. Let's hope our users reporting these issues can use this to figure out which files are triggering the issue.
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r--src/core/lombok/javac/JavacAST.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java
index 5a91258c..36c51210 100644
--- a/src/core/lombok/javac/JavacAST.java
+++ b/src/core/lombok/javac/JavacAST.java
@@ -315,9 +315,18 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
}
private JavacNode drill(JCTree statement) {
- List<JavacNode> childNodes = new ArrayList<JavacNode>();
- for (FieldAccess fa : fieldsOf(statement.getClass())) childNodes.addAll(buildWithField(JavacNode.class, statement, fa));
- return putInMap(new JavacNode(this, statement, childNodes, Kind.STATEMENT));
+ try {
+ List<JavacNode> childNodes = new ArrayList<JavacNode>();
+ for (FieldAccess fa : fieldsOf(statement.getClass())) childNodes.addAll(buildWithField(JavacNode.class, statement, fa));
+ return putInMap(new JavacNode(this, statement, childNodes, Kind.STATEMENT));
+ } catch (OutOfMemoryError oome) {
+ String msg = oome.getMessage();
+ if (msg == null) msg = "(no original message)";
+ OutOfMemoryError newError = new OutOfMemoryError(getFileName() + "@pos" + statement.getPreferredPosition() + ": " + msg);
+ // We could try to set the stack trace of the new exception to the same one as the old exception, but this costs memory,
+ // and we're already in an extremely fragile situation in regards to remaining heap space, so let's not do that.
+ throw newError;
+ }
}
/** For javac, both JCExpression and JCStatement are considered as valid children types. */