8061323: JavadocTokenizer repeatedly compiles pattern to check for deprecation
Summary: Keeping the "@deprecated" Pattern in a static field.
Reviewed-by: mcimadamore
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java Fri Oct 24 08:34:51 2014 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java Fri Oct 24 20:07:08 2014 +0200
@@ -30,6 +30,7 @@
import com.sun.tools.javac.util.*;
import java.nio.*;
+import java.util.regex.Pattern;
import static com.sun.tools.javac.util.LayoutCharacters.*;
@@ -450,11 +451,15 @@
scanned = true;
comment_reader = null;
if (docComment != null &&
- docComment.matches("(?sm).*^\\s*@deprecated( |$).*")) {
+ DEPRECATED_PATTERN.matcher(docComment).matches()) {
deprecatedFlag = true;
}
}
}
+ //where:
+ private static final Pattern DEPRECATED_PATTERN =
+ Pattern.compile("(?sm).*^\\s*@deprecated( |$).*");
+
}
@Override