Package org.eclipse.jdt.internal.compiler.lookup

Examples of org.eclipse.jdt.internal.compiler.lookup.Binding


  public Set<? extends Element> getElementsAnnotatedWith(TypeElement a)
  {
    if (a.getKind() != ElementKind.ANNOTATION_TYPE) {
      throw new IllegalArgumentException("Argument must represent an annotation type"); //$NON-NLS-1$
    }
    Binding annoBinding = ((TypeElementImpl)a)._binding;
    if (0 != (annoBinding.getAnnotationTagBits() & TagBits.AnnotationInherited)) {
      Set<Element> annotatedElements = new HashSet<Element>(_annoToUnit.getValues(a));
      // For all other root elements that are TypeElements, and for their recursively enclosed
      // types, add each element if it has a superclass are annotated with 'a'
      ReferenceBinding annoTypeBinding = (ReferenceBinding) annoBinding;
      for (TypeElement element : ElementFilter.typesIn(getRootElements())) {
View Full Code Here


        case ANNOTATION_TYPE :
        case INTERFACE :
        case CLASS :
        case ENUM :
          TypeElementImpl typeElementImpl = (TypeElementImpl) e;
          Binding typeBinding = typeElementImpl._binding;
          if (typeBinding instanceof SourceTypeBinding) {
            SourceTypeBinding sourceTypeBinding = (SourceTypeBinding) typeBinding;
            TypeDeclaration typeDeclaration = (TypeDeclaration) sourceTypeBinding.scope.referenceContext();
            referenceContext = typeDeclaration;
            elementAnnotations = typeDeclaration.annotations;
            startPosition = typeDeclaration.sourceStart;
            endPosition = typeDeclaration.sourceEnd;
          }
          break;
        case PACKAGE :
          // nothing to do: there is no reference context for a package
          break;
        case CONSTRUCTOR :
        case METHOD :
          ExecutableElementImpl executableElementImpl = (ExecutableElementImpl) e;
          Binding binding = executableElementImpl._binding;
          if (binding instanceof MethodBinding) {
            MethodBinding methodBinding = (MethodBinding) binding;
            AbstractMethodDeclaration sourceMethod = methodBinding.sourceMethod();
            if (sourceMethod != null) {
              referenceContext = sourceMethod;
View Full Code Here

* by a super type or because it *is* raw and the current type has no control over it (i.e the rawness
* originates from some other file.)
*/
public boolean forcedToBeRaw(ReferenceContext referenceContext) {
  if (this instanceof NameReference) {
    final Binding receiverBinding = ((NameReference) this).binding;
    if (receiverBinding.isParameter() && (((LocalVariableBinding) receiverBinding).tagBits & TagBits.ForcedToBeRawType) != 0) {
      return true// parameter is forced to be raw since super method uses raw types.
    } else if (receiverBinding instanceof FieldBinding) {
      FieldBinding field = (FieldBinding) receiverBinding;
      if (field.type.isRawType()) {
        if (referenceContext instanceof AbstractMethodDeclaration) {
View Full Code Here

      if (this.arguments != null) {
        for (int i = 0, count = this.arguments.length; i < count; i++) {
          // if this method uses a type parameter declared by the declaring class,
          // it can't be static. https://bugs.eclipse.org/bugs/show_bug.cgi?id=318682
          if (this.arguments[i].binding != null && (this.arguments[i].binding.type instanceof TypeVariableBinding)) {
            Binding declaringElement = ((TypeVariableBinding)this.arguments[i].binding.type).declaringElement;
            if (this.binding != null && this.binding.declaringClass == declaringElement)
              this.bits &= ~ASTNode.CanBeStatic;
          }
        }
      }
View Full Code Here

                throw new IllegalArgumentException("Invalid type mirror for directSupertypes"); //$NON-NLS-1$
            default:
                break;
        }
        TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) t;
        Binding binding = typeMirrorImpl._binding;
        if (binding instanceof ReferenceBinding) {
          ReferenceBinding referenceBinding = (ReferenceBinding) binding;
          ArrayList<TypeMirror> list = new ArrayList<TypeMirror>();
          ReferenceBinding superclass = referenceBinding.superclass();
      if (superclass != null) {
View Full Code Here

     * @see javax.lang.model.util.Types#erasure(javax.lang.model.type.TypeMirror)
     */
    @Override
    public TypeMirror erasure(TypeMirror t) {
      TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) t;
      Binding binding = typeMirrorImpl._binding;
      if (binding instanceof ReferenceBinding) {
        return _env.getFactory().newTypeMirror(((ReferenceBinding) binding).erasure());
      }
      if (binding instanceof ArrayBinding) {
        TypeBinding typeBinding = (TypeBinding) binding;
View Full Code Here

            throw new IllegalArgumentException("Number of typeArguments doesn't match the number of formal parameters of typeElem"); //$NON-NLS-1$
        }
        TypeBinding[] typeArguments = new TypeBinding[typeArgsLength];
        for (int i = 0; i < typeArgsLength; i++) {
            TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) typeArgs[i];
            Binding binding = typeMirrorImpl._binding;
            if (!(binding instanceof TypeBinding)) {
                throw new IllegalArgumentException("Invalid type argument: " + typeMirrorImpl); //$NON-NLS-1$
            }
            typeArguments[i] = (TypeBinding) binding;
        }
View Full Code Here

            throw new IllegalArgumentException("Number of typeArguments doesn't match the number of formal parameters of typeElem"); //$NON-NLS-1$
        }
        TypeBinding[] typeArguments = new TypeBinding[typeArgsLength];
        for (int i = 0; i < typeArgsLength; i++) {
            TypeMirrorImpl typeMirrorImpl = (TypeMirrorImpl) typeArgs[i];
            Binding binding = typeMirrorImpl._binding;
            if (!(binding instanceof TypeBinding)) {
                throw new IllegalArgumentException("Invalid type for a type arguments : " + typeMirrorImpl); //$NON-NLS-1$
            }
            typeArguments[i] = (TypeBinding) binding;
        }
View Full Code Here

    @Override
    public boolean isAssignable(TypeMirror t1, TypeMirror t2) {
        if (!(t1 instanceof TypeMirrorImpl) || !(t2 instanceof TypeMirrorImpl)) {
            return false;
        }
        Binding b1 = ((TypeMirrorImpl)t1).binding();
        Binding b2 = ((TypeMirrorImpl)t2).binding();
        if (!(b1 instanceof TypeBinding) || !(b2 instanceof TypeBinding)) {
            // package, method, import, etc.
            throw new IllegalArgumentException();
        }
        if (((TypeBinding)b1).isCompatibleWith((TypeBinding)b2)) {
View Full Code Here

            return true;
        }
        if (!(t1 instanceof TypeMirrorImpl) || !(t2 instanceof TypeMirrorImpl)) {
            return false;
        }
        Binding b1 = ((TypeMirrorImpl)t1).binding();
        Binding b2 = ((TypeMirrorImpl)t2).binding();
        return b1 == b2;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.lookup.Binding

Copyright © 2018 www.massapicom. 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.