-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 2.5.7
-
Fix Version/s: 2.5.8, 3.0.0-beta-2
-
Component/s: Static compilation
-
Labels:None
-
Environment:Linux. Java 11.
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.
- 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
-