|
[
Permalink
| « Hide
]
René de Bloois added a comment - 22/Dec/07 12:20 PM
Forgot to attach the test project
I haven't looked at your test project so far, but are you able to retrieve four different Closure classes through reflection?
Decompiler have to generate some Java source code, but don't necessarily reflect 100% the reality. Looking at the time of day (or night
In the attached java file I added the constructor twice, once without bytecode, once with the bytecodes. So you can look at the bytecodes too. Furthermore, after compiling, I get 4 closure classes on the filesystem: Test1$_closure1.class Jochen, can you double-check this?
I verified it and part 1 and 2 of this issue are solved now. Although minor, part 3 still exists:
Class class1 = Test1.class$0 == null ? ( Test1.class$0 = Test1.class$( "app.Test1" ) ) : Test1.class$0; Class class2 = Test1.class$groovy$lang$MetaClass == null ? ( Test1.class$groovy$lang$MetaClass = Test1.class$( "groovy.lang.MetaClass" ) ) : Test1.class$groovy$lang$MetaClass; But most of the time class2 is not used, and half of the time class1 is not used. In generated getters and setters they are never used. For each call to a groovy method you get unused executions of: getstatic app.Test1.class$0 ifnonnull ... getstatic app.Test1.class$0 dup astore_1 pop ('dup' and 'pop' are questionable by itself) But, we can also wait till java 1.4 is dropped (when is that?). This issue is partially fixed in beta1 for simple getter and setter. In general you still have the class prelude in many cases where you don't need need it. But that is not really a bug. Also removing that requires a reachability test in the compiler for bytecode variables... This improvement will come, but not soon.
|
|||||||||||||||||||||||||||||||||||||||||||||||||