use of org.eclipse.xtext.common.types.JvmType in project xtext-xtend by eclipse.
the class AbstractXtendOutlineTreeBuilder method buildInheritedMembers.
protected void buildInheritedMembers(final JvmDeclaredType inferredType, final IXtendOutlineContext context) {
ResourceSet _resourceSet = inferredType.eResource().getResourceSet();
final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, _resourceSet);
final LightweightTypeReference typeReference = owner.toLightweightTypeReference(inferredType);
final List<LightweightTypeReference> superTypes = typeReference.getAllSuperTypes();
IXtendOutlineContext superTypeContext = context;
for (final LightweightTypeReference superTypeRef : superTypes) {
{
superTypeContext = superTypeContext.increaseInheritanceDepth();
final ResolvedFeatures resolvedFeatures = new ResolvedFeatures(superTypeRef);
List<IResolvedField> _declaredFields = resolvedFeatures.getDeclaredFields();
for (final IResolvedField jvmField : _declaredFields) {
boolean _skipFeature = this.skipFeature(jvmField.getDeclaration());
boolean _not = (!_skipFeature);
if (_not) {
this.xtendOutlineNodeBuilder.buildResolvedFeatureNode(inferredType, jvmField, superTypeContext);
}
}
List<IResolvedConstructor> _declaredConstructors = resolvedFeatures.getDeclaredConstructors();
for (final IResolvedConstructor constructor : _declaredConstructors) {
boolean _skipFeature_1 = this.skipFeature(constructor.getDeclaration());
boolean _not_1 = (!_skipFeature_1);
if (_not_1) {
this.xtendOutlineNodeBuilder.buildResolvedFeatureNode(inferredType, constructor, superTypeContext);
}
}
List<IResolvedOperation> _declaredOperations = resolvedFeatures.getDeclaredOperations();
for (final IResolvedOperation operation : _declaredOperations) {
if (((!this.skipFeature(operation.getDeclaration())) && (!superTypeContext.isProcessed(operation.getDeclaration())))) {
this.xtendOutlineNodeBuilder.buildResolvedFeatureNode(inferredType, operation, superTypeContext);
}
}
final JvmType declaredType = superTypeRef.getType();
if ((declaredType instanceof JvmDeclaredType)) {
final IXtendOutlineContext nestedTypeContext = superTypeContext.hideInherited();
final Consumer<JvmDeclaredType> _function = (JvmDeclaredType it) -> {
this.buildJvmType(it, nestedTypeContext);
};
Iterables.<JvmDeclaredType>filter(((JvmDeclaredType) declaredType).getMembers(), JvmDeclaredType.class).forEach(_function);
}
}
}
}
use of org.eclipse.xtext.common.types.JvmType in project xtext-xtend by eclipse.
the class LinkingTest method testTypeParameterShadowsType_3.
@Test
public void testTypeParameterShadowsType_3() throws Exception {
final XtendFile file = file("class A {} class B extends A { def <A> A foo(A x) {x}}");
final XtendClass xtendClass = ((XtendClass) file.getXtendTypes().get(1));
final JvmType extendedType = xtendClass.getExtends().getType();
assertTrue(extendedType instanceof JvmGenericType);
XtendFunction func = (XtendFunction) xtendClass.getMembers().get(0);
JvmTypeReference returnType = func.getReturnType();
JvmTypeParameter typeParamDecl = (JvmTypeParameter) returnType.getType();
assertEquals("A", typeParamDecl.getIdentifier());
JvmTypeParameter param = (JvmTypeParameter) func.getParameters().get(0).getParameterType().getType();
assertSame(typeParamDecl, param);
assertNotSame(extendedType, param);
}
use of org.eclipse.xtext.common.types.JvmType in project xtext-xtend by eclipse.
the class Java8TypeProviderTest method testDefaultJavaMethod.
@Test
public void testDefaultJavaMethod() {
final IJvmTypeProvider typeProvider = this.typeProviderFactory.createTypeProvider();
JvmType _findTypeByName = typeProvider.findTypeByName(JavaInterface.class.getCanonicalName());
final JvmGenericType intf = ((JvmGenericType) _findTypeByName);
this.doTestMethods(intf);
}
Aggregations