New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GROOVY-9618: index "static getX()" as "X" if class field X also exists #1296
Conversation
// one meta-property "X" class C { static private X static getX() } // one meta-property "x" class C { static private x static getX() } // one meta-property "x" and one meta-field "X" class C { static private x, X static getX() } // one class meta-property "X" and one instance meta-field "x" class C { static private X static getX() private x }
An alternative would be to dual index "static getX()" as "x" and "X". |
Merged. Thanks. |
I think I might roll this back for the time being. Sorry for not getting time to review earlier. For this script:
In 3.0.4 we get:
But after this breaking change we get:
To me this is an edge case from the JavaBean spec which isn't clear. I am not necessarily against some kind of change here and the dual index idea might be close to what we need, but the above is inconsistent as well as likely to break some existing code. |
@paulk-asert Good catch! We should avoid breaking existing code as possible as we could. |
We have different behavior (similar to after the proposed change) with static Groovy. Adding the necessary @CompileStatic annotations gives, with 3.0.4:
but with 3.0.5-SNAPSHOT with this change we have the subtly different:
I suspect the GCE/CCE is an orthogonal issue to this change, but we have work to do to improve consistency regardless. |
I'll have a go at the dual index idea, and aligning static/instance behavior first and if I can't get that to work I will rollback. |
…so exists" See the discussion: #1296
@paulk-asert I rolled back the change for now. |
PR#1316 now covers this case. |
https://issues.apache.org/jira/browse/GROOVY-9618