[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2951) regression: cannot compile return value "(java.lang.Object.class)"

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Tue Jul 12 03:22:23 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-2951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12613634#comment-12613634 ] 

Wolfgang Laun commented on JBRULES-2951:
----------------------------------------

Apparently you can write a comparison such as
   clazz == java.lang.Object
but you cannot write
   clazz == (java.lang.Object)
which is rather quirky. You can write 
   clazz == (java.lang.Object.class)
but not any more:
   clazz == java.lang.Object.class
Headache!

Note that the JIRA title says "regression...". I have code where 
   clazz == (java.lang.Object.class)
is used, which - alone - is accepted by 5.3.0 (which makes it even more confusing) but fails when combined with '||', e.g.
   clazz == null || clazz == (java.lang.Object.class)



> regression: cannot compile return value "(java.lang.Object.class)"
> ------------------------------------------------------------------
>
>                 Key: JBRULES-2951
>                 URL: https://issues.jboss.org/browse/JBRULES-2951
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler
>    Affects Versions: 5.2.0.M2
>            Reporter: Wolfgang Laun
>            Assignee: Mark Proctor
>            Priority: Critical
>
> The rule below compiled with a version build from HEAD on February 10, 2011. But now: 
> Unable to Analyse Expression target == source || target == (java.lang.Object.class):
> [Error: Failed to compile: 2 compilation error(s): 
>  - (1,32) unable to resolve method using strict-mode: ex10.Assignment.java()
>  - (1,32) unqualified type in strict mode for: java]
> [Near : {... target == source || target == (java.lang.Object.class) ....}]
>                                             ^
> [Line: 1, Column: 32] : [Rule name='SameOrObjectIsAssignable']
> ALSO please note that the line number is way off.
> rule SameOrObjectIsAssignable
> when
>     $a: Assignment( $t: target, target == source  || target == (java.lang.Object.class) )
> then
>     System.out.println( $a.toString() + " is OK. " );
>     retract( $a.getOriginal() );
> end

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list