changeset 21927:6a93800d10f1

Map from method name to rule should be per type not per annotation processor
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 11 Jun 2015 12:15:19 -0700
parents 607a5d806916
children 130e06e34659
files graal/com.oracle.graal.compiler.match.processor/src/com/oracle/graal/compiler/match/processor/MatchProcessor.java
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.match.processor/src/com/oracle/graal/compiler/match/processor/MatchProcessor.java	Thu Jun 11 09:51:50 2015 -0700
+++ b/graal/com.oracle.graal.compiler.match.processor/src/com/oracle/graal/compiler/match/processor/MatchProcessor.java	Thu Jun 11 12:15:19 2015 -0700
@@ -333,12 +333,6 @@
      */
     Map<String, TypeDescriptor> knownTypes = new HashMap<>();
 
-    /**
-     * The mapping between elements with MatchRules and the wrapper class used invoke the code
-     * generation after the match.
-     */
-    private Map<String, MethodInvokerItem> invokers = new LinkedHashMap<>();
-
     private TypeDescriptor valueType;
 
     private TypeMirror matchRulesTypeMirror;
@@ -500,7 +494,7 @@
             out.println();
 
             // Generate declarations for the wrapper class to invoke the code generation methods.
-            for (MethodInvokerItem invoker : invokers.values()) {
+            for (MethodInvokerItem invoker : info.invokers.values()) {
                 StringBuilder args = new StringBuilder();
                 StringBuilder types = new StringBuilder();
                 int count = invoker.fields.size();
@@ -646,6 +640,12 @@
         public Set<String> positionDeclarations = new LinkedHashSet<>();
 
         /**
+         * The mapping between elements with MatchRules and the wrapper class used invoke the code
+         * generation after the match.
+         */
+        Map<String, MethodInvokerItem> invokers = new LinkedHashMap<>();
+
+        /**
          * The set of packages which must be imported to refer the classes mention in matchRules.
          */
         Set<String> requiredPackages = new HashSet<>();
@@ -919,14 +919,15 @@
             }
 
             String methodName = method.getSimpleName().toString();
-            MethodInvokerItem invoker = invokers.get(methodName);
+            MethodInvokerItem invoker = info.invokers.get(methodName);
             if (invoker == null) {
                 invoker = new MethodInvokerItem(methodName, topDeclaringType(method).getSimpleName().toString(), method, actualParameters);
-                invokers.put(methodName, invoker);
+                info.invokers.put(methodName, invoker);
             } else if (invoker.method != method) {
                 // This could be supported but it's easier if they are unique since the names
                 // are used in log output and snippet counters.
-                errorMessage(method, "Use unique method names for match methods.");
+                errorMessage(method, "Use unique method names for match methods: %s.%s != %s.%s", method.getReceiverType(), method.getSimpleName(), invoker.method.getReceiverType(),
+                                invoker.method.getSimpleName());
                 return;
             }