Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-01-07 20:43:42 -0500
committerSergey Prigogin2012-01-07 20:43:42 -0500
commitd8c53b250142c12a74bdb6dadfe16189e675f1bf (patch)
treeed4b94ddda1158861f1ba47e83a2613c22e2dfb6 /codan/org.eclipse.cdt.codan.checkers
parent4071a34762f970dd6ffd0cc231c055940234bbe2 (diff)
downloadorg.eclipse.cdt-d8c53b250142c12a74bdb6dadfe16189e675f1bf.tar.gz
org.eclipse.cdt-d8c53b250142c12a74bdb6dadfe16189e675f1bf.tar.xz
org.eclipse.cdt-d8c53b250142c12a74bdb6dadfe16189e675f1bf.zip
@Override annotations.
Diffstat (limited to 'codan/org.eclipse.cdt.codan.checkers')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CodanCheckersActivator.java6
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java4
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentInConditionChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentToItselfChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CatchByReference.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java19
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java3
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NonVirtualDestructor.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java1
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java9
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnStyleChecker.java1
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java1
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuspiciousSemicolonChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java1
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/fs/ScanfFormatStringSecurityChecker.java2
17 files changed, 49 insertions, 12 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CodanCheckersActivator.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CodanCheckersActivator.java
index c2e21c3812..3511970584 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CodanCheckersActivator.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/checkers/CodanCheckersActivator.java
@@ -37,6 +37,7 @@ public class CodanCheckersActivator extends Plugin {
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -49,6 +50,7 @@ public class CodanCheckersActivator extends Plugin {
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
@@ -71,7 +73,7 @@ public class CodanCheckersActivator extends Plugin {
}
public static void log(String message) {
- getDefault().getLog().log(new Status(Status.ERROR, PLUGIN_ID, message));
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
}
/**
@@ -79,6 +81,6 @@ public class CodanCheckersActivator extends Plugin {
* @return
*/
public static IStatus getStatus(Throwable e) {
- return new Status(Status.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
+ return new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
}
}
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
index 8b5e66ceb3..927f37209a 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AbstractClassInstantiationChecker.java
@@ -61,6 +61,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
CheckerLaunchMode.RUN_ON_DEMAND);
}
+ @Override
public void processAst(IASTTranslationUnit ast) {
try {
ast.accept(new OnEachClass());
@@ -77,6 +78,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
shouldVisitParameterDeclarations = true;
}
+ @Override
public int visit(IASTDeclaration declaration) {
// Looking for the variables declarations.
if (declaration instanceof IASTSimpleDeclaration) {
@@ -96,6 +98,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
return PROCESS_CONTINUE;
}
+ @Override
public int visit(IASTParameterDeclaration parameterDecl) {
// Looking for parameters declaration. Skip references & pointers.
if (!hasPointerOrReference(parameterDecl.getDeclarator())) {
@@ -122,6 +125,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
}
}
+ @Override
public int visit(IASTExpression expression) {
if (expression instanceof ICPPASTNewExpression) {
// New expression.
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentInConditionChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentInConditionChecker.java
index 1693229363..3918a7d79b 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentInConditionChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentInConditionChecker.java
@@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
// traverse the ast using the visitor pattern.
ast.accept(new CheckCodeVisitor());
@@ -36,6 +37,7 @@ public class AssignmentInConditionChecker extends AbstractIndexAstChecker {
shouldVisitExpressions = true;
}
+ @Override
public int visit(IASTExpression expression) {
if (isAssignmentExpression(expression) && isUsedAsCondition(expression)) {
reportProblem(ER_ID, expression, expression.getRawSignature());
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentToItselfChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentToItselfChecker.java
index 6b4d6f4d7e..7be5b8857d 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentToItselfChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/AssignmentToItselfChecker.java
@@ -24,6 +24,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
public class AssignmentToItselfChecker extends AbstractIndexAstChecker {
private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
// traverse the ast using the visitor pattern.
ast.accept(new ASTVisitor() {
@@ -32,6 +33,7 @@ public class AssignmentToItselfChecker extends AbstractIndexAstChecker {
}
// visit expressions
+ @Override
public int visit(IASTExpression expression) {
if (isAssignmentToItself(expression)) {
reportProblem(ER_ID, expression, expression.getRawSignature());
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java
index 20da627cbc..13f4f3c21e 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java
@@ -217,6 +217,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
return getCommentMap().getLastFreestandingCommentForNode(statement);
}
+ @Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);
addPreference(problem, PARAM_NO_BREAK_COMMENT, CheckersMessages.CaseBreakChecker_DefaultNoBreakCommentDescription,
@@ -225,6 +226,7 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
addPreference(problem, PARAM_EMPTY_CASE, CheckersMessages.CaseBreakChecker_EmptyCaseDescription, Boolean.FALSE);
}
+ @Override
public void processAst(IASTTranslationUnit ast) {
_checkLastCase = (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_LAST_CASE);
_checkEmptyCase = (Boolean) getPreference(getProblemById(ER_ID, getFile()), PARAM_EMPTY_CASE);
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CatchByReference.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CatchByReference.java
index 3373f76a2c..6d493a11e8 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CatchByReference.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CatchByReference.java
@@ -45,6 +45,7 @@ public class CatchByReference extends AbstractIndexAstChecker {
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
public static final String PARAM_UNKNOWN_TYPE = "unknown"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
// traverse the ast using the visitor pattern.
ast.accept(new OnCatch());
@@ -55,6 +56,7 @@ public class CatchByReference extends AbstractIndexAstChecker {
shouldVisitStatements = true;
}
+ @Override
public int visit(IASTStatement stmt) {
if (stmt instanceof ICPPASTTryBlockStatement) {
try {
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java
index 5de06044fc..ccd265c378 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
-import java.util.Stack;
import java.util.HashSet;
import java.util.Set;
+import java.util.Stack;
import org.eclipse.cdt.codan.core.cxx.model.AbstractIndexAstChecker;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
@@ -26,6 +26,7 @@ import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.ICompositeType;
@@ -36,7 +37,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.ITypedef;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUnaryExpression;
-import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
@@ -57,6 +57,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization"; //$NON-NLS-1$
public static final String PARAM_SKIP = "skip"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
ast.accept(new OnEachClass());
}
@@ -64,7 +65,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
class OnEachClass extends ASTVisitor {
// NOTE: Classes can be nested and even can be declared in constructors of the other classes
- private Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
+ private final Stack< Set<IField> > constructorsStack = new Stack< Set<IField> >();
OnEachClass() {
shouldVisitDeclarations = true;
@@ -72,6 +73,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
shouldVisitExpressions = skipConstructorsWithFCalls();
}
+ @Override
public int visit(IASTDeclaration declaration) {
ICPPConstructor constructor = getConstructor(declaration);
if (constructor != null) {
@@ -87,6 +89,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
return PROCESS_CONTINUE;
}
+ @Override
public int leave(IASTDeclaration declaration) {
if (getConstructor(declaration) != null) {
for (IField field : constructorsStack.pop()) {
@@ -96,6 +99,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
return PROCESS_CONTINUE;
}
+ @Override
public int visit(IASTExpression expression) {
if (!constructorsStack.empty() && expression instanceof IASTFunctionCallExpression) {
Set<IField> actualConstructorFields = constructorsStack.peek();
@@ -141,15 +145,16 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
} else if (expr instanceof ICPPASTUnaryExpression) {
ICPPASTUnaryExpression unExpr = (ICPPASTUnaryExpression)expr;
switch (unExpr.getOperator()) {
- case ICPPASTUnaryExpression.op_amper:
- case ICPPASTUnaryExpression.op_star:
- case ICPPASTUnaryExpression.op_bracketedPrimary:
+ case IASTUnaryExpression.op_amper:
+ case IASTUnaryExpression.op_star:
+ case IASTUnaryExpression.op_bracketedPrimary:
return referencesThis(unExpr.getOperand());
}
}
return false;
}
+ @Override
public int visit(IASTName name) {
if (!constructorsStack.empty()) {
Set<IField> actualConstructorFields = constructorsStack.peek();
@@ -198,7 +203,7 @@ public class ClassMembersInitializationChecker extends AbstractIndexAstChecker {
IBinding binding = functionDefinition.getDeclarator().getName().resolveBinding();
if (binding instanceof ICPPConstructor) {
ICPPConstructor constructor = (ICPPConstructor) binding;
- if (constructor.getClassOwner().getKey()!=ICPPClassType.k_union) {
+ if (constructor.getClassOwner().getKey()!=ICompositeType.k_union) {
return constructor;
}
}
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java
index f155d4f6fe..466e688d92 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java
@@ -37,6 +37,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
public static final String PARAM_METHODS = "macro"; //$NON-NLS-1$
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
final List<IProblem> pts = getProblemsByMainId(ER_ID, getFile());
try {
@@ -45,6 +46,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
shouldVisitDeclarations = true;
}
+ @Override
public int visit(IASTDeclaration element) {
if (element instanceof IASTFunctionDefinition) {
IASTName astName = ((IASTFunctionDefinition) element).getDeclarator().getName();
@@ -109,6 +111,7 @@ public class NamingConventionFunctionChecker extends AbstractIndexAstChecker imp
* org.eclipse.cdt.codan.core.model.ICheckerWithPreferences#initParameters
* (org.eclipse.cdt.codan.core.model.IProblemWorkingCopy)
*/
+ @Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);
addPreference(problem, PARAM_KEY, CheckersMessages.NamingConventionFunctionChecker_LabelNamePattern, "^[a-z]"); //$NON-NLS-1$
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NonVirtualDestructor.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NonVirtualDestructor.java
index 24fb21b8a4..b1d1afc0c6 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NonVirtualDestructor.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NonVirtualDestructor.java
@@ -34,6 +34,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
public class NonVirtualDestructor extends AbstractIndexAstChecker {
public static final String PROBLEM_ID = "org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
// Traverse the AST using the visitor pattern.
ast.accept(new OnEachClass());
@@ -70,6 +71,7 @@ public class NonVirtualDestructor extends AbstractIndexAstChecker {
shouldVisitDeclSpecifiers = true;
}
+ @Override
public int visit(IASTDeclSpecifier decl) {
if (decl instanceof ICPPASTCompositeTypeSpecifier) {
ICPPASTCompositeTypeSpecifier spec = (ICPPASTCompositeTypeSpecifier) decl;
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java
index 87adf7bf55..a5eba7e178 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java
@@ -71,6 +71,7 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
getLaunchModePreference(problem).enableInLaunchModes(CheckerLaunchMode.RUN_AS_YOU_TYPE, CheckerLaunchMode.RUN_ON_DEMAND);
}
+ @Override
public void processAst(IASTTranslationUnit ast) {
try {
ast.accept(new ASTVisitor() {
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
index dd9ef6d59f..8747dfacb2 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java
@@ -42,7 +42,6 @@ import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
-import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLambdaExpression;
@@ -66,7 +65,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
public static final String RET_NORET_ID = "org.eclipse.cdt.codan.checkers.errnoreturn"; //$NON-NLS-1$
class ReturnStmpVisitor extends ASTVisitor {
- private IASTFunctionDefinition func;
+ private final IASTFunctionDefinition func;
boolean hasret;
ReturnStmpVisitor(IASTFunctionDefinition func) {
@@ -77,12 +76,14 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
this.hasret = false;
}
+ @Override
public int visit(IASTDeclaration element) {
if (element != func)
return PROCESS_SKIP; // skip inner functions
return PROCESS_CONTINUE;
}
+ @Override
public int visit(IASTExpression expr) {
if (expr instanceof ICPPASTLambdaExpression) {
return PROCESS_SKIP;
@@ -90,6 +91,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
return PROCESS_CONTINUE;
}
+ @Override
public int visit(IASTStatement stmt) {
if (stmt instanceof IASTReturnStatement) {
IASTReturnStatement ret = (IASTReturnStatement) stmt;
@@ -246,7 +248,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
* @return
*/
protected boolean isExplicitReturn(IASTFunctionDefinition func) {
- return getDeclSpecType(func) != ICASTSimpleDeclSpecifier.t_unspecified;
+ return getDeclSpecType(func) != IASTSimpleDeclSpecifier.t_unspecified;
}
/**
@@ -306,6 +308,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
}
/* checker must implement @link ICheckerWithPreferences */
+ @Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);
if (problem.getId().equals(RET_NO_VALUE_ID) || problem.getId().equals(RET_NORET_ID)) {
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnStyleChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnStyleChecker.java
index 5c72c562c9..51b6876317 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnStyleChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnStyleChecker.java
@@ -26,6 +26,7 @@ public class ReturnStyleChecker extends AbstractIndexAstChecker {
return true;
}
+ @Override
public void processAst(IASTTranslationUnit ast) {
ast.accept(new ASTVisitor() {
{
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java
index f1d3982924..3b7c1ace67 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/StatementHasNoEffectChecker.java
@@ -43,6 +43,7 @@ public class StatementHasNoEffectChecker extends AbstractIndexAstChecker {
public static final String PARAM_MACRO_ID = "macro"; //$NON-NLS-1$
public static final String PARAM_EXCEPT_ARG_LIST = "exceptions"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
ast.accept(new CheckStmpVisitor());
}
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java
index 16eb9537a4..cfeb0c179c 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuggestedParenthesisChecker.java
@@ -35,6 +35,7 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem"; //$NON-NLS-1$
public static final String PARAM_NOT = "paramNot"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
// traverse the ast using the visitor pattern.
ast.accept(new ExpressionVisitor());
@@ -45,6 +46,7 @@ public class SuggestedParenthesisChecker extends AbstractIndexAstChecker {
shouldVisitExpressions = true;
}
+ @Override
public int visit(IASTExpression expression) {
int precedence = getPrecedence(expression);
IASTNode parent = expression.getParent();
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuspiciousSemicolonChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuspiciousSemicolonChecker.java
index d865df1202..f7efd921e3 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuspiciousSemicolonChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/SuspiciousSemicolonChecker.java
@@ -28,6 +28,7 @@ public class SuspiciousSemicolonChecker extends AbstractIndexAstChecker {
public static final String PARAM_ELSE = "else"; //$NON-NLS-1$
public static final String PARAM_ALFTER_ELSE = "afterelse"; //$NON-NLS-1$
+ @Override
public void processAst(IASTTranslationUnit ast) {
ast.accept(new ASTVisitor() {
{
@@ -74,6 +75,7 @@ public class SuspiciousSemicolonChecker extends AbstractIndexAstChecker {
return macro != null;
}
+ @Override
public void initPreferences(IProblemWorkingCopy problem) {
super.initPreferences(problem);
addPreference(problem, PARAM_ELSE, CheckersMessages.SuspiciousSemicolonChecker_ParamElse, Boolean.FALSE);
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java
index 54390de9ec..b22e9f2690 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/UnusedSymbolInFileScopeChecker.java
@@ -101,6 +101,7 @@ public class UnusedSymbolInFileScopeChecker extends AbstractIndexAstChecker {
!staticVariableDeclarations.isEmpty();
}
+ @Override
public void processAst(IASTTranslationUnit ast) {
if (ast.isHeaderUnit())
return;
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/fs/ScanfFormatStringSecurityChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/fs/ScanfFormatStringSecurityChecker.java
index 1eca5d8c77..b340360b78 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/fs/ScanfFormatStringSecurityChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/fs/ScanfFormatStringSecurityChecker.java
@@ -78,6 +78,7 @@ public class ScanfFormatStringSecurityChecker extends AbstractIndexAstChecker {
new VulnerableFunction("sscanf", 1) //$NON-NLS-1$
};
+ @Override
public void processAst(IASTTranslationUnit ast) {
ast.accept(new FormatStringVisitor());
}
@@ -111,6 +112,7 @@ public class ScanfFormatStringSecurityChecker extends AbstractIndexAstChecker {
shouldVisitExpressions = true;
}
+ @Override
public int visit(IASTExpression expression) {
if (expression instanceof IASTFunctionCallExpression) {
IASTFunctionCallExpression callExpression = (IASTFunctionCallExpression) expression;

Back to the top