-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array declarator bracket placement in TYPE_ARGUMENTS
AST is incorrect
#10181
Comments
This is a bug. Such tree should be created for something like public TypeVariable<Class<String>[]> getTypeParameters() interesting that for public TypeVariable<Class<String[]>[]>[] getTypeParameters() the AST is correct:
|
Fixed via #10280: ➜ src cat Test.java
import java.lang.reflect.TypeVariable;
public class Test {
public TypeVariable<Class<String>>[] getTypeParameters() {
return null;
}
}
➜ src java -jar ~/IdeaProjects/checkstyle/target/checkstyle-9.0-SNAPSHOT-all.jar -t Test.java
IMPORT -> import [1:0]
|--DOT -> . [1:24]
| |--DOT -> . [1:16]
| | |--DOT -> . [1:11]
| | | |--IDENT -> java [1:7]
| | | `--IDENT -> lang [1:12]
| | `--IDENT -> reflect [1:17]
| `--IDENT -> TypeVariable [1:25]
`--SEMI -> ; [1:37]
CLASS_DEF -> CLASS_DEF [3:0]
|--MODIFIERS -> MODIFIERS [3:0]
| `--LITERAL_PUBLIC -> public [3:0]
|--LITERAL_CLASS -> class [3:7]
|--IDENT -> Test [3:13]
`--OBJBLOCK -> OBJBLOCK [3:18]
|--LCURLY -> { [3:18]
|--METHOD_DEF -> METHOD_DEF [4:4]
| |--MODIFIERS -> MODIFIERS [4:4]
| | `--LITERAL_PUBLIC -> public [4:4]
| |--TYPE -> TYPE [4:11]
| | |--IDENT -> TypeVariable [4:11]
| | |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS [4:23]
| | | |--GENERIC_START -> < [4:23]
| | | |--TYPE_ARGUMENT -> TYPE_ARGUMENT [4:24]
| | | | |--IDENT -> Class [4:24]
| | | | `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS [4:29]
| | | | |--GENERIC_START -> < [4:29]
| | | | |--TYPE_ARGUMENT -> TYPE_ARGUMENT [4:30]
| | | | | `--IDENT -> String [4:30]
| | | | `--GENERIC_END -> > [4:36]
| | | `--GENERIC_END -> > [4:37]
| | `--ARRAY_DECLARATOR -> [ [4:38]
| | `--RBRACK -> ] [4:39]
| |--IDENT -> getTypeParameters [4:41]
| |--LPAREN -> ( [4:58]
| |--PARAMETERS -> PARAMETERS [4:59]
| |--RPAREN -> ) [4:59]
| `--SLIST -> { [4:61]
| |--LITERAL_RETURN -> return [5:8]
| | |--EXPR -> EXPR [5:15]
| | | `--LITERAL_NULL -> null [5:15]
| | `--SEMI -> ; [5:19]
| `--RCURLY -> } [6:4]
`--RCURLY -> } [7:0]
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
[]
that follow the type arguments of thegetTypeParameters()
method are part of the return type of the method itself, and should be located in the method declaration'sTYPE
subtree.Example:
The text was updated successfully, but these errors were encountered: