Daniel Sun created GROOVY-12808:
-----------------------------------
Summary: STC: @TypeChecked wrapping @CompileStatic still does not
compose type-checking extensions
Key: GROOVY-12808
URL: https://issues.apache.org/jira/browse/GROOVY-12808
Project: Groovy
Issue Type: Bug
Components: Static compilation, Static Type Checker
Reporter: Daniel Sun
GROOVY-10770 (Closed/Fixed in 5.0.0-alpha-1) made nested `@CompileStatic` /
`@TypeChecked` annotations compose their type-checking extensions. On master
`ca71425976fd2e3da6db9634955ba0d39550a6d4`, three combinations already pass,
but the mixed case of an outer `@TypeChecked(extensions=...)` class with an
inner `@CompileStatic(extensions=...)` class is still marked
`@NotYetImplemented`.
The skipped test, `bugs.Groovy10770#testExtensions4` in
`src/test/groovy/bugs/Groovy10770.groovy`, expects the same forbidden-access
diagnostic that the two `@CompileStatic`-outer cases already produce (`Access
to java.lang.String#baz is forbidden`). The original ticket even noted that
nesting `@CompileStatic` inside `@TypeChecked` (and vice versa) might still be
incomplete.
Re-checked on 22 Nov 2026 (Asia/Taipei) at the same SHA by temporarily removing
@NotYetImplemented and running the test on JDK 17: it still fails. Compilation
produced STC "[Static type checking] - No such property: baz for class:
java.lang.String" at bar.baz, not the expected "Access to java.lang.String#baz
is forbidden" diagnostic. The @TypeChecked / @CompileStatic type-checking
extensions still do not compose in this mixed nesting.
**Acceptance criterion:** Enable `testExtensions4` so that this combination
applies both extensions and produces the expected diagnostic, then remove
`@NotYetImplemented`.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)