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

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


  // 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 (this.binding.declaringClass != this.actualReceiverType
      && this.receiverGenericCast == null
      && !this.actualReceiverType.isArrayType()) {
    CompilerOptions options = currentScope.compilerOptions();
    if ((options.targetJDK >= ClassFileConstants.JDK1_2
        && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !(this.receiver.isImplicitThis() && this.codegenBinding.isStatic()))
        && this.binding.declaringClass.id != TypeIds.T_JavaLangObject) // no change for Object methods
      || !this.binding.declaringClass.canBeSeenBy(currentScope)) {
View Full Code Here


        closestMatchOriginal.modifiers |= ExtraCompilerModifiers.AccLocallyUsed;
      }
    }
    return this.resolvedType;
  }
  final CompilerOptions compilerOptions = scope.compilerOptions();
  if (!this.binding.isStatic()) {
    // the "receiver" must not be a type, in other words, a NameReference that the TC has bound to a Type
    if (receiverIsType) {
      scope.problemReporter().mustUseAStaticMethod(this, this.binding);
      if (this.actualReceiverType.isRawType()
          && (this.receiver.bits & ASTNode.IgnoreRawTypeCheck) == 0
          && compilerOptions.getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore) {
        scope.problemReporter().rawTypeReference(this.receiver, this.actualReceiverType);
      }
    } else {
      this.receiver.computeConversion(scope, this.actualReceiverType, this.actualReceiverType);
      // compute generic cast if necessary
      TypeBinding receiverErasure = this.actualReceiverType.erasure();
      if (receiverErasure instanceof ReferenceBinding) {
        if (receiverErasure.findSuperTypeWithSameErasure(this.binding.declaringClass) == null) {
          this.receiverGenericCast = this.binding.declaringClass; // handle indirect inheritance thru variable secondary bound
        }
      }
    }
  } else {
    // static message invoked through receiver? legal but unoptimal (optional warning).
    if (!(this.receiver.isImplicitThis() || this.receiver.isSuper() || receiverIsType)) {
      scope.problemReporter().nonStaticAccessToStaticMethod(this, this.binding);
    }
    if (!this.receiver.isImplicitThis() && this.binding.declaringClass != this.actualReceiverType) {
      scope.problemReporter().indirectAccessToStaticMethod(this, this.binding);
    }   
  }
  checkInvocationArguments(scope, this.receiver, this.actualReceiverType, this.binding, this.arguments, argumentTypes, argsContainCast, this);

  //-------message send that are known to fail at compile time-----------
  if (this.binding.isAbstract()) {
    if (this.receiver.isSuper()) {
      scope.problemReporter().cannotDireclyInvokeAbstractMethod(this, this.binding);
    }
    // abstract private methods cannot occur nor abstract static............
  }
  if (isMethodUseDeprecated(this.binding, scope, true))
    scope.problemReporter().deprecatedMethod(this.binding, this);

  // from 1.5 compliance on, array#clone() returns the array type (but binding still shows Object)
  if (this.actualReceiverType.isArrayType()
      && this.binding.parameters == Binding.NO_PARAMETERS
      && compilerOptions.complianceLevel >= ClassFileConstants.JDK1_5
      && CharOperation.equals(this.binding.selector, TypeConstants.CLONE)) {
    this.resolvedType = this.actualReceiverType;
  } else {
    TypeBinding returnType = this.binding.returnType;
    if (returnType != null) returnType = returnType.capture(scope, this.sourceEnd);
    this.resolvedType = returnType;
  }
  if (this.receiver.isSuper() && compilerOptions.getSeverity(CompilerOptions.OverridingMethodWithoutSuperInvocation) != ProblemSeverities.Ignore) {
    final ReferenceContext referenceContext = scope.methodScope().referenceContext;
    if (referenceContext instanceof AbstractMethodDeclaration) {
      final AbstractMethodDeclaration abstractMethodDeclaration = (AbstractMethodDeclaration) referenceContext;
      MethodBinding enclosingMethodBinding = abstractMethodDeclaration.binding;
      if (enclosingMethodBinding.isOverriding()
View Full Code Here

  if (this.binding.declaringClass != someReceiverType
      && !someReceiverType.isArrayType()
      && this.binding.declaringClass != null // array.length
      && this.binding.constant() == Constant.NotAConstant) {
 
    CompilerOptions options = currentScope.compilerOptions();
    if ((options.targetJDK >= ClassFileConstants.JDK1_2
        && (options.complianceLevel >= ClassFileConstants.JDK1_4 || !receiver.isImplicitThis() || !this.codegenBinding.isStatic())
        && this.binding.declaringClass.id != T_JavaLangObject) // no change for Object fields
      || !this.binding.declaringClass.canBeSeenBy(currentScope)) {
View Full Code Here

    // If modified, also modify the method JavaModelManager#getDefaultOptionsNoInitialization()
    // Get options names set
    HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames;
   
    // Compiler settings
    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 (fieldBinding.declaringClass != lastReceiverType
        && !lastReceiverType.isArrayType()
        && fieldBinding.declaringClass != null // array.length
        && fieldBinding.constant() == Constant.NotAConstant) {
      CompilerOptions options = currentScope.compilerOptions();
      if ((options.targetJDK >= ClassFileConstants.JDK1_2
          && (options.complianceLevel >= ClassFileConstants.JDK1_4 || (index < 0 ? fieldBinding != binding : index > 0) || this.indexOfFirstFieldBinding > 1 || !fieldBinding.isStatic())
          && fieldBinding.declaringClass.id != T_JavaLangObject) // no change for Object fields
        || !(useDelegate
            ? new CodeSnippetScope(currentScope).canBeSeenByForCodeSnippet(fieldBinding.declaringClass, (ReferenceBinding) this.delegateThis.type)
View Full Code Here

protected abstract char[] getClassName();
/**
* Creates and returns a compiler for this evaluator.
*/
Compiler getCompiler(ICompilerRequestor compilerRequestor) {
  CompilerOptions compilerOptions = new CompilerOptions(this.options);
  compilerOptions.performMethodsFullRecovery = true;
  compilerOptions.performStatementsRecovery = true;
  return new Compiler(
    this.environment,
    DefaultErrorHandlingPolicies.exitAfterAllProblems(),
View Full Code Here

  this.logger = new Logger(this, outWriter, errWriter);
  this.proceed = true;
  this.out = outWriter;
  this.err = errWriter;
  this.systemExitWhenFinished = systemExit;
  this.options = new CompilerOptions().getMap();
  if (customDefaultOptions != null) {
    this.didSpecifySource = customDefaultOptions.get(CompilerOptions.OPTION_Source) != null;
    this.didSpecifyTarget = customDefaultOptions.get(CompilerOptions.OPTION_TargetPlatform) != null;
    for (Iterator iter = customDefaultOptions.entrySet().iterator(); iter.hasNext();) {
      Map.Entry entry = (Map.Entry) iter.next();
View Full Code Here

public void performCompilation() throws InvalidInputException {

  this.startTime = System.currentTimeMillis();

  FileSystem environment = getLibraryAccess();
  this.compilerOptions = new CompilerOptions(this.options);
  this.compilerOptions.performMethodsFullRecovery = false;
  this.compilerOptions.performStatementsRecovery = false;
  this.batchCompiler =
    new Compiler(
      environment,
View Full Code Here

}
/**
* Creates a new parser.
*/
protected SourceElementParser getParser(Map settings) {
  return new SourceElementParser(this, new DefaultProblemFactory(), new CompilerOptions(settings), false/*don't report local declarations*/, true/*optimize string literals*/);
}
 
View Full Code Here

        this.typeParameters[i].resolve(this.scope);
      }
    }
   
    // check @Override annotation
    final CompilerOptions compilerOptions = this.scope.compilerOptions();
    checkOverride: {
      if (this.binding == null) break checkOverride;
      long sourceLevel = compilerOptions.sourceLevel;
      if (sourceLevel < ClassFileConstants.JDK1_5) break checkOverride;
      int bindingModifiers = this.binding.modifiers;
      boolean hasOverrideAnnotation = (this.binding.tagBits & TagBits.AnnotationOverride) != 0;
      boolean isInterfaceMethod = this.binding.declaringClass.isInterface();
      if (hasOverrideAnnotation) {
        // no static method is considered overriding
        if (!isInterfaceMethod && (bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding)
          break checkOverride;
        //  in 1.5, strictly for overriding superclass method
        //  in 1.6 and above, also tolerate implementing interface method
        if (sourceLevel >= ClassFileConstants.JDK1_6
            && ((bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccImplementing)) == ExtraCompilerModifiers.AccImplementing))
          break checkOverride;
        // claims to override, and doesn't actually do so
        this.scope.problemReporter().methodMustOverride(this);         
      } else if (!isInterfaceMethod  
            && (bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) {
        // actually overrides, but did not claim to do so
        this.scope.problemReporter().missingOverrideAnnotation(this);
      }
    }
       
    // by grammatical construction, interface methods are always abstract
    switch (TypeDeclaration.kind(this.scope.referenceType().modifiers)) {
      case TypeDeclaration.ENUM_DECL :
        if (this.selector == TypeConstants.VALUES) break;
        if (this.selector == TypeConstants.VALUEOF) break;
      case TypeDeclaration.CLASS_DECL :
        // if a method has an semicolon body and is not declared as abstract==>error
        // native methods may have a semicolon body
        if ((this.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0) {
          if ((this.modifiers & ClassFileConstants.AccNative) == 0)
            if ((this.modifiers & ClassFileConstants.AccAbstract) == 0)
              this.scope.problemReporter().methodNeedBody(this);
        } else {
          // the method HAS a body --> abstract native modifiers are forbiden
          if (((this.modifiers & ClassFileConstants.AccNative) != 0) || ((this.modifiers & ClassFileConstants.AccAbstract) != 0))
            this.scope.problemReporter().methodNeedingNoBody(this);
        }
    }
    super.resolveStatements();
   
    // TagBits.OverridingMethodWithSupercall is set during the resolveStatements() call
    if (compilerOptions.getSeverity(CompilerOptions.OverridingMethodWithoutSuperInvocation) != ProblemSeverities.Ignore) {
      if (this.binding != null) {
            int bindingModifiers = this.binding.modifiers;
            if ((bindingModifiers & (ExtraCompilerModifiers.AccOverriding|ExtraCompilerModifiers.AccImplementing)) == ExtraCompilerModifiers.AccOverriding
                && (this.bits & ASTNode.OverridingMethodWithSupercall) == 0) {
              this.scope.problemReporter().overridesMethodWithoutSuperInvocation(this.binding);
View Full Code Here

TOP

Related Classes of org.aspectj.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.