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

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding


        tvbs = makeTypeVariableBindingsFromAJTypeVariables(member.getTypeVariables());
        // QQQ do we need to bother fixing up the declaring element here?
      }
    }

    ReferenceBinding declaringType = (ReferenceBinding) makeTypeBinding(member.getDeclaringType());

    // If there are aliases, place them in the map
    if (aliases != null && aliases.size() != 0 && declaringType.typeVariables() != null
        && declaringType.typeVariables().length != 0) {
      int i = 0;
      ReferenceBinding aliasTarget = (ReferenceBinding) makeTypeBinding(aliasTargetType);
      if (aliasTarget.isRawType()) {
        aliasTarget = ((RawTypeBinding) aliasTarget).genericType();
      }
      for (Iterator iter = aliases.iterator(); iter.hasNext();) {
        String element = (String) iter.next();
        typeVariableToTypeBinding.put(element, aliasTarget.typeVariables()[i++]);
      }
    }

    currentType = declaringType;
    MethodBinding mb = new MethodBinding(member.getModifiers(), member.getName().toCharArray(),
View Full Code Here


      lastFieldBinding = (FieldBinding) this.binding;
      if (needValue || complyTo14) {
        manageSyntheticAccessIfNecessary(currentScope, lastFieldBinding, this.actualReceiverType, 0, flowInfo);
      }
      if (this.indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
        ReferenceBinding declaringClass = lastFieldBinding.declaringClass;
        // check if accessing enum static field in initializer         
        if (declaringClass.isEnum()) {
          MethodScope methodScope = currentScope.methodScope();
          SourceTypeBinding sourceType = methodScope.enclosingSourceType();
          if (lastFieldBinding.isStatic()
              && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
              && lastFieldBinding.constant() == Constant.NotAConstant
View Full Code Here

      if (needValue || complyTo14) {
        manageSyntheticAccessIfNecessary(currentScope, (FieldBinding) this.binding, this.actualReceiverType, 0, flowInfo);
      }
      if (this.indexOfFirstFieldBinding == 1) { // was an implicit reference to the first field binding
        FieldBinding fieldBinding = (FieldBinding) this.binding;
        ReferenceBinding declaringClass = fieldBinding.declaringClass;
        // check if accessing enum static field in initializer         
        if (declaringClass.isEnum()) {
          MethodScope methodScope = currentScope.methodScope();
          SourceTypeBinding sourceType = methodScope.enclosingSourceType();
          if (fieldBinding.isStatic()
              && (sourceType == declaringClass || sourceType.superclass == declaringClass) // enum constant body
              && fieldBinding.constant() == Constant.NotAConstant
View Full Code Here

          ? compileTimeType  // unboxing: checkcast before conversion
          : runtimeTimeType;
        TypeBinding typeCast = originalType.genericCast(targetType);
        setGenericCast(length, typeCast);
          if (typeCast instanceof ReferenceBinding) {
        ReferenceBinding referenceCast = (ReferenceBinding) typeCast;
        if (!referenceCast.canBeSeenBy(scope)) {
              scope.problemReporter().invalidType(this,
                  new ProblemReferenceBinding(
                CharOperation.splitOn('.', referenceCast.shortReadableName()),
                referenceCast,
                ProblemReasons.NotVisible));
        }
          }           
    }  
View Full Code Here

        break;
      }
      if ((needValue && !lastFieldBinding.isStatic()) || lastGenericCast != null) {
        int pc = codeStream.position;
        if ((this.bits & ASTNode.DepthMASK) != 0) {
          ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & ASTNode.DepthMASK) >> ASTNode.DepthSHIFT);
          Object[] emulationPath = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
          codeStream.generateOuterAccess(emulationPath, this, targetType, currentScope);
        } else {
          generateReceiver(codeStream);
        }
View Full Code Here

    // generate receiver/enclosing instance access
    boolean isStatic = this.codegenBinding.isStatic();
    // outer access ?
    if (!isStatic && ((this.bits & DepthMASK) != 0)) {
      // outer method can be reached through emulation
      ReferenceBinding targetType = currentScope.enclosingSourceType().enclosingTypeAt((this.bits & DepthMASK) >> DepthSHIFT);
      Object[] path = currentScope.getEmulationPath(targetType, true /*only exact match*/, false/*consider enclosing arg*/);
      if (path == null) {
        // emulation was not possible (should not happen per construction)
        currentScope.problemReporter().needImplementation();
      } else {
View Full Code Here

      switch(referenceBinding.problemId()) {
        case ProblemReasons.NotVisible :
        case ProblemReasons.NonStaticReferenceInStaticContext :
          if (referenceBinding instanceof ProblemReferenceBinding) {
            ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding;
            ReferenceBinding binding2 = problemReferenceBinding.closestMatch();
            ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(binding2);
            if (binding != null) {
              return binding;
            }
            binding = new TypeBinding(this, binding2);
View Full Code Here

            ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) variableBinding;
            switch(problemFieldBinding.problemId()) {
              case ProblemReasons.NotVisible :
              case ProblemReasons.NonStaticReferenceInStaticContext :
              case ProblemReasons.NonStaticReferenceInConstructorInvocation :
                ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
                FieldBinding exactBinding = declaringClass.getField(problemFieldBinding.name, true /*resolve*/);
                if (exactBinding != null) {
                  IVariableBinding variableBinding2 = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
                  if (variableBinding2 != null) {
                    return variableBinding2;
                  }
View Full Code Here

          ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) variableBinding;
          switch(problemFieldBinding.problemId()) {
            case ProblemReasons.NotVisible :
            case ProblemReasons.NonStaticReferenceInStaticContext :
            case ProblemReasons.NonStaticReferenceInConstructorInvocation :
              ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
              FieldBinding exactBinding = declaringClass.getField(problemFieldBinding.name, true /*resolve*/);
              if (exactBinding != null) {
                IVariableBinding variableBinding2 = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
                if (variableBinding2 != null) {
                  return variableBinding2;
                }
View Full Code Here

            } else  if (binding instanceof ProblemFieldBinding) {
              ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) binding;
              switch(problemFieldBinding.problemId()) {
                case ProblemReasons.NotVisible :
                case ProblemReasons.NonStaticReferenceInStaticContext :
                  ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
                  if (declaringClass != null) {
                    FieldBinding exactBinding = declaringClass.getField(tokens[tokens.length - 1], true /*resolve*/);
                    if (exactBinding != null) {
                      if (exactBinding.type != null) {
                        IVariableBinding variableBinding = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
                        if (variableBinding != null) {
                          return variableBinding;
                        }
                        variableBinding = new VariableBinding(this, exactBinding);
                        this.bindingTables.compilerBindingsToASTBindings.put(exactBinding, variableBinding);
                        return variableBinding;
                      }
                    }
                  }
                  break;
              }
            }
          }
        }
      } else {
        /* This is the case for a name which is part of a qualified name that
         * cannot be resolved. See PR 13063.
         */
        if (qualifiedNameReference.otherBindings == null || (index - indexOfFirstFieldBinding - 1) < 0) {
          return null;
        } else {
          return this.getVariableBinding(qualifiedNameReference.otherBindings[index - indexOfFirstFieldBinding - 1]);
        }
      }
    } else if (node instanceof QualifiedTypeReference) {
      QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) node;
      if (qualifiedTypeReference.resolvedType == null) {
        return null;
      }
      if (index == qualifiedTypeReference.tokens.length) {
        if (!qualifiedTypeReference.resolvedType.isValidBinding() && qualifiedTypeReference instanceof JavadocQualifiedTypeReference) {
          JavadocQualifiedTypeReference typeRef = (JavadocQualifiedTypeReference) node;
          if (typeRef.packageBinding != null) {
            return getPackageBinding(typeRef.packageBinding);
          }
        }
        return this.getTypeBinding(qualifiedTypeReference.resolvedType.leafComponentType());
      } else {
        if (index >= 0) {
          BlockScope internalScope = (BlockScope) this.astNodesToBlockScope.get(name);
          Binding binding = null;
          try {
            if (internalScope == null) {
              if (this.scope == null) return null;
              binding = this.scope.getTypeOrPackage(CharOperation.subarray(qualifiedTypeReference.tokens, 0, index));
            } else {
              binding = internalScope.getTypeOrPackage(CharOperation.subarray(qualifiedTypeReference.tokens, 0, index));
            }
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
          if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
            return this.getPackageBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
            // it is a type
            return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
          } else {
            return null;
          }
        }
      }
    } else if (node instanceof ImportReference) {
      ImportReference importReference = (ImportReference) node;
      int importReferenceLength = importReference.tokens.length;
      if (index >= 0) {
        Binding binding = null;
        if (this.scope == null) return null;
        if (importReferenceLength == index) {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), (importReference.bits & org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        } else {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), true, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        }
        if (binding != null) {
          if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
            return this.getPackageBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
            // it is a type
            return this.getTypeBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding) {
            // it is a type
            return this.getVariableBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding)binding);
          } else if (binding instanceof org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding) {
            // it is a type
            return this.getMethodBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding)binding);
          } else {
            return null;
          }
        }
      }
    } else if (node instanceof CompilationUnitDeclaration) {
      CompilationUnitDeclaration compilationUnitDeclaration = (CompilationUnitDeclaration) node;
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types;
      if (types == null || types.length == 0) {
        return null;
      }
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration type = types[0];
      if (type != null) {
        ITypeBinding typeBinding = this.getTypeBinding(type.binding);
        if (typeBinding != null) {
          return typeBinding.getPackage();
        }
      }
    } else if (node instanceof AbstractMethodDeclaration) {
      AbstractMethodDeclaration methodDeclaration = (AbstractMethodDeclaration) node;
      IMethodBinding methodBinding = this.getMethodBinding(methodDeclaration.binding);
      if (methodBinding != null) {
        return methodBinding;
      }
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration) node;
      ITypeBinding typeBinding = this.getTypeBinding(typeDeclaration.binding);
      if (typeBinding != null) {
        return typeBinding;
      }
    } if (node instanceof SingleNameReference) {
      SingleNameReference singleNameReference = (SingleNameReference) node;
      if (singleNameReference.isTypeReference()) {
        return this.getTypeBinding(singleNameReference.resolvedType);
      } else {
        // this is a variable or a field
        Binding binding = singleNameReference.binding;
        if (binding != null) {
          if (binding.isValidBinding()) {
            return this.getVariableBinding((org.aspectj.org.eclipse.jdt.internal.compiler.lookup.VariableBinding) binding);
          } else {
            /*
             * http://dev.eclipse.org/bugs/show_bug.cgi?id=24449
             */
            if (binding instanceof ProblemFieldBinding) {
              ProblemFieldBinding problemFieldBinding = (ProblemFieldBinding) binding;
              switch(problemFieldBinding.problemId()) {
                case ProblemReasons.NotVisible :
                case ProblemReasons.NonStaticReferenceInStaticContext :
                case ProblemReasons.NonStaticReferenceInConstructorInvocation :
                  ReferenceBinding declaringClass = problemFieldBinding.declaringClass;
                  FieldBinding exactBinding = declaringClass.getField(problemFieldBinding.name, true /*resolve*/);
                  if (exactBinding != null) {
                    if (exactBinding.type != null) {
                      IVariableBinding variableBinding2 = (IVariableBinding) this.bindingTables.compilerBindingsToASTBindings.get(exactBinding);
                      if (variableBinding2 != null) {
                        return variableBinding2;
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

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.