Examples of LookupEnvironment


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

  /* (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

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

    }
    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

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

                  }
                  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

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

  }

  // pre: !argumentTypeElided()
  // try to merge null annotations from descriptor into binding, complaining about any incompatibilities found
  private void mergeParameterNullAnnotations(BlockScope currentScope) {
    LookupEnvironment env = currentScope.environment();
    TypeBinding[] ourParameters = this.binding.parameters;
    TypeBinding[] descParameters = this.descriptor.parameters;
    int len = Math.min(ourParameters.length, descParameters.length);
    for (int i = 0; i < len; i++) {
      long ourTagBits = ourParameters[i].tagBits & TagBits.AnnotationNullMASK;
      long descTagBits = descParameters[i].tagBits & TagBits.AnnotationNullMASK;
      if (ourTagBits == 0L) {
        if (descTagBits != 0L && !ourParameters[i].isBaseType()) {
          AnnotationBinding [] annotations = descParameters[i].getTypeAnnotations();
          for (int j = 0, length = annotations.length; j < length; j++) {
            AnnotationBinding annotation = annotations[j];
            if (annotation != null) {
              switch (annotation.getAnnotationType().id) {
                case TypeIds.T_ConfiguredAnnotationNullable :
                case TypeIds.T_ConfiguredAnnotationNonNull :
                  ourParameters[i] = env.createAnnotatedType(ourParameters[i], new AnnotationBinding [] { annotation });
                  break;
              }
            }
          }
        }
      } else if (ourTagBits != descTagBits) {
        if (ourTagBits == TagBits.AnnotationNonNull) { // requested @NonNull not provided
          char[][] inheritedAnnotationName = null;
          if (descTagBits == TagBits.AnnotationNullable)
            inheritedAnnotationName = env.getNullableAnnotationName();
          currentScope.problemReporter().illegalRedefinitionToNonNullParameter(this.arguments[i], this.descriptor.declaringClass, inheritedAnnotationName);
        }
      }     
    }
  }
View Full Code Here

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

      && !this.resolvedType.isTypeVariable()
      && !this.resolvedType.isWildcard()
      && location != 0
      && scope.hasDefaultNullnessFor(location))
  {
    LookupEnvironment environment = scope.environment();
    AnnotationBinding[] annots = new AnnotationBinding[]{environment.getNonNullAnnotation()};
    this.resolvedType = environment.createAnnotatedType(this.resolvedType, annots);
  }
}
View Full Code Here

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

      this.basicParser.scanner.taskTags = null;
      this.cud = this.basicParser.parse(this.compilationUnit, new CompilationResult(this.compilationUnit, 0, 0, this.options.maxProblemsPerUnit));

      // Use a non model name environment to avoid locks, monitors and such.
      INameEnvironment nameEnvironment = new JavaSearchNameEnvironment(javaProject, JavaModelManager.getJavaModelManager().getWorkingCopies(DefaultWorkingCopyOwner.PRIMARY, true/*add primary WCs*/));
      this.lookupEnvironment = new LookupEnvironment(this, this.options, problemReporter, nameEnvironment);
      reduceParseTree(this.cud);
      this.lookupEnvironment.buildTypeBindings(this.cud, null);
      this.lookupEnvironment.completeTypeBindings();
      this.cud.scope.faultInTypes();
      this.cud.resolve();
View Full Code Here

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

                  }
                  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 (TypeBinding.equalsEquals(alternateCastType.findSuperTypeOriginatingFrom(expressionType), match)) {
                    this.bits |= ASTNode.UnsafeCast;
                    break;
                  }
                }
View Full Code Here

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

                  }
                  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
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.