Marinell / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

J2me build fails #472

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
J2me build now fails when a funtion has a vector paramater (and maybe other 
containers) and in the function body exists an anonymous class object 
initialization.
Took me a few hours and alot of builds to catch this extreamly strange (new?) 
bug.
The error on the build log indicate that it cant find the enclosed method... 

What steps will reproduce the problem?
1. create a new project
2. add a new method that has a vector arguement
3. add an anonymous class new object initialization in the above method and 
call it from the start method
4. send j2me build to server.

What is the expected output? What do you see instead?
build should be completed successfully, instead build fails because it is 
unable to find the new method.

What version of the product are you using? On what operating system?
eclipse, win7, cn1 plugin 201210220011

Original issue reported on code.google.com by s...@the-futuresoft.com on 7 Jan 2013 at 3:29

GoogleCodeExporter commented 9 years ago
That's not a new issue and has been around for a while. Its related to the Java 
5 translation with anonymous inner method classes referencing method 
parameters. We tried to fix this but the bytecode stuff there is pretty hairy. 
The workaround is rather simple, just assign the value to a final Object 
reference the object from the inner class and downcast to the type you really 
need. Yes it sucks which is why I'm leaving this issue open but I'm not 
optimistic about fixing it since I think its a bug in ASM.   

Original comment by shai.almog on 7 Jan 2013 at 6:22

GoogleCodeExporter commented 9 years ago
I already fixed it like that but thats extreamly ugly and undocumented it took 
me a couple of hours to find it, i dont think normal users can cope with that.

Original comment by s...@the-futuresoft.com on 7 Jan 2013 at 6:44