Example usage for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccOverriding

List of usage examples for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccOverriding

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccOverriding.

Prototype

int AccOverriding

To view the source code for org.eclipse.jdt.internal.compiler.lookup ExtraCompilerModifiers AccOverriding.

Click Source Link

Usage

From source file:org.eclipse.jdt.internal.compiler.lookup.MethodVerifier15.java

License:Open Source License

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;/*from   www  .j  a v a 2 s  . c  o  m*/
    }
    /* 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);
                        }
                    }
                }
            }
        }
    }
}

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.bytecode.WordValueAttribute.java

License:Open Source License

/**
 * Evaluate class level attribute(s)./*from w  ww  .j a v a  2 s.  c  o  m*/
 */
public void evaluate(Binding binding, LookupEnvironment environment, char[][][] missingTypeNames) {
    if (CharOperation.equals(this._name, OT_CLASS_FLAGS)) {
        checkBindingMismatch(binding, 0);
        BinaryTypeBinding type = (BinaryTypeBinding) binding;
        if ((this._value & OT_CLASS_ROLE) != 0)
            type.modifiers |= ExtraCompilerModifiers.AccRole;
        if ((this._value & OT_CLASS_TEAM) != 0)
            type.modifiers |= ClassFileConstants.AccTeam;
        if ((this._value & OT_CLASS_FLAG_HAS_TSUPER) != 0)
            type.modifiers |= ExtraCompilerModifiers.AccOverriding;
        if ((this._value & OT_CLASS_ROLE_LOCAL) != 0)
            type.setIsRoleLocal();
        if ((this._value & (OT_CLASS_ROLE_FILE | OT_CLASS_PURELY_COPIED)) != 0)
            type.roleModel.setExtraRoleFlags(this._value & (OT_CLASS_ROLE_FILE | OT_CLASS_PURELY_COPIED));
        if ((this._value & OT_CLASS_CONFINED) != 0) {
            boolean wasMissingType = false;
            if (missingTypeNames != null) {
                for (int i = 0, max = missingTypeNames.length; i < max; i++) {
                    if (CharOperation.equals(IOTConstants.ORG_OBJECTTEAMS_TEAM_OTCONFINED,
                            missingTypeNames[i])) {
                        wasMissingType = true;
                        break;
                    }
                }
            }
            ReferenceBinding superclass = environment.getTypeFromCompoundName(
                    IOTConstants.ORG_OBJECTTEAMS_TEAM_OTCONFINED, false, wasMissingType);
            if (superclass instanceof UnresolvedReferenceBinding)
                superclass = ((UnresolvedReferenceBinding) superclass).resolve(environment, false);
            type.resetSuperclass(superclass);
        }
        // TODO (SH): might also need to compute type.enclosingType from its name.
        // TODO(SH): not yet evaluated: purely-copied, rolefile. Do we need to?
    } else if (CharOperation.equals(this._name, IOTConstants.OT_COMPILER_VERSION)) {
        checkBindingMismatch(binding, 0);
        BinaryTypeBinding type = (BinaryTypeBinding) binding;
        if (type.isRole())
            type.roleModel._compilerVersion = this._value;
        if (type.isTeam())
            type.getTeamModel()._compilerVersion = this._value;
        if (this._value < IOTConstants.OTVersion.getCompilerVersionMin())
            environment.problemReporter.incompatibleOTJByteCodeVersion(
                    ((BinaryTypeBinding) binding).getFileName(), getBytecodeVersionString(this._value));
        if ((type.isRole() || type.isTeam())
                && !CharOperation.equals(type.getPackage().compoundName, IOTConstants.ORG_OBJECTTEAMS)
                && !TypeAnalyzer.isPredefinedRole(type) && !TSuperHelper.isMarkerInterface(type)) {
            switch (environment.globalOptions.weavingScheme) {
            case OTRE:
                if ((this._value & OTDRE_FLAG) != 0)
                    environment.problemReporter.incompatibleWeavingScheme(type, WeavingScheme.OTDRE);
                break;
            case OTDRE:
                if ((this._value & OTDRE_FLAG) == 0)
                    environment.problemReporter.incompatibleWeavingScheme(type, WeavingScheme.OTRE);
                break;
            }
        }
    }
}

From source file:org.eclipse.objectteams.otdt.internal.core.RoleType.java

License:Open Source License

public IType[] getTSuperRoles() throws JavaModelException {
    ArrayList<IType> tsuperRoles = new ArrayList<IType>();
    IOTType teamType = getTeam();//  w  w  w  .j  a v a 2s  . com
    if (teamType == null)
        throw new JavaModelException(new JavaModelStatus(IStatus.ERROR, "Enclosing team not found for " //$NON-NLS-1$
                + this.getElementName() + " perhaps this element is not on the build path?")); //$NON-NLS-1$
    String superteamName = teamType.getSuperclassName();
    if (superteamName != null) {
        if (superteamName.indexOf('.') != -1) {
            // have qualifed super team name, find it directly:
            IType superTeam = getJavaProject().findType(superteamName);
            if (superTeam != null) {
                IType tsuperRole = superTeam.getType(getElementName());
                if (tsuperRole != null && tsuperRole.exists()) {
                    this.flags |= ExtraCompilerModifiers.AccOverriding;
                    tsuperRoles.add(tsuperRole);
                }
            }
        } else {
            // only have a simply super team name, resolve it now:
            String[][] resolvedSuperTeams = teamType.resolveType(superteamName);
            if (resolvedSuperTeams != null)
                for (String[] resolvedSuperTeam : resolvedSuperTeams)
                    checkAddTSuperRole(resolvedSuperTeam[0] + '.' + resolvedSuperTeam[1], tsuperRoles);
        }
    }
    // no direct tsuper, search in tsuper-team if some exist:
    if (teamType.isRole())
        for (IType tsuperTeam : ((IRoleType) teamType).getTSuperRoles())
            checkAddTSuperRole(tsuperTeam.getFullyQualifiedName('.'), tsuperRoles);
    return tsuperRoles.toArray(new IType[tsuperRoles.size()]);
}

From source file:org.eclipse.objectteams.otdt.internal.core.RoleType.java

License:Open Source License

private void checkAddTSuperRole(String qualifiedTeamName, ArrayList<IType> tsuperRoles)
        throws JavaModelException {
    IType tsuperRole = getJavaProject().findType(qualifiedTeamName + '.' + getElementName());
    if (tsuperRole != null) {
        // in case the client was only interested in the fact that we have a tsuper role
        // store this flag to avoid duplicate search for tsuper roles:
        this.flags |= ExtraCompilerModifiers.AccOverriding;
        tsuperRoles.add(tsuperRole);/*w ww  .ja  va 2  s  .c  o  m*/
    }
}