You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/12/03 20:52:00 UTC
[jira] [Resolved] (GROOVY-9884) groovy3: setProperty does not work in sub classes
[ https://issues.apache.org/jira/browse/GROOVY-9884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-9884.
---------------------------------
Fix Version/s: 4.0.0-rc-2
Resolution: Fixed
https://github.com/apache/groovy/commit/a63ee5e26023dd22db81834d7134053bd566f441
> groovy3: setProperty does not work in sub classes
> -------------------------------------------------
>
> Key: GROOVY-9884
> URL: https://issues.apache.org/jira/browse/GROOVY-9884
> Project: Groovy
> Issue Type: Bug
> Reporter: Howard
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-rc-2
>
>
> The following code runs in groovy2, but not 3
> {code:java}
> class A {
> def a = "a";
> }
> class B extends A {
>
> }
> class C extends B {
> void setProperty(String name, Object value) {
> super.setProperty(name, value);
> }
> }
> def newC = new C();
> newC.setProperty("a", "b");
> newC.a
> {code}
> groovy 3 output:
> {code}
> groovy.lang.MissingMethodException: No signature of method: B.setProperty() is applicable for argument types: (String, String) values: [a, b]
> Possible solutions: hasProperty(java.lang.String), getProperties()
> at C.setProperty(ConsoleScript10:11)
> at ConsoleScript10.run(ConsoleScript10:16)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)