Daniel Sun created GROOVY-11292: ----------------------------------- Summary: Class without sealed parent cannot be non-sealed Key: GROOVY-11292 URL: https://issues.apache.org/jira/browse/GROOVY-11292 Project: Groovy Issue Type: Improvement Reporter: Daniel Sun
Java 21 has more strict check for {{non-sealed}} classes, i.e. class cannot be non-sealed if it has no sealed parent. We have to align with check rule of Java 21, and declare class {{non-sealed}} by default if and only if it has {{sealed}} parent. Before the proposed improvement, {{TestReference}} will be declared {{non-sealed}} by default, but its parent {{SoftReference}} is {{non-sealed}} and {{SoftReference}}'s parent {{Reference}} is {{sealed}}, so Java 21 will emit the following error: {code:java} startup failed: /home/daniel/IdeaProjects/groovy/src/test/org/codehaus/groovy/util/ReferenceManagerTest.groovy: 147: The class 'org.codehaus.groovy.util.ReferenceManagerTest$TestReference' cannot be non-sealed as it has no sealed parent. @ line 147, column 13. private class TestReference<T> ^ 1 error > Task :compileTestGroovy FAILED {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)