@@ -115,7 +115,7 @@ public PathImpl getPathWithoutLeafNode() {
115
115
public NodeImpl addPropertyNode (String nodeName ) {
116
116
requiresWriteableNodeList ();
117
117
118
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
118
+ NodeImpl parent = currentLeafNode ;
119
119
currentLeafNode = NodeImpl .createPropertyNode ( nodeName , parent );
120
120
nodeList .add ( currentLeafNode );
121
121
hashCode = -1 ;
@@ -125,7 +125,7 @@ public NodeImpl addPropertyNode(String nodeName) {
125
125
public NodeImpl addContainerElementNode (String nodeName ) {
126
126
requiresWriteableNodeList ();
127
127
128
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
128
+ NodeImpl parent = currentLeafNode ;
129
129
currentLeafNode = NodeImpl .createContainerElementNode ( nodeName , parent );
130
130
nodeList .add ( currentLeafNode );
131
131
hashCode = -1 ;
@@ -135,7 +135,7 @@ public NodeImpl addContainerElementNode(String nodeName) {
135
135
public NodeImpl addParameterNode (String nodeName , int index ) {
136
136
requiresWriteableNodeList ();
137
137
138
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
138
+ NodeImpl parent = currentLeafNode ;
139
139
currentLeafNode = NodeImpl .createParameterNode ( nodeName , parent , index );
140
140
nodeList .add ( currentLeafNode );
141
141
hashCode = -1 ;
@@ -145,7 +145,7 @@ public NodeImpl addParameterNode(String nodeName, int index) {
145
145
public NodeImpl addCrossParameterNode () {
146
146
requiresWriteableNodeList ();
147
147
148
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
148
+ NodeImpl parent = currentLeafNode ;
149
149
currentLeafNode = NodeImpl .createCrossParameterNode ( parent );
150
150
nodeList .add ( currentLeafNode );
151
151
hashCode = -1 ;
@@ -155,7 +155,7 @@ public NodeImpl addCrossParameterNode() {
155
155
public NodeImpl addBeanNode () {
156
156
requiresWriteableNodeList ();
157
157
158
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
158
+ NodeImpl parent = currentLeafNode ;
159
159
currentLeafNode = NodeImpl .createBeanNode ( parent );
160
160
nodeList .add ( currentLeafNode );
161
161
hashCode = -1 ;
@@ -165,7 +165,7 @@ public NodeImpl addBeanNode() {
165
165
public NodeImpl addReturnValueNode () {
166
166
requiresWriteableNodeList ();
167
167
168
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
168
+ NodeImpl parent = currentLeafNode ;
169
169
currentLeafNode = NodeImpl .createReturnValue ( parent );
170
170
nodeList .add ( currentLeafNode );
171
171
hashCode = -1 ;
@@ -175,7 +175,7 @@ public NodeImpl addReturnValueNode() {
175
175
private NodeImpl addConstructorNode (String name , Class <?>[] parameterTypes ) {
176
176
requiresWriteableNodeList ();
177
177
178
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
178
+ NodeImpl parent = currentLeafNode ;
179
179
currentLeafNode = NodeImpl .createConstructorNode ( name , parent , parameterTypes );
180
180
nodeList .add ( currentLeafNode );
181
181
hashCode = -1 ;
@@ -185,7 +185,7 @@ private NodeImpl addConstructorNode(String name, Class<?>[] parameterTypes) {
185
185
private NodeImpl addMethodNode (String name , Class <?>[] parameterTypes ) {
186
186
requiresWriteableNodeList ();
187
187
188
- NodeImpl parent = nodeList . isEmpty () ? null : ( NodeImpl ) nodeList . get ( nodeList . size () - 1 ) ;
188
+ NodeImpl parent = currentLeafNode ;
189
189
currentLeafNode = NodeImpl .createMethodNode ( name , parent , parameterTypes );
190
190
nodeList .add ( currentLeafNode );
191
191
hashCode = -1 ;
0 commit comments