[jboss-jira] [JBoss JIRA] (DROOLS-61) Classes with package protected visibility cannot be used in rules defined in the same package

Mario Fusco (JIRA) jira-events at lists.jboss.org
Wed Feb 27 12:07:56 EST 2013


     [ https://issues.jboss.org/browse/DROOLS-61?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mario Fusco resolved DROOLS-61.
-------------------------------

    Fix Version/s: 5.6
                   6.0.0.Alpha1
       Resolution: Done


It is not possible to make this use case to work because both the drools compiler and mvel has no notion of the package to which a given rule, pattern, statement or expression belongs to.

I fixed this issue raising a proper compilation failure every time you use a non-public class inside a DRL.
                
> Classes with package protected visibility cannot be used in rules defined in the same package
> ---------------------------------------------------------------------------------------------
>
>                 Key: DROOLS-61
>                 URL: https://issues.jboss.org/browse/DROOLS-61
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>            Reporter: Mario Fusco
>            Assignee: Mario Fusco
>             Fix For: 5.6, 6.0.0.Alpha1
>
>
> The following two files (foo/Foo.java, foo/foo.drl) are sufficient to
> reproduce the bug, i.e., a diagnostic
> Exception in thread "main" [Error: could not access field: foo.Foo.x]
> [Near : {... x == 1 ....}]
> {code}
> package foo;
> /*** not public ***/ class Foo {
>     private int x = 1;
>     public int getX(){ return x; }
> }
> package foo;
> rule "foo getX"
> when
>     Foo( x == 1 )
> then
>     System.out.println( "some Foo.x == 1" );
> end
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list