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

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


      && !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

      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

                  }
                  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

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