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

Very long method resolution causing OOM error

XMLWordPrintable

    • b134
    • unknown
    • generic
    • Verified

        Javac hangs while compiling the following program:


        package pkg196134;

        public class Main {

            public static void main(String[] args) {
                Obj o = null;
                o.test(0, 0, 0, 0, 0, 0, 0, 0, undefined);
            }
        }

        interface Test {
            public void test(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, String str);
            public void test(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, long l);
        }

        interface Obj extends Test, A, B, C, D, E {}
        interface A extends Test {}
        interface B extends A, Test {}
        interface C extends A, B, Test {}
        interface D extends A, B, C, Test {}
        interface E extends A, B, C, D, Test {}


        Compilation eventually fails with the following stack trace:

        The system is out of resources.
        Consult the following stack trace for details.
        java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOfRange(Arrays.java:2694)
        at java.lang.String.<init>(String.java:234)
        at java.lang.StringBuilder.toString(StringBuilder.java:405)
        at com.sun.tools.javac.util.JCDiagnostic$Factory.qualify(JCDiagnostic.java:234)
        at com.sun.tools.javac.util.JCDiagnostic$Factory.create(JCDiagnostic.java:230)
        at com.sun.tools.javac.util.JCDiagnostic$Factory.fragment(JCDiagnostic.java:200)
        at com.sun.tools.javac.comp.Resolve$InapplicableMethodException.setMessage(Resolve.java:496)
        at com.sun.tools.javac.comp.Resolve.checkRawArgumentsAcceptable(Resolve.java:444)
        at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:389)
        at com.sun.tools.javac.comp.Resolve.instantiate(Resolve.java:405)
        at com.sun.tools.javac.comp.Resolve.signatureMoreSpecific(Resolve.java:820)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:727)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:803)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)
        at com.sun.tools.javac.comp.Resolve.mostSpecific(Resolve.java:802)

              mcimadamore Maurizio Cimadamore
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: