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

[jira] [Created] (GROOVY-9123) "java.nio.file.Path.setText" does not work with CompileStatic on Groovy 2.5.7

Jan Hackel created GROOVY-9123:
----------------------------------

             Summary: "java.nio.file.Path.setText" does not work with CompileStatic on Groovy 2.5.7
                 Key: GROOVY-9123
                 URL: https://issues.apache.org/jira/browse/GROOVY-9123
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 2.5.7
         Environment: Linux. Java 11.
            Reporter: Jan Hackel
         Attachments: gradle-nio-path-gettext.zip

Code like the following will not work correctly on Groovy 2.5.7 with {{@CompileStatic}} enabled (groovy-nio required):

{{Files.createTempFile('will not', 'compile').text = 'Some Text'}}

On Groovy 2.5.7 it compiles as

{{String var1 = "Some Text";}}
 {{NioGroovyMethods.getText(Files.createTempFile("will not", "compile"));}}

whereas Groovy 2.5.6 it compiled as

{{String var1 = "Some Text";}}
 {{ScriptBytecodeAdapter.setProperty(var1, (Class)null, Files.createTempFile("will not", "compile"), (String)"text");}}

The latter is working, the former is not.

Calling {{Path.setText}} should call the setter and not the getter for property {{text}} when compiling statically!

Attached is a sample project demonstrating the issue.



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