You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/17 05:45:00 UTC

[jira] [Resolved] (GROOVY-6632) CompileStatic selects wrong constructor when GString is a parameter

     [ https://issues.apache.org/jira/browse/GROOVY-6632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Sun resolved GROOVY-6632.
--------------------------------
       Resolution: Fixed
         Assignee: Daniel Sun
    Fix Version/s: 2.5.0-rc-3
                   3.0.0-alpha-3
                   2.6.0-alpha-4

The issue should be same with GROOVY-7883, which has been fixed in 2.5.0-rc-3(will be released soon)

> CompileStatic selects wrong constructor when GString is a parameter
> -------------------------------------------------------------------
>
>                 Key: GROOVY-6632
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6632
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.2.2
>            Reporter: Neil Galarneau
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0-rc-3
>
>
> This JavaFX program runs fine on Java 8:
> {code}
> //@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
>   }
> }
> {code}
> 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:
> {code}
> public Image(String)
> {code}
> to the wrong one:
> {code}
> private Image(Object)
> {code}
> Changing the constructor invocation to:
> {code}
>     Image img = new Image("$path" as String)
> {code}
> also works.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)