Skip to content

Commit

Permalink
Merge pull request #457 from cflint/addmissingfinal
Browse files Browse the repository at this point in the history
add missing final to method arguments
  • Loading branch information
justinmclean authored Aug 20, 2017
2 parents 9ba2491 + b00e09c commit 0b60492
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/cflint/CFLintStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ public CFLintStats() {
super();
}

public CFLintStats(long timestamp, long fileCount, BigInteger totalLines) {
public CFLintStats(final long timestamp, long fileCount, BigInteger totalLines) {
super();
this.timestamp = timestamp;
this.fileCount = fileCount;
this.totalLines = totalLines;
}

public CFLintStats(long timestamp, long fileCount, BigInteger totalLines, BugCounts counts) {
public CFLintStats(final long timestamp, long fileCount, BigInteger totalLines, BugCounts counts) {
super();
this.timestamp = timestamp;
this.fileCount = fileCount;
this.totalLines = totalLines;
this.counts = counts;
}

public void addFile(long numberOfLines){
public void addFile(final long numberOfLines){
fileCount++;
totalLines = totalLines.add(BigInteger.valueOf(numberOfLines));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cflint/Levels.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum Levels {

private final String severity;

private Levels(String name) {
private Levels(final String name) {
severity = name;
}

Expand All @@ -25,7 +25,7 @@ public String toString() {
return this.severity;
}

public static Levels fromString(String severity) {
public static Levels fromString(final String severity) {
for (Levels level : Levels.values()) {
if (level.toString().equals(severity)) {
return level;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/com/cflint/config/CFLintChainedConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public class CFLintChainedConfig implements CFLintConfiguration {
final private CFLintConfig config;
final private CFLintConfiguration parent;

public CFLintChainedConfig(CFLintConfiguration config) {
public CFLintChainedConfig(final CFLintConfiguration config) {
super();
this.config = (CFLintConfig) config;
parent = null;
}

public CFLintChainedConfig(CFLintConfiguration config, CFLintConfiguration parent) {
public CFLintChainedConfig(final CFLintConfiguration config, CFLintConfiguration parent) {
super();
this.config = (CFLintConfig) config;
this.parent = parent;
Expand All @@ -30,18 +30,18 @@ public CFLintChainedConfig(CFLintConfiguration config, CFLintConfiguration paren
* @param config
* @return
*/
public CFLintChainedConfig createNestedConfig(CFLintConfiguration config) {
public CFLintChainedConfig createNestedConfig(final CFLintConfiguration config) {
return config == null ? this : new CFLintChainedConfig(config, this);
}

@Override
public boolean includes(PluginMessage pluginMessage) {
public boolean includes(final PluginMessage pluginMessage) {
return config.includes(pluginMessage)
|| (config.isInheritParent() && parent != null && parent.includes(pluginMessage));
}

@Override
public boolean excludes(PluginMessage pluginMessage) {
public boolean excludes(final PluginMessage pluginMessage) {
return config.excludes(pluginMessage)
|| (config.isInheritParent() && parent != null && parent.excludes(pluginMessage));
}
Expand All @@ -51,7 +51,7 @@ public CFLintConfiguration getParent() {
}

@Override
public PluginInfoRule getRuleByClass(Class<?> clazz) {
public PluginInfoRule getRuleByClass(final Class<?> clazz) {
PluginInfoRule retval = config.getRuleByClass(clazz);
if (retval != null || parent == null) {
return retval;
Expand All @@ -69,12 +69,12 @@ public PluginInfoRule getRuleForPlugin(CFLintScanner plugin) {
}

@Override
public void addInclude(PluginMessage pluginMessage) {
public void addInclude(final PluginMessage pluginMessage) {
config.addInclude(pluginMessage);
}

@Override
public void addExclude(PluginMessage pluginMessage) {
public void addExclude(final PluginMessage pluginMessage) {
config.addExclude(pluginMessage);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/cflint/config/CFLintConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public boolean isInheritParent() {
}

@XmlAttribute(name = "inheritParent")
public void setInheritParent(boolean inheritParent) {
public void setInheritParent(final boolean inheritParent) {
this.inheritParent = inheritParent;
}

Expand All @@ -101,7 +101,7 @@ public boolean isInheritPlugins() {

@XmlAttribute(name = "inheritPlugins")
@Deprecated
public void setInheritPlugins(boolean inheritPlugins) {
public void setInheritPlugins(final boolean inheritPlugins) {
// #315 --- inheritPlugins can not be overwritten to false in 1.2.0 --- will be fully removed in 1.3.0 (but will then break people's setup if the setting remains in .cflintrc or the xml config
this.inheritPlugins = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cflint/main/CFLintMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected static void applyRuleGroups(final CFLintMain main, final CFLintPluginI
*
* @param pluginInfo
*/
private static void listRuleGroups(CFLintPluginInfo pluginInfo) {
private static void listRuleGroups(final CFLintPluginInfo pluginInfo) {
Map<String, PluginMessage> allCodes = new LinkedHashMap<String, PluginMessage>();
for (PluginInfoRule rule : pluginInfo.getRules()) {
for (PluginMessage msg : rule.getMessages()) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/cflint/plugins/CFLintStructureListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface CFLintStructureListener {
* @param bugs
* List of errors reported
*/
public void startFile(String fileName, BugList bugs);
public void startFile(final String fileName, BugList bugs);

/**
* Called when processing of current file has ended
Expand All @@ -31,7 +31,7 @@ public interface CFLintStructureListener {
* @param bugs
* List of errors reported
*/
public void endFile(String fileName, BugList bugs);
public void endFile(final String fileName, BugList bugs);

/**
* Called when processing a new component has started
Expand All @@ -41,7 +41,7 @@ public interface CFLintStructureListener {
* @param bugs
* List of errors reported
*/
public void startComponent(Context context, BugList bugs);
public void startComponent(final Context context, BugList bugs);

/**
* Called when processing of current component has ended
Expand All @@ -51,7 +51,7 @@ public interface CFLintStructureListener {
* @param bugs
* List of errors reported
*/
public void endComponent(Context context, BugList bugs);
public void endComponent(final Context context, BugList bugs);

/**
* Called when processing of a new function has started
Expand All @@ -61,7 +61,7 @@ public interface CFLintStructureListener {
* @param bugs
* List of errors reported
*/
public void startFunction(Context context, BugList bugs);
public void startFunction(final Context context, BugList bugs);

/**
* Called when processing of current function has ended
Expand All @@ -71,6 +71,6 @@ public interface CFLintStructureListener {
* @param bugs
* List of errors reported
*/
public void endFunction(Context context, BugList bugs);
public void endFunction(final Context context, BugList bugs);

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void element(final Element element, final Context context, final BugList
}
}

private boolean isCheck(String content, final String name) {
private boolean isCheck(final String content, final String name) {
boolean checked = false;
String stripped = content.replace(" ", "").replace("'", "\"").toLowerCase();
boolean structKeyCheck = (stripped.contains("structkeyexists(arguments,\"" + name + "\""));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cflint/plugins/core/ArgHintChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void element(final Element element, final Context context, final BugList
}

@Override
public void expression(CFScriptStatement expression, Context context, BugList bugs) {
public void expression(final CFScriptStatement expression, Context context, BugList bugs) {
if (expression instanceof CFFuncDeclStatement) {
final CFFuncDeclStatement funcDeclStatement = (CFFuncDeclStatement) expression;
final String _mlText = PrecedingCommentReader.getMultiLine(context, expression.getToken());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void element(final Element element, final Context context, final BugList
}

@Override
public void expression(CFScriptStatement expression, Context context, BugList bugs) {
public void expression(final CFScriptStatement expression, Context context, BugList bugs) {
if (expression instanceof CFCompDeclStatement) {
final CFCompDeclStatement compDeclStatement = (CFCompDeclStatement) expression;
final CFExpression hintAttribute = CFTool.convertMap(compDeclStatement.getAttributes()).get("hint");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void element(final Element element, final Context context, final BugList
}

@Override
public void expression(CFScriptStatement expression, Context context, BugList bugs) {
public void expression(final CFScriptStatement expression, Context context, BugList bugs) {
if (expression instanceof CFFuncDeclStatement) {
final CFFuncDeclStatement funcDeclStatement = (CFFuncDeclStatement) expression;
final CFExpression hintAttribute = CFTool.convertMap(funcDeclStatement.getAttributes()).get("hint");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cflint/plugins/core/LiteralChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected boolean isCommon(final String name) {
* @param name
* @return
*/
private boolean isSpecial(String name) {
private boolean isSpecial(final String name) {
//Empty literals do not flag
if(name == null || name.length()==0){
return true;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/cflint/plugins/core/PackageCaseChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private boolean checkComponentRegister(final Context context, final String compo
}

@Override
public void startComponent(Context context, BugList bugs) {
public void startComponent(final Context context, BugList bugs) {
final String key = context.getComponentName().toLowerCase();
if(!componentRegister.containsKey(key)){
componentRegister.put(key, new ArrayList<String>());
Expand Down Expand Up @@ -93,11 +93,11 @@ public void startComponent(Context context, BugList bugs) {
}
}

private String normalize(String filename) {
private String normalize(final String filename) {
return filename.replaceAll(".[cC][fF][cC]$", "").replace("\\",".").replace("/",".");
}

private boolean isCreateObject(CFFunctionExpression funcExpr) {
private boolean isCreateObject(final CFFunctionExpression funcExpr) {
return "createobject".equalsIgnoreCase(funcExpr.getFunctionName()) && funcExpr.getArgs().size() > 1
&& "'component'".equalsIgnoreCase(funcExpr.getArgs().get(0).Decompile(0));
}
Expand All @@ -116,7 +116,7 @@ public PackageCaseCheckerEntry(Context context, String componentPath,final Strin
}

@Override
public void setCFLint(CFLint cflint) {
public void setCFLint(final CFLint cflint) {
this.cflintRef = cflint;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SimpleComplexityChecker extends CFLintScannerAdapter {
private int functionLineNo = 1;

@Override
public void startFile(String fileName, BugList bugs) {
public void startFile(final String fileName, BugList bugs) {
complexity = 0;
alreadyTooComplex = false;
functionLineNo = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected void checkNumberFunctions(final int functionCount, final int atLine, f
}
}

public void startComponent(Context context, BugList bugs) {
public void startComponent(final Context context, BugList bugs) {
functionCount = 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void endFunction(final Context context, final BugList bugs) {
}
}

private boolean isUsed(String content, final String name) {
private boolean isUsed(final String content, final String name) {
boolean isUsed = false;
String stripped = content.replace(" ", "").replace("'", "\"").toLowerCase();
boolean structKeyCheck = (stripped.contains("arguments[\"" + name + "\"]"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public static class VarInfo {
private Integer lineNumber;
private String name;

public VarInfo(String name, Boolean used){
this.name=name;
this.used=used;
public VarInfo(final String name, Boolean used) {
this.name = name;
this.used = used;
}
}

Expand All @@ -122,7 +122,7 @@ public void element(final Element element, final Context context, final BugList
}

@Override
public void setParameter(String name, Object value) {
public void setParameter(final String name, Object value) {
super.setParameter(name, value);
if("UsedTagAttributes".equals(name)){
usedTagAttributes = getParameter("UsedTagAttributes",List.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void element(final Element element, final Context context, final BugList
}

@Override
public void setParameter(String name, Object value) {
public void setParameter(final String name, Object value) {
super.setParameter(name, value);

populateExclusions();
Expand Down Expand Up @@ -181,7 +181,7 @@ public void checkNameForBugs(final Context context, final String fullVariable, f
}
}

protected boolean excludeFromAnalyse(String variable) {
protected boolean excludeFromAnalyse(final String variable) {
return exclusions.contains(normalize(variable));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cflint/tools/CommentReformatting.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class CommentReformatting {
private static final String COMMENT_TEXT = "<!---";
private static final String COMMENT_END_TEXT = "--->";

public static String wrap(String value) {
public static String wrap(final String value) {
Stack<Integer> stack = new Stack<>();
StringBuilder sb = new StringBuilder(value);
int pos = sb.indexOf(COMMENT_TEXT);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cflint/tools/ObjectEquals.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class ObjectEquals {

public static boolean equals(Object a, Object b) {
public static boolean equals(final Object a, final Object b) {
if (a == null) {
return b == null;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/cflint/tools/PrecedingCommentReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class PrecedingCommentReader {
public static final String CFC_DEFAULT_EXTENSION = ".cfc";
public static final String CFM_DEFAULT_EXTENSION = ".cfm";

public static String getMultiLine(Context context, final Token token) {
public static String getMultiLine(final Context context, final Token token) {
Iterable<Token> tokens = context.beforeTokens(token);
for (Token currentTok : tokens) {
if (currentTok.getChannel() == Token.HIDDEN_CHANNEL && currentTok.getType() == CFSCRIPTLexer.ML_COMMENT) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/cflint/xml/MarshallerException.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ public class MarshallerException extends Exception {
public MarshallerException() {
}

public MarshallerException(String message) {
public MarshallerException(final String message) {
super(message);
}

public MarshallerException(String message, Throwable cause) {
public MarshallerException(final String message, Throwable cause) {
super(message, cause);
}

public MarshallerException(Throwable cause) {
public MarshallerException(final Throwable cause) {
super(cause);
}
}
Loading

0 comments on commit 0b60492

Please sign in to comment.