Java Code Examples for org.eclipse.xtext.xbase.typesystem.references.StandardTypeReferenceOwner#newParameterizedTypeReference()
The following examples show how to use
org.eclipse.xtext.xbase.typesystem.references.StandardTypeReferenceOwner#newParameterizedTypeReference() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractOverloadedInstanceMethodTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
protected void linksTo(final String invocation, final String method) { try { final XtendFile file = this.file(this.inMethodBody(invocation), false); XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes()); final XtendClass c = ((XtendClass) _head); XtendMember _head_1 = IterableExtensions.<XtendMember>head(c.getMembers()); final XtendFunction m = ((XtendFunction) _head_1); XExpression _expression = m.getExpression(); final XBlockExpression body = ((XBlockExpression) _expression); XExpression _last = IterableExtensions.<XExpression>last(body.getExpressions()); final XAbstractFeatureCall featureCall = ((XAbstractFeatureCall) _last); JvmIdentifiableElement _feature = featureCall.getFeature(); final JvmOperation operation = ((JvmOperation) _feature); final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, file); final ParameterizedTypeReference declaration = owner.newParameterizedTypeReference(operation.getDeclaringType()); final BottomResolvedOperation resolved = new BottomResolvedOperation(operation, declaration, this.overrideTester); Assert.assertEquals(method, resolved.getSimpleSignature()); Assert.assertTrue(IterableExtensions.join(file.eResource().getErrors(), "\n"), file.eResource().getErrors().isEmpty()); Assert.assertNotNull(featureCall.getImplicitReceiver()); Assert.assertNull(featureCall.getImplicitFirstArgument()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 2
Source File: AbstractOverloadedStaticMethodTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
protected void linksTo(final String invocation, final String method) { try { final XtendFile file = this.file(this.inMethodBody(invocation), false); XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes()); final XtendClass c = ((XtendClass) _head); XtendMember _head_1 = IterableExtensions.<XtendMember>head(c.getMembers()); final XtendFunction m = ((XtendFunction) _head_1); XExpression _expression = m.getExpression(); final XBlockExpression body = ((XBlockExpression) _expression); XExpression _last = IterableExtensions.<XExpression>last(body.getExpressions()); final XAbstractFeatureCall featureCall = ((XAbstractFeatureCall) _last); JvmIdentifiableElement _feature = featureCall.getFeature(); final JvmOperation operation = ((JvmOperation) _feature); final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, file); final ParameterizedTypeReference declaration = owner.newParameterizedTypeReference(operation.getDeclaringType()); final BottomResolvedOperation resolved = new BottomResolvedOperation(operation, declaration, this.overrideTester); Assert.assertEquals(method, resolved.getSimpleSignature()); Assert.assertTrue(IterableExtensions.join(file.eResource().getErrors(), "\n"), file.eResource().getErrors().isEmpty()); Assert.assertNull(featureCall.getImplicitReceiver()); Assert.assertNull(featureCall.getImplicitFirstArgument()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 3
Source File: Bug661Test.java From sarl with Apache License 2.0 | 6 votes |
@RepeatedTest(5) public void isSubtypeOf_01() throws Exception { ParseHelper<SarlScript> helper = getParseHelper(); SarlScript mas0 = helper.parse(SNIPSET1); ResourceSet resourceSet = mas0.eResource().getResourceSet(); SarlScript mas1 = helper.parse(SNIPSET1, resourceSet); assertSame(mas0.eResource().getResourceSet(), mas1.eResource().getResourceSet()); JvmTypeReference reference0 = this.typeReferences.getTypeForName("boolean", mas0); StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, mas1); LightweightTypeReference reference1 = owner.newParameterizedTypeReference(this.typeReferences.findDeclaredType("boolean", mas1)); assertTrue(reference1.isSubtypeOf(reference0.getType())); }
Example 4
Source File: Bug661Test.java From sarl with Apache License 2.0 | 6 votes |
@RepeatedTest(5) public void isAssignableFrom_01() throws Exception { ParseHelper<SarlScript> helper = getParseHelper(); SarlScript mas0 = helper.parse(SNIPSET1); ResourceSet resourceSet = mas0.eResource().getResourceSet(); SarlScript mas1 = helper.parse(SNIPSET1, resourceSet); assertSame(mas0.eResource().getResourceSet(), mas1.eResource().getResourceSet()); JvmTypeReference reference0 = this.typeReferences.getTypeForName("boolean", mas0); StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, mas1); LightweightTypeReference reference1 = owner.newParameterizedTypeReference(this.typeReferences.findDeclaredType("boolean", mas1)); assertTrue(reference1.isAssignableFrom(reference0.getType())); }
Example 5
Source File: AbstractBuilderTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
protected LightweightTypeReference createTypeRef(final JvmType type) { ParameterizedTypeReference _xblockexpression = null; { final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, type); _xblockexpression = owner.newParameterizedTypeReference(type); } return _xblockexpression; }
Example 6
Source File: Bug661Test.java From sarl with Apache License 2.0 | 5 votes |
@Test public void isSubtypeOf_00() throws Exception { SarlScript mas0 = file(getParseHelper(), SNIPSET1); SarlScript mas1 = file(getParseHelper(), SNIPSET1); assertNotSame(mas0.eResource().getResourceSet(), mas1.eResource().getResourceSet()); JvmTypeReference reference0 = this.typeReferences.getTypeForName("boolean", mas0); StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, mas1); LightweightTypeReference reference1 = owner.newParameterizedTypeReference(this.typeReferences.findDeclaredType("boolean", mas1)); assertFalse(reference1.isSubtypeOf(reference0.getType())); }
Example 7
Source File: Bug661Test.java From sarl with Apache License 2.0 | 5 votes |
@RepeatedTest(5) public void isAssignableFrom_00() throws Exception { SarlScript mas0 = file(getParseHelper(), SNIPSET1); SarlScript mas1 = file(getParseHelper(), SNIPSET1); assertNotSame(mas0.eResource().getResourceSet(), mas1.eResource().getResourceSet()); JvmTypeReference reference0 = this.typeReferences.getTypeForName("boolean", mas0); StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, mas1); LightweightTypeReference reference1 = owner.newParameterizedTypeReference(this.typeReferences.findDeclaredType("boolean", mas1)); assertFalse(reference1.isAssignableFrom(reference0.getType())); }
Example 8
Source File: RawResolvedFeatures.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
/** * Static helper method that is used from within the super call in the constructor of * {@link RawResolvedFeatures}. */ private static LightweightTypeReference createTypeReference(JvmDeclaredType type, CommonTypeComputationServices services) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); return owner.newParameterizedTypeReference(type); }
Example 9
Source File: JavaTypeQuickfixes.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected ContextualVisibilityHelper getVisibilityHelper(final JvmDeclaredType contextType) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, contextType); final ParameterizedTypeReference contextTypeRef = owner.newParameterizedTypeReference(contextType); final ContextualVisibilityHelper visibilityHelper = new ContextualVisibilityHelper(contextTypeRef); return visibilityHelper; }