Updated setter/getter support to handle accessor of the format 'isSomething'
This commit is contained in:
parent
836e4d1b12
commit
055aa0cf9d
|
|
@ -812,10 +812,11 @@ public class JavadocMethodCheck extends AbstractTypeAwareCheck
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check the name matches format getX...
|
||||
// Check the name matches format of getX or isX. Technically I should
|
||||
// check that the format isX is only used with a boolean type.
|
||||
final DetailAST type = aAST.findFirstToken(TokenTypes.TYPE);
|
||||
final String name = type.getNextSibling().getText();
|
||||
if (!name.matches("^get[A-Z].*")) { // Depends on JDK 1.4
|
||||
if (!name.matches("^(is|get)[A-Z].*")) { // Depends on JDK 1.4
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,4 +43,8 @@ public class InputSetterGetter
|
|||
return 666;
|
||||
}
|
||||
|
||||
public boolean isSomething()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ public class JavadocMethodCheckTest extends BaseCheckTestCase
|
|||
{
|
||||
public void testTags() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(JavadocMethodCheck.class);
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
final String[] expected = {
|
||||
"14:5: Missing a Javadoc comment.",
|
||||
"18: Unused @param tag for 'unused'.",
|
||||
|
|
@ -137,7 +138,8 @@ public class JavadocMethodCheckTest extends BaseCheckTestCase
|
|||
|
||||
public void testScopeAnonInnerPrivate() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(JavadocMethodCheck.class);
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(JavadocMethodCheck.class);
|
||||
checkConfig.addAttribute("scope", Scope.PRIVATE.getName());
|
||||
final String[] expected = {};
|
||||
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
|
||||
|
|
@ -324,7 +326,8 @@ public class JavadocMethodCheckTest extends BaseCheckTestCase
|
|||
"26:5: Missing a Javadoc comment.",
|
||||
"30:5: Missing a Javadoc comment.",
|
||||
"35:5: Missing a Javadoc comment.",
|
||||
"41:5: Missing a Javadoc comment.", };
|
||||
"41:5: Missing a Javadoc comment.",
|
||||
"46:5: Missing a Javadoc comment.", };
|
||||
verify(checkConfig, getPath("javadoc" + File.separator
|
||||
+ "InputSetterGetter.java"), expected);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue