[
https://issues.apache.org/jira/browse/GROOVY-10922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-10922:
------------------------------------
Assignee: Eric Milles
> stack overflow calling implicit getter/setter from override
> -----------------------------------------------------------
>
> Key: GROOVY-10922
> URL: https://issues.apache.org/jira/browse/GROOVY-10922
> Project: Groovy
> Issue Type: Bug
> Components: Compiler, Static compilation
> Affects Versions: 2.5.19, 3.0.14, 2.5.20, 2.5.21
> Reporter: Jason Garrett
> Assignee: Eric Milles
> Priority: Major
> Labels: StackOverflowError
>
> In the following situation, under static compilation:
> * An interface declares a getter and/or setter
> * An implementing class declares a property of the corresponding name and
> type, so the implicit getter and/or setter implement the interface
> * A subclass overrides the getter/setter and calls the super getter/setter
> the subclass getter/setter will recurse instead of calling the superclass
> implicit method.
> This appears to have been introduced in 3.0.14.
> Running the main method in this example will reproduce the stack overflow.
> {code:java}
> package example
> import groovy.transform.CompileStatic
> @CompileStatic
> class SuperImplicitSetter {
> interface FooHaving {
> String getFoo()
> void setFoo(String foo)
> }
> static class Foo implements FooHaving {
> String foo // implements interface
> }
> static class Bar extends Foo {
> String bar
> @Override
> void setFoo(String foo) {
> super.setFoo(foo) // recurses instead of calling implicit
> Foo.setFoo(String)
> bar = foo
> }
> }
> static void main(String[] args) {
> Bar bar = new Bar()
> bar.setFoo("bar") // stack overflow
> println bar.foo
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)