Changelog for Groovy 5.0.0-unreleased

Bug

  • [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-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-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-11284] - Generated size() method on records performs unnecessary boxing
  • [GROOVY-11285] - Generated toList() and toMap() methods on records perform unnecessary wrapping
  • [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-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-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-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-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-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-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-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-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-11039] - DGM every for primitive arrays
  • [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-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-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-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)