jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-2323

Parser fails to recognize function calls properly

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Wish Wish
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: parser
  • Labels:
    None

Description

Problem: Under certain circumstances (names starting with upper case letters) the parser fails to recognize certain function calls. I did not file it as bug, though, because after a closer look at the parser code, I found, that the reason for this behaviour is actually by design (and might be pretty hard to change; OTOH, this hack is truly gross enough to reward being filed as change-this! request. It makes you wonder, how many traps like that might be hidden somewhere else in the Groovy sources).

Before having seen the parser code, I was completely surprised, when some of my code failed to compile because of this:

class OldJavaLegacyCode {

    public def GenerateSomething(ob) {
        println("Old method ${ob}")
    }

    public def GENERATE_SOMETHING(ob) {
        println("Old method ${ob}")
    }

    public def generateSomething(ob) {
        println("Old method ${ob}")
    }
}

class ExtendsLegacyCode extends OldJavaLegacyCode {

    def wontCompile(sequence) {
        sequence.each { GENERATE_SOMETHING it }
    }

    def wontCompileNeither(sequence) {
        sequence.each { GenerateSomething it }
    }

    def willCompile(sequence) {
        sequence.each { generateSomething it }
    }
}

Issue Links

relates to

Sub-task - The sub-task of the issue GROOVY-2324 grammar forces usage of lowercase names for commands

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Paul King added a comment - 21/Nov/07 5:47 AM

Add code tags

Show
Paul King added a comment - 21/Nov/07 5:47 AM Add code tags
Hide
Permalink
blackdrag blackdrag added a comment - 30/Dec/10 7:29 AM

assuming there is a class GENERATE_SOMETHING and GenerateSomething, there is no way of seeing if it is intended as method call or as declaration

Show
blackdrag blackdrag added a comment - 30/Dec/10 7:29 AM assuming there is a class GENERATE_SOMETHING and GenerateSomething, there is no way of seeing if it is intended as method call or as declaration

People

  • Assignee:
    blackdrag blackdrag
    Reporter:
    Dirk Eßer
Vote (0)
Watch (0)

Dates

  • Created:
    20/Nov/07 6:53 AM
    Updated:
    30/Dec/10 7:29 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.