Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.5.23
-
None
Description
I have the following code:
class Book { String title String blurb = '' List<String> authors = [] }
When checking the compiled output, the creation of the empty list goes through ScriptBytecodeAdapter:
@Generated public Book() { String var1 = ""; this.blurb = var1; List var2 = ScriptBytecodeAdapter.createList(new Object[0]); this.authors = var2; MetaClass var3 = this.$getStaticMetaClass(); this.metaClass = var3; }
This case can be simplified to "List var2 = new ArrayList()", which would avoid some overhead and slightly improve @POJO support.
Attachments
Issue Links
- is related to
-
GROOVY-10029 SC: produce direct method call for assignment of collection to array
- Closed
- links to