changeset 2855:65c218b25b61

8024510: lib/combo/tools/javac/combo/TemplateTest.java fails Summary: Edit regex in Template to allow "MAJOR." pattern. Reviewed-by: briangoetz
author emc
date Wed, 11 Sep 2013 08:30:58 -0400
parents d87f017ec217
children cf37c3775397
files test/lib/combo/tools/javac/combo/Template.java
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/lib/combo/tools/javac/combo/Template.java	Tue Sep 10 16:47:40 2013 +0100
+++ b/test/lib/combo/tools/javac/combo/Template.java	Wed Sep 11 08:30:58 2013 -0400
@@ -40,11 +40,22 @@
     public static class Behavior {
         /* Looks for expandable keys.  An expandable key can take the form:
          *   #{MAJOR}
+         *   #{MAJOR.}
          *   #{MAJOR.MINOR}
-         *   where MAJOR can be IDENTIFIER or IDENTIFIER[NUMERIC_INDEX]
-         *   and MINOR can be an identifier
+         * where MAJOR can be IDENTIFIER or IDENTIFIER[NUMERIC_INDEX]
+         * and MINOR can be an identifier.
+         *
+         * The ability to have an empty minor is provided on the
+         * assumption that some tests that can be written with this
+         * will find it useful to make a distinction akin to
+         * distinguishing F from F(), where F is a function pointer,
+         * and also cases of #{FOO.#{BAR}}, where BAR expands to an
+         * empty string.
+         *
+         * However, this being a general-purpose framework, the exact
+         * use is left up to the test writers.
          */
-        private static final Pattern pattern = Pattern.compile("#\\{([A-Z_][A-Z0-9_]*(?:\\[\\d+\\])?)(?:\\.([A-Z_][A-Z0-9_]*))?\\}");
+        private static final Pattern pattern = Pattern.compile("#\\{([A-Z_][A-Z0-9_]*(?:\\[\\d+\\])?)(?:\\.([A-Z0-9_]*))?\\}");
 
         public static String expandTemplate(String template, final Map<String, Template> vars) {
             return expandTemplate(template, new MapResolver(vars));