Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.4
-
Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Environment:Java 1.6, Ubuntu and Windows XP
-
Testcase included:yes
-
Number of attachments :
Description
A static method with a default parameter is not found, when it is imported statically and called without prefixing his class:
=== test.groovy ===
import static Settings.*
import static ConsoleUI.*
class Settings
{
static void initialize()
}
class ConsoleUI
{
static void writeln(String s, int delay = 0)
}
Settings.initialize()
=== Output ===
working
Caught: groovy.lang.MissingMethodException: No signature of method: static Settings.writeln() is applicable for argument types: (java.lang.String) values:
at Settings.initialize(test.groovy:8)
at test.run(test.groovy:20)
at test.main(test.groovy)
Exited: 256
Issue Links
- is depended upon by
-
GROOVY-4613
static import of method with default parameter value broken again: MissingMethodException
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Fix Version/s | 1.6-beta-1 [ 14008 ] |
| Fix Version/s | 1.6-beta-1 [ 14008 ] | |
| Fix Version/s | 1.6-beta-2 [ 14261 ] |
| Fix Version/s | 1.6-rc-1 [ 14009 ] | |
| Fix Version/s | 1.6-beta-2 [ 14261 ] |
| Fix Version/s | 1.7 [ 14014 ] | |
| Fix Version/s | 1.5.8 [ 14630 ] |
| Attachment | 2746Patch.zip [ 38028 ] |
| Attachment | 2746Patch.zip [ 38028 ] |
| Attachment | 2746_v16x_v2.diff [ 38337 ] | |
| Attachment | 2746_v17x_v2.diff [ 38338 ] | |
| Attachment | 2746_v15x_v2.diff [ 38336 ] |
| Attachment | 2746_v17x_v2.diff [ 38338 ] |
| Attachment | 2746_v17x_v2.diff [ 38344 ] |
| Status | Open [ 1 ] | Closed [ 6 ] |
| Assignee | Jochen Theodorou [ blackdrag ] | |
| Resolution | Fixed [ 1 ] |
| Link |
This issue is depended upon by |
Hi,
I am attaching a zip that has patches for all 3 affected groovy versions for this issue.
The patch has changes to the following 2 files:
1) src/main/org/codehaus/groovy/ast/ClassNode.java - Its hasPossibleStaticMethod() now handles finding the static methods having parameters with default values.
2) src/test/groovy/StaticImportTest.groovy - Added a few test cases for this issue.
Hope it helps.
Roshan