Search in sources :

Example 51 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class TMemberEntry method toString.

@Override
public String toString() {
    String pre = (_static ? "static " : "") + name + ": {";
    List<String> out = new ArrayList<>(8);
    for (int i = 0; i < 4; i++) {
        TMember m = members[i];
        if (m != null) {
            out.add(m.eClass().getName());
        }
        if (i != FIELD) {
            m = members[i + ABSTRACT_OFFSET];
            if (m != null) {
                out.add("a." + m.eClass().getName());
            }
        }
    }
    return pre + Joiner.on(", ").join(out) + "}";
}
Also used : ArrayList(java.util.ArrayList) TMember(org.eclipse.n4js.ts.types.TMember)

Example 52 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4JSMemberRedefinitionValidator method addIssueToMemberOrInterfaceReference.

private void addIssueToMemberOrInterfaceReference(RedefinitionType redefinitionType, TMember overriding, TMember implemented, String message, String issueCode, String... issueData) {
    if (redefinitionType == RedefinitionType.overridden && overriding.getContainingType() != getCurrentClassifier()) {
        throw new IllegalStateException("must not happen as member is not consumed");
    }
    TClassifier currentClassifier = getCurrentClassifier();
    if (overriding.getContainingType() == currentClassifier) {
        addIssue(message, overriding.getAstElement(), N4JSPackage.Literals.PROPERTY_NAME_OWNER__DECLARED_NAME, issueCode, issueData);
    } else {
        MemberCollector memberCollector = containerTypesHelper.fromContext(getCurrentClassifierDefinition());
        ContainerType<?> bequestingType = memberCollector.directSuperTypeBequestingMember(currentClassifier, implemented);
        Optional<ParameterizedTypeRef> optRef = StreamSupport.stream(getCurrentClassifierDefinition().getImplementedOrExtendedInterfaceRefs().spliterator(), false).filter(ref -> ref.getDeclaredType() == bequestingType).findAny();
        ParameterizedTypeRef ref = optRef.get();
        EStructuralFeature feature = ref.eContainingFeature();
        List<?> list = (List<?>) getCurrentClassifierDefinition().eGet(feature);
        int index = list.indexOf(ref);
        addIssue(message, getCurrentClassifierDefinition(), feature, index, issueCode, issueData);
    }
}
Also used : TClassifier(org.eclipse.n4js.ts.types.TClassifier) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) IssueCodes.getMessageForCLF_REDEFINED_NON_ACCESSIBLE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_REDEFINED_NON_ACCESSIBLE) CLF_CONSUMED_INHERITED_MEMBER_UNSOLVABLE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.CLF_CONSUMED_INHERITED_MEMBER_UNSOLVABLE_CONFLICT) TClass(org.eclipse.n4js.ts.types.TClass) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) IssueCodes.getMessageForCLF_OVERRIDE_FINAL(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_FINAL) TSetter(org.eclipse.n4js.ts.types.TSetter) IssueCodes.getMessageForCLF_IMPLEMENT_MEMBERTYPE_INCOMPATIBLE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_IMPLEMENT_MEMBERTYPE_INCOMPATIBLE) IssueCodes.getMessageForCLF_MISSING_IMPLEMENTATION(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_MISSING_IMPLEMENTATION) IssueCodes.getMessageForCLF_OVERRIDE_VISIBILITY(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_VISIBILITY) Type(org.eclipse.n4js.ts.types.Type) IssueCodes.getMessageForCLF_OVERRIDE_CONST(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_CONST) Map(java.util.Map) CLF_PSEUDO_REDEFINED_SPEC_CTOR_INCOMPATIBLE(org.eclipse.n4js.validation.IssueCodes.CLF_PSEUDO_REDEFINED_SPEC_CTOR_INCOMPATIBLE) IssueUserDataKeys(org.eclipse.n4js.validation.IssueUserDataKeys) Check(org.eclipse.xtext.validation.Check) CLF_CONSUMED_FIELD_ACCESSOR_PAIR_INCOMPLETE(org.eclipse.n4js.validation.IssueCodes.CLF_CONSUMED_FIELD_ACCESSOR_PAIR_INCOMPLETE) CLF_OVERRIDE_ANNOTATION(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_ANNOTATION) CLF_OVERRIDE_MEMBERTYPE_INCOMPATIBLE(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_MEMBERTYPE_INCOMPATIBLE) IssueCodes.getMessageForCLF_OVERRIDE_WITH_FINAL_OR_CONST_FIELD(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_WITH_FINAL_OR_CONST_FIELD) CLF_REDEFINED_TYPE_NOT_SAME_TYPE(org.eclipse.n4js.validation.IssueCodes.CLF_REDEFINED_TYPE_NOT_SAME_TYPE) IssueCodes.getMessageForCLF_OVERRIDE_FIELD_REQUIRES_ACCESSOR_PAIR(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_FIELD_REQUIRES_ACCESSOR_PAIR) CLF_NON_ACCESSIBLE_ABSTRACT_MEMBERS(org.eclipse.n4js.validation.IssueCodes.CLF_NON_ACCESSIBLE_ABSTRACT_MEMBERS) Set(java.util.Set) CLF_REDEFINED_METHOD_TYPE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.CLF_REDEFINED_METHOD_TYPE_CONFLICT) CLF_IMPLEMENT_MEMBERTYPE_INCOMPATIBLE(org.eclipse.n4js.validation.IssueCodes.CLF_IMPLEMENT_MEMBERTYPE_INCOMPATIBLE) N4ClassifierDefinition(org.eclipse.n4js.n4JS.N4ClassifierDefinition) MethodDeclaration(org.eclipse.n4js.n4JS.MethodDeclaration) CLF_OVERRIDE_FINAL(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_FINAL) Iterables(com.google.common.collect.Iterables) MemberType(org.eclipse.n4js.ts.types.MemberType) MemberAccessModifier(org.eclipse.n4js.ts.types.MemberAccessModifier) IssueCodes.getMessageForCLF_OVERRIDEN_CONCRETE_WITH_ABSTRACT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDEN_CONCRETE_WITH_ABSTRACT) TypeUtils(org.eclipse.n4js.ts.utils.TypeUtils) ArrayList(java.util.ArrayList) TModule(org.eclipse.n4js.ts.types.TModule) TypeSystemHelper(org.eclipse.n4js.typesystem.TypeSystemHelper) RuleEnvironmentExtensions(org.eclipse.n4js.typesystem.RuleEnvironmentExtensions) TInterface(org.eclipse.n4js.ts.types.TInterface) MemberMatrix(org.eclipse.n4js.validation.validators.utils.MemberMatrix) IssueCodes.getMessageForCLF_OVERRIDE_NON_EXISTENT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_NON_EXISTENT) MemberVisibilityChecker(org.eclipse.n4js.scoping.accessModifiers.MemberVisibilityChecker) AbstractN4JSDeclarativeValidator(org.eclipse.n4js.validation.AbstractN4JSDeclarativeValidator) StreamSupport(java.util.stream.StreamSupport) CLF_OVERRIDE_NON_EXISTENT(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_NON_EXISTENT) IssueCodes.getMessageForCLF_OVERRIDE_MEMBERTYPE_INCOMPATIBLE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_MEMBERTYPE_INCOMPATIBLE) N4JSLanguageUtils(org.eclipse.n4js.utils.N4JSLanguageUtils) EcoreUtil(org.eclipse.emf.ecore.util.EcoreUtil) NameStaticPair(org.eclipse.n4js.ts.types.util.NameStaticPair) FunctionTypeExprOrRef(org.eclipse.n4js.ts.typeRefs.FunctionTypeExprOrRef) IssueCodes.getMessageForCLF_OVERRIDE_NON_EXISTENT_INTERFACE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_NON_EXISTENT_INTERFACE) N4JSTypeSystem(org.eclipse.n4js.typesystem.N4JSTypeSystem) FunctionTypeExpression(org.eclipse.n4js.ts.typeRefs.FunctionTypeExpression) IssueCodes.getMessageForCLF_UNMATCHED_ACCESSOR_OVERRIDE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_UNMATCHED_ACCESSOR_OVERRIDE) IssueCodes.getMessageForCLF_NON_ACCESSIBLE_ABSTRACT_MEMBERS(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_NON_ACCESSIBLE_ABSTRACT_MEMBERS) Arrays(org.eclipse.xtext.util.Arrays) RuleEnvironment(org.eclipse.xsemantics.runtime.RuleEnvironment) SourceAwareIterator(org.eclipse.n4js.validation.validators.utils.MemberMatrix.SourceAwareIterator) Inject(com.google.inject.Inject) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) ContainerType(org.eclipse.n4js.ts.types.ContainerType) IssueCodes.getMessageForCLF_REDEFINED_MEMBER_TYPE_INVALID(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_REDEFINED_MEMBER_TYPE_INVALID) IssueCodes.getMessageForCLF_OVERRIDE_ANNOTATION(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_OVERRIDE_ANNOTATION) CLF_OVERRIDE_FIELD_REQUIRES_ACCESSOR_PAIR(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_FIELD_REQUIRES_ACCESSOR_PAIR) CLF_MISSING_IMPLEMENTATION(org.eclipse.n4js.validation.IssueCodes.CLF_MISSING_IMPLEMENTATION) CLF_OVERRIDE_VISIBILITY(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_VISIBILITY) MemberList(org.eclipse.n4js.ts.types.util.MemberList) N4InterfaceDeclaration(org.eclipse.n4js.n4JS.N4InterfaceDeclaration) TypeRef(org.eclipse.n4js.ts.typeRefs.TypeRef) N4ClassDefinition(org.eclipse.n4js.n4JS.N4ClassDefinition) IssueCodes.getMessageForCLF_CONSUMED_FIELD_ACCESSOR_PAIR_INCOMPLETE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_CONSUMED_FIELD_ACCESSOR_PAIR_INCOMPLETE) TField(org.eclipse.n4js.ts.types.TField) Collection(java.util.Collection) IssueCodes.getMessageForCLF_MISSING_IMPLEMENTATION_EXT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_MISSING_IMPLEMENTATION_EXT) JavaScriptVariantHelper(org.eclipse.n4js.validation.JavaScriptVariantHelper) IssueCodes.getMessageForCLF_PSEUDO_REDEFINED_SPEC_CTOR_INCOMPATIBLE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_PSEUDO_REDEFINED_SPEC_CTOR_INCOMPATIBLE) EObject(org.eclipse.emf.ecore.EObject) TMethod(org.eclipse.n4js.ts.types.TMethod) Collectors(java.util.stream.Collectors) List(java.util.List) TClassifier(org.eclipse.n4js.ts.types.TClassifier) IssueCodes.getMessageForCLF_UNMATCHED_ACCESSOR_OVERRIDE_JS(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_UNMATCHED_ACCESSOR_OVERRIDE_JS) Entry(java.util.Map.Entry) Resource(org.eclipse.emf.ecore.resource.Resource) CLF_OVERRIDE_CONST(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_CONST) Optional(java.util.Optional) MemberRedefinitionUtils(org.eclipse.n4js.validation.validators.utils.MemberRedefinitionUtils) IssueCodes.getMessageForCLF_REDEFINED_TYPE_NOT_SAME_TYPE(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_REDEFINED_TYPE_NOT_SAME_TYPE) HashMap(java.util.HashMap) N4JSPackage(org.eclipse.n4js.n4JS.N4JSPackage) CLF_OVERRIDE_NON_EXISTENT_INTERFACE(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_NON_EXISTENT_INTERFACE) CLF_UNMATCHED_ACCESSOR_OVERRIDE(org.eclipse.n4js.validation.IssueCodes.CLF_UNMATCHED_ACCESSOR_OVERRIDE) FieldAccessor(org.eclipse.n4js.ts.types.FieldAccessor) Iterators(com.google.common.collect.Iterators) HashSet(java.util.HashSet) IssueCodes.getMessageForCLF_CONSUMED_MEMBER_SOLVABLE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_CONSUMED_MEMBER_SOLVABLE_CONFLICT) ContainerTypesHelper(org.eclipse.n4js.utils.ContainerTypesHelper) EcoreUtil2(org.eclipse.xtext.EcoreUtil2) IssueCodes.getMessageForCLF_REDEFINED_METHOD_TYPE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_REDEFINED_METHOD_TYPE_CONFLICT) CLF_MISSING_IMPLEMENTATION_EXT(org.eclipse.n4js.validation.IssueCodes.CLF_MISSING_IMPLEMENTATION_EXT) MemberCube(org.eclipse.n4js.validation.validators.utils.MemberCube) MemberCollector(org.eclipse.n4js.utils.ContainerTypesHelper.MemberCollector) IssueCodes.getMessageForCLF_CONSUMED_MEMBER_UNSOLVABLE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_CONSUMED_MEMBER_UNSOLVABLE_CONFLICT) CLF_OVERRIDEN_CONCRETE_WITH_ABSTRACT(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDEN_CONCRETE_WITH_ABSTRACT) Result(org.eclipse.xsemantics.runtime.Result) TMember(org.eclipse.n4js.ts.types.TMember) CLF_CONSUMED_MEMBER_UNSOLVABLE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.CLF_CONSUMED_MEMBER_UNSOLVABLE_CONFLICT) IssueCodes.getMessageForCLF_CONSUMED_INHERITED_MEMBER_UNSOLVABLE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.getMessageForCLF_CONSUMED_INHERITED_MEMBER_UNSOLVABLE_CONFLICT) CLF_REDEFINED_MEMBER_TYPE_INVALID(org.eclipse.n4js.validation.IssueCodes.CLF_REDEFINED_MEMBER_TYPE_INVALID) CLF_OVERRIDE_WITH_FINAL_OR_CONST_FIELD(org.eclipse.n4js.validation.IssueCodes.CLF_OVERRIDE_WITH_FINAL_OR_CONST_FIELD) AccessModifiers(org.eclipse.n4js.ts.types.util.AccessModifiers) CLF_CONSUMED_MEMBER_SOLVABLE_CONFLICT(org.eclipse.n4js.validation.IssueCodes.CLF_CONSUMED_MEMBER_SOLVABLE_CONFLICT) CLF_REDEFINED_NON_ACCESSIBLE(org.eclipse.n4js.validation.IssueCodes.CLF_REDEFINED_NON_ACCESSIBLE) EValidatorRegistrar(org.eclipse.xtext.validation.EValidatorRegistrar) CLF_UNMATCHED_ACCESSOR_OVERRIDE_JS(org.eclipse.n4js.validation.IssueCodes.CLF_UNMATCHED_ACCESSOR_OVERRIDE_JS) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature) ArrayList(java.util.ArrayList) MemberList(org.eclipse.n4js.ts.types.util.MemberList) List(java.util.List) MemberCollector(org.eclipse.n4js.utils.ContainerTypesHelper.MemberCollector)

Example 53 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4JSMemberRedefinitionValidator method constraints_60_InheritedConsumedCovariantSpecConstructor.

/**
 * Checks a certain special case of Constraints 60 related to &#64;Spec constructors: if the classifier being
 * validated does *not* have an owned constructor, normally nothing would be checked; in case of &#64;Spec
 * constructors, however, we have to check that the inherited/consumed constructor (if any) is compatible to itself
 * within the classifier being validated:
 *
 * <pre>
 * class C {
 *     &#64;CovariantConstructor constructor(&#64;Spec spec: ~i~this) {}
 * }
 * class D { // &lt;-- must show error here, because inherited &#64;Spec constructor not compatible to itself
 *     public badField;
 * }
 * </pre>
 */
private boolean constraints_60_InheritedConsumedCovariantSpecConstructor(TClassifier tClassifier, MemberMatrix mm) {
    boolean isValid = true;
    if (!mm.hasOwned()) {
        final TMember firstInherited = mm.hasInherited() ? mm.inherited().iterator().next() : null;
        if (firstInherited instanceof TMethod && firstInherited.isConstructor() && isCovarianceForConstructorsRequired(tClassifier, firstInherited)) {
            isValid &= checkSpecConstructorOverrideCompatibility(tClassifier, (TMethod) firstInherited);
        }
        final TMember firstImplemented = mm.hasImplemented() ? mm.implemented().iterator().next() : null;
        if (firstImplemented instanceof TMethod && firstImplemented.isConstructor() && isCovarianceForConstructorsRequired(tClassifier, firstImplemented)) {
            isValid &= checkSpecConstructorOverrideCompatibility(tClassifier, (TMethod) firstImplemented);
        }
    }
    return isValid;
}
Also used : TMethod(org.eclipse.n4js.ts.types.TMethod) TMember(org.eclipse.n4js.ts.types.TMember)

Example 54 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4JSMemberRedefinitionValidator method constraints_69_Implementation.

/**
 * Constraints 69: Implementation of Interface Members
 *
 * This method doesn't add issues for missing override annotations but adds the missing-annotation-members to the
 * given collection.
 */
private void constraints_69_Implementation(MemberMatrix mm, Collection<TMember> membersMissingOverrideAnnotation) {
    String missingAccessor = null;
    List<TMember> missingAccessors = new MemberList<>();
    List<TMember> conflictingMembers = new MemberList<>();
    TClassifier currentClassifier = getCurrentClassifier();
    // avoid multiple errors on a single element (but not on
    Set<TMember> ownedErroneousMembers = null;
    for (TMember m : mm.implemented()) {
        if (mm.isConsumed(m)) {
            // m is mixed in, so it exits and we do not need other tests
            continue;
        }
        boolean bExistCompatibleMember = false;
        boolean bExistCompatibleGetter = false;
        boolean bExistCompatibleSetter = false;
        for (SourceAwareIterator iter = mm.ownedConsumedInheritedImplemented(); iter.hasNext(); ) {
            TMember m_ = iter.next();
            if (ownedErroneousMembers != null && !iter.isOwnedMember()) {
                // we found problems with owned members, we do not need more error messages.
                break;
            }
            // short cut and avoid multiple errors for single member
            if (m_ == m || ownedErroneousMembers != null && ownedErroneousMembers.contains(m_)) {
                if (iter.isInheritedMember()) {
                    // consumed by super class and then inherited
                    bExistCompatibleMember = true;
                }
                // we do not break since we want to find possible consumption problems
                continue;
            }
            // 1. m must be accessible and
            // 2.a & 2.b: m_ must be implementation-compatible to m
            OverrideCompatibilityResult compatibility = checkAccessibilityAndOverrideCompatibility(RedefinitionType.implemented, m_, m, !iter.isActualMember(), mm);
            if (compatibility == OverrideCompatibilityResult.ACCESSOR_PAIR) {
                continue;
            } else if (compatibility == OverrideCompatibilityResult.ERROR) {
                if (iter.isOwnedMember()) {
                    // do not skip other errors for owned members, usually accessor pairs
                    if (ownedErroneousMembers == null) {
                        ownedErroneousMembers = new HashSet<>();
                    }
                    ownedErroneousMembers.add(m_);
                } else if (iter.isActualMember()) {
                    // error message already
                    return;
                } else {
                    break;
                }
            } else if (iter.isActualMember()) {
                // mark found implementor
                if (m.isField()) {
                    if (m_.isGetter()) {
                        bExistCompatibleGetter = true;
                    } else if (m_.isSetter()) {
                        bExistCompatibleSetter = true;
                    } else {
                        bExistCompatibleMember = true;
                    }
                } else {
                    bExistCompatibleMember = true;
                }
                // 1 & 2 declared overridden
                if (!m_.isDeclaredOverride() && m_.getContainingType() == currentClassifier) {
                    membersMissingOverrideAnnotation.add(m_);
                }
            }
        }
        if (bExistCompatibleGetter != bExistCompatibleSetter) {
            missingAccessor = bExistCompatibleGetter ? "setter" : "getter";
            missingAccessors.add(m);
        } else if (!bExistCompatibleMember && !(bExistCompatibleGetter && bExistCompatibleSetter)) {
            conflictingMembers.add(m);
        }
    }
    if (ownedErroneousMembers != null) {
        // avoid consequential errors
        return;
    }
    if (!conflictingMembers.isEmpty()) {
        messageConflictingMixins(conflictingMembers);
    } else if (!missingAccessors.isEmpty()) {
        messageMissingAccessor(missingAccessor, missingAccessors);
    }
}
Also used : TClassifier(org.eclipse.n4js.ts.types.TClassifier) MemberList(org.eclipse.n4js.ts.types.util.MemberList) SourceAwareIterator(org.eclipse.n4js.validation.validators.utils.MemberMatrix.SourceAwareIterator) TMember(org.eclipse.n4js.ts.types.TMember) HashSet(java.util.HashSet)

Example 55 with TMember

use of org.eclipse.n4js.ts.types.TMember in project n4js by eclipse.

the class N4JSMemberRedefinitionValidator method constraints_42_45_46_AbstractMember.

/**
 * Constraints 42, 3 (Abstract Member)<br>
 * Constraints 45, 4 (Extending Interfaces)<br>
 * Constraints 46, 5 (Implementing Interfaces)
 *
 * This method doesn't add issues for missing override annotations but adds the missing-annotation-members to the
 * given collection.
 */
private void constraints_42_45_46_AbstractMember(MemberMatrix mm, Map<ParameterizedTypeRef, MemberList<TMember>> nonAccessibleAbstractMembersBySuperTypeRef) {
    N4ClassifierDefinition classifierDefinition = getCurrentClassifierDefinition();
    TClassifier classifier = getCurrentClassifier();
    TModule contextModule = EcoreUtil2.getContainerOfType(classifier, TModule.class);
    for (SourceAwareIterator iter = mm.allMembers(); iter.hasNext(); ) {
        TMember m = iter.next();
        if (!iter.isOwnedMember() && m.isAbstract()) {
            if (!memberVisibilityChecker.isVisibleWhenOverriding(contextModule, classifier, classifier, m)) {
                Iterable<ParameterizedTypeRef> superTypeRefs = FindClassifierInHierarchyUtils.findSuperTypesWithMember(classifierDefinition, m);
                for (ParameterizedTypeRef superTypeRef : superTypeRefs) {
                    MemberList<TMember> nonAccessible = nonAccessibleAbstractMembersBySuperTypeRef.get(superTypeRef);
                    if (nonAccessible == null) {
                        nonAccessible = new MemberList<>();
                        nonAccessibleAbstractMembersBySuperTypeRef.put(superTypeRef, nonAccessible);
                    }
                    nonAccessible.add(m);
                }
            }
        }
    }
}
Also used : TClassifier(org.eclipse.n4js.ts.types.TClassifier) ParameterizedTypeRef(org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef) N4ClassifierDefinition(org.eclipse.n4js.n4JS.N4ClassifierDefinition) SourceAwareIterator(org.eclipse.n4js.validation.validators.utils.MemberMatrix.SourceAwareIterator) TModule(org.eclipse.n4js.ts.types.TModule) TMember(org.eclipse.n4js.ts.types.TMember)

Aggregations

TMember (org.eclipse.n4js.ts.types.TMember)65 EObject (org.eclipse.emf.ecore.EObject)19 TClassifier (org.eclipse.n4js.ts.types.TClassifier)13 Type (org.eclipse.n4js.ts.types.Type)13 ContainerType (org.eclipse.n4js.ts.types.ContainerType)11 ArrayList (java.util.ArrayList)10 TClass (org.eclipse.n4js.ts.types.TClass)10 TField (org.eclipse.n4js.ts.types.TField)10 TMethod (org.eclipse.n4js.ts.types.TMethod)9 TModule (org.eclipse.n4js.ts.types.TModule)9 MemberList (org.eclipse.n4js.ts.types.util.MemberList)9 RuleEnvironment (org.eclipse.xsemantics.runtime.RuleEnvironment)9 HashSet (java.util.HashSet)8 HashMap (java.util.HashMap)7 NameStaticPair (org.eclipse.n4js.ts.types.util.NameStaticPair)7 MemberCollector (org.eclipse.n4js.utils.ContainerTypesHelper.MemberCollector)7 Optional (java.util.Optional)6 ParameterizedPropertyAccessExpression (org.eclipse.n4js.n4JS.ParameterizedPropertyAccessExpression)6 EcoreUtil2 (org.eclipse.xtext.EcoreUtil2)6 Inject (com.google.inject.Inject)5