Fixed bug where enum constants were causing NPE in Javadoc style check because enum constants have no explicit modifiers.
This commit is contained in:
parent
06b377b34c
commit
c83b8eeeac
|
|
@ -138,8 +138,17 @@ public class JavadocStyleCheck
|
|||
return false;
|
||||
}
|
||||
|
||||
final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
|
||||
final Scope declaredScope = ScopeUtils.getScopeFromMods(mods);
|
||||
final Scope declaredScope;
|
||||
if (aAST.getType() == TokenTypes.ENUM_CONSTANT_DEF)
|
||||
{
|
||||
declaredScope = Scope.PUBLIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
declaredScope = ScopeUtils.getScopeFromMods(
|
||||
aAST.findFirstToken(TokenTypes.MODIFIERS));
|
||||
}
|
||||
|
||||
final Scope scope =
|
||||
ScopeUtils.inInterfaceOrAnnotationBlock(aAST)
|
||||
? Scope.PUBLIC : declaredScope;
|
||||
|
|
|
|||
|
|
@ -231,4 +231,18 @@ public class InputJavadocStyleCheck
|
|||
public void method19()
|
||||
{ // should report empty javadoc (no text before see tag)
|
||||
}
|
||||
|
||||
public enum Test
|
||||
//Should complain about no javadoc
|
||||
{
|
||||
/**
|
||||
* Value 1 without a period
|
||||
*/
|
||||
value1,
|
||||
|
||||
/**
|
||||
* Value 2 with a period.
|
||||
*/
|
||||
value2,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public class JavadocStyleCheckTest
|
|||
"109:39: Extra HTML tag found: </img>",
|
||||
"186:8: Unclosed HTML tag found: <blockquote>",
|
||||
"193: First sentence should end with a period.",
|
||||
"238: First sentence should end with a period.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected);
|
||||
|
|
@ -48,6 +49,7 @@ public class JavadocStyleCheckTest
|
|||
"81: First sentence should end with a period.",
|
||||
"88: First sentence should end with a period.",
|
||||
"193: First sentence should end with a period.",
|
||||
"238: First sentence should end with a period.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected);
|
||||
|
|
@ -90,6 +92,7 @@ public class JavadocStyleCheckTest
|
|||
"90: Incomplete HTML tag found: * should fail <",
|
||||
"205: Javadoc has empty description section.",
|
||||
"230: Javadoc has empty description section.",
|
||||
"238: First sentence should end with a period.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected);
|
||||
|
|
@ -114,6 +117,7 @@ public class JavadocStyleCheckTest
|
|||
"205: Javadoc has empty description section.",
|
||||
"211: Javadoc has empty description section.",
|
||||
"230: Javadoc has empty description section.",
|
||||
"238: First sentence should end with a period.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected);
|
||||
|
|
@ -141,6 +145,7 @@ public class JavadocStyleCheckTest
|
|||
"211: Javadoc has empty description section.",
|
||||
"218: Javadoc has empty description section.",
|
||||
"230: Javadoc has empty description section.",
|
||||
"238: First sentence should end with a period.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected);
|
||||
|
|
|
|||
Loading…
Reference in New Issue