Skip to content

Commit 9e8febd

Browse files
authored
Merge pull request #2854 from guwirth/td-28
fix technical debt
2 parents 08fe7f5 + a20e9e9 commit 9e8febd

File tree

1 file changed

+2
-12
lines changed
  • cxx-sslr/sslr-core/src/main/java/com/sonar/cxx/sslr/api

1 file changed

+2
-12
lines changed

cxx-sslr/sslr-core/src/main/java/com/sonar/cxx/sslr/api/AstNode.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.ArrayList;
2828
import java.util.Collections;
2929
import java.util.List;
30-
import javax.annotation.CheckForNull;
3130
import javax.annotation.Nullable;
3231
import org.sonar.cxx.sslr.internal.grammar.MutableParsingRule;
3332

@@ -142,7 +141,6 @@ public int getNumberOfChildren() {
142141
*
143142
* @since 1.17
144143
*/
145-
@CheckForNull
146144
public AstNode getNextAstNode() {
147145
var nextSibling = getNextSibling();
148146
if (nextSibling != null) {
@@ -162,7 +160,6 @@ public AstNode getNextAstNode() {
162160
*
163161
* @since 1.17
164162
*/
165-
@CheckForNull
166163
public AstNode getPreviousAstNode() {
167164
var previousSibling = getPreviousSibling();
168165
if (previousSibling != null) {
@@ -181,7 +178,6 @@ public AstNode getPreviousAstNode() {
181178
*
182179
* @since 1.17
183180
*/
184-
@CheckForNull
185181
public AstNode getNextSibling() {
186182
if (parent == null) {
187183
return null;
@@ -199,7 +195,6 @@ public AstNode getNextSibling() {
199195
*
200196
* @since 1.17
201197
*/
202-
@CheckForNull
203198
public AstNode getPreviousSibling() {
204199
if (parent == null) {
205200
return null;
@@ -366,7 +361,6 @@ public boolean isNot(AstNodeType... types) {
366361
*
367362
* @since 1.17
368363
*/
369-
@CheckForNull
370364
public AstNode getFirstChild(AstNodeType... nodeTypes) {
371365
for (var child : children) {
372366
for (var nodeType : nodeTypes) {
@@ -396,7 +390,6 @@ public AstNode getFirstChild(AstNodeType... nodeTypes) {
396390
*
397391
* @since 1.17
398392
*/
399-
@CheckForNull
400393
public AstNode getFirstDescendant(AstNodeType... nodeTypes) {
401394
for (var child : children) {
402395
if (child.is(nodeTypes)) {
@@ -508,11 +501,11 @@ public AstNode getLastChild() {
508501
* </pre>
509502
*
510503
* @param nodeTypes to be checked
511-
* @return last child of one of specified types, or null if not found
504+
* @return last child of one of specified types, or null if not found (@CheckForNull -> normally already ensured via
505+
* grammar)
512506
*
513507
* @since 1.20
514508
*/
515-
@CheckForNull // -> normally already ensured via grammar
516509
public AstNode getLastChild(AstNodeType... nodeTypes) {
517510
for (int i = children.size() - 1; i >= 0; i--) {
518511
var child = children.get(i);
@@ -592,7 +585,6 @@ public boolean hasAncestor(AstNodeType... nodeTypes) {
592585
*
593586
* @since 1.17
594587
*/
595-
@CheckForNull
596588
public AstNode getFirstAncestor(AstNodeType nodeType) {
597589
if (parent == null) {
598590
return null;
@@ -612,7 +604,6 @@ public AstNode getFirstAncestor(AstNodeType nodeType) {
612604
*
613605
* @since 1.19.2
614606
*/
615-
@CheckForNull
616607
public AstNode getFirstAncestor(AstNodeType... nodeTypes) {
617608
var result = parent;
618609
while (result != null) {
@@ -687,7 +678,6 @@ public String toString() {
687678
*
688679
* @return last token of this node (@CheckForNull -> normally already ensured via grammar)
689680
*/
690-
@CheckForNull
691681
public Token getLastToken() {
692682
if (!this.hasToken()) {
693683
return null;

0 commit comments

Comments
 (0)