Java Code Examples for sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl

The following examples show how to use sun.reflect.generics.reflectiveObjects.GenericArrayTypeImpl. These examples are extracted from open source projects. 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 Project: gadtry   Source File: JavaTypesTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void typeToClassGiveGenericArrayType()
{
    Type type = JavaTypes.make(List.class, new Type[] {String.class}, null);
    Type arrayType = GenericArrayTypeImpl.make(type);

    Assert.assertTrue(JavaTypes.isClassType(arrayType));
    Assert.assertEquals(JavaTypes.typeToClass(arrayType), List[].class);

    try {
        JavaTypes.typeToClass(AopFactory.proxy(Type.class).byInstance(String.class).before(a -> {}));
        Assert.fail();
    }
    catch (IllegalArgumentException e) {
        Assert.assertEquals("Cannot convert type to class", e.getMessage());
    }
}
 
Example 2
Source Project: gadtry   Source File: ArrayType.java    License: Apache License 2.0 4 votes vote down vote up
public ArrayType(Type valueType)
{
    this.genericArrayType = GenericArrayTypeImpl.make(valueType);
}