Skip to content

Commit 87affd1

Browse files
committed
Fix quality flaw: private methods which could be static
1 parent 8e8544a commit 87affd1

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

java-checks/src/main/java/org/sonar/java/checks/LeftCurlyBraceBaseTreeVisitor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.sonar.java.checks;
2121

2222
import com.google.common.collect.Iterables;
23+
2324
import org.sonar.plugins.java.api.JavaCheck;
2425
import org.sonar.plugins.java.api.JavaFileScanner;
2526
import org.sonar.plugins.java.api.JavaFileScannerContext;
@@ -78,7 +79,7 @@ public void visitClass(ClassTree tree) {
7879
}
7980

8081
@CheckForNull
81-
private SyntaxToken getLastTokenFromSignature(ClassTree classTree) {
82+
private static SyntaxToken getLastTokenFromSignature(ClassTree classTree) {
8283
List<TypeTree> superInterfaces = classTree.superInterfaces();
8384
if (!superInterfaces.isEmpty()) {
8485
return getIdentifierToken(Iterables.getLast(superInterfaces));
@@ -199,7 +200,7 @@ public void visitMethod(MethodTree tree) {
199200
super.visitMethod(tree);
200201
}
201202

202-
private SyntaxToken getLastTokenFromSignature(MethodTree methodTree) {
203+
private static SyntaxToken getLastTokenFromSignature(MethodTree methodTree) {
203204
if (methodTree.throwsClauses().isEmpty()) {
204205
return methodTree.closeParenToken();
205206
} else {

java-checks/src/main/java/org/sonar/java/checks/naming/FieldNameMatchingTypeNameCheck.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.sonar.java.checks.naming;
2121

2222
import com.google.common.collect.Lists;
23+
2324
import org.sonar.api.server.rule.RulesDefinition;
2425
import org.sonar.check.Priority;
2526
import org.sonar.check.Rule;
@@ -84,7 +85,7 @@ public void visitClass(ClassTree tree) {
8485
fields.clear();
8586
}
8687

87-
private boolean staticFieldSameType(Symbol classSymbol, Symbol sym) {
88+
private static boolean staticFieldSameType(Symbol classSymbol, Symbol sym) {
8889
return sym.type().equals(classSymbol.type()) && sym.isStatic();
8990
}
9091

0 commit comments

Comments
 (0)