groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-6632) CompileStatic selects wrong constructor when GString is a parameter
Date Thu, 26 Jul 2018 04:39:09 GMT

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

Paul King closed GROOVY-6632.
-----------------------------

> 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)

Mime
View raw message