Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8184750

Adding final modifier to a string variable causes stack overflow error

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac 10.12.4

      A DESCRIPTION OF THE PROBLEM :
      adding final modifier to a string variable causes stack overflow error.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Information:java: The system is out of resources.
      Information:java: Consult the following stack trace for details.
      Information:java: at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2296)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1624)
      Information:java: at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:576)
      Information:java: at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2435)
      Information:java: Errors occurred while compiling module 'server'
      Information:javac 1.8.0_121 was used to compile java sources
      Information:7/14/17, 6:29 PM - Compilation completed with 45 errors and 100 warnings in 5s 804ms
      Error:java: java.lang.StackOverflowError

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      private static final String UPDATE_PERMISSIONS_LIST = "Test " + String.join(",", Stream.of(test.values())
            .map(perm -> perm.name() + "=?").collect(Collectors.toList())) ;


      public enum test {
          one,
          two,
          three
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      // not using final fixes.

      private static String UPDATE_PERMISSIONS_LIST = "Test " + String.join(",", Stream.of(test.values())
            .map(perm -> perm.name() + "=?").collect(Collectors.toList())) ;

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fmatte Fairoz Matte
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: