History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-2797
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Keith R. Bennett
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Consolidate and address all bugs relating to compile errors occurring when parentheses are omitted from a method call.

Created: 01/May/08 03:19 PM   Updated: 02/May/08 06:23 AM
Component/s: syntax
Affects Version/s: 1.5.6
Fix Version/s: None

Time Tracking:
Not Specified

Environment: N/A

Testcase included: yes


 Description  « Hide
Consolidate and address all bugs relating to compile errors occurring when parentheses are omitted from a method call (including a constructor call).

Identify the commonality among the following bugs relating to the use of parentheses in method calls:

GROOVY-2571
GROOVY-165
GROOVY-135
GROOVY-1354
GROOVY-1087

Design and implement some kind of logical and consistent behavior that the programmer can rely on regarding this (if there isn't one already that I'm just not aware of). Include more descriptive error messages when parentheses are required but not provided.

Here is one minimal example relating to super, but the above bugs specify others as well:

Code:

class Base {
    Base() {
        System.out.println 'created a Base';
    }


    Base(s) {
        System.out.println s  
    }
}


class Derived extends Base {
    Derived() {
        super 'foo'
        System.out.println 'created a Derived';
    }
}


new Base('calling new Base()')
new Derived()

Output:

calling new Base()
created a Base
Caught: groovy.lang.MissingMethodException: No signature of method: Derived.super() is applicable for argument types: (java.lang.String) values: {"foo"}
        at Derived.<init>(Test.groovy:15)
        at Test.run(Test.groovy:22)
        at Test.main(Test.groovy)


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Keith R. Bennett - 01/May/08 03:45 PM
In the code example above, there should be a newline in the Derived constructor separating:

super 'foo'

and

System.out.println 'created a Derived';

The test failed even with the newline there.


Jochen Theodorou - 01/May/08 04:55 PM - edited
this()and super() are no method calls, same for expressions with new. If I remove bugs concerning this and closed bugs, then your list contains only GROOVY-2571. If you want to have the command style method call for super and this as well, then we should name this an improvement. It is not really a bug

Paul King - 02/May/08 03:58 AM
add code tags