Community
Participate
Working Groups
To reproduce this problem, write some code that: 1. Finds a particular IMethod that has both non-primitive parameters and a non-void, non-primitive return type. 2. Using the binding key from the IMethod, try to get the corresponding IMethodBinding, using something like this: IMethod method = findSomeMethod(); try { keys = new String[] { method.getKey() }; } catch (JavaModelException jme) {} final BindingRequestor requestor = new BindingRequestor(); final ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setResolveBindings(true); parser.setProject(method.getJavaProject()); // this doesn’t really do a parse; it’s a type lookup parser.createASTs(new ICompilationUnit[] {}, keys, requestor, null); return requestor._result; where BindingRequestor looks like this: class BindingRequestor extends ASTRequestor { private IMethodBinding _result = null; public void acceptBinding(String bindingKey, IBinding binding) { if (_result == null && binding != null && binding.getKind() == IBinding.METHOD) _result = (IMethodBinding) binding; } } Expected: requestor._result contains the IMethodBinding that corresponds to the IMethod Actual: you get the ITypeBinding for the class containing the method. On closer inspection this seems to happen because the key from the IMethod does not match the key in the IMethodBinding. If you tweak the key in a debugger to match, the code works. Seems like the key for the IMethod is not correctly generated. This looks like it might be similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=99137 but I'm not sure it's the same issue.
*** This bug has been marked as a duplicate of 99137 ***