The GitHub Actions job "Code Style" on grails-core.git/grails8-groovy6-canary 
has failed.
Run started by GitHub user jamesfredley (triggered by jamesfredley).

Head commit for run:
4a518983a2ab20230c12f5da07dbaa6b337b9113 / James Fredley <[email protected]>
fix: workaround Groovy 6 stub generator regression in HibernateSettings

Apache Groovy 6.0.0-SNAPSHOT build #546 (and onward, until upstream
fixes it) regresses the Java stub generator: when @AutoClone is applied
to a class that extends a JDK type whose clone() override drops the
`throws CloneNotSupportedException` clause (LinkedHashMap.clone() is
the canonical example), the generated stub still emits

  @groovy.transform.Generated() public ... HibernateSettings clone()
      throws java.lang.CloneNotSupportedException { return null; }

and javac rejects it because the parent LinkedHashMap.clone() doesn't
declare that exception. CI was failing the entire 'Core Projects' job
on grails-data-hibernate5-core:compileGroovy with:

  HibernateConnectionSourceSettings.java:89: error:
    clone() in HibernateSettings cannot override clone() in HashMap
    overridden method does not throw CloneNotSupportedException

The fix is to define clone() explicitly. @AutoClone short-circuits its
own clone() generation when the user already provides one, so the stub
generator emits a stub matching this user-defined no-throws signature.
Tested @AutoClone(style = COPY_CONSTRUCTOR) first - same stub still
emitted, confirming the regression is in the stub generator and is
independent of the @AutoClone style.

The body mirrors what @AutoClone(style = CLONE) used to produce - a
shallow LinkedHashMap.clone() followed by deep-cloning of the Cloneable
typed fields (osiv, cache, flush, additionalProperties) - so multi-tenant
settings cloning in HibernateDatastore.createTenantConnectionSource
(line 597, getSettings().clone()) keeps the same isolation properties
it had on Groovy 5 and earlier Groovy 6 snapshots.

Verified locally on Java 21 / Groovy 6.0.0-SNAPSHOT build #546:
  ./gradlew :grails-data-hibernate5-core:compileGroovy --rerun-tasks
    -> BUILD SUCCESSFUL
  ./gradlew :grails-data-hibernate5-core:codeStyle
    -> BUILD SUCCESSFUL
  ./gradlew :grails-data-hibernate5-core:test --tests \
      
'org.grails.orm.hibernate.connections.HibernateConnectionSourceSettingsSpec'
    -> 1 tests, 1 successes, 0 failures

This is a separate Groovy 6 regression, not caused by the workaround
removals in 2a5e983555. Confirmed by stashing those removals and
reproducing the same failure on the unmodified merge state. Filing
upstream against apache/groovy is the next step; revert this commit
once the stub-generator fix lands and a fresh snapshot publishes.

Report URL: https://github.com/apache/grails-core/actions/runs/25252610702

With regards,
GitHub Actions via GitBox

Reply via email to