# HG changeset patch # User emc # Date 1378902658 14400 # Node ID 41f7c3013d9bcd64a59a019be7ba0557c6f8d996 # Parent 8f2c828192c3d3a7ce25cdc1118ae0ce8cfce75e 8024510: lib/combo/tools/javac/combo/TemplateTest.java fails Summary: Edit regex in Template to allow "MAJOR." pattern. Reviewed-by: briangoetz diff -r 8f2c828192c3 -r 41f7c3013d9b langtools/test/lib/combo/tools/javac/combo/Template.java --- a/langtools/test/lib/combo/tools/javac/combo/Template.java Tue Sep 10 16:47:40 2013 +0100 +++ b/langtools/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 vars) { return expandTemplate(template, new MapResolver(vars));