Issue Details (XML | Word | Printable)

Key: GROOVY-3255
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Paul King
Reporter: Jochen Theodorou
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
groovy
GROOVY-3254

ClassNode:306

Created: 05/Jan/09 07:25 AM   Updated: 15/Oct/09 05:17 PM   Resolved: 19/Jun/09 06:19 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.7-beta-1

Time Tracking:
Not Specified

File Attachments: 1. Text File groovy-3255.patch (2 kB)



 Description  « Hide

ClassNode:306 has

if ((modifiers & ACC_INTERFACE) == 0)
          addField("$ownClass", ACC_STATIC|ACC_PUBLIC|ACC_FINAL, ClassHelper.CLASS_Type, new ClassExpression(this)).setSynthetic(true);

        transformInstances = new EnumMap<CompilePhase, Map<Class <? extends ASTTransformation>, Set<ASTNode>>>(CompilePhase.class);
        for (CompilePhase phase : CompilePhase.values()) {
            transformInstances.put(phase, new HashMap<Class <? extends ASTTransformation>, Set<ASTNode>>());
        }
which should be moved somewhere else. The "$ownclass" probably into verifier and the for transformInstances (moved to GROOVY-3588) we need to find a good place. At last there is no sense in addeding these instances to a ClassNode, that is no primary class node. The code above is for example executed for each class creation in ClassHelper, which looks very surplus



René de Bloois added a comment - 08/Mar/09 10:36 AM

Added in rev 10389, I think $ownClass is not really needed.

I attached a patch which removes it.


Paul King added a comment - 19/Jun/09 06:34 AM

Jochen, any thoughts on this patch?


Jochen Theodorou added a comment - 19/Jun/09 06:51 AM

it is a partial solution, since it does not move out the transform code. maybe we should make two sub tasks, one for the transform code and one for the $ownclass code. Now the patch removes the usage of this field totally. On first glance this seems to be a valid change. So I approve of the patch


Paul King added a comment - 19/Jun/09 07:34 AM

Just on trunk right - not 1_6_X.


Paul King added a comment - 19/Jun/09 06:19 PM

Assuming just for trunk. Thanks for the patch René.


René de Bloois added a comment - 29/Jun/09 05:48 AM

You're welcome.