Java Code Examples for org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference#tryConvertToArray()

The following examples show how to use org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference#tryConvertToArray() . 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: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_04() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.StringIterable");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("String[]", arrayType.getSimpleName());
}
 
Example 2
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_05() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.CharSequenceIterable");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	// intuitively one would assume CharSequence[] but Object[] fulfills the raw type contract of Java
	assertEquals("Object[]", arrayType.getSimpleName());
}
 
Example 3
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_06() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.CharSequenceIterable<StringBuffer>");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("StringBuffer[]", arrayType.getSimpleName());
}
 
Example 4
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_07() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.StrangeIterable");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("Object[]", arrayType.getSimpleName());
}
 
Example 5
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_08() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.StrangeIterable<String>");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("Object[]", arrayType.getSimpleName());
}
 
Example 6
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_09() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.StrangeStringIterable");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	// intuitively one would assume String[] but Object[] fulfills the raw type contract of Java
	assertEquals("Object[]", arrayType.getSimpleName());
}
 
Example 7
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_10() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.StrangeStringIterable<Integer>");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("String[]", arrayType.getSimpleName());
}
 
Example 8
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testTryConvertToArray_11() throws Exception {
	LightweightTypeReference typeReference = toTypeReference(
			"org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeComputerUnitTest.IterableContainer<String>.Iter");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("String[]", arrayType.getSimpleName());
}
 
Example 9
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testTryConvertToArray_01() throws Exception {
	LightweightTypeReference typeReference = toTypeReference("Iterable<?>");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("Object[]", arrayType.getSimpleName());
}
 
Example 10
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testTryConvertToArray_02() throws Exception {
	LightweightTypeReference typeReference = toTypeReference("Iterable<? extends String>");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("String[]", arrayType.getSimpleName());
}
 
Example 11
Source File: ArrayTypesTest.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testTryConvertToArray_03() throws Exception {
	LightweightTypeReference typeReference = toTypeReference("java.util.Collection");
	ArrayTypeReference arrayType = typeReference.tryConvertToArray();
	assertEquals("Object[]", arrayType.getSimpleName());
}