You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Andres Luuk (Jira)" <ji...@apache.org> on 2022/07/20 06:30:00 UTC
[jira] [Created] (GROOVY-10695) StackOverflowError when calling a static method.
Andres Luuk created GROOVY-10695:
------------------------------------
Summary: StackOverflowError when calling a static method.
Key: GROOVY-10695
URL: https://issues.apache.org/jira/browse/GROOVY-10695
Project: Groovy
Issue Type: Bug
Affects Versions: 3.0.11
Reporter: Andres Luuk
I tryed it on all 3.x versions (didn't try 2.x). Found it from Grails code but extracted it as an example
{code:java}
package test;
public class Environment {
public static Throwable currentReloadError = null
static void setCurrentReloadError(Throwable currentReloadError) {
Environment.currentReloadError = currentReloadError
}
static Throwable getCurrentReloadError() {
return currentReloadError
}
}
{code}
Now when I call the setter:
{code:java}
Environment.setCurrentReloadError(null);{code}
I get a StackOverflowError.
I decompiled the class and the code is compiled into:
{code:java}
public static void setCurrentReloadError(Throwable currentReloadError) {
Throwable throwable = currentReloadError;
ScriptBytecodeAdapter.setProperty(throwable, null, Environment.class, "currentReloadError");
}{code}
The cause seems to be that it finds the same setter and this causes the circularity.
If I remove the (Environment.) from the original code then it works.
The cause s
--
This message was sent by Atlassian Jira
(v8.20.10#820010)