Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.2.2
-
Fix Version/s: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0-rc-3
-
Component/s: Static compilation
-
Labels:None
Description
This JavaFX program runs fine on Java 8:
//@CompileStatic class ImageCompStatic { public static void main(String[] args) { PlatformImpl.startup({}) // quick hack to start up the JavaFX runtime String path = "image.png" Image img = new Image("$path") println img.height } }
If CompileStatic is not commented out, you get the following error at run time:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method javafx.scene.image.Image.<init>(Ljava/lang/Object;)V from class ImageCompStatic
CompileStatic seems to change the selected constructor from the correct one:
public Image(String)
to the wrong one:
private Image(Object)
Changing the constructor invocation to:
Image img = new Image("$path" as String)
also works.
Attachments
Issue Links
- relates to
-
GROOVY-6647 static compilation fails at runtime for calling private constructor
-
- Closed
-