Changelog for Groovy 5.0.0-unreleased

Bug

  • [GROOVY-10095] - Wrong LUB when involving a numeric constant and null
  • [GROOVY-10359] - STC misses type error when involving a variable with a char a declared type
  • [GROOVY-10527] - Extension method getProperties() returns raw map
  • [GROOVY-10568] - MissingMethodException using method-pointer operator in superclass
  • [GROOVY-10592] - Java static interface methods cannot be located using property notation in dynamic context
  • [GROOVY-10617] - Return statement insertion generates unnecessary dynamic cast
  • [GROOVY-10636] - STC: closure array or varargs parameter not properly type-checked
  • [GROOVY-10695] - StackOverflowError when calling a static method.
  • [GROOVY-10750] - Compiler does not resolve compile-time constants in string concatenation
  • [GROOVY-10763] - ClassNode setSuperClass and setInterfaces should update usingGenerics
  • [GROOVY-10770] - Multiple @CompileStatic annotations don't combine extensions
  • [GROOVY-10792] - Declared generic parameter on method not transferred to Closure
  • [GROOVY-10800] - The % operator returns unexpected results for negative numbers for BigIntegers *
  • [GROOVY-10818] - STC: Cannot choose between TimeDuration#plus(Duration) and Duration#plus(TimeDuration)
  • [GROOVY-10858] - STC method reference return type checking
  • [GROOVY-10862] - Annotation default set for every binary method *
  • [GROOVY-10904] - STC doesn't find property accessor on nested class
  • [GROOVY-10930] - STC accepts program although constructor reference is invalid
  • [GROOVY-10936] - Patterns conditionally created using pattern operator ~ are cast to String/GString
  • [GROOVY-10971] - STC is looking for the wrong constructor reference
  • [GROOVY-10974] - Fail to perform SAM conversion using method references
  • [GROOVY-10975] - STC rejects program when passing method reference in parameterized function
  • [GROOVY-10985] - Precedence of self property over outer class field *
  • [GROOVY-11014] - CompileStatic & Elvis operator: Cannot assign literal value of type (java.lang.Number or java.lang.Comparable) to variable of type double
  • [GROOVY-11026] - NPE when checking compatibility of method reference
  • [GROOVY-11051] - Static compiler does not coerce Groovy truth from closures
  • [GROOVY-11060] - SC internal error when spreading inside list literal
  • [GROOVY-11071] - Compiler error related to getAt and interface methods
  • [GROOVY-11073] - Cannot infer type of parameterized method when dealing with arrays
  • [GROOVY-11117] - return first nested interface when GroovyClassLoader.parseClass parse interfaces with nested interfaces
  • [GROOVY-11121] - unexpected error when having overloaded methods, one of which receiving an Iterable
  • [GROOVY-11128] - implicit-this access within closure to private members in declaring class when invoked from derived class
  • [GROOVY-11144] - MissingPropertyEx when accessing private static field in closure of same class
  • [GROOVY-11163] - Class parsing does not set erasure of type param with bounds
  • [GROOVY-11170] - Fix edge cases for SecureASTCustomizer
  • [GROOVY-11178] - JSR308 constructor call annotations not resolved or available
  • [GROOVY-11179] - JSR308 inline constants for annotations in class header
  • [GROOVY-11180] - Regression: STC loses track of package-scope constants
  • [GROOVY-11185] - each after transpose with 2 arguments does not compile
  • [GROOVY-11189] - STC LUB of List and Set is not Collection for Java 21
  • [GROOVY-11192] - Code that causes Groovy Compiler Crash
  • [GROOVY-11196] - ambiguous method error for tap on null receiver
  • [GROOVY-11198] - access to public static variable forbidden in enum
  • [GROOVY-11199] - inner class cannot set property of enclosing class that has a getter without a setter
  • [GROOVY-11200] - JsonSlurper parses badly format JSON without throwing exception
  • [GROOVY-11206] - Concatenated strings not treated as compile-time constants
  • [GROOVY-11207] - STC rejects concatenated string as annotation parameter
  • [GROOVY-11209] - XmlUtil escapeControlCharacters escapes control characters 0-30 instead of 0-31
  • [GROOVY-11212] - Access to private fields of superclass from a block fails in subclass
  • [GROOVY-11223] - STC: error message for inaccessible setter is not too helpful
  • [GROOVY-11224] - Reconsider name duplication for groovysh *
  • [GROOVY-11239] - VerifyError for explicit this parameter and default argument(s)
  • [GROOVY-11241] - Regression in STC generics solution
  • [GROOVY-11254] - Compiler crash: ClassNode#getTypeClass for TemporalAccessor called before the type class is set
  • [GROOVY-11256] - Fail to identify direct call of abstract method
  • [GROOVY-11257] - [STC] Cannot detect the type of Optional in some cases
  • [GROOVY-11258] - AssertJ collection mapping is badly supported
  • [GROOVY-11265] - Runtime rehydrate error for closure in interface default method
  • [GROOVY-11269] - GroovyClassDoc has empty 'enumConstants' when call method GroovyDocParser.getClassDocsFromSingleSource(...)
  • [GROOVY-11273] - Fail to identify updates on final variables declared in default methods
  • [GROOVY-11274] - Not reporting error when implicit default constructor is private
  • [GROOVY-11284] - Generated size() method on records performs unnecessary boxing
  • [GROOVY-11285] - Generated toList() and toMap() methods on records perform unnecessary wrapping
  • [GROOVY-11286] - Extraneous bytecode generated after calls to void methods
  • [GROOVY-11288] - Unnecessary bytecode generated after variable assignment
  • [GROOVY-11290] - STC: multiple instanceof checks produce different results
  • [GROOVY-11292] - Class without sealed parent cannot be non-sealed
  • [GROOVY-11293] - Error "BUG! At this point argument array length and parameter array length should be the same"
  • [GROOVY-11296] - shuffled modifies input array
  • [GROOVY-11297] - Fail to identify duplicate constructor declaration
  • [GROOVY-11299] - ClassNode getField(String), getMethods(String) and others return from super interface when class uses extends
  • [GROOVY-11301] - References to inaccesible methods with static compilation leads to runtime error
  • [GROOVY-11302] - Method call with type args loses information within trait
  • [GROOVY-11304] - The script running reports a null pointer.
  • [GROOVY-11308] - DefaultGroovyMethods#unique now returns null for empty or 1 element input
  • [GROOVY-11311] - Groovy Closure not retaining param annotations, but only for the default single object param case
  • [GROOVY-11313] - Closure owner seems to be overwritten
  • [GROOVY-11319] - Access to a private property of a parent object is not caught
  • [GROOVY-11323] - Interface default method and static import precedence
  • [GROOVY-11325] - @NamedVariant self referential default values are not correctly resolved when calculations are involved
  • [GROOVY-11328] - Groovy 4.0.19 - Unable to start (picocli)
  • [GROOVY-11329] - Class using trait and @Immutable and allProperties gives BUG! exception in phase 'canonicalization' NPE
  • [GROOVY-11335] - STC: for loop element type inference with multiple instanceof
  • [GROOVY-11339] - AutoImplement and method with default arguments
  • [GROOVY-11341] - @CompileStatic: Compilation fails due to a synthetic bridge method in the subclass
  • [GROOVY-11352] - Reference to this in ctor before this/super call false positive
  • [GROOVY-11353] - SC: variable initialized to null and assigned primitive value in loop
  • [GROOVY-11356] - STC: missing property error for implicit-this reference to private super field or method
  • [GROOVY-11357] - Package-private field and method or property have different treatment *
  • [GROOVY-11358] - STC: error for abstract class private or package-private field access
  • [GROOVY-11362] - implicit type of catch parameter is written as Object
  • [GROOVY-11363] - Bootstrap method error for method reference used with a primitive literal
  • [GROOVY-11364] - STC loses generic specialization on inheritance
  • [GROOVY-11365] - IllegalAccessError when using protected method as reference
  • [GROOVY-11366] - STC: callable (closure) property from super class
  • [GROOVY-11369] - STC: map properties "class" and "empty" indicated as read-only
  • [GROOVY-11371] - unsafe conversion of array of reference type to an array of primitive type
  • [GROOVY-11372] - STC: write property via extension method
  • [GROOVY-11373] - IllegalAccessError writing package-private property of other-package map-based type
  • [GROOVY-11375] - Power binary expression finds incorrect type - currently uses declaration inferred type
  • [GROOVY-11376] - SC: put entry replaced write field for public and protected of map-based type
  • [GROOVY-11378] - array or collection coercion of non-collection iterable produces single-element result
  • [GROOVY-11380] - STC: property reference to generated method not recognized
  • [GROOVY-11381] - STC: field and interface default method accessor property
  • [GROOVY-11383] - incorrect comparison is missed by the compiler
  • [GROOVY-11384] - STC: map property access within closure
  • [GROOVY-11385] - reference to the constructor of an abstract class is not detected
  • [GROOVY-11386] - STC: closure property precedence
  • [GROOVY-11393] - STC: error for non-static member of class delegate
  • [GROOVY-11394] - STC: zero-parameter closure call with args
  • [GROOVY-11399] - STC: inferred type of closure delegate, owner and thisObject
  • [GROOVY-11400] - STC: closure parameter metadata after re-assignment of variable
  • [GROOVY-11401] - STC: inferred type of name within closure (delegate property versus owner field) *
  • [GROOVY-11402] - STC: inferred type of this.name within closure
  • [GROOVY-11412] - SC: outer class field and self dynamic property
  • [GROOVY-11413] - ClassNode makeArray() and make(Type[].class) differences
  • [GROOVY-11427] - unexpected crash in class generation "On receiver: x with message: getAt and arguments: 0"
  • [GROOVY-11436] - [GINQ] Some non-ascii characters in ascii table can not align correctly in console
  • [GROOVY-11438] - STC: loss of precision check for typecast number literals
  • [GROOVY-11440] - invalid reference to an array constructor leads to type unsafe results
  • [GROOVY-11448] - General error during canonicalization when having closure with default args
  • [GROOVY-11450] - flow typing can lead to type unsafe results when having nested ifs
  • [GROOVY-11451] - IncompatibleClassChange with map-style constructor and overloaded setters
  • [GROOVY-11453] - Spread-safe operator differences and efficiencies *
  • [GROOVY-11457] - STC does not properly handle try/catch in flow typing leading to type unsafety
  • [GROOVY-11459] - weak hashing algorithm (使用弱哈希算法)
  • [GROOVY-11467] - Failed to find method when using method reference on a class field
  • [GROOVY-11469] - Empty execute method in groovy.sql.Sql
  • [GROOVY-11471] - Assignments in closures can introduce issues in flow typing
  • [GROOVY-11474] - flow typing on loops can introduce type unsafety
  • [GROOVY-11479] - crash when annotating a lambda parameter
  • [GROOVY-11480] - Cast exception when using qualified this in lambda
  • [GROOVY-11481] - anonymous inner class visibility *
  • [GROOVY-11483] - reference to outer class non-private static field before special ctor call
  • [GROOVY-11485] - undefined default constructor of outer class causes runtime exception
  • [GROOVY-11490] - ClassCastException when assigning a lambda returning null into a SAM expecting a primitive
  • [GROOVY-11507] - "class" and "empty" listed as map properties
  • [GROOVY-11512] - Inconsistent isAttribute & getAttribute behavior in Groovy 4 with traits
  • [GROOVY-3142] - Unable to access inherited private fields from a closure within an inherited method
  • [GROOVY-4020] - ClassFormatError when using the name including "-" sign
  • [GROOVY-4487] - null.class inconsistent with null.getClass() [NullObject]
  • [GROOVY-5001] - Map access is given higher precedence when trying to access fields/properties in classes which implement java.util.Map or extend java.util.HashMap or java.util.Properties *
  • [GROOVY-5051] - 'this' uses in a superclass is treated as subclass, preventing acces to private members
  • [GROOVY-5491] - HashMap subclass property access inconsistent
  • [GROOVY-5744] - Multiple assignment from Iterator skips every other element
  • [GROOVY-5760] - CLONE - dash in script filename
  • [GROOVY-5881] - Type inference breaks in longer transitive generic structures
  • [GROOVY-5893] - Return type of "inject" is not inferred properly
  • [GROOVY-6144] - Confusing treatment of m['foo'], m.get('foo'), m.foo, m.getFoo() for Maps *
  • [GROOVY-6146] - Calling a Java vararg method from Groovy with a null argument cast to the vararg type behaves differently than in Java
  • [GROOVY-6277] - super class private members are preferred over public members of the current class with lower priority
  • [GROOVY-6324] - Cannot call closure like a method in type checked mode
  • [GROOVY-6335] - MissingPropertyException when private static property is used inside a nested closure and called from a child class
  • [GROOVY-6363] - The extension mechanism do not work when a method named "X" is a added to class having a private method named "X"
  • [GROOVY-6429] - flow typing detects unexpected error at if-else flow
  • [GROOVY-6567] - delegate is NullObject instance for closure metamethods invoked on null
  • [GROOVY-6591] - error message glitch for LUB
  • [GROOVY-6663] - Incorrect order of calling super.method when depth more than two and first class is generic
  • [GROOVY-6668] - Static compiler doesn't coerce GString for getAt() call
  • [GROOVY-6939] - Calling "each" on an untyped model variable with two arguments causes doCall error
  • [GROOVY-7670] - CLONE - dash in script filename
  • [GROOVY-7734] - ClassNode tryFindPossibleMethod only defined for TupleExpression
  • [GROOVY-7861] - asType(null) called in @CompileStatic method returns a string 'null'
  • [GROOVY-7984] - @SelfType does not allow trait to be added dynamically
  • [GROOVY-8096] - setScriptBaseClass with Java base class breaks @Field initialization from Binding due to generated call to wrong constructor
  • [GROOVY-8145] - Cross-project @Log + static import issue
  • [GROOVY-8168] - When using Interface: BigDecimal cannot be cast to Double
  • [GROOVY-8184] - Class constant withouts .class in annotation value resolves as VariableExpression
  • [GROOVY-8212] - coerce GString to String when used as Map key
  • [GROOVY-8219] - Add @TupleConstructor(includeFields = true) to a class implements a trait which contains properties will cause NPE *
  • [GROOVY-8254] - Alias is ignored in constructor call *
  • [GROOVY-8488] - STC: floating-point literals no longer accepted as args to method with double parameter
  • [GROOVY-8499] - Glitch with native lambda support when supplied with incorrect arity lambda
  • [GROOVY-8555] - The private keyword of an instance variable is causing a behavior change in a map class
  • [GROOVY-8587] - Calling super in an overridden method results in MissingMethodException when method indirectly inherited from trait
  • [GROOVY-8788] - Inconsistency in extension method selection with @CompileStatic *
  • [GROOVY-8854] - MissingMethodException when a public method on a trait calls a static private one in a class hierarchy
  • [GROOVY-8875] - NullObject.metaClass
  • [GROOVY-8948] - BigDecimal to primitive conversion not working
  • [GROOVY-9154] - JSR308 info incomplete in bytecode
  • [GROOVY-9155] - JSR308 annotation attributes not being validated
  • [GROOVY-9306] - error for enum constant with comma followed by method *
  • [GROOVY-9367] - org.codehaus.groovy.runtime.MetaClassHelper#getClassWithNullAndWrapper should return NullObject when accept null
  • [GROOVY-9523] - MissingMethodException when referencing a private enum method
  • [GROOVY-9596] - Cannot access protected field of Java superclass with --illegal-access=deny
  • [GROOVY-9801] - Stub generator omits default interface methods
  • [GROOVY-9850] - STC: add error for write of private or package-private field of super class
  • [GROOVY-9873] - SAM type or functional interface referenced from a method is not visible from class loader
  • [GROOVY-9987] - MissingMethodException when a base class calls a private static method inside a closure

Dependency upgrade

Improvement

  • [GROOVY-10223] - Add support for Optional to DefaultTypeTransformation.asCollection()
  • [GROOVY-10278] - CompilerConfiguration: improve target bytecode selection
  • [GROOVY-10473] - Extend streams support to spread and subscript
  • [GROOVY-10597] - STC: support spread arguments for varargs
  • [GROOVY-10616] - Add peek extension method for Optional, OptionalInt, OptionalLong and OptionalDouble
  • [GROOVY-10655] - Add extension method for coercing AtomicBoolean to boolean value
  • [GROOVY-10666] - Implement multiple-assignment (aka destructuring) via getAt(IntRange) or iterator()
  • [GROOVY-10672] - Provide a stream 'from' DGM method taking an IntRange
  • [GROOVY-10682] - Provide eachWithIndex for primitive arrays
  • [GROOVY-10687] - JEP 181: replace bridge methods with nest-based access control
  • [GROOVY-10845] - Add type checking for enum constant constructor call
  • [GROOVY-10855] - Meta-annotation retention policy and target *
  • [GROOVY-10879] - Potential additional DGM collectEntries variants
  • [GROOVY-10898] - Provide tail/init/head/first/last for primitive arrays
  • [GROOVY-10905] - Improve matching implicit arg closures to SAM types
  • [GROOVY-10909] - bytecode for in, !in, !() and ?:
  • [GROOVY-10916] - Provide min/max closure/comparator variants for primitive arrays
  • [GROOVY-10921] - Optimised variants for AGM#each
  • [GROOVY-10943] - Treat multiple underscores as placeholders in multi-assignment statements and closure/lambda parameters
  • [GROOVY-10949] - Add asBoolean for File and Path meaning the file or path exists
  • [GROOVY-10953] - Extend multi-assignment type checking to Range expressions
  • [GROOVY-10964] - List.minus() slow for Numbers *
  • [GROOVY-10993] - Produce and publish CycloneDX SBOM artifacts
  • [GROOVY-11039] - DGM every for primitive arrays
  • [GROOVY-11055] - Support lambda expression as named value
  • [GROOVY-11070] - ObjectArrayStaticTypesHelper does not handle negative indices
  • [GROOVY-11092] - STC: support coerced closure argument destructuring (for list and tuple)
  • [GROOVY-11145] - add a join() method for Iterable/List
  • [GROOVY-11146] - Support flattening of Optionals in flatten/flattenMany
  • [GROOVY-11156] - Groovy should no longer use MagicAccessorImpl from sun.reflect
  • [GROOVY-11167] - JsonOutput should handle Records like POGOs
  • [GROOVY-11181] - Improve STC error message for non-functional interface
  • [GROOVY-11184] - JSR308: improve support for explicit-this type annotations
  • [GROOVY-11186] - Support spread method arguments for iterable, iterator and stream
  • [GROOVY-11203] - IllegalArgumentException: null argument for primitive parameter
  • [GROOVY-11213] - indexOf extension method for arrays
  • [GROOVY-11225] - shouldFail return type
  • [GROOVY-11230] - ProxyGenerator creates a lot of AtomicReference instances regardless of "groovy.adapter.cache.default.size" setting
  • [GROOVY-11240] - Tweak cleanup DFA cache of parser
  • [GROOVY-11253] - Identity variants for DGM#countBy
  • [GROOVY-11255] - DGM#flatten flattens nested structures including arrays but not primitive arrays
  • [GROOVY-11260] - ASTMatcher should support matching a var-arg placeholder
  • [GROOVY-11262] - Avoid processing duplicated entries within META-INF
  • [GROOVY-11270] - Don't truncate argument types in MissingMethodException
  • [GROOVY-11272] - Generate `serialVersionUID` for each closure
  • [GROOVY-11289] - STC: error message for improper property initialization includes internal "<UnionType:"
  • [GROOVY-11295] - Optimise generated next() and previous() in enums
  • [GROOVY-11305] - STC: support for-each or for-in loop for implicitly-Iterable type
  • [GROOVY-11309] - Optimise bytecode for empty list expressions
  • [GROOVY-11342] - SQL enhancement to allow metadata access for execute
  • [GROOVY-11347] - Support JDK 23
  • [GROOVY-11351] - Add zip and columns extension methods
  • [GROOVY-11360] - Issue a warning when accessing static fields that are "shadowed" by get() methods
  • [GROOVY-11367] - property semantics of map-based types *
  • [GROOVY-11374] - MethodCallExpression getText() support for type arguments and dynamic selector
  • [GROOVY-11403] - property semantics of map-based types (pt.2) *
  • [GROOVY-11406] - Make Console.prefs public accessible
  • [GROOVY-11432] - Support method references/method pointers in annotations
  • [GROOVY-11443] - Support multiple Requires/Ensures/Invariant annotations in groovy-contracts
  • [GROOVY-11478] - Enable GroovyClassLoader to be ParallelCapable
  • [GROOVY-11491] - Add support for join and group by in ginq
  • [GROOVY-6022] - Static type checker should not register errors for ellipsis closure parameter annotated with @DelegatesTo
  • [GROOVY-6260] - "Possible solutions" message is confusing because it doesn't reflect whether a property is read-only or write-only
  • [GROOVY-6285] - Null safety: delegate constructor selection using static param types
  • [GROOVY-6925] - Cannot enable static type checking on a method where static compilation has been disabled
  • [GROOVY-7319] - Add primitive array min() and max()
  • [GROOVY-7919] - Unexpected behaviour of in operator on an Iterable
  • [GROOVY-8064] - Confusing error message when trying to access a property which is actually a method
  • [GROOVY-8299] - Generate bytecode for interface with default, private and static methods
  • [GROOVY-8411] - Support instanceof-like flow typing for class literal switch case
  • [GROOVY-8412] - Support !instanceof flow typing for else case
  • [GROOVY-8551] - Java compatibility: support multi-dimensional array initializers
  • [GROOVY-8566] - Array initialization from list literal without "as" should be supported under static compilation for multi-dimension arrays
  • [GROOVY-8591] - Consider additional target bytecode checks and/or simplification in some areas
  • [GROOVY-8859] - fix trait private method consistency
  • [GROOVY-9464] - GroovyDoc: List inherited properties

New Feature

  • [GROOVY-10942] - Add `extension` & `baseName` extension methods
  • [GROOVY-10980] - Provide an AST transform to rename operator methods
  • [GROOVY-11103] - Provide an ascii barchart method
  • [GROOVY-11127] - Add '|', '&', and '^' operators to Set and SortedSet
  • [GROOVY-11194] - groovyc missing features from the library compiler
  • [GROOVY-11238] - Logical implication operator revisited
  • [GROOVY-11252] - StringGroovyMethods should have a getCodePoints method
  • [GROOVY-11261] - Provide a custom type checker for format strings
  • [GROOVY-11306] - Provide left/right shift operators for BitSet
  • [GROOVY-4232] - Better support for CheckedCollections

Question

  • [GROOVY-10438] - DGM: getMetaPropertyValues and getProperties includes private entries

Sub-task

  • [GROOVY-10060] - Support private interface methods
  • [GROOVY-11118] - Initial JEP 445 compatibility
  • [GROOVY-11165] - JEP 445 compatibility additional functionality
  • [GROOVY-11237] - Support static interface methods
  • [GROOVY-2433] - Closure in base class unable to call private methods when invoked from derived class
  • [GROOVY-3073] - Private inheritance bug: Closure accessing private method
  • [GROOVY-5438] - Private field inaccessible in closure when using a subclass

Task

  • [GROOVY-11164] - Mark main/run methods in scripts as @Generated
  • [GROOVY-11197] - Support JDK 22
  • [GROOVY-11330] - Remove experimental AGM @Incubating methods now that selection by parameter count is improved

Wish

  • [GROOVY-10931] - Remove $getLookup method generation (Groovy 4+) *
  • [GROOVY-11314] - JsonOutput Pretty Print always escapes characters

* potentially breaking change (read issue for details - even minor differences are sometimes flagged as potentially breaking changes)