Examples of IMethodBinding


Examples of org.eclipse.jdt.core.dom.IMethodBinding

      AbstractTypeDeclaration dec = (AbstractTypeDeclaration) o;
      List bodyDeclarations = dec.bodyDeclarations();
      assertNotNull(dec.resolveBinding());
      for(Object body:bodyDeclarations){
        MethodDeclaration methodDec = (MethodDeclaration) body;
        IMethodBinding binding = methodDec.resolveBinding();
        assertNotNull(binding);
        ASTNode node = cu.findDeclaringNode(binding);
        assertNotNull("can't find declaring node",node);
        System.out.println(node);
      }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

 
 
  private Pair<ReturnInstruction, Method> getRetAndMethod(StubVariable tarVar, List<Variable> params, StubVariable rVar) {
    NamedTypeBinding rBinding = new NamedTypeBinding("Foo");   
    NamedTypeBinding[] vBindings = new NamedTypeBinding[] {new NamedTypeBinding("Bar"), new NamedTypeBinding("Baz")};
    IMethodBinding methodBinding = new StubMethodBinding("name", rBinding, vBindings);

    Variable[] vArr = new Variable[params.size()];
    int ndx = 0;
    for (Variable var : params) {
      vArr[ndx] = var;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

  }

  private Pair<EntryInstruction, Method> getEntryAndMethod(StubVariable tarVar, List<Variable> params) {
    NamedTypeBinding rBinding = new NamedTypeBinding("Foo");   
    NamedTypeBinding[] vBindings = new NamedTypeBinding[] {new NamedTypeBinding("Bar"), new NamedTypeBinding("Baz")};
    IMethodBinding methodBinding = new StubMethodBinding("name", rBinding, vBindings);
   
    Variable[] vArr = new Variable[params.size()];
    int ndx = 0;
    for (Variable var : params) {
      vArr[ndx] = var;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

    if (!(instr instanceof NewObjectInstruction))
      return null;

    NewObjectInstruction newObj = (NewObjectInstruction) instr;

    IMethodBinding binding = newObj.resolveBinding();

    if (binding.getParameterTypes().length != paramTypes.length)
      return null;

    if (!types.existsCommonSubtype(type, binding.getDeclaringClass().getQualifiedName()))
      return null;

    for (int ndx = 0; ndx < paramTypes.length; ndx++)
      if (!types.existsCommonSubtype(paramTypes[ndx], binding.getParameterTypes()[ndx].getQualifiedName()))
        return null;
   
    ConsList<Binding> vars = ConsList.empty();
   
    vars = ConsList.cons(new Binding(ret, newObj.getTarget()), vars);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

    if (!(instr instanceof EntryInstruction))
      return null;

    EntryInstruction invoke = (EntryInstruction) instr;

    IMethodBinding binding = invoke.resolveBinding();
   
    if (methodName != null && !(methodName.equals(binding.getName())))
      return null;

    if (thisType != null && !types.existsCommonSubtype(thisType, binding.getDeclaringClass().getQualifiedName()))
      return null;
   
    //it's ok if we have a receiver and we're static (we just won't use it), but not the other way around.
    if (invoke.getReceiver() == null && !isStatic)
      return null;

    ConsList<Binding> vars = ConsList.empty();
    if (paramTypes != null) {
      if (binding.getParameterTypes().length != paramTypes.length)
        return null;
     
      Variable[] params = method.getParams();
 
      for (int ndx = 0; ndx < paramTypes.length; ndx++) {
        if (!types.existsCommonSubtype(paramTypes[ndx], binding.getParameterTypes()[ndx].getQualifiedName()))
          return null;
        vars = ConsList.cons(new Binding(paramNames[ndx], params[ndx]), vars);
      }
    }
   
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

    if (!(instr instanceof ReturnInstruction))
      return null;

    ReturnInstruction invoke = (ReturnInstruction) instr;

    IMethodBinding binding = method.getBinding();
   
    if (methodName != null && !(methodName.equals(binding.getName())))
      return null;

    if (thisType != null && !types.existsCommonSubtype(thisType, binding.getDeclaringClass().getQualifiedName()))
      return null;
   
    //it should match if the op is static and the method we are in is not, but not
    //the other way around.
    if (method.getThisVar() == null && !isStatic)
      return null;
   
    if (resType != null) {
      if (invoke.getReturnedVariable() == null)
        return null;
     
      String resVarType = invoke.getReturnedVariable().resolveType().getQualifiedName();
      if (!types.existsCommonSubtype(resType, resVarType))
        return null;
    }

    ConsList<Binding> vars = ConsList.empty();
    Variable[] params = method.getParams();
   
    if (paramTypes != null) {
      if (binding.getParameterTypes().length != paramTypes.length)
        return null;
     
      for (int ndx = 0; ndx < paramTypes.length; ndx++) {
        if (!types.existsCommonSubtype(paramTypes[ndx], binding.getParameterTypes()[ndx].getQualifiedName()))
          return null;
        vars = ConsList.cons(new Binding(paramNames[ndx], params[ndx]), vars);
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

      return null;
   
    if (isStatic != invoke.isStaticMethodCall())
      return null;

    IMethodBinding binding = invoke.resolveBinding();

    if (!types.existsCommonSubtype(thisType, invoke.getReceiverOperand().resolveType().getQualifiedName()))
      return null;

    if (binding.getParameterTypes().length != paramTypes.length)
      return null;

    for (int ndx = 0; ndx < paramTypes.length; ndx++)
      if (!types.existsCommonSubtype(paramTypes[ndx], invoke.getArgOperands().get(ndx).resolveType().getQualifiedName()))
        return null;
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

*/
@Test
public class IMethodBindingWrapperTest {

  public void to_method_info() {
    IMethodBinding binding = IMethodBindingFake.SOURCE_FILE_TESTABLE_IS_EQUAL;
    MethodInfo res = IMethodBindingWrapper.wrapperOf(binding)
        .toMethodInfo();
    assertThat(res, isEqualTo(MethodInfoFake.SOURCE_FILE_TESTABLE_IS_EQUAL));
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

*/
@Test
public class ITypeBindingWrapperTest {

  public void to_parameter_info() {
    IMethodBinding method = IMethodBindingFake.ENTITY_IFACE_TESTABLE_IS_EQUAL;
    ITypeBinding binding = method.getParameterTypes()[0];
    ParameterInfo res = ITypeBindingWrapper.wrapperOf(binding)
        .toParameterInfo();
    assertThat(res, isEqualTo(ParameterInfoFake.ENTITY_ARG));
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.IMethodBinding

    if(findExistingConstructor(type, properties).exists()){
      return Services.getMessage("constructor.already.exists",
          type.getElementName() + '(' + buildParams(type, properties) + ')');
    }

    IMethodBinding constructor =
      findParentConstructor(cu, typeBinding, variables);
    if (constructor == null){
      return ActionMessages
        .GenerateConstructorUsingFieldsAction_error_nothing_found;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.