Commit 649d7bb
committed
fix(gsp): resolve g.taglib STC calls when the GSP page inherits getProperty (GROOVY-12041)
GroovyPageTypeCheckingExtension recorded the taglib-namespace receiver (e.g. `g`)
in unresolvedVariable / unresolvedProperty and matched it back by AST node
identity in methodNotFound. On Groovy 5, when the compiled GSP page inherits
getProperty(String) from its base class, those callbacks no longer fire for the
namespace, so the receiver is never recorded and `g.message(...)` is rejected by
@CompileStatic with "Cannot find matching method java.lang.Object#message(...)".
Per GROOVY-12041, match the call receiver by name against the allowed taglib
namespaces in methodNotFound, independently of whether the earlier callback
fired. This is resilient to the getProperty(String) short-circuit and does not
rely on node identity. Re-enables the previously @IgnoreIf-skipped g.* prefix
cases in GspCompileStaticSpec on Groovy 5.
Standalone reproducer (matrix across 4.0.31 / 5.0.6 / 5.0.7-SNAPSHOT / 6.0.0-SNAPSHOT):
https://github.com/jamesfredley/groovy5-stc-extension-node-identity-bug
Verified: grails-gsp-core test on 5.0.7-SNAPSHOT - 21 passed, 0 failed, 2 skipped
(the 2 skips are an unrelated undeclared-variable concern, left as-is).
Assisted-by: claude-code:claude-4.8-opus1 parent 68fe246 commit 649d7bb
2 files changed
Lines changed: 23 additions & 7 deletions
File tree
- grails-gsp/core/src
- main/groovy/org/grails/gsp/compiler
- test/groovy/org/grails/gsp
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
73 | 95 | | |
74 | 96 | | |
75 | 97 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | 96 | | |
101 | 97 | | |
102 | 98 | | |
| |||
108 | 104 | | |
109 | 105 | | |
110 | 106 | | |
111 | | - | |
112 | 107 | | |
113 | 108 | | |
114 | 109 | | |
| |||
124 | 119 | | |
125 | 120 | | |
126 | 121 | | |
127 | | - | |
128 | 122 | | |
129 | 123 | | |
130 | 124 | | |
| |||
0 commit comments