Warning: An error occurred compiling a semantic invoker. Errors should have been reported elsewhere. stilton 200 1610 public static accumulateTestMethod(org.drools.rule.Declaration[] innerDeclarations, java.util.List matchingObjects, String name,int age, String aGlobal,String anotherGlobal ) throws Exception { int x = 0; for( java.util.Iterator it = matchingObjects.iterator(); it.hasNext(); ) { Object __itNextElem__ = it.next(); org.drools.Cheese cheese = (org.drools.Cheese) innerDeclarations[0].getValue( __itNextElem__ ); int price = (int) innerDeclarations[1].getIntValue( __itNextElem__ ); x += 1; } return ( x + 10 ); } package org.drools.semantics.java; import org.drools.asm.ClassReader; import org.drools.asm.util.TraceMethodVisitor; import org.drools.util.asm.MethodComparator.Tracer; public class AccumulateInvokerClass implements org.drools.spi.Accumulator, org.drools.spi.CompiledInvoker { private static final long serialVersionUID = 320L; public Object accumulate(org.drools.spi.Tuple tuple, java.util.List matchingObjects, org.drools.rule.Declaration[] declarations, org.drools.rule.Declaration[] innerDeclarations, org.drools.WorkingMemory workingMemory) throws Exception { String name = ( String ) declarations[0].getValue( ( (org.drools.common.InternalFactHandle) tuple.get( declarations[0] ) ).getObject() ); int age = ( int ) declarations[1].getIntValue( ( (org.drools.common.InternalFactHandle) tuple.get( declarations[1] ) ).getObject() ); String aGlobal = ( String ) workingMemory.getGlobal( "aGlobal" ); String anotherGlobal = ( String ) workingMemory.getGlobal( "anotherGlobal" ); return RuleWithAccumulate.accumulateTestMethod( innerDeclarations, matchingObjects, name, age, aGlobal, anotherGlobal ); } public int hashCode() { return 13; } public java.util.List getMethodBytecode() { org.drools.util.asm.MethodComparator.Tracer visit = new org.drools.util.asm.MethodComparator.Tracer("accumulateTestMethod"); java.io.InputStream is = RuleWithAccumulate.class.getClassLoader().getResourceAsStream( "org.drools.semantics.java.RuleWithAccumulate".replace( '.', '/' ) + ".class" ); java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream(); byte[] data = new byte[1024]; int byteCount; try { while ( (byteCount = is.read( data, 0, 1024 )) > -1 ) { bos.write(data, 0, byteCount); } } catch ( java.io.IOException e ) { throw new org.drools.RuntimeDroolsException("Unable getResourceAsStream for Class 'RuleWithAccumulate' "); } org.drools.asm.ClassReader classReader = new org.drools.asm.ClassReader( bos.toByteArray() ); classReader.accept( visit, true ); org.drools.asm.util.TraceMethodVisitor trace = visit.getTrace(); return trace.getText(); } public boolean equals(Object object) { if (object == null ) { return false; } else if ( object == this ){ return true; } if ( ! (object instanceof org.drools.spi.CompiledInvoker) ) { return false; } org.drools.spi.CompiledInvoker other = ( org.drools.spi.CompiledInvoker ) object; return org.drools.util.asm.MethodComparator.compareBytecode( getMethodBytecode(), other.getMethodBytecode() ); } } package foo expander foo rule "new rule" activation-group "boo" when expanded: line 1 expanded: line 2 then expanded: line 3 end Runtime for compile with dictionary of 1000: 16ms setting value to 1 setting value to 2 setting value to 3 setting value to 4 setting value to 5 setting value to 6 setting value to 7 setting value to 8 setting value to 9 java.lang.Exception: this should throw an exception at org.drools.test.Rule_Throw_Consequence_Exception_0.consequence(Rule_Throw_Consequence_Exception_0.java:7) at org.drools.test.Rule_Throw_Consequence_Exception_0ConsequenceInvoker.evaluate(Rule_Throw_Consequence_Exception_0ConsequenceInvoker.java:18) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:456) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:425) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:353) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:334) at org.drools.integrationtests.IntegrationCases.testConsequenceException(IntegrationCases.java:1381) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) java.lang.Exception: this should throw an exception at org.drools.test.ThrowException.throwException(ThrowException.java:11) at org.drools.test.Rule_Throw_Function_Exception_0.consequence(Rule_Throw_Function_Exception_0.java:7) at org.drools.test.Rule_Throw_Function_Exception_0ConsequenceInvoker.evaluate(Rule_Throw_Function_Exception_0ConsequenceInvoker.java:18) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:456) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:425) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:353) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:334) at org.drools.integrationtests.IntegrationCases.testFunctionException(IntegrationCases.java:1403) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) (null: 43, 54): cvc-complex-type.3.2.2: Attribute 'field-name' is not allowed to appear in element 'predicate'. (null: 43, 54): cvc-complex-type.3.2.2: Attribute 'identifier' is not allowed to appear in element 'predicate'. Warning: An error occurred compiling a semantic invoker. Errors should have been reported elsewhere.