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

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


    // search in static import
    ImportBinding[] importBindings = scope.compilationUnitScope().imports;
    for (int i = 0; i < importBindings.length; i++) {
      ImportBinding importBinding = importBindings[i];
      if(importBinding.isValidBinding() && importBinding.isStatic()) {
        Binding binding = importBinding.resolvedImport;
        if(binding != null && binding.isValidBinding()) {
          if(importBinding.onDemand) {
            if((binding.kind() & Binding.TYPE) != 0) {
              searchVisibleFields(
                  (ReferenceBinding)binding,
                  scope,
                  invocationSite,
                  scope,
                  staticsOnly,
                  notInJavadoc,
                  localsFound,
                  fieldsFound);

              searchVisibleMethods(
                  (ReferenceBinding)binding,
                  scope,
                  invocationSite,
                  scope,
                  staticsOnly,
                  notInJavadoc,
                  methodsFound);
            }
          } else {
            if ((binding.kind() & Binding.FIELD) != 0) {
              searchVisibleFields(
                  new FieldBinding[]{(FieldBinding)binding},
                  ((FieldBinding)binding).declaringClass,
                  scope,
                  invocationSite,
                  scope,
                  staticsOnly,
                  localsFound,
                  fieldsFound);
            } else if ((binding.kind() & Binding.METHOD) != 0) {
              MethodBinding methodBinding = (MethodBinding)binding;

              searchVisibleLocalMethods(
                  methodBinding.declaringClass.getMethods(methodBinding.selector),
                  methodBinding.declaringClass,
View Full Code Here


  IBinding createBinding(String key) {
    if (this.bindingTables == null)
      throw new RuntimeException("Cannot be called outside ASTParser#createASTs(...)"); //$NON-NLS-1$
    BindingKeyResolver keyResolver = new BindingKeyResolver(key, this, this.lookupEnvironment);
    Binding compilerBinding = keyResolver.getCompilerBinding();
    if (compilerBinding == null) return null;
    DefaultBindingResolver resolver = new DefaultBindingResolver(this.lookupEnvironment, null/*no owner*/, this.bindingTables, false, this.fromJavaProject);
    return resolver.getBinding(compilerBinding);
  }
View Full Code Here

      DefaultBindingResolver resolver = new DefaultBindingResolver(this.lookupEnvironment, owner, this.bindingTables, (flags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0, true);
      Object[] keys = this.requestedKeys.valueTable;
      for (int j = 0, keysLength = keys.length; j < keysLength; j++) {
        BindingKeyResolver keyResolver = (BindingKeyResolver) keys[j];
        if (keyResolver == null) continue;
        Binding compilerBinding = keyResolver.getCompilerBinding();
        IBinding binding = compilerBinding == null ? null : resolver.getBinding(compilerBinding);
        // pass it to requestor
        astRequestor.acceptBinding(((BindingKeyResolver) this.requestedKeys.valueTable[j]).getKey(), binding);
        worked(1);
      }
View Full Code Here

      DefaultBindingResolver resolver = new DefaultBindingResolver(this.lookupEnvironment, null, this.bindingTables, (flags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0, true);
      Object[] keys = this.requestedKeys.valueTable;
      for (int j = 0, keysLength = keys.length; j < keysLength; j++) {
        BindingKeyResolver keyResolver = (BindingKeyResolver) keys[j];
        if (keyResolver == null) continue;
        Binding compilerBinding = keyResolver.getCompilerBinding();
        IBinding binding = compilerBinding == null ? null : resolver.getBinding(compilerBinding);
        // pass it to requestor
        astRequestor.acceptBinding(((BindingKeyResolver) this.requestedKeys.valueTable[j]).getKey(), binding);
        worked(1);
      }
View Full Code Here

    }
  }

  private void reportBinding(Object key, ASTRequestor astRequestor, WorkingCopyOwner owner, CompilationUnitDeclaration unit) {
    BindingKeyResolver keyResolver = (BindingKeyResolver) key;
    Binding compilerBinding = keyResolver.getCompilerBinding();
    if (compilerBinding != null) {
      DefaultBindingResolver resolver = new DefaultBindingResolver(unit.scope, owner, this.bindingTables, false, this.fromJavaProject);
      AnnotationBinding annotationBinding = keyResolver.getAnnotationBinding();
      IBinding binding;
      if (annotationBinding != null) {
View Full Code Here

    }
  }

  private void reportBinding(Object key, FileASTRequestor astRequestor, CompilationUnitDeclaration unit) {
    BindingKeyResolver keyResolver = (BindingKeyResolver) key;
    Binding compilerBinding = keyResolver.getCompilerBinding();
    if (compilerBinding != null) {
      DefaultBindingResolver resolver = new DefaultBindingResolver(unit.scope, null, this.bindingTables, false, this.fromJavaProject);
      AnnotationBinding annotationBinding = keyResolver.getAnnotationBinding();
      IBinding binding;
      if (annotationBinding != null) {
View Full Code Here

}
protected void matchLevelAndReportImportRef(ImportReference importRef, Binding binding, MatchLocator locator) throws CoreException {

  // for static import, binding can be a field binding or a member type binding
  // verify that in this case binding is static and use declaring class for fields
  Binding refBinding = binding;
  if (importRef.isStatic()) {
    if (binding instanceof FieldBinding) {
      FieldBinding fieldBinding = (FieldBinding) binding;
      if (!fieldBinding.isStatic()) return;
      refBinding = fieldBinding.declaringClass;
View Full Code Here

              Expression currentExpression = expressions[i];
              if (currentExpression instanceof NullLiteral) {
                scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, currentExpression, true);
              } else if (currentExpression instanceof NameReference) {
                NameReference nameReference = (NameReference) currentExpression;
                final Binding nameReferenceBinding = nameReference.binding;
                if (nameReferenceBinding.kind() == Binding.FIELD) {
                  FieldBinding fieldBinding = (FieldBinding) nameReferenceBinding;
                  if (!fieldBinding.declaringClass.isEnum()) {
                    scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, currentExpression, true);
                  }
                }
              }
            }
          }
        } else if (this.value instanceof NameReference) {
          NameReference nameReference = (NameReference) this.value;
          final Binding nameReferenceBinding = nameReference.binding;
          if (nameReferenceBinding.kind() == Binding.FIELD) {
            FieldBinding fieldBinding = (FieldBinding) nameReferenceBinding;
            if (!fieldBinding.declaringClass.isEnum()) {
              if (!fieldBinding.type.isArrayType()) {
                scope.problemReporter().annotationValueMustBeConstant(this.binding.declaringClass, this.name, this.value, true);
              } else {
View Full Code Here

        for (int i = 0, count = this.arguments.length; i < count; i++) {
          flowInfo.markAsDefinitelyAssigned(this.arguments[i].binding);
          // 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

      return call;
    }

    JExpression processExpression(QualifiedNameReference x) {
      SourceInfo info = makeSourceInfo(x);
      Binding binding = x.binding;
      JNode node = typeMap.get(binding);
      if (!(node instanceof JVariable)) {
        return null;
      }
      JVariable variable = (JVariable) node;
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.