Examples of ITypeBinding


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

        throw new IllegalArgumentException("Invalid element for implicit this: " + accessedElement);
      genericBinding = ((IVariableBinding) accessedElement).getVariableDeclaration();
      isMethod = false;
    }
   
    ITypeBinding scope = method.getDeclaringClass();
    if(scope.isTopLevel())
      // easy: we're in a top-level class
      // this must bind to that class (no lexically enclosing classes exist)
      return scope;
    while(scope != null) {
      if(findElementDeclarationByName(genericBinding, isMethod, scope, false, false) != null)
        return scope;
      scope = scope.getDeclaringClass();
    }
    throw new IllegalArgumentException("Unknown element: " + accessedElement);
  }
View Full Code Here

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

        if(genericAccessedElement.equals(b.getVariableDeclaration() /* use generic field */))
          return type;
      }
    }
   
    ITypeBinding result = null;
    if(type.getSuperclass() != null) {
      ITypeBinding t = type.getSuperclass();
      result = findElementDeclarationByName(
          genericAccessedElement, isMethod, t,
          true /* always skip private declarations in supertypes */,
          ! t.getPackage().equals(type.getPackage()) /* skip package-private when leaving current package */);
      if(result != null)
        return result;
    }
    // go though interfaces as well
    for(ITypeBinding i : type.getInterfaces()) {
View Full Code Here

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

    }
    return result;
  }
 
  public SuperVariable superVariable(Name qualifier) {
    ITypeBinding thisType = resolveThisType();
    if(thisType == null || thisType.getSuperclass() == null)
      // static method or no superclass
      return null;
   
    // TODO find super-type binding based on qualifier and accessed element
    SuperVariable result = superVar.get(qualifier);
View Full Code Here

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

          declaredIn = declaredIn.getMethodDeclaration();
        }
        result = new SourceVariable(vb.getName(), vb, method.equals(declaredIn));
      }
      else if(binding instanceof ITypeBinding) {
        ITypeBinding tb = (ITypeBinding) binding;
        result = new TypeVariable(tb);
      }
      else
        throw new IllegalArgumentException("Not a variable: " + binding);
      variables.put(binding, result);
View Full Code Here

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

    /**
     * The rule is that the declared, generic type, is the single canonical type.
     * Parameterized types are actually different type bindings.
     * @see org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment#createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType)
     */
    ITypeBinding generic_type = node.resolveTypeBinding().getTypeDeclaration();
    ThisVariable result = thisVar.get(generic_type);
    if(result == null) {
      // explicitly qualified this
      result = new ThisVariable(this, qualifier);
      thisVar.put(node.resolveTypeBinding(), result);
View Full Code Here

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

    return tf.transfer(this, labels, value);
  }

  @Override
  public String toString() {
    ITypeBinding t = getTestedTypeNode().resolveBinding();
    if(t == null)
      return getTarget() + " = " + getOperand() + "instanceof <Type>";
    return getTarget() + " = " + getOperand() + " instanceof " + t.getName();
  }
View Full Code Here

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

  public void endVisit(AssertStatement node) {
    EclipseCFGNode assertNode = nodeMap.get(node);
    EclipseCFGNode expNode = nodeMap.get(node.getExpression());
    EclipseCFGNode messageNode = nodeMap.get(node.getMessage());
    EclipseCFGNode falsePath = new EclipseCFGNode(null);
    ITypeBinding binding = node.getAST().resolveWellKnownType("java.lang.Throwable");
    EclipseCFGNode catchNode = exceptionMap.getCatchNode(binding);

    createEdge(assertNode, expNode.getStart());
    assertNode.setStart(expNode.getStart());
    createBooleanEdge(expNode.getEnd(), assertNode, true);
View Full Code Here

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

  @Override
  public void endVisit(ThrowStatement node) {
    EclipseCFGNode throwNode = nodeMap.get(node);
    EclipseCFGNode expNode = nodeMap.get(node.getExpression());
    ITypeBinding binding = node.getExpression().resolveTypeBinding();
    EclipseCFGNode catchNode = exceptionMap.getCatchNode(binding);
    EclipseCFGNode current = throwNode;

    createEdge(expNode.getEnd(), throwNode);
View Full Code Here

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

  public void endVisit(AssertStatement node) {
    EclipseCFGNode assertNode = nodeMap.get(node);
    EclipseCFGNode expNode = nodeMap.get(node.getExpression());
    EclipseCFGNode messageNode = nodeMap.get(node.getMessage());
    EclipseCFGNode falsePath = new EclipseCFGNode(null);
    ITypeBinding binding = node.getAST().resolveWellKnownType("java.lang.Throwable");
    EclipseCFGNode catchNode = exceptionMap.getCatchNode(binding);

    assertNode.setStart(expNode.getStart());
    createBooleanEdge(expNode.getEnd(), assertNode, true);
View Full Code Here

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

    uberReturn = new EclipseCFGNode(null);
    uberReturn.setName("(uber-return)");
    createEdge(uberReturn, method);

    if (node.isConstructor()) {
      ITypeBinding parentClass = node.resolveBinding().getDeclaringClass();
      if (parentClass.isClass()) { //ignore enums or annotations, as they have constructors but not fields
        TypeDeclaration type = (TypeDeclaration) node.getParent();
        for (FieldDeclaration field : type.getFields()) {
          if (!Modifier.isStatic(field.getModifiers()))
            field.accept(this);
        }
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.