Search in sources :

Example 46 with TypeMirror

use of javax.lang.model.type.TypeMirror in project auto by google.

the class MoreTypesIsTypeOfTest method isTypeOf_Void.

@Test
public void isTypeOf_Void() {
    assertTrue(MoreTypes.isType(typeElementFor(DeclaredVoid.class).asType()));
    TypeMirror declared = extractReturnTypeFromHolder(typeElementFor(DeclaredVoid.class));
    assertThat(MoreTypes.isTypeOf(Void.class, declared)).named("mirror of a void").isTrue();
}
Also used : TypeMirror(javax.lang.model.type.TypeMirror) Test(org.junit.Test)

Example 47 with TypeMirror

use of javax.lang.model.type.TypeMirror in project auto by google.

the class MoreTypesIsTypeOfTest method isTypeOf_PrimitiveShort.

@Test
public void isTypeOf_PrimitiveShort() {
    assertTrue(MoreTypes.isType(typeElementFor(PrimitiveShort.class).asType()));
    TypeMirror type = extractReturnTypeFromHolder(typeElementFor(PrimitiveShort.class));
    assertThat(MoreTypes.isTypeOf(Short.TYPE, type)).named("mirror of a short").isTrue();
}
Also used : TypeMirror(javax.lang.model.type.TypeMirror) Test(org.junit.Test)

Example 48 with TypeMirror

use of javax.lang.model.type.TypeMirror in project auto by google.

the class MoreTypesIsTypeOfTest method isTypeOf_ArrayType.

@Test
public void isTypeOf_ArrayType() {
    assertTrue(MoreTypes.isType(typeElementFor(ArrayType.class).asType()));
    TypeMirror type = extractReturnTypeFromHolder(typeElementFor(ArrayType.class));
    assertThat(MoreTypes.isTypeOf(new String[] {}.getClass(), type)).named("array mirror represents an array Class object").isTrue();
}
Also used : TypeMirror(javax.lang.model.type.TypeMirror) Test(org.junit.Test)

Example 49 with TypeMirror

use of javax.lang.model.type.TypeMirror in project auto by google.

the class MoreTypesIsTypeOfTest method isTypeOf_PrimitiveDouble.

@Test
public void isTypeOf_PrimitiveDouble() {
    assertTrue(MoreTypes.isType(typeElementFor(PrimitiveDouble.class).asType()));
    TypeMirror type = extractReturnTypeFromHolder(typeElementFor(PrimitiveDouble.class));
    assertThat(MoreTypes.isTypeOf(Double.TYPE, type)).named("mirror of a double").isTrue();
}
Also used : TypeMirror(javax.lang.model.type.TypeMirror) Test(org.junit.Test)

Example 50 with TypeMirror

use of javax.lang.model.type.TypeMirror in project auto by google.

the class MoreTypesIsTypeOfTest method isTypeOf_PrimitiveByte.

@Test
public void isTypeOf_PrimitiveByte() {
    assertTrue(MoreTypes.isType(typeElementFor(PrimitiveByte.class).asType()));
    TypeMirror type = extractReturnTypeFromHolder(typeElementFor(PrimitiveByte.class));
    assertThat(MoreTypes.isTypeOf(Byte.TYPE, type)).named("mirror of a byte").isTrue();
}
Also used : TypeMirror(javax.lang.model.type.TypeMirror) Test(org.junit.Test)

Aggregations

TypeMirror (javax.lang.model.type.TypeMirror)1086 TypeElement (javax.lang.model.element.TypeElement)419 ExecutableElement (javax.lang.model.element.ExecutableElement)259 VariableElement (javax.lang.model.element.VariableElement)237 Element (javax.lang.model.element.Element)196 DeclaredType (javax.lang.model.type.DeclaredType)177 ArrayList (java.util.ArrayList)154 Test (org.junit.Test)152 AnnotationMirror (javax.lang.model.element.AnnotationMirror)75 Types (javax.lang.model.util.Types)70 List (java.util.List)66 Elements (javax.lang.model.util.Elements)60 HashSet (java.util.HashSet)53 ArrayCodeTypeMirror (com.oracle.truffle.dsl.processor.java.model.CodeTypeMirror.ArrayCodeTypeMirror)50 Map (java.util.Map)49 ExecutableType (javax.lang.model.type.ExecutableType)45 MethodSpec (com.squareup.javapoet.MethodSpec)44 PackageElement (javax.lang.model.element.PackageElement)41 ArrayType (javax.lang.model.type.ArrayType)41 Expression (com.google.devtools.j2objc.ast.Expression)39