Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-01-09 13:52:51 -0500
committerSergey Prigogin2012-01-09 13:52:51 -0500
commitecd14f70f8ffe70114d2bbb0129ab703d96d1813 (patch)
tree979ebaf99a490f6b8137eacc301551eeac470fe1 /codan/org.eclipse.cdt.codan.checkers
parent99fa95b7cd235239f10db99593c458d6ee354144 (diff)
downloadorg.eclipse.cdt-ecd14f70f8ffe70114d2bbb0129ab703d96d1813.tar.gz
org.eclipse.cdt-ecd14f70f8ffe70114d2bbb0129ab703d96d1813.tar.xz
org.eclipse.cdt-ecd14f70f8ffe70114d2bbb0129ab703d96d1813.zip
Declare utility methods static.
Diffstat (limited to 'codan/org.eclipse.cdt.codan.checkers')
-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/CaseBreakChecker.java3
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CatchByReference.java4
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ClassMembersInitializationChecker.java2
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ProblemBindingChecker.java12
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/ReturnChecker.java11
6 files changed, 17 insertions, 19 deletions
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 927f37209a..0461da5b94 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
@@ -51,7 +51,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ClassTypeHelper;
*/
public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
public static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation"; //$NON-NLS-1$
- private HashMap<ICPPClassType, ICPPMethod[]> pureVirtualMethodsCache = new HashMap<ICPPClassType, ICPPMethod[]>();
+ private final HashMap<ICPPClassType, ICPPMethod[]> pureVirtualMethodsCache = new HashMap<ICPPClassType, ICPPMethod[]>();
@Override
public void initPreferences(IProblemWorkingCopy problem) {
@@ -189,7 +189,7 @@ public class AbstractClassInstantiationChecker extends AbstractIndexAstChecker {
* If it is, reports violations on each pure virtual method
*/
private void reportProblemsIfAbstract(IType typeToCheck, IASTNode problemNode ) {
- IType unwindedType = CxxAstUtils.getInstance().unwindTypedef(typeToCheck);
+ IType unwindedType = CxxAstUtils.unwindTypedef(typeToCheck);
if (!(unwindedType instanceof ICPPClassType) || unwindedType instanceof IProblemBinding) {
return;
}
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 13f4f3c21e..dc39e19c27 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
@@ -71,10 +71,9 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
* - "exit"
*/
protected boolean isBreakOrExitStatement(IASTStatement statement) {
- CxxAstUtils utils = CxxAstUtils.getInstance();
return (statement instanceof IASTBreakStatement) || statement instanceof IASTReturnStatement
|| statement instanceof IASTContinueStatement || statement instanceof IASTGotoStatement
- || utils.isThrowStatement(statement) || utils.isExitStatement(statement);
+ || CxxAstUtils.isThrowStatement(statement) || CxxAstUtils.isExitStatement(statement);
}
@Override
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 6d493a11e8..ee4de9bbcd 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
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Alena Laskavaia - initial API and implementation
+ * Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
@@ -72,7 +72,7 @@ public class CatchByReference extends AbstractIndexAstChecker {
if (spec instanceof IASTNamedTypeSpecifier) {
IASTName tname = ((IASTNamedTypeSpecifier) spec).getName();
IType typeName = (IType) tname.resolveBinding();
- typeName = CxxAstUtils.getInstance().unwindTypedef(typeName);
+ typeName = CxxAstUtils.unwindTypedef(typeName);
if (typeName instanceof IBasicType || typeName instanceof IPointerType || typeName == null)
continue;
if (typeName instanceof IProblemBinding && !shouldReportForUnknownType())
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 ccd265c378..ca27fa1203 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
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Anton Gorenkov - initial implementation
+ * Anton Gorenkov - initial implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
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 a5eba7e178..e6efcdea7d 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
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Marc-Andre Laperle - Initial API and implementation
- * Tomasz Wesolowski - Extension for fixes
+ * Marc-Andre Laperle - Initial API and implementation
+ * Tomasz Wesolowski - Extension for fixes
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers;
@@ -179,11 +179,10 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
}
private boolean isInClassContext(IASTName name) {
- CxxAstUtils utils = CxxAstUtils.getInstance();
- if (utils.getEnclosingCompositeTypeSpecifier(name) != null) {
+ if (CxxAstUtils.getEnclosingCompositeTypeSpecifier(name) != null) {
return true;
}
- IASTFunctionDefinition function = utils.getEnclosingFunction(name);
+ IASTFunctionDefinition function = CxxAstUtils.getEnclosingFunction(name);
if (function == null) {
return false;
}
@@ -194,8 +193,7 @@ public class ProblemBindingChecker extends AbstractIndexAstChecker {
}
private boolean isInFunctionContext(IASTName name) {
- CxxAstUtils utils = CxxAstUtils.getInstance();
- IASTFunctionDefinition function = utils.getEnclosingFunction(name);
+ IASTFunctionDefinition function = CxxAstUtils.getEnclosingFunction(name);
return (function != null);
}
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 8747dfacb2..07825aa1ab 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
@@ -204,13 +204,14 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
* @return
*/
private boolean isCompoundStatement(IASTStatement last) {
- return last instanceof IASTIfStatement || last instanceof IASTWhileStatement || last instanceof IASTDoStatement
- || last instanceof IASTForStatement || last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement;
+ return last instanceof IASTIfStatement || last instanceof IASTWhileStatement ||
+ last instanceof IASTDoStatement || last instanceof IASTForStatement ||
+ last instanceof IASTSwitchStatement || last instanceof IASTCompoundStatement;
}
protected boolean isFuncExitStatement(IASTStatement statement) {
- CxxAstUtils utils = CxxAstUtils.getInstance();
- return statement instanceof IASTReturnStatement || utils.isThrowStatement(statement) || utils.isExitStatement(statement);
+ return statement instanceof IASTReturnStatement || CxxAstUtils.isThrowStatement(statement) ||
+ CxxAstUtils.isExitStatement(statement);
}
/**
@@ -300,7 +301,7 @@ public class ReturnChecker extends AbstractAstFunctionChecker {
type = ((IASTSimpleDeclSpecifier) declSpecifier).getType();
} else if (declSpecifier instanceof IASTNamedTypeSpecifier) {
IBinding binding = ((IASTNamedTypeSpecifier) declSpecifier).getName().resolveBinding();
- IType utype = CxxAstUtils.getInstance().unwindTypedef((IType) binding);
+ IType utype = CxxAstUtils.unwindTypedef((IType) binding);
if (isVoid(utype))
return IASTSimpleDeclSpecifier.t_void;
}

Back to the top