Why does resolveBinding() return null even though I setResolveBindings(true) on my ASTParser?

后端 未结 1 1085
无人及你
无人及你 2020-12-11 18:15

I am writing an Eclipse plug-in that uses JDT AST\'s ASTParser to parse a method. I am looking within that method for the creation of a particular type of obje

相关标签:
1条回答
  • 2020-12-11 19:02

    Tucked away at the bottom of the overview of ASTParser.setKind(), carefully hidden from people troubleshooting resolveBinding() and setResolveBindings(), is the statement

    Binding information is only computed when kind is K_COMPILATION_UNIT.

    (from the online Javadoc)

    I don't understand offhand why this would be the case, but it does seem to point pretty clearly at what needs to be different!

    0 讨论(0)
提交回复
热议问题