java.lang.StackOverflowError in Lowering
Ali Ebrahimi
ali.ebrahimi1781 at gmail.com
Wed Jun 22 07:26:38 PDT 2011
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, 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