Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.5.7
-
None
-
Linux. Java 11.
Description
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.
Attachments
Attachments
Issue Links
- duplicates
-
GROOVY-9115 General error during class generation
- Closed
- is duplicated by
-
GROOVY-9147 Using 'File.text = ' cause FileNotFoundException in Groovy 2.5.7 with @CompileStatic
- Closed