Examples of ITypeBinding


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

    private void writeSuperClass(StringBuffer buf, ImportsManager imports) {
        String superclass = getSuperClass();
        if (fTypeKind == CLASS_TYPE && superclass.length() > 0 && !"java.lang.Object".equals(superclass)) { //$NON-NLS-1$
            buf.append(" extends "); //$NON-NLS-1$

            ITypeBinding binding = null;
            if (fCurrType != null) {
                binding = TypeContextChecker.resolveSuperClass(superclass, fCurrType, getSuperClassStubTypeContext());
            }
            if (binding != null) {
                buf.append(imports.addImport(binding));
View Full Code Here

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

                bindings = TypeContextChecker.resolveSuperInterfaces(intfs, fCurrType, getSuperInterfacesStubTypeContext());
            } else {
                bindings = new ITypeBinding[intfs.length];
            }
            for (int i = 0; i <= last; i++) {
                ITypeBinding binding = bindings[i];
                if (binding != null) {
                    buf.append(imports.addImport(binding));
                } else {
                    buf.append(imports.addImport(intfs[i]));
                }
View Full Code Here

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

        settings.createComments = isAddComments();
        ASTParser parser = ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL);
        parser.setResolveBindings(true);
        parser.setSource(cu);
        CompilationUnit unit = (CompilationUnit) parser.createAST(new SubProgressMonitor(monitor, 1));
        final ITypeBinding binding = ASTNodes.getTypeBinding(unit, type);
        if (binding != null) {
            if (doUnimplementedMethods) {
                AddUnimplementedMethodsOperation operation = new AddUnimplementedMethodsOperation(unit, binding, null, -1, false, true, false);
                operation.setCreateComments(isAddComments());
                operation.run(monitor);
View Full Code Here

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

      if (node instanceof Expression) {
      if (node instanceof Name) {
        IBinding b = ((Name) node).resolveBinding();
        return bindingsResolver.resolveType(b, false);
      }
        ITypeBinding binding = ((Expression) node).resolveTypeBinding();
        return bindingsResolver.resolveType(binding, false);
      }
      else if (node instanceof TypeDeclaration) {
        ITypeBinding binding = ((TypeDeclaration) node).resolveBinding();
        return bindingsResolver.resolveType(binding, true);
      }
      else if (node instanceof MethodDeclaration) {
        IMethodBinding binding = ((MethodDeclaration) node).resolveBinding();
          return bindingsResolver.resolveType(binding, true);
      }
      else if (node instanceof VariableDeclaration) {
        IVariableBinding binding = ((VariableDeclaration) node).resolveBinding();
        return bindingsResolver.resolveType(binding.getType(), false);
      }
    } catch (NullPointerException e) {
      System.err.println("Got NPE for node " + node);
    }
   
View Full Code Here

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

      /*
       * For wildcards the isUpperbound() information is only correct in the binding here.
       * The previous implementation tried to look for that information in the type binding of the bounds,
       * which wasn't correct.
       */
      ITypeBinding bound = binding.getBound();
     
      if (bound == null) {
        return wildcardSymbol(unboundedSym());
      }
      else {
        return wildcardSymbol(boundSymbol(new ITypeBinding[] { bound }, isDeclaration, binding.isUpperbound()));
      }
    }
    else if (binding.isClass()) {
      return classSymbol(decl, computeTypes(isDeclaration ? binding.getTypeParameters() : binding.getTypeArguments(), isDeclaration));
    }
    else if (binding.isCapture()) {
      ITypeBinding[] typeBounds = binding.getTypeBounds();
      ITypeBinding wildcard = binding.getWildcard();
     
      if (typeBounds.length == 0) {
        return captureSymbol(unboundedSym(), resolveType(wildcard, isDeclaration));
      }
      else {
View Full Code Here

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

        return makeBinding("unresolved", null, null);
      }
   
    String qualifiedName = "";
   
    ITypeBinding declaringClass = binding.getDeclaringClass();
    if (declaringClass != null) {
      qualifiedName = getPath(resolveBinding(declaringClass));
    } else {
      IMethodBinding declaringMethod = binding.getDeclaringMethod();
      if (declaringMethod != null) {
View Full Code Here

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

   *
   * @param annoBinding
   * @return true id this is a multi annotation, and false if it is not.
   */
  public boolean isMulti(IAnnotationBinding annoBinding) {
    ITypeBinding binding = annoBinding.getAnnotationType();

    for (IAnnotationBinding meta : binding.getAnnotations()) {
      if (meta.getAnnotationType().getQualifiedName().equals(MultiAnnotation.class.getName()))
        return true;
    }
    return false;
  }
View Full Code Here

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

    else
      existing.add(anno);
  }

  public void addAnnotationToType(ICrystalAnnotation anno, TypeDeclaration type) {
    ITypeBinding binding = type.resolveBinding();
    String name = binding.getKey();
    List<ICrystalAnnotation> annoList;

    annoList = classes.get(name);
    if (annoList == null) {
      annoList = new ArrayList<ICrystalAnnotation>();
View Full Code Here

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

  /**
   * Returns the represented method's (unqualified) <code>this</code>.
   * @return the represented method's (unqualified) <code>this</code>.
   */
  public ThisVariable thisVariable() {
    ITypeBinding thisBinding = resolveThisType();
    if(thisBinding == null)
      // static method
      return null;
   
    ThisVariable result = thisVar.get(thisBinding);
View Full Code Here

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

    if(isStaticBinding(accessedElement))
      throw new IllegalArgumentException("Accessed element is static: " + accessedElement);
    if(isStaticBinding(method))
      throw new IllegalStateException("Access happens in static method: " + accessedElement);
   
    ITypeBinding thisBinding = implicitThisBinding(accessedElement);
    boolean implicitQualifier = thisBinding.equals(method.getDeclaringClass()) == false;
    // TODO can this happen?
    if(thisBinding.getName().equals("") && implicitQualifier) {
      // true if (1) binding is an anonymous class and (2) binding is not the innermost class around the current method
      // not sure how to qualify "this" in this case
      throw new IllegalArgumentException("implicit this resolves not to innermost class: " + accessedElement);
    }
   
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.