You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Theodorou (Jira)" <ji...@apache.org> on 2023/08/18 12:39:00 UTC

[jira] [Commented] (GROOVY-11159) ClassNode: separate type definition information

    [ https://issues.apache.org/jira/browse/GROOVY-11159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17755952#comment-17755952 ] 

Jochen Theodorou commented on GROOVY-11159:
-------------------------------------------

I  would do for example TypeReference, ClassNode and maybe something like ResolvedClass. in class A extends B, A would become a ClassNode with all the fields and methods, B would be a TypeReference maybe to be resolved by the compiler. If B is backed by a to be compiled class, it points to a ClassNode, otherwise it would point to a ResolvedClass. And maybe I would even have another class you can use to get all the fields and methods from, which you get from ResolvedClass and maybe also ClassNode. Then we could move the lazy init to that part.... Of course ClassNode would not need the lazy init anymore in this scenario.

Well, just an idea. and of course it will break about every transform there is.

> ClassNode: separate type definition information
> -----------------------------------------------
>
>                 Key: GROOVY-11159
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11159
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Eric Milles
>            Priority: Minor
>
> ClassNode is used to represent type definitions as well as type references.  There are a lot of data members that apply only to type definitions.  However, every reference pays the cost.  ClassNode could have a single reference to another class (essentially a struct) that holds all the definition information.  With this, type references would only have one reference (initialized to null) instead of all those fields.
> Fields:
> * modifiers
> * syntheticPublic
> * superClass
> * interfaces
> * mixins
> * objectInitializers
> * constructors
> * methods
> * methodsList
> * fields
> * properties
> * fieldIndex
> * module
> * compileUnit
> * staticClass
> * scriptBody
> * script
> * innerClasses
> * transformInstances?
> * lazyInitDone
> * lazyInitLock
> * clazz
> * permittedSubclasses
> * recordComponents



--
This message was sent by Atlassian Jira
(v8.20.10#820010)