Skip to content

Commit

Permalink
Merge pull request #2851 from guwirth/td-25
Browse files Browse the repository at this point in the history
fix technical debt
  • Loading branch information
guwirth authored Jan 14, 2025
2 parents 74e5db5 + 01558fd commit e47e270
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.builder.EqualsBuilder;

Expand All @@ -35,7 +36,7 @@ class ValgrindStack {

private final List<ValgrindFrame> frames = new ArrayList<>();

private static boolean isInside(String path, String folder) {
private static boolean isInside(@Nullable String path, String folder) {
return (path != null) && !path.isBlank() && path.startsWith(folder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected SourceCode(String key, @Nullable String name) {
this.name = name;
}

protected SourceCode(SourceCode parentKey, String key, @Nullable String name, int startAtLine) {
protected SourceCode(@Nullable SourceCode parentKey, String key, @Nullable String name, int startAtLine) {
var sb = new StringBuilder();
if (parentKey != null) {
sb.append(parentKey.getKey()).append('@');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public AstNode getParent() {
*
* @param child AstNode to add
*/
public void addChild(AstNode child) {
public void addChild(@Nullable AstNode child) {
if (child != null) {
if (children.isEmpty()) {
children = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package com.sonar.cxx.sslr.impl.matcher;

import com.sonar.cxx.sslr.api.TokenType;
import javax.annotation.Nullable;
import org.sonar.cxx.sslr.internal.vm.ParsingExpression;
import org.sonar.cxx.sslr.internal.vm.SequenceExpression;
import org.sonar.cxx.sslr.internal.vm.lexerful.TokenTypeClassExpression;
Expand Down Expand Up @@ -76,7 +77,7 @@ private static ParsingExpression convertToExpression(Object e) {
return expression;
}

private static void checkSize(Object[] e) {
private static void checkSize(@Nullable Object[] e) {
if (e == null || e.length == 0) {
throw new IllegalArgumentException("You must define at least one matcher.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.Reader;
import java.util.regex.Matcher;
import javax.annotation.Nullable;

/**
* The CodeReader class provides some advanced features to read a source code. The most important one is the ability to
Expand Down Expand Up @@ -141,7 +142,7 @@ public final int popTo(Matcher matcher, Appendable appendable) {
* @param appendable the consumed characters are appended to this appendable
* @return number of consumed characters or -1 if one of the two Matchers doesn't match
*/
public final int popTo(Matcher matcher, Matcher afterMatcher, Appendable appendable) {
public final int popTo(Matcher matcher, @Nullable Matcher afterMatcher, Appendable appendable) {
try {
matcher.reset(this);
if (matcher.lookingAt()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public AstNode getAstNodeFollowingCurrentSourceCodeTextCursorPosition() {
return getFollowingAstNode((DefaultMutableTreeNode) astTree.getModel().getRoot(), currentOffset);
}

private AstNode getFollowingAstNode(DefaultMutableTreeNode treeNode, int offset) {
private AstNode getFollowingAstNode(@Nullable DefaultMutableTreeNode treeNode, int offset) {
AstNode followingAstNode = null;

if (treeNode != null) {
Expand Down

0 comments on commit e47e270

Please sign in to comment.