[jboss-jira] [JBoss JIRA] Closed: (JBRULES-1092) Invalid Java code generated from 'accumulate' function with nested classes

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Mon Aug 20 10:43:03 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-1092?page=all ]

Edson Tirelli closed JBRULES-1092.
----------------------------------

    Fix Version/s: 4.0.1
       Resolution: Done

Problem was that Class.getName() method returns the binary name of the class and Class.getCanonicalName() is a java 1.5 method. 
Implemented a helper function to generate the canonical name for 1.4 classes.

Unit test and integration tests added.

Thanks for reporting and providing test case.


> Invalid Java code generated from 'accumulate' function with nested classes
> --------------------------------------------------------------------------
>
>                 Key: JBRULES-1092
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-1092
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions:  4.0.0.GA
>            Reporter: Alexandre Gattiker
>         Assigned To: Edson Tirelli
>             Fix For: 4.0.1
>
>
> Steps to reproduce:
> - Create a sample new project with the Eclipse plugin
> - Add following rule to the .drl file
> - Execute DroolsTest
> rule "AccumulateTest"
> 	no-loop true
> 	when
> 		$d: Double()
> 		from accumulate ( m : Message( $value: status ),
>                               init( double total = 0; ),
>                               action( total += $status ),
>                               result( total )
>                          )
> 	then
> 		System.out.println( "ok" ); 
> 		
> end
> Exception is:
> org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule name=AccumulateTest, agendaGroup=MAIN, salience=0, no-loop=true]
> 	com/sample/Rule_AccumulateTest_0.java (27:834) : The nested type com.sample.DroolsTest$Message cannot be referenced using its binary name
> 	com/sample/Rule_AccumulateTest_0.java (27:869) : The nested type com.sample.DroolsTest$Message cannot be referenced using its binary name
> 	com/sample/Rule_AccumulateTest_0.java (29:1027) : Syntax error, insert ";" to complete Statement
> 	com/sample/Rule_AccumulateTest_0.java (29:1027) : $status cannot be resolved
> 	com/sample/Rule_AccumulateTest_0.java (39:1483) : The nested type com.sample.DroolsTest$Message cannot be referenced using its binary name
> 	com/sample/Rule_AccumulateTest_0.java (39:1518) : The nested type com.sample.DroolsTest$Message cannot be referenced using its binary name
> 	at org.drools.rule.Package.checkValidity(Package.java:408)
> 	at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:288)
> 	at com.sample.DroolsTest.readRule(DroolsTest.java:64)
> 	at com.sample.DroolsTest.main(DroolsTest.java:21)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list