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

[jira] [Updated] (GROOVY-9147) Using 'File.text = ' cause FileNotFoundException in Groovy 2.5.7 and Java 11 and @CompileStatic

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

A. Lepe updated GROOVY-9147:
----------------------------
    Description: 
The following code, throws FileNotFoundException:
{code:java}
@CompileStatic
class Sample {
    static void main(String[] args) {
        new File("/tmp/sample.txt").text = "something"
    }
}
{code}
The cause is reported to be related to InputStream, however, in this case, it should be OutputStream. 

The following throws no error:
{code:java}
new File("/tmp/sample.txt").setText("something"){code}
If I use Groovy 2.5.6 or bellow (or without @CompileStatic), it works as expected. 

 

  was:
The following code, throws FileNotFoundException:

 
{code:java}
@CompileStatic
class Sample {
    static void main(String[] args) {
        new File("/tmp/sample.txt").text = "something"
    }
}
{code}
The cause is reported to be related to InputStream, however, in this case, it should be OutputStream. 

The following throws no error:
{code:java}
new File("/tmp/sample.txt").setText("something"){code}
If I use Groovy 2.5.6 or bellow, it works as expected. 

 


> Using 'File.text = ' cause FileNotFoundException in Groovy 2.5.7 and Java 11 and @CompileStatic
> -----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9147
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9147
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 2.5.7
>         Environment: Java 11, Gradle 5.4
>            Reporter: A. Lepe
>            Priority: Minor
>              Labels: easyfix
>             Fix For: 2.5.6
>
>
> The following code, throws FileNotFoundException:
> {code:java}
> @CompileStatic
> class Sample {
>     static void main(String[] args) {
>         new File("/tmp/sample.txt").text = "something"
>     }
> }
> {code}
> The cause is reported to be related to InputStream, however, in this case, it should be OutputStream. 
> The following throws no error:
> {code:java}
> new File("/tmp/sample.txt").setText("something"){code}
> If I use Groovy 2.5.6 or bellow (or without @CompileStatic), it works as expected. 
>  



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