Package org.eclipse.jdt.internal.compiler.impl

Examples of org.eclipse.jdt.internal.compiler.impl.CompilerOptions


  return false;
}
void checkAgainstInheritedMethods(MethodBinding currentMethod, MethodBinding[] methods, int length, MethodBinding[] allInheritedMethods)
{
  super.checkAgainstInheritedMethods(currentMethod, methods, length, allInheritedMethods);
  CompilerOptions options = this.environment.globalOptions;
  if (options.isAnnotationBasedNullAnalysisEnabled
      && (currentMethod.tagBits & TagBits.IsNullnessKnown) == 0)
  {
    // if annotations are inherited these have been checked during STB.resolveTypesFor() (for methods explicit in this.type)
    AbstractMethodDeclaration srcMethod = null;
View Full Code Here


  }
  super.checkNullSpecInheritance(currentMethod, srcMethod, hasNonNullDefault, complain, inheritedMethod, scope, inheritedNonNullnessInfos);
}

void reportRawReferences() {
  CompilerOptions compilerOptions = this.type.scope.compilerOptions();
  if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_5 // shouldn't whine at all
      || compilerOptions.reportUnavoidableGenericTypeProblems) { // must have already whined
    return;
  }
  /* Code below is only for a method that does not override/implement a super type method. If it were to,
     it would have been handled in checkAgainstInheritedMethods.
  */
  Object [] methodArray = this.currentMethods.valueTable;
  for (int s = methodArray.length; --s >= 0;) {
    if (methodArray[s] == null) continue;
    MethodBinding[] current = (MethodBinding[]) methodArray[s];
    for (int i = 0, length = current.length; i < length; i++) {
      MethodBinding currentMethod = current[i];
      if ((currentMethod.modifiers & (ExtraCompilerModifiers.AccImplementing | ExtraCompilerModifiers.AccOverriding)) == 0) {
        AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
        if (methodDecl == null) return;
        TypeBinding [] parameterTypes = currentMethod.parameters;
        Argument[] arguments = methodDecl.arguments;
        for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
          TypeBinding parameterType = parameterTypes[j];
          Argument arg = arguments[j];
          if (parameterType.leafComponentType().isRawType()
            && compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                && (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
            methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
            }
        }
        if (!methodDecl.isConstructor() && methodDecl instanceof MethodDeclaration) {
          TypeReference returnType = ((MethodDeclaration) methodDecl).returnType;
          TypeBinding methodType = currentMethod.returnType;
          if (returnType != null) {
            if (methodType.leafComponentType().isRawType()
                && compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
                && (returnType.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
              methodDecl.scope.problemReporter().rawTypeReference(returnType, methodType);
            }
          }
        }
View Full Code Here

      }
    }
  }
}
public void reportRawReferences(MethodBinding currentMethod, MethodBinding inheritedMethod) {
  CompilerOptions compilerOptions = this.type.scope.compilerOptions();
  if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_5 // shouldn't whine at all
      || compilerOptions.reportUnavoidableGenericTypeProblems) { // must have already whined
    return;
  }
  AbstractMethodDeclaration methodDecl = currentMethod.sourceMethod();
  if (methodDecl == null) return;
  TypeBinding [] parameterTypes = currentMethod.parameters;
  TypeBinding [] inheritedParameterTypes = inheritedMethod.parameters;
  Argument[] arguments = methodDecl.arguments;
  for (int j = 0, size = currentMethod.parameters.length; j < size; j++) {
    TypeBinding parameterType = parameterTypes[j];
    TypeBinding inheritedParameterType = inheritedParameterTypes[j];
    Argument arg = arguments[j];
    if (parameterType.leafComponentType().isRawType()) {
      if (inheritedParameterType.leafComponentType().isRawType()) {
        arg.binding.tagBits |= TagBits.ForcedToBeRawType;
      } else {
        if (compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore
            && (arg.type.bits & ASTNode.IgnoreRawTypeCheck) == 0) {
          methodDecl.scope.problemReporter().rawTypeReference(arg.type, parameterType);
        }
      }
      }
    }
  TypeReference returnType = null;
  if (!methodDecl.isConstructor() && methodDecl instanceof MethodDeclaration && (returnType = ((MethodDeclaration) methodDecl).returnType) != null) {
    final TypeBinding inheritedMethodType = inheritedMethod.returnType;
    final TypeBinding methodType = currentMethod.returnType;
    if (methodType.leafComponentType().isRawType()) {
      if (inheritedMethodType.leafComponentType().isRawType()) {
        //
      } else {
        if ((returnType.bits & ASTNode.IgnoreRawTypeCheck) == 0
            && compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
          methodDecl.scope.problemReporter().rawTypeReference(returnType, methodType);
        }
      }
    }
  }
View Full Code Here

  }

  public ClassFile(SourceTypeBinding typeBinding) {
    // default constructor for subclasses
    this.constantPool = new ConstantPool(this);
    final CompilerOptions options = typeBinding.scope.compilerOptions();
    this.targetJDK = options.targetJDK;
    this.produceAttributes = options.produceDebugAttributes;
    this.referenceBinding = typeBinding;
    this.isNestedType = typeBinding.isNestedType();
    if (this.targetJDK >= ClassFileConstants.JDK1_6) {
View Full Code Here

    return this.bootstrapMethods.size() - 1;
  }

  public void reset(SourceTypeBinding typeBinding) {
    // the code stream is reinitialized for each method
    final CompilerOptions options = typeBinding.scope.compilerOptions();
    this.referenceBinding = typeBinding;
    this.isNestedType = typeBinding.isNestedType();
    this.targetJDK = options.targetJDK;
    this.produceAttributes = options.produceDebugAttributes;
    if (this.targetJDK >= ClassFileConstants.JDK1_6) {
View Full Code Here

   * @param unit
   * @param source
   */
  private String processElement(ICompilationUnit unit, char[] source) {
    Document document = new Document(new String(source));
    CompilerOptions options = new CompilerOptions(unit.getJavaProject().getOptions(true));
    ASTParser parser = ASTParser.newParser(this.apiLevel);
    parser.setCompilerOptions(options.getMap());
    parser.setSource(source);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setResolveBindings(false);
    org.eclipse.jdt.core.dom.CompilationUnit ast = (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(null);

View Full Code Here

    return options;
  }

  // Do not modify without modifying getDefaultOptions()
  private Hashtable getDefaultOptionsNoInitialization() {
    Map defaultOptionsMap = new CompilerOptions().getMap(); // compiler defaults

    // Override some compiler defaults
    defaultOptionsMap.put(JavaCore.COMPILER_LOCAL_VARIABLE_ATTR, JavaCore.GENERATE);
    defaultOptionsMap.put(JavaCore.COMPILER_CODEGEN_UNUSED_LOCAL, JavaCore.PRESERVE);
    defaultOptionsMap.put(JavaCore.COMPILER_TASK_TAGS, JavaCore.DEFAULT_TASK_TAGS);
View Full Code Here

  // and not from Object or implicit static field access.
  if (TypeBinding.notEquals(constantPoolDeclaringClass, actualReceiverType.erasure())
      && !actualReceiverType.isArrayType()
      && constantPoolDeclaringClass != null // array.length
      && codegenBinding.constant() == Constant.NotAConstant) {
    CompilerOptions options = currentScope.compilerOptions();
    if ((options.targetJDK >= ClassFileConstants.JDK1_2
          && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(isImplicitThisReceiver && codegenBinding.isStatic()))
          && constantPoolDeclaringClass.id != TypeIds.T_JavaLangObject) // no change for Object fields
        || !constantPoolDeclaringClass.canBeSeenBy(currentScope)) {
View Full Code Here

public static TypeBinding getConstantPoolDeclaringClass(Scope currentScope, MethodBinding codegenBinding, TypeBinding actualReceiverType, boolean isImplicitThisReceiver) {
  TypeBinding constantPoolDeclaringClass = codegenBinding.declaringClass;
  // Post 1.4.0 target, array clone() invocations are qualified with array type
  // This is handled in array type #clone method binding resolution (see Scope and UpdatedMethodBinding)
  if (codegenBinding == currentScope.environment().arrayClone) {
    CompilerOptions options = currentScope.compilerOptions();
    if (options.sourceLevel > ClassFileConstants.JDK1_4 ) {
      constantPoolDeclaringClass = actualReceiverType.erasure();
    }
  } else {
    // if the binding declaring class is not visible, need special action
    // for runtime compatibility on 1.2 VMs : change the declaring class of the binding
    // NOTE: from target 1.2 on, method's declaring class is touched if any different from receiver type
    // and not from Object or implicit static method call.
    if (TypeBinding.notEquals(constantPoolDeclaringClass, actualReceiverType.erasure()) && !actualReceiverType.isArrayType()) {
      CompilerOptions options = currentScope.compilerOptions();
 
      if ((options.targetJDK >= ClassFileConstants.JDK1_2
            && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(isImplicitThisReceiver && codegenBinding.isStatic()))
            && codegenBinding.declaringClass.id != TypeIds.T_JavaLangObject) // no change for Object methods
          || !codegenBinding.declaringClass.canBeSeenBy(currentScope)) {
View Full Code Here

void checkAgainstInheritedMethods(MethodBinding currentMethod, MethodBinding[] methods, int length, MethodBinding[] allInheritedMethods) {
  if (this.type.isAnnotationType()) { // annotation cannot override any method
    problemReporter().annotationCannotOverrideMethod(currentMethod, methods[length - 1]);
    return; // do not repoort against subsequent inherited methods
  }
  CompilerOptions options = this.type.scope.compilerOptions();
  // need to find the overridden methods to avoid blaming this type for issues which are already reported against a supertype
  // but cannot ignore an overridden inherited method completely when it comes to checking for bridge methods
  int[] overriddenInheritedMethods = length > 1 ? findOverriddenInheritedMethods(methods, length) : null;
  nextMethod : for (int i = length; --i >= 0;) {
    MethodBinding inheritedMethod = methods[i];
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.impl.CompilerOptions

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.