Don't forget annotation methods
This commit is contained in:
@ -3160,7 +3160,7 @@ void AnnotationMethodDeclaration(int modifiers) #MethodDeclaration:
|
||||
Type() #ResultType
|
||||
t=<IDENTIFIER>
|
||||
("(" ")") #FormalParameters(true)
|
||||
( "[" "]" )* // TODO use ArrayTypeDims
|
||||
[ Dims() ]
|
||||
[ DefaultValue() ] ";"
|
||||
{
|
||||
jjtThis.setImage(t.image);
|
||||
|
@ -7,7 +7,6 @@ package net.sourceforge.pmd.lang.java.ast
|
||||
|
||||
import net.sourceforge.pmd.lang.ast.test.shouldBe
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTPrimitiveType.PrimitiveType.INT
|
||||
import net.sourceforge.pmd.lang.java.ast.ParserTestCtx.Companion.EnclosedDeclarationParsingCtx
|
||||
|
||||
class ASTFieldDeclarationTest : ParserTestSpec({
|
||||
|
||||
|
@ -7,7 +7,6 @@ package net.sourceforge.pmd.lang.java.ast
|
||||
|
||||
import net.sourceforge.pmd.lang.ast.test.shouldBe
|
||||
import net.sourceforge.pmd.lang.java.ast.ASTPrimitiveType.PrimitiveType.INT
|
||||
import net.sourceforge.pmd.lang.java.ast.ParserTestCtx.Companion.StatementParsingCtx
|
||||
|
||||
class ASTLocalVariableDeclarationTest : ParserTestSpec({
|
||||
|
||||
|
@ -220,6 +220,7 @@ class ASTMethodDeclarationTest : ParserTestSpec({
|
||||
formalsList(0)
|
||||
}
|
||||
}
|
||||
|
||||
"int bar() default 2;" should parseAs {
|
||||
annotationMethod {
|
||||
it::getResultType shouldBe resultType {
|
||||
@ -231,6 +232,22 @@ class ASTMethodDeclarationTest : ParserTestSpec({
|
||||
}
|
||||
}
|
||||
|
||||
"int bar() @NonZero [];" should parseAs {
|
||||
annotationMethod {
|
||||
it::getResultType shouldBe resultType {
|
||||
primitiveType(PrimitiveType.INT)
|
||||
}
|
||||
it::getFormalParameters shouldBe formalsList(0)
|
||||
|
||||
it::getDefaultClause shouldBe null
|
||||
it::getExtraDimensions shouldBe child {
|
||||
arrayDim {
|
||||
annotation("NonZero")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"Override bar() default @Override;" should parseAs {
|
||||
annotationMethod {
|
||||
it::getResultType shouldBe resultType {
|
||||
@ -249,6 +266,9 @@ class ASTMethodDeclarationTest : ParserTestSpec({
|
||||
}
|
||||
it::getFormalParameters shouldBe formalsList(0)
|
||||
|
||||
it::getExtraDimensions shouldBe child {
|
||||
arrayDim {}
|
||||
}
|
||||
it::getDefaultClause shouldBe defaultValue {
|
||||
memberValueArray {
|
||||
annotation("Override")
|
||||
|
Reference in New Issue
Block a user