Permalink
Browse files

fix for Findbugs violations NM_CONFUSING. Issue #912

  • Loading branch information...
1 parent e1d0e7f commit 7dd24c8c35572b5db3e5c905d440e813cfe2538c @romani romani committed Apr 11, 2015
@@ -34,4 +34,10 @@
<Class name="com.puppycrawl.tools.checkstyle.checks.indentation.LineWrappingHandler" />
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" />
</Match>
+ <Match>
+ <!-- till #922 -->
+ <Class name="com.puppycrawl.tools.checkstyle.Checker" />
+ <Method name="setClassloader" />
+ <Bug pattern="NM_CONFUSING" />
+ </Match>
</FindBugsFilter>
@@ -467,7 +467,7 @@ public static DetailAST parse(FileContents contents)
final String fullText = contents.getText().getFullText().toString();
final Reader sr = new StringReader(fullText);
final GeneratedJavaLexer lexer = new GeneratedJavaLexer(sr);
- lexer.setFilename(contents.getFilename());
+ lexer.setFilename(contents.getFileName());
lexer.setCommentListener(contents);
lexer.setTreatAssertAsKeyword(true);
lexer.setTreatEnumAsKeyword(true);
@@ -480,7 +480,7 @@ public static DetailAST parse(FileContents contents)
final GeneratedJavaRecognizer parser =
new GeneratedJavaRecognizer(filter);
- parser.setFilename(contents.getFilename());
+ parser.setFilename(contents.getFileName());
parser.setASTNodeClass(DetailAST.class.getName());
parser.compilationUnit();
@@ -47,7 +47,7 @@
.compile(MATCH_SINGLELINE_COMMENT_PAT);
/** the file name */
- private final String filename;
+ private final String fileName;
/** the text */
private final FileText text;
@@ -76,7 +76,7 @@
*/
@Deprecated public FileContents(String filename, String[] lines)
{
- this.filename = filename;
+ this.fileName = filename;
text = FileText.fromLines(new File(filename), Arrays.asList(lines));
}
@@ -87,7 +87,7 @@
*/
public FileContents(FileText text)
{
- filename = text.getFile().toString();
+ fileName = text.getFile().toString();
this.text = text;
}
@@ -261,9 +261,9 @@ public String getLine(int index)
}
/** @return the name of the file */
- public String getFilename()
+ public String getFileName()
{
- return filename;
+ return fileName;
}
/**
@@ -332,6 +332,6 @@ public boolean hasIntersectionWithComment(int startLineNo,
*/
public boolean inPackageInfo()
{
- return this.getFilename().endsWith("package-info.java");
+ return this.getFileName().endsWith("package-info.java");
}
}
@@ -111,7 +111,7 @@ public void finishTree(DetailAST rootAST)
*/
private String getFileName()
{
- String fname = getFileContents().getFilename();
+ String fname = getFileContents().getFileName();
fname = fname.substring(fname.lastIndexOf(File.separatorChar) + 1);
fname = fname.replaceAll("\\.[^\\.]*$", "");
return fname;
@@ -111,7 +111,7 @@ public boolean isIncompleteTag()
* Used for displaying a Checkstyle error.
* @return an int line number.
*/
- public int getLineno()
+ public int getLineNo()
{
return lineNo;
}
@@ -371,8 +371,8 @@ private void checkHtml(final DetailAST ast, final TextBlock comment)
final HtmlTag tag = parser.nextTag();
if (tag.isIncompleteTag()) {
- log(tag.getLineno(), INCOMPLETE_TAG,
- text[tag.getLineno() - lineno]);
+ log(tag.getLineNo(), INCOMPLETE_TAG,
+ text[tag.getLineNo() - lineno]);
return;
}
if (tag.isClosedTag()) {
@@ -389,7 +389,7 @@ private void checkHtml(final DetailAST ast, final TextBlock comment)
// We have found a close tag.
if (isExtraHtml(tag.getId(), htmlStack)) {
// No corresponding open tag was found on the stack.
- log(tag.getLineno(),
+ log(tag.getLineNo(),
tag.getPosition(),
EXTRA_HTML,
tag);
@@ -409,7 +409,7 @@ private void checkHtml(final DetailAST ast, final TextBlock comment)
&& !htag.getId().equals(lastFound)
&& !typeParameters.contains(htag.getId()))
{
- log(htag.getLineno(), htag.getPosition(), UNCLOSED_HTML, htag);
+ log(htag.getLineNo(), htag.getPosition(), UNCLOSED_HTML, htag);
lastFound = htag.getId();
}
}
@@ -448,7 +448,7 @@ private void checkUnclosedTags(Deque<HtmlTag> htmlStack, String token)
continue;
}
lastFound = lastOpenTag.getId();
- log(lastOpenTag.getLineno(),
+ log(lastOpenTag.getLineNo(),
lastOpenTag.getPosition(),
UNCLOSED_HTML,
lastOpenTag);

0 comments on commit 7dd24c8

Please sign in to comment.