Skip to content
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

[BUG] java.lang.StackOverflowError when method has more then 500 lines of code #2453

Closed
djogss opened this issue May 6, 2020 · 5 comments
Closed

Comments

@djogss
Copy link

djogss commented May 6, 2020

Describe the bug
Produce the java.lang.StackOverflowError if codebase contains the method longer than 500 lines

To Reproduce
Please see repository on github with instructions:
https://github.com/djogss/lombok-issue

Expected behavior
Code compiles without any issue

Version info (please complete the following information):

  • Lombok version: 1.18.12
  • Java version:
 openjdk version "15-ea" 2020-09-15
 OpenJDK Runtime Environment (build 15-ea+21-975)
 OpenJDK 64-Bit Server VM (build 15-ea+21-975, mixed mode, sharing)

The same happens on java 8 as well.

@Rawi01
Copy link
Collaborator

Rawi01 commented May 6, 2020

Stacktrace:

Caused by: java.lang.StackOverflowError
        at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:384)
        at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
        at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
        at lombok.core.AST.buildWithField0(AST.java:394)
        at lombok.core.AST.buildWithField(AST.java:292)
        at lombok.javac.JavacAST.drill(JavacAST.java:421)
        at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:387)
        at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
        at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
        at lombok.core.AST.buildWithField0(AST.java:394)
        at lombok.core.AST.buildWithField(AST.java:292)
        at lombok.javac.JavacAST.drill(JavacAST.java:421)
        at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:387)
        ...

The problem is the really long chained method call. As a workaround you can split it up into multiple shorter chains.

@randakar
Copy link

randakar commented May 8, 2020 via email

@MichelMunoz
Copy link

MichelMunoz commented Oct 2, 2020

Reproduced on linux, with eclipse, on edge and 1.18.12, when doing a gradle clean/build
And it get worse : this happens even if the code does not use lombok annotations at all ; the project is configured to use lombok, but the code - only one file, see below - doesn't use any annotation or lombok stuff ; on 1.18.12 it produces a:

Caused by: java.lang.StackOverflowError
	at lombok.core.AST.fieldsOf(AST.java:234)
	at lombok.javac.JavacAST.drill(JavacAST.java:421)
	at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:387)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
	at lombok.core.AST.buildWithField0(AST.java:394)
	at lombok.core.AST.buildWithField(AST.java:292)
	at lombok.javac.JavacAST.drill(JavacAST.java:421)
	at lombok.javac.JavacAST.buildStatementOrExpression(JavacAST.java:387)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:196)
	at lombok.javac.JavacAST.buildTree(JavacAST.java:1)
	at lombok.core.AST.buildWithField0(AST.java:394)
	at lombok.core.AST.buildWithField(AST.java:292)
	at lombok.javac.JavacAST.drill(JavacAST.java:421)
        ...

similar (but not identical) to the one listed by @Rawi01

FxPalettes.java.zip
The source just uses a builder-type construction of a color palette, but I imagine it can be generalized to any non-lombok using class with long chained calls of size at least 500.

@MichelMunoz
Copy link

I've made an even simpler, minimal, reproduction of the problem, can be used for unit test or something. Just some class that initializes a static field with a long chained call.
MinimalReproductionOfProblem.java.zip

@rspilker
Copy link
Collaborator

I'm closing all duplicates of #1118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants