Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.4.4
-
None
-
None
Description
I believe GROOVY-7366 didn't account for aliasing in imports. For example, if I have
Application.groovy
import static Util.hello as hi class Application { static void main(def args) { hi } }
Util.groovy
class Util { static void sayHello() { println "Hello" } }
The generated stub looks like
Application.java
import java.lang.*; import java.io.*; import java.net.*; import java.util.*; import groovy.lang.*; import groovy.util.*; import static Util.hi; public class Application extends java.lang.Object implements groovy.lang.GroovyObject { ; public groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;} public void setMetaClass(groovy.lang.MetaClass mc) { } public java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;} public java.lang.Object getProperty(java.lang.String property) { return null;} public void setProperty(java.lang.String property, java.lang.Object value) { } public static void main(java.lang.String... args) { } }
When it should be like
Application.java
import java.lang.*; import java.io.*; import java.net.*; import java.util.*; import groovy.lang.*; import groovy.util.*; import static Util.hello; public class Application extends java.lang.Object implements groovy.lang.GroovyObject { ; public groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;} public void setMetaClass(groovy.lang.MetaClass mc) { } public java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;} public java.lang.Object getProperty(java.lang.String property) { return null;} public void setProperty(java.lang.String property, java.lang.Object value) { } public static void main(java.lang.String... args) { } }
Attachments
Issue Links
- duplicates
-
GROOVY-7509 Problem With Stub Generator And Static Import Aliases
- Closed
- is related to
-
GROOVY-7366 Static imports are missing in generated stubs
- Closed