use of org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.MemberInterfaceImpl in project ceylon by eclipse.
the class ClassOrInterfaceImpl method applyClassOrInterface.
@SuppressWarnings("rawtypes")
private <Container, Kind extends ceylon.language.meta.model.ClassOrInterface<?>> ceylon.language.meta.model.Member<Container, Kind> applyClassOrInterface(@Ignore TypeDescriptor $reifiedContainer, @Ignore TypeDescriptor $reifiedKind, ClassOrInterfaceDeclarationImpl type, Sequential<? extends ceylon.language.meta.model.Type<?>> types) {
if (type == null)
return null;
ceylon.language.meta.model.Type<Container> appliedContainer = getAppliedContainer($reifiedContainer, type);
Member<Container, Kind> member = type.getAppliedClassOrInterface(this.$reifiedType, $reifiedKind, types, appliedContainer);
// This is all very ugly but we're trying to make it cheaper and friendlier than just checking the full type and showing
// implementation types to the user, such as AppliedMemberClass
TypeDescriptor actualReifiedContainer;
TypeDescriptor actualKind;
if (member instanceof MemberClassImpl) {
actualReifiedContainer = ((MemberClassImpl) member).$reifiedContainer;
actualKind = TypeDescriptor.klass(ceylon.language.meta.model.Class.class, ((MemberClassImpl) member).$reifiedType, ((MemberClassImpl) member).$reifiedArguments);
} else {
actualReifiedContainer = ((MemberInterfaceImpl) member).$reifiedContainer;
actualKind = TypeDescriptor.klass(ceylon.language.meta.model.Interface.class, ((MemberInterfaceImpl) member).$reifiedType);
}
Metamodel.checkReifiedTypeArgument("getClassOrInterface", "Member<$1,$2>&$2", Variance.IN, Metamodel.getProducedType(actualReifiedContainer), $reifiedContainer, Variance.OUT, Metamodel.getProducedType(actualKind), $reifiedKind);
return member;
}
use of org.eclipse.ceylon.compiler.java.runtime.metamodel.meta.MemberInterfaceImpl in project ceylon by eclipse.
the class ClassOrInterfaceDeclarationImpl method memberApply.
@SuppressWarnings("rawtypes")
@TypeInfo("ceylon.language.meta.model::Member<Container,ceylon.language.meta.model::ClassOrInterface<Type>>&ceylon.language.meta.model::ClassOrInterface<Type>")
@TypeParameters({ @TypeParameter("Container"), @TypeParameter("Type") })
@Override
public <Container, Type extends Object> java.lang.Object memberApply(@Ignore TypeDescriptor $reifiedContainer, @Ignore TypeDescriptor $reifiedType, @Name("containerType") ceylon.language.meta.model.Type<? extends Object> containerType, @Name("typeArguments") @Sequenced Sequential<? extends ceylon.language.meta.model.Type<?>> typeArguments) {
if (getToplevel())
throw new ceylon.language.meta.model.TypeApplicationException("Cannot apply a toplevel declaration to a container type: use apply");
ceylon.language.meta.model.Member<? extends Container, ceylon.language.meta.model.ClassOrInterface<?>> member = getAppliedClassOrInterface(null, null, typeArguments, containerType);
// This is all very ugly but we're trying to make it cheaper and friendlier than just checking the full type and showing
// implementation types to the user, such as AppliedMemberClass
TypeDescriptor actualReifiedContainer;
if (member instanceof MemberClassImpl)
actualReifiedContainer = ((MemberClassImpl) member).$reifiedContainer;
else
actualReifiedContainer = ((MemberInterfaceImpl) member).$reifiedContainer;
org.eclipse.ceylon.model.typechecker.model.Type actualType = Metamodel.getModel((ceylon.language.meta.model.Type<?>) member);
Metamodel.checkReifiedTypeArgument("memberApply", "Member<$1,ClassOrInterface<$2>>&ClassOrInterface<$2>", Variance.IN, Metamodel.getProducedType(actualReifiedContainer), $reifiedContainer, Variance.OUT, actualType, $reifiedType);
return member;
}
Aggregations