[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2376) Parser fails when accessing property/method called 'end'

Barry Kaplan (JIRA) jira-events at lists.jboss.org
Tue Apr 13 17:55:25 EDT 2010


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

Barry Kaplan commented on JBRULES-2376:
---------------------------------------

I'm not seeing this behavior:

with this

  update(entryPoints["downtime"].getFactHandle(downtime),
         downtime.`end`)

I get

  java.lang.RuntimeException: [41,23]: [ERR 102] Line 41:23 mismatched input ')'

with this

  update(entryPoints["downtime"].getFactHandle(downtime),
         downtime.`end`())

I get

java.lang.RuntimeException: [41,23]: [ERR 102] Line 41:23 mismatched input '('

----

where:

case class DowntimeInterval(deviceId: String, interval: Interval,
                            classification: Option[DowntimeClassification] = None,
                            id: String = ObjectId.get.toString)
        extends DeviceEvent with Logging {

  def this(deviceId: String) = this(deviceId, fromNow)
  debug("downtime: started now="+interval.start)

  def end = {
    debug("downtime: ended interval="+interval)
    this.copy(interval = this.interval.start to now)
  }
  def endd = end // alias for drools

  def classify(classification: DowntimeClassification): DowntimeInterval = {
    debug("classfied as: "+classification)
    copy(classification = Some(classification))
  }

}

Using the 'endd' method does work: 

  update(entryPoints["downtime"].getFactHandle(downtime),
         downtime.endd)


> Parser fails when accessing property/method called 'end'
> --------------------------------------------------------
>
>                 Key: JBRULES-2376
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2376
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler-DSL
>    Affects Versions: 5.1.0.M1
>            Reporter: Barry Kaplan
>            Assignee: Mark Proctor
>             Fix For: 5.1.0.M1
>
>
> Consider the following: 
> declare Foo
>    end : String
> end
> rule "foo" dialect "java"
> when
> then
>    foo = new Foo()
>    e = foo.end()
> end
> The compiler fails with the following error:  [xx,yy]: [ERR 102] Line xx:yy mismatched input '('  
> If the rule is changed to (ie, remove the parens on the 'end')
> rule "foo" dialect "java"
> when
> then
>    foo = new Foo()
>    e = foo.end
> end
> The compiler error is: [0,-1]: [ERR 101] Line 0:-1 no viable alternative at input '<eof>'

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

        


More information about the jboss-jira mailing list