changeset 27232:85cb761ea65c

8061323: JavadocTokenizer repeatedly compiles pattern to check for deprecation Summary: Keeping the "@deprecated" Pattern in a static field. Reviewed-by: mcimadamore
author jlahoda
date Fri, 24 Oct 2014 20:07:08 +0200
parents c1ca668b421e
children ceaad401ef69
files langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavadocTokenizer.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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