Example usage for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment getTypeFromCompoundName

List of usage examples for org.eclipse.jdt.internal.compiler.lookup LookupEnvironment getTypeFromCompoundName

Introduction

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

Prototype

private ReferenceBinding getTypeFromCompoundName(char[][] compoundName, boolean isParameterized,
            boolean wasMissingType) 

Source Link

Usage

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

License:Open Source License

/**
 * Evaluate class level attribute(s).//from www  . ja v  a 2s  . co  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;
            }
        }
    }
}