Make sure MethodDeclaration is similar to IMethod

Is there any way I can compare the MethodDeclaration object and the IMethod object and see if they are similar? Or is there any way that a MethodDeclaration object can be converted to an IMethod object (IMethod provides the isSimilar function)?

Update: Similarly, I would like to know if FieldDeclaration can be converted to IField.

+3
source share
1 answer

The Declaration method is ASTNode, and IMethod is JavaElement. A certain way to check whether these two objects correspond to the same method, to compare their binding.

. http://wiki.eclipse.org/JDT/FAQ#From_an_ASTNode_to_an_IBinding http://wiki.eclipse.org/JDT/FAQ#From_an_IJavaElement_to_an_IBinding ASTNode JavaElement. Binding, .

+2

All Articles