FileContents.getFileName() - resolve issue #1205

This commit is contained in:
Thomas Jensen 2015-06-12 20:18:18 +02:00
parent 1308724558
commit 3090cf0dab
3 changed files with 19 additions and 1 deletions

View File

@ -73,6 +73,14 @@
<Class name="com.puppycrawl.tools.checkstyle.api.DetailAST" />
<Bug pattern="BC_UNCONFIRMED_CAST" />
</Match>
<Match>
<!-- Support both getFileName() and getFilename() -->
<and>
<Class name="com.puppycrawl.tools.checkstyle.api.FileContents" />
<Method name="~setFile[nN]ame" />
</and>
<Bug pattern="NM_CONFUSING" />
</Match>
<Match>
<!-- false positive, beginTree is a kind of constructor for Checks -->
<Or>

View File

@ -717,7 +717,7 @@
<regex><pattern>.*.api.Check</pattern><branchRate>100</branchRate><lineRate>86</lineRate></regex>
<regex><pattern>.*.api.Comment</pattern><branchRate>100</branchRate><lineRate>95</lineRate></regex>
<regex><pattern>.*.api.DetailAST</pattern><branchRate>95</branchRate><lineRate>98</lineRate></regex>
<regex><pattern>.*.api.FileContents</pattern><branchRate>96</branchRate><lineRate>94</lineRate></regex>
<regex><pattern>.*.api.FileContents</pattern><branchRate>96</branchRate><lineRate>93</lineRate></regex>
<regex><pattern>.*.api.FileText</pattern><branchRate>50</branchRate><lineRate>59</lineRate></regex>
<regex><pattern>.*.api.FullIdent</pattern><branchRate>83</branchRate><lineRate>96</lineRate></regex>
<regex><pattern>.*.api.JavadocTagInfo</pattern><branchRate>25</branchRate><lineRate>77</lineRate></regex>

View File

@ -251,6 +251,16 @@ public final class FileContents implements CommentListener {
return fileName;
}
/**
* Getter.
* @return the name of the file
* @deprecated use {@link #getFileName} instead
*/
@Deprecated
public String getFilename() {
return getFileName();
}
/**
* Checks if the specified line is blank.
* @param lineNo the line number to check