java.lang.StackOverflowError in Lowering
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jun 22 08:50:40 PDT 2011
Hi Ali,
the bug is not in lower but is actually in attribution - the enclosing
type of the innermost lambda is not set properly; which causes the loop
in the desugaring phase. I will fix this in my next push.
Maurizio
On 22/06/11 15:26, Ali Ebrahimi wrote:
> Hi Maurizio,
> I'm working on converting statefull lambdas to stateless ones and
> discovered following StackOverflowError error.
>
> Test case:
> class Test{
> static class D {
>
> int[] grandTotal = {0}; //******************************
> public void foo() {
>
> MList<Department> departments = new MList.MListImpl<>();
>
> MList<Employee> employees = new MList.MListImpl<>();
>
> departments.forEach( #{Department d ->
> int[] deptTotal = {0};
> employees.filter(#{Employee e -> e.dept == d
> }).forEach(#{Employee e ->
> deptTotal[0] += e.salary;
> grandTotal[0] += e.salary;
> });
> System.out.printf("Total for dept %s = %d \n",
> d.name <http://d.name>, deptTotal[0]);
> });
> System.out.printf("Grant total = %d \n", grandTotal[0]);
> }
> }
>
> Error Report:
>
> Information:The system is out of resources.
> Information:Consult the following stack trace for details.
> Information:java.lang.StackOverflowError
> Information: at
> com.sun.tools.javac.code.Symbol$ClassSymbol.isSubClass(Symbol.java:802)
> Information: at
> com.sun.tools.javac.code.Symbol.isMemberOf(Symbol.java:322)
> Information: at com.sun.tools.javac.comp.Lower.access(Lower.java:1138)
> Information: at com.sun.tools.javac.comp.Lower.access(Lower.java:1189)
> Information: at
> com.sun.tools.javac.comp.Lower.makeOwnerThisN(Lower.java:1720)
> Information: at
> com.sun.tools.javac.comp.Lower.makeOwnerThis(Lower.java:1704)
> Information: at
> com.sun.tools.javac.comp.Lower.accessBase(Lower.java:1013)
> Information: at com.sun.tools.javac.comp.Lower.access(Lower.java:1175)
> Information:Compilation completed with 1 error and 0 warnings
> Information:1 error
> Information:0 warnings
> Error:Compiler internal error. Process terminated with exit code 3
>
> One Note:
> if you move "int[] grandTotal = {0};" into foo method, the error goes
> away.
>
> Best Regards,
> Ali Ebrahimi
More information about the lambda-dev
mailing list