Project

General

Profile

Actions

bug #6404

closed

StackOverflow when compiling large java classes in Java8 (jdk1.8)

Added by Patrick Plitzner about 7 years ago. Updated about 7 years ago.

Status:
Rejected
Priority:
Highest
Assignee:
Patrick Plitzner
Category:
platform
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Severity:
normal
Found in Version:
Tags:

Description

After updating to Java 8 compiling via mvn clean install results in a StackOverflow. (compiling in Eclipse works because it uses its own javac)

This can happen because of very large java files (MarkupTransformer.java in this case)

This can be solved by increasing the stack size for the maven compile process in the pom.xml (You have to update the maven-compiler-plugin to use the arguments)

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version> 
        <configuration>
          <source>${java.codelevel}</source>
          <target>${java.codelevel}</target>
          <!-- fork has to be true to allow to set the compile args -->
          <fork>true</fork>
          <compilerArgs>
            <arg>-J-Xss4M</arg><!-- Increase stack size to avoid StackOverflow during parsing of large java classes-->
          </compilerArgs>
        </configuration>
      </plugin>

We anyway decided to split up the MarkupTransformer class in order to have no customized settings for the maven-compiler-plugin.

stacktrace:

The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
        at com.sun.tools.javac.parser.JavaTokenizer.readToken(JavaTokenizer.java:566)
        at com.sun.tools.javac.parser.Scanner.nextToken(Scanner.java:115)
        at com.sun.tools.javac.parser.JavacParser.nextToken(JavacParser.java:301)
        at com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:759)
        at com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:659)
        at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1196)
        at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:909)
        at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:880)
        at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:836)
        at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:816)
        at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:779)
        at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1818)
        at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1833)
        at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1294)
        at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:909)
        at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:880)
        at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:836)
        at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:816)
        at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:779)
        at com.sun.tools.javac.parser.JavacParser.parExpression(JavacParser.java:2299)
        at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2483)
        at com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2391)
        at com.sun.tools.javac.parser.JavacParser.parseStatementAsBlock(JavacParser.java:2356)
        at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2488)
        at com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2391)
        at com.sun.tools.javac.parser.JavacParser.parseStatementAsBlock(JavacParser.java:2356)
        at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2488)
        at com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2391)
        at com.sun.tools.javac.parser.JavacParser.parseStatementAsBlock(JavacParser.java:2356)
        at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2488)
        at com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2391)


Related issues

Related to EDIT - task #6401: Update working environment to jdk 1.8ClosedPatrick Plitzner

Actions
Related to EDIT - bug #6406: Refactor MarkupTransformer class which is too largeIn ProgressAndreas Müller

Actions
Related to EDIT - bug #6407: Upgrade maven compiler plugin to latest versionNewAndreas Müller

Actions
Actions #1

Updated by Patrick Plitzner about 7 years ago

  • Related to task #6401: Update working environment to jdk 1.8 added
Actions #2

Updated by Patrick Plitzner about 7 years ago

  • Status changed from New to Closed

Andreas M.: Can you link the ticket for the MarkupTransformer class to this ticket?

Actions #3

Updated by Andreas Müller about 7 years ago

  • Related to bug #6406: Refactor MarkupTransformer class which is too large added
Actions #4

Updated by Andreas Müller about 7 years ago

  • Status changed from Closed to Rejected

We decided to NOT use the compilerArgs but rather try to fix the large class issue #6406.

Also the above compilerArgs don't work with maven compiler plugin <3.x but currently we still can't upgrade (blocked by #6407)

Actions #5

Updated by Andreas Müller about 7 years ago

  • Related to bug #6407: Upgrade maven compiler plugin to latest version added
Actions #6

Updated by Andreas Müller about 7 years ago

@PP: if you still if the old version of the compilerArgs, could you please add them to the ticket?

Actions #7

Updated by Andreas Müller about 7 years ago

  • Priority changed from New to Highest
Actions #8

Updated by Andreas Müller about 7 years ago

  • Target version deleted (Release 4.6)
Actions

Also available in: Atom PDF