How to get data in "binding"

This is a screenshot of the debug mode in my custom rule development. I want to get the content in the red box.

I have made sure that the type of this identifier
class is IdentifierTree.But I still can’t get the content in “binding”.

Please tell me whether it is possible to get the contents here. I hope you could kindly give me some ideas.

List list=new ArrayList(5);

In addition, I’m also developing a rule related to collection initialization, and I also encountered a problem, that is, I can’t get the ‘5’ when creating a collection.
If there’s any way to tell me about this place, I’d be grateful.

Hello @KevinJin ,

You will never be able to access this binding. This is the internal semantic layer, and it is not exposed to the users for custom rules. However, we do expose another semantic API that should allow you to get through it.

  1. From the IdentifierTree, call symbol().owner().
  2. If the owner is not null, it then means that the semantic layer has been able to resolve its owner type.
  3. You should then be able to call type()
  4. From the type, you finally can check that it corresponds to the fully qualified name of the class you are looking for, with"java.lang.StringBuffer").

Et voila.
Good luck!

Please start another thread for this. This is a completely different problem.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.