java.lang.StackOverflowError in Lowering
Ali Ebrahimi
ali.ebrahimi1781 at gmail.com
Wed Jun 22 07:45:34 PDT 2011
Oh, I know this is out of scope.
Ali Ebrahimi
On Wed, Jun 22, 2011 at 6:01 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> And for using the one-element-array trick to work around the mutable
> capture restriction, your license to code in Java has been permanently
> revoked. Please turn in your keyboard, and security will escort you out of
> the building.
>
>
> On 6/22/2011 10:26 AM, 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, 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