Closed foresightyj closed 7 years ago
OK. I got around it the ugly way by adding one line to parser.py
:
The value token
is there but is not passed into FormalParameter. Is there any reason that it is left out?
ReferenceType
is actually a type of AST node declared in javalang/tree.py
. I believe handlerNode.parameters[0].type.name
would give you what you're looking for.
import javalang.parse
sig = javalang.parse.parse_member_signature(r'''String foo(List<String> bar, Integer baz)''')
print(sig.parameters[0].type.name) # "List"
print(sig.parameters[1].type.name) # "String"
Oh. I feel stupid after seeing your answer. I jumped to conclusion too quickly. Sorry.
This is my code:
I am analyzing a typical Android Activity class, which have a bunch of
onEvent
methods for EventBus, these methods look like:I want to get the type of the notification as something like:
UnreadChatMessageEvent
, but the type given by javalang is alwaysReferenceType
: