19
19
import static org .codehaus .groovy .ast .tools .GenericsUtils .parseClassNodesFromString ;
20
20
import static org .codehaus .groovy .transform .stc .StaticTypeCheckingSupport .evaluateExpression ;
21
21
22
- import java .beans .Introspector ;
23
22
import java .io .DataInputStream ;
24
23
import java .io .DataOutputStream ;
25
24
import java .io .File ;
61
60
import org .codehaus .groovy .ast .MethodNode ;
62
61
import org .codehaus .groovy .ast .ModuleNode ;
63
62
import org .codehaus .groovy .ast .Parameter ;
64
- import org .codehaus .groovy .ast .PropertyNode ;
65
63
import org .codehaus .groovy .ast .Variable ;
66
64
import org .codehaus .groovy .ast .expr .BinaryExpression ;
67
65
import org .codehaus .groovy .ast .expr .ClassExpression ;
@@ -97,10 +95,10 @@ public class VariableScope implements Iterable<VariableScope.VariableInfo> {
97
95
public static final ClassNode VOID_CLASS_NODE = ClassHelper .VOID_TYPE ; // void.class
98
96
public static final ClassNode VOID_WRAPPER_CLASS_NODE = ClassHelper .void_WRAPPER_TYPE ; // Void.class
99
97
98
+ public static final ClassNode CLASS_CLASS_NODE = ClassHelper .CLASS_Type ;
100
99
public static final ClassNode OBJECT_CLASS_NODE = ClassHelper .OBJECT_TYPE ;
101
100
public static final ClassNode GROOVY_OBJECT_CLASS_NODE = ClassHelper .GROOVY_OBJECT_TYPE ;
102
101
public static final ClassNode GROOVY_SUPPORT_CLASS_NODE = ClassHelper .GROOVY_OBJECT_SUPPORT_TYPE ;
103
- public static final ClassNode CLOSURE_CLASS_NODE = ClassHelper .CLOSURE_TYPE ;
104
102
public static final ClassNode ENUMERATION_CLASS_NODE = ClassHelper .make (Enumeration .class );
105
103
public static final ClassNode COLLECTION_CLASS_NODE = ClassHelper .make (Collection .class );
106
104
public static final ClassNode ITERABLE_CLASS_NODE = ClassHelper .make (Iterable .class );
@@ -110,11 +108,12 @@ public class VariableScope implements Iterable<VariableScope.VariableInfo> {
110
108
public static final ClassNode ENTRY_CLASS_NODE = ClassHelper .make (Map .Entry .class );
111
109
public static final ClassNode RANGE_CLASS_NODE = ClassHelper .RANGE_TYPE ;
112
110
public static final ClassNode TUPLE_CLASS_NODE = ClassHelper .make (Tuple .class );
113
- public static final ClassNode STRING_CLASS_NODE = ClassHelper .STRING_TYPE ;
114
- public static final ClassNode GSTRING_CLASS_NODE = ClassHelper .GSTRING_TYPE ;
115
- public static final ClassNode NUMBER_CLASS_NODE = ClassHelper .Number_TYPE ;
116
111
public static final ClassNode BIG_DECIMAL_CLASS = ClassHelper .BigDecimal_TYPE ;
117
112
public static final ClassNode BIG_INTEGER_CLASS = ClassHelper .BigInteger_TYPE ;
113
+ public static final ClassNode NUMBER_CLASS_NODE = ClassHelper .Number_TYPE ;
114
+ public static final ClassNode STRING_CLASS_NODE = ClassHelper .STRING_TYPE ;
115
+ public static final ClassNode GSTRING_CLASS_NODE = ClassHelper .GSTRING_TYPE ;
116
+ public static final ClassNode CLOSURE_CLASS_NODE = ClassHelper .CLOSURE_TYPE ;
118
117
public static final ClassNode PATTERN_CLASS_NODE = ClassHelper .PATTERN_TYPE ;
119
118
public static final ClassNode MATCHER_CLASS_NODE = ClassHelper .make (Matcher .class );
120
119
@@ -144,18 +143,6 @@ public class VariableScope implements Iterable<VariableScope.VariableInfo> {
144
143
public static final ClassNode FLOAT_CLASS_NODE = ClassHelper .Float_TYPE ;
145
144
public static final ClassNode DOUBLE_CLASS_NODE = ClassHelper .Double_TYPE ;
146
145
147
- // don't cache because we have to add properties
148
- public static final ClassNode CLASS_CLASS_NODE = initializeProperties (ClassHelper .makeWithoutCaching (Class .class ));
149
-
150
- // NOTE: JDTClassNode contains very similar method
151
- private static ClassNode initializeProperties (ClassNode node ) {
152
- node .getMethods ().stream ().filter (AccessorSupport ::isGetter ).forEach (methodNode -> {
153
- String propertyName = Introspector .decapitalize (methodNode .getName ().substring (methodNode .getName ().startsWith ("is" ) ? 2 : 3 ));
154
- node .addProperty (new PropertyNode (propertyName , methodNode .getModifiers (), methodNode .getReturnType (), null , null , null , null ));
155
- });
156
- return node ;
157
- }
158
-
159
146
//--------------------------------------------------------------------------
160
147
161
148
/**
0 commit comments