|
24 | 24 | import static com.google.errorprone.bugpatterns.javadoc.Utils.getStartPosition; |
25 | 25 | import static com.google.errorprone.bugpatterns.javadoc.Utils.replace; |
26 | 26 | import static com.google.errorprone.matchers.Description.NO_MATCH; |
27 | | -import static com.google.errorprone.util.ErrorProneLog.deferredDiagnosticHandler; |
28 | 27 |
|
29 | 28 | import com.google.common.collect.ImmutableSet; |
30 | 29 | import com.google.errorprone.BugPattern; |
|
47 | 46 | import com.sun.tools.javac.api.JavacTrees; |
48 | 47 | import com.sun.tools.javac.tree.DCTree.DCDocComment; |
49 | 48 | import com.sun.tools.javac.tree.DCTree.DCText; |
50 | | -import com.sun.tools.javac.util.Log; |
51 | 49 | import java.util.regex.Matcher; |
52 | 50 | import java.util.regex.Pattern; |
53 | 51 | import javax.lang.model.element.Element; |
@@ -145,21 +143,9 @@ public Void visitLink(LinkTree linkTree, Void unused) { |
145 | 143 | return super.visitLink(linkTree, null); |
146 | 144 | } |
147 | 145 | String reference = linkTree.getReference().getSignature(); |
148 | | - Element element = null; |
149 | | - Log log = Log.instance(state.context); |
150 | | - // Install a deferred diagnostic handler before calling DocTrees.getElement(DocTreePath) |
151 | | - // TODO(cushon): revert if https://bugs.openjdk.java.net/browse/JDK-8248117 is fixed |
152 | | - Log.DeferredDiagnosticHandler deferredDiagnosticHandler = deferredDiagnosticHandler(log); |
153 | | - try { |
154 | | - element = |
155 | | - JavacTrees.instance(state.context) |
156 | | - .getElement(new DocTreePath(getCurrentPath(), linkTree.getReference())); |
157 | | - } catch (NullPointerException | AssertionError e) { |
158 | | - // TODO(b/176098078): remove once JDK 12 is the minimum supported version |
159 | | - // https://bugs.openjdk.java.net/browse/JDK-8200432 |
160 | | - } finally { |
161 | | - log.popDiagnosticHandler(deferredDiagnosticHandler); |
162 | | - } |
| 146 | + Element element = |
| 147 | + JavacTrees.instance(state.context) |
| 148 | + .getElement(new DocTreePath(getCurrentPath(), linkTree.getReference())); |
163 | 149 | // Don't warn about fully qualified types; they won't always be known at compile-time. |
164 | 150 | if (element != null || reference.contains(".")) { |
165 | 151 | return super.visitLink(linkTree, null); |
|
0 commit comments