Example usage for org.eclipse.jdt.internal.compiler.lookup Binding INTERSECTION_TYPE18

List of usage examples for org.eclipse.jdt.internal.compiler.lookup Binding INTERSECTION_TYPE18

Introduction

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

Prototype

int INTERSECTION_TYPE18

To view the source code for org.eclipse.jdt.internal.compiler.lookup Binding INTERSECTION_TYPE18.

Click Source Link

Usage

From source file:org.eclipse.objectteams.otdt.internal.core.compiler.model.TypeModel.java

License:Open Source License

/**
 * Get all members which are not roles represented by their TypeModel.
 * Considers Ast or Bindings, whatever is more appropriate.
 * Note, that members could again be teams.
 *
 * @returns all non-role members for this Team.
 *///from ww  w  .  j av a 2 s  .  co m
public TypeModel[] getMembers() {
    List<TypeModel> list = new LinkedList<TypeModel>();

    if (this._ast == null) {
        if (this._binding.kind() == Binding.TYPE_PARAMETER || this._binding.kind() == Binding.WILDCARD_TYPE
                || this._binding.kind() == Binding.INTERSECTION_TYPE
                || this._binding.kind() == Binding.INTERSECTION_TYPE18)
            return new TypeModel[0]; // has no members
        //binary type
        assert this._binding.isBinaryBinding();
        // don't used memberTypes() as not to trigger resolving unneeded members.
        // see tests.compiler.regegression.LookupTest.test044
        ReferenceBinding[] memberBindings = ((BinaryTypeBinding) this._binding).unresolvedMemberTypes();
        for (int i = 0; i < memberBindings.length; i++) {
            ReferenceBinding binding = memberBindings[i];
            if (binding instanceof UnresolvedReferenceBinding)
                continue; // has no model yet cannot handle yet.
            if (binding.isTeam())
                list.add(binding.getTeamModel());
            else
                list.add(binding.model);
        }
    } else {
        TypeDeclaration[] members = this._ast.memberTypes;
        if (members != null) {
            for (int idx = 0; idx < members.length; idx++) {
                TypeDeclaration decl = members[idx];
                if (decl.isTeam())
                    list.add(decl.getTeamModel());
                else if (decl.isRole())
                    list.add(decl.getRoleModel());
                else
                    list.add(decl.getModel());
            }
        }

        AbstractMethodDeclaration[] methods = this._ast.methods;
        if (methods != null) {
            for (int i = 0; i < methods.length; i++) {
                if (methods[i].scope != null) {
                    ClassScope[] scopes = methods[i].scope.getAllLocalTypes();
                    for (int j = 0; j < scopes.length; j++) {
                        TypeDeclaration type = scopes[j].referenceContext;
                        if (type.isTeam()) // very unlikely ;-)
                            list.add(type.getTeamModel());
                        else if (type.isRole())
                            list.add(type.getRoleModel());
                        else
                            list.add(type.getModel());
                    }
                }
                // no scope could mean:
                // 1. it's a <clinit>
                // 2. we are before scope creation
                //    (which happens in completeTypeBindings(), last step of beginToCompile).
                // This is ok, since then we only miss step RoleSplitter, but local types
                // cannot be teams with roles anyway.
            }
        }
    }
    return list.toArray(new TypeModel[list.size()]);
}