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

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


  }

  @Override
  public List<? extends Element> getEnclosedElements() {
    PackageBinding binding = (PackageBinding)_binding;
    LookupEnvironment environment = binding.environment;
    char[][][] typeNames = null;
    INameEnvironment nameEnvironment = binding.environment.nameEnvironment;
    if (nameEnvironment instanceof FileSystem) {
      typeNames = ((FileSystem) nameEnvironment).findTypeNames(binding.compoundName);
    }
    HashSet<Element> set = new HashSet<Element>();
    if (typeNames != null) {
      for (char[][] typeName : typeNames) {
        ReferenceBinding type = environment.getType(typeName);
        if (type != null && type.isValidBinding()) {
          set.add(_env.getFactory().newElement(type));
        }
      }
    }
View Full Code Here


    return new NameImpl(cs);
  }

  @Override
  public PackageElement getPackageElement(CharSequence name) {
    LookupEnvironment le = _env.getLookupEnvironment();
    if (name.length() == 0) {
      return new PackageElementImpl(_env, le.defaultPackage);
    }
    char[] packageName = name.toString().toCharArray();
    PackageBinding packageBinding = le.createPackage(CharOperation.splitOn('.', packageName));
    if (packageBinding == null) {
      return null;
    }
    return new PackageElementImpl(_env, packageBinding);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see javax.lang.model.util.Elements#getTypeElement(java.lang.CharSequence)
   */
  @Override
  public TypeElement getTypeElement(CharSequence name) {
    LookupEnvironment le = _env.getLookupEnvironment();
    final char[][] compoundName = CharOperation.splitOn('.', name.toString().toCharArray());
    ReferenceBinding binding = le.getType(compoundName);
    // If we didn't find the binding, maybe it's a nested type;
    // try finding the top-level type and then working downwards.
    if (null == binding) {
      ReferenceBinding topLevelBinding = null;
      int topLevelSegments = compoundName.length;
      while (--topLevelSegments > 0) {
        char[][] topLevelName = new char[topLevelSegments][];
        for (int i = 0; i < topLevelSegments; ++i) {
          topLevelName[i] = compoundName[i];
        }
        topLevelBinding = le.getType(topLevelName);
        if (null != topLevelBinding) {
          break;
        }
      }
      if (null == topLevelBinding) {
View Full Code Here

      && ((ParameterizedGenericMethodBinding) this.binding).isRaw;
  }

  public boolean isSubsignature(IMethodBinding otherMethod) {
    try {
      LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment();
      return lookupEnvironment != null
        && lookupEnvironment.methodVerifier().isMethodSubsignature(this.binding, ((MethodBinding) otherMethod).binding);
    } catch (AbortCompilation e) {
      // don't surface internal exception to clients
      // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
      return false;
    }
View Full Code Here

  /**
   * @see IMethodBinding#overrides(IMethodBinding)
   */
  public boolean overrides(IMethodBinding otherMethod) {
      LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment();
      return lookupEnvironment != null
        && lookupEnvironment.methodVerifier().doesMethodOverride(this.binding, ((MethodBinding) otherMethod).binding);
  }
View Full Code Here

    }
    classFile.addAttributes();
    unitResult.record(typeBinding.constantPoolName(), classFile);
  }
  public static ClassFile getNewInstance(SourceTypeBinding typeBinding) {
    LookupEnvironment env = typeBinding.scope.environment();
    return env.classFilePool.acquire(typeBinding);
  }
View Full Code Here

    return new NameImpl(cs);
  }

  @Override
  public PackageElement getPackageElement(CharSequence name) {
    LookupEnvironment le = _env.getLookupEnvironment();
    if (name.length() == 0) {
      return new PackageElementImpl(_env, le.defaultPackage);
    }
    char[] packageName = name.toString().toCharArray();
    PackageBinding packageBinding = le.createPackage(CharOperation.splitOn('.', packageName));
    if (packageBinding == null) {
      return null;
    }
    return new PackageElementImpl(_env, packageBinding);
  }
View Full Code Here

  /* (non-Javadoc)
   * @see javax.lang.model.util.Elements#getTypeElement(java.lang.CharSequence)
   */
  @Override
  public TypeElement getTypeElement(CharSequence name) {
    LookupEnvironment le = _env.getLookupEnvironment();
    final char[][] compoundName = CharOperation.splitOn('.', name.toString().toCharArray());
    ReferenceBinding binding = le.getType(compoundName);
    // If we didn't find the binding, maybe it's a nested type;
    // try finding the top-level type and then working downwards.
    if (null == binding) {
      ReferenceBinding topLevelBinding = null;
      int topLevelSegments = compoundName.length;
      while (--topLevelSegments > 0) {
        char[][] topLevelName = new char[topLevelSegments][];
        for (int i = 0; i < topLevelSegments; ++i) {
          topLevelName[i] = compoundName[i];
        }
        topLevelBinding = le.getType(topLevelName);
        if (null != topLevelBinding) {
          break;
        }
      }
      if (null == topLevelBinding) {
View Full Code Here

    }
    classFile.addAttributes();
    unitResult.record(typeBinding.constantPoolName(), classFile);
  }
  public static ClassFile getNewInstance(SourceTypeBinding typeBinding) {
    LookupEnvironment env = typeBinding.scope.environment();
    return env.classFilePool.acquire(typeBinding);
  }
View Full Code Here

                  }
                  TypeBinding[] alternateArguments;
                  // need to clone for each iteration to avoid env paramtype cache interference
                  System.arraycopy(paramCastType.arguments, 0, alternateArguments = new TypeBinding[length], 0, length);
                  alternateArguments[i] = scope.getJavaLangObject();
                  LookupEnvironment environment = scope.environment();
                  ParameterizedTypeBinding alternateCastType = environment.createParameterizedType((ReferenceBinding)castType.erasure(), alternateArguments, castType.enclosingType());
                  if (alternateCastType.findSuperTypeOriginatingFrom(expressionType) == match) {
                    this.bits |= ASTNode.UnsafeCast;
                    break;
                  }
                }
View Full Code Here

TOP

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

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.