[jboss-svn-commits] JBL Code SVN: r11306 - labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Apr 24 11:58:20 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-04-24 11:58:20 -0400 (Tue, 24 Apr 2007)
New Revision: 11306

Modified:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
Log:
-antlr 3.0b7 introduced a bug where we have to use a List of 
 Integers instead of int[]

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java	2007-04-24 15:29:11 UTC (rev 11305)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaConsequenceBuilder.java	2007-04-24 15:58:20 UTC (rev 11306)
@@ -16,6 +16,7 @@
 
 package org.drools.rule.builder.dialect.java;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
@@ -92,14 +93,15 @@
         // Must use the rule declarations, so we use the same order as used in the generated invoker
         final List list = Arrays.asList( context.getRule().getDeclarations() );
 
-        final int[] indexes = new int[declarations.length];
+        //final int[] indexes = new int[declarations.length];
+        final List indexes = new ArrayList(declarations.length);
 
         // have to user a String[] as boolean[] is broken in stringtemplate
         final String[] notPatterns = new String[declarations.length];
         for ( int i = 0, length = declarations.length; i < length; i++ ) {
-            indexes[i] = list.indexOf( declarations[i] );
+            indexes.add( i, new Integer( list.indexOf( declarations[i] ) ) );
             notPatterns[i] = (declarations[i].getExtractor() instanceof PatternExtractor) ? null : "true";
-            if ( indexes[i] == -1 ) {
+            if ( ((Integer)indexes.get(i)).intValue() == -1 ) {
                 // some defensive code, this should never happen
                 throw new RuntimeDroolsException( "Unable to find declaration in list while generating the consequence invoker" );
             }




More information about the jboss-svn-commits mailing list