aboutsummaryrefslogtreecommitdiff
path: root/src/utils/lombok/javac/java6/CommentCollectingParser.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-03-17 21:56:49 +0100
committerRoel Spilker <r.spilker@gmail.com>2014-03-17 21:56:49 +0100
commit17972d59fa7e2eec6b73ba5da8234f5fa7ac2536 (patch)
treefbcc5c272480e5915b60ac0992639c083d2507d8 /src/utils/lombok/javac/java6/CommentCollectingParser.java
parent362000933f46ad1d509a659e39279298440a97ec (diff)
downloadlombok-17972d59fa7e2eec6b73ba5da8234f5fa7ac2536.tar.gz
lombok-17972d59fa7e2eec6b73ba5da8234f5fa7ac2536.tar.bz2
lombok-17972d59fa7e2eec6b73ba5da8234f5fa7ac2536.zip
[#590][refactor] Fix for deadlock in WeakHashMap. Refactored all code that used a
WeakHashMap to fake a field.
Diffstat (limited to 'src/utils/lombok/javac/java6/CommentCollectingParser.java')
-rw-r--r--src/utils/lombok/javac/java6/CommentCollectingParser.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/utils/lombok/javac/java6/CommentCollectingParser.java b/src/utils/lombok/javac/java6/CommentCollectingParser.java
index 30192b06..215bf5b6 100644
--- a/src/utils/lombok/javac/java6/CommentCollectingParser.java
+++ b/src/utils/lombok/javac/java6/CommentCollectingParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 The Project Lombok Authors.
+ * Copyright (C) 2013-2014 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -21,8 +21,7 @@
*/
package lombok.javac.java6;
-import java.util.Map;
-
+import lombok.core.ReferenceFieldAugment;
import lombok.javac.CommentInfo;
import com.sun.tools.javac.parser.EndPosParser;
@@ -33,20 +32,20 @@ import com.sun.tools.javac.util.List;
class CommentCollectingParser extends EndPosParser {
- private final Map<JCCompilationUnit, List<CommentInfo>> commentsMap;
+ private final ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField;
private final Lexer lexer;
- protected CommentCollectingParser(Parser.Factory fac, Lexer S, boolean keepDocComments, Map<JCCompilationUnit, List<CommentInfo>> commentsMap) {
+ protected CommentCollectingParser(Parser.Factory fac, Lexer S, boolean keepDocComments, ReferenceFieldAugment<JCCompilationUnit, List<CommentInfo>> commentsField) {
super(fac, S, keepDocComments);
lexer = S;
- this.commentsMap = commentsMap;
+ this.commentsField = commentsField;
}
@Override public JCCompilationUnit compilationUnit() {
JCCompilationUnit result = super.compilationUnit();
if (lexer instanceof CommentCollectingScanner) {
List<CommentInfo> comments = ((CommentCollectingScanner)lexer).getComments();
- commentsMap.put(result, comments);
+ commentsField.set(result, comments);
}
return result;
}