Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf7b5c0

Browse filesBrowse files
committed
HV-1480 Getting reference to parent node in a simpler way
1 parent 3b79cdd commit bf7b5c0
Copy full SHA for bf7b5c0

File tree

Expand file treeCollapse file tree

1 file changed

+8
-8
lines changed
Filter options
  • engine/src/main/java/org/hibernate/validator/internal/engine/path
Expand file treeCollapse file tree

1 file changed

+8
-8
lines changed

‎engine/src/main/java/org/hibernate/validator/internal/engine/path/PathImpl.java

Copy file name to clipboardExpand all lines: engine/src/main/java/org/hibernate/validator/internal/engine/path/PathImpl.java
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public PathImpl getPathWithoutLeafNode() {
115115
public NodeImpl addPropertyNode(String nodeName) {
116116
requiresWriteableNodeList();
117117

118-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
118+
NodeImpl parent = currentLeafNode;
119119
currentLeafNode = NodeImpl.createPropertyNode( nodeName, parent );
120120
nodeList.add( currentLeafNode );
121121
hashCode = -1;
@@ -125,7 +125,7 @@ public NodeImpl addPropertyNode(String nodeName) {
125125
public NodeImpl addContainerElementNode(String nodeName) {
126126
requiresWriteableNodeList();
127127

128-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
128+
NodeImpl parent = currentLeafNode;
129129
currentLeafNode = NodeImpl.createContainerElementNode( nodeName, parent );
130130
nodeList.add( currentLeafNode );
131131
hashCode = -1;
@@ -135,7 +135,7 @@ public NodeImpl addContainerElementNode(String nodeName) {
135135
public NodeImpl addParameterNode(String nodeName, int index) {
136136
requiresWriteableNodeList();
137137

138-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
138+
NodeImpl parent = currentLeafNode;
139139
currentLeafNode = NodeImpl.createParameterNode( nodeName, parent, index );
140140
nodeList.add( currentLeafNode );
141141
hashCode = -1;
@@ -145,7 +145,7 @@ public NodeImpl addParameterNode(String nodeName, int index) {
145145
public NodeImpl addCrossParameterNode() {
146146
requiresWriteableNodeList();
147147

148-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
148+
NodeImpl parent = currentLeafNode;
149149
currentLeafNode = NodeImpl.createCrossParameterNode( parent );
150150
nodeList.add( currentLeafNode );
151151
hashCode = -1;
@@ -155,7 +155,7 @@ public NodeImpl addCrossParameterNode() {
155155
public NodeImpl addBeanNode() {
156156
requiresWriteableNodeList();
157157

158-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
158+
NodeImpl parent = currentLeafNode;
159159
currentLeafNode = NodeImpl.createBeanNode( parent );
160160
nodeList.add( currentLeafNode );
161161
hashCode = -1;
@@ -165,7 +165,7 @@ public NodeImpl addBeanNode() {
165165
public NodeImpl addReturnValueNode() {
166166
requiresWriteableNodeList();
167167

168-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
168+
NodeImpl parent = currentLeafNode;
169169
currentLeafNode = NodeImpl.createReturnValue( parent );
170170
nodeList.add( currentLeafNode );
171171
hashCode = -1;
@@ -175,7 +175,7 @@ public NodeImpl addReturnValueNode() {
175175
private NodeImpl addConstructorNode(String name, Class<?>[] parameterTypes) {
176176
requiresWriteableNodeList();
177177

178-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
178+
NodeImpl parent = currentLeafNode;
179179
currentLeafNode = NodeImpl.createConstructorNode( name, parent, parameterTypes );
180180
nodeList.add( currentLeafNode );
181181
hashCode = -1;
@@ -185,7 +185,7 @@ private NodeImpl addConstructorNode(String name, Class<?>[] parameterTypes) {
185185
private NodeImpl addMethodNode(String name, Class<?>[] parameterTypes) {
186186
requiresWriteableNodeList();
187187

188-
NodeImpl parent = nodeList.isEmpty() ? null : (NodeImpl) nodeList.get( nodeList.size() - 1 );
188+
NodeImpl parent = currentLeafNode;
189189
currentLeafNode = NodeImpl.createMethodNode( name, parent, parameterTypes );
190190
nodeList.add( currentLeafNode );
191191
hashCode = -1;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.