Search in sources :

Example 1 with ResolvedTypeVariable

use of com.github.javaparser.resolution.types.ResolvedTypeVariable in project javaparser by javaparser.

the class InferenceContextTest method placingASingleVariableTopLevel.

@Test
public void placingASingleVariableTopLevel() {
    ResolvedType result = new InferenceContext(MyObjectProvider.INSTANCE).addPair(new ResolvedTypeVariable(tpE), listOfString);
    assertEquals(new InferenceVariableType(0, MyObjectProvider.INSTANCE), result);
}
Also used : ResolvedTypeVariable(com.github.javaparser.resolution.types.ResolvedTypeVariable) ResolvedType(com.github.javaparser.resolution.types.ResolvedType) Test(org.junit.Test)

Example 2 with ResolvedTypeVariable

use of com.github.javaparser.resolution.types.ResolvedTypeVariable in project javaparser by javaparser.

the class ArrayTypeTest method setup.

@Before
public void setup() {
    typeSolver = new ReflectionTypeSolver();
    OBJECT = new ReferenceTypeImpl(new ReflectionClassDeclaration(Object.class, typeSolver), typeSolver);
    STRING = new ReferenceTypeImpl(new ReflectionClassDeclaration(String.class, typeSolver), typeSolver);
    arrayOfBooleans = new ResolvedArrayType(ResolvedPrimitiveType.BOOLEAN);
    arrayOfStrings = new ResolvedArrayType(STRING);
    tpA = ResolvedTypeParameterDeclaration.onType("A", "foo.Bar", Collections.emptyList());
    arrayOfListOfA = new ResolvedArrayType(new ReferenceTypeImpl(new ReflectionInterfaceDeclaration(List.class, typeSolver), ImmutableList.of(new ResolvedTypeVariable(tpA)), typeSolver));
    arrayOfListOfStrings = new ResolvedArrayType(new ReferenceTypeImpl(new ReflectionInterfaceDeclaration(List.class, typeSolver), ImmutableList.of(new ReferenceTypeImpl(new ReflectionClassDeclaration(String.class, typeSolver), typeSolver)), typeSolver));
}
Also used : ResolvedArrayType(com.github.javaparser.resolution.types.ResolvedArrayType) ResolvedTypeVariable(com.github.javaparser.resolution.types.ResolvedTypeVariable) ReflectionClassDeclaration(com.github.javaparser.symbolsolver.reflectionmodel.ReflectionClassDeclaration) ReflectionInterfaceDeclaration(com.github.javaparser.symbolsolver.reflectionmodel.ReflectionInterfaceDeclaration) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ReflectionTypeSolver(com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver) Before(org.junit.Before)

Example 3 with ResolvedTypeVariable

use of com.github.javaparser.resolution.types.ResolvedTypeVariable in project javaparser by javaparser.

the class NullTypeTest method setup.

@Before
public void setup() {
    typeSolver = new ReflectionTypeSolver();
    OBJECT = new ReferenceTypeImpl(new ReflectionClassDeclaration(Object.class, typeSolver), typeSolver);
    STRING = new ReferenceTypeImpl(new ReflectionClassDeclaration(String.class, typeSolver), typeSolver);
    arrayOfBooleans = new ResolvedArrayType(ResolvedPrimitiveType.BOOLEAN);
    arrayOfListOfA = new ResolvedArrayType(new ReferenceTypeImpl(new ReflectionInterfaceDeclaration(List.class, typeSolver), ImmutableList.of(new ResolvedTypeVariable(ResolvedTypeParameterDeclaration.onType("A", "foo.Bar", Collections.emptyList()))), typeSolver));
}
Also used : ResolvedArrayType(com.github.javaparser.resolution.types.ResolvedArrayType) ResolvedTypeVariable(com.github.javaparser.resolution.types.ResolvedTypeVariable) ReflectionClassDeclaration(com.github.javaparser.symbolsolver.reflectionmodel.ReflectionClassDeclaration) ReflectionInterfaceDeclaration(com.github.javaparser.symbolsolver.reflectionmodel.ReflectionInterfaceDeclaration) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ReflectionTypeSolver(com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver) Before(org.junit.Before)

Example 4 with ResolvedTypeVariable

use of com.github.javaparser.resolution.types.ResolvedTypeVariable in project javaparser by javaparser.

the class TypeVariableUsageTest method setup.

@Before
public void setup() {
    tpA = new ResolvedTypeVariable(ResolvedTypeParameterDeclaration.onType("A", "foo.Bar", Collections.emptyList()));
    typeSolver = new ReflectionTypeSolver();
    tpString = new ReferenceTypeImpl(new ReflectionClassDeclaration(String.class, typeSolver), typeSolver);
}
Also used : ResolvedTypeVariable(com.github.javaparser.resolution.types.ResolvedTypeVariable) ReflectionClassDeclaration(com.github.javaparser.symbolsolver.reflectionmodel.ReflectionClassDeclaration) ReflectionTypeSolver(com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver) Before(org.junit.Before)

Example 5 with ResolvedTypeVariable

use of com.github.javaparser.resolution.types.ResolvedTypeVariable in project javaparser by javaparser.

the class WildcardUsageTest method setup.

@Before
public void setup() {
    typeSolver = new ReflectionTypeSolver();
    foo = new ReferenceTypeImpl(new ReflectionClassDeclaration(Foo.class, typeSolver), typeSolver);
    bar = new ReferenceTypeImpl(new ReflectionClassDeclaration(Bar.class, typeSolver), typeSolver);
    object = new ReferenceTypeImpl(new ReflectionClassDeclaration(Object.class, typeSolver), typeSolver);
    string = new ReferenceTypeImpl(new ReflectionClassDeclaration(String.class, typeSolver), typeSolver);
    superFoo = ResolvedWildcard.superBound(foo);
    superBar = ResolvedWildcard.superBound(bar);
    extendsFoo = ResolvedWildcard.extendsBound(foo);
    extendsBar = ResolvedWildcard.extendsBound(bar);
    a = new ResolvedTypeVariable(ResolvedTypeParameterDeclaration.onType("A", "foo.Bar", Collections.emptyList()));
    superA = ResolvedWildcard.superBound(a);
    extendsA = ResolvedWildcard.extendsBound(a);
    superString = ResolvedWildcard.superBound(string);
    extendsString = ResolvedWildcard.extendsBound(string);
}
Also used : ResolvedTypeVariable(com.github.javaparser.resolution.types.ResolvedTypeVariable) ReflectionClassDeclaration(com.github.javaparser.symbolsolver.reflectionmodel.ReflectionClassDeclaration) ReflectionTypeSolver(com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver) Before(org.junit.Before)

Aggregations

ResolvedTypeVariable (com.github.javaparser.resolution.types.ResolvedTypeVariable)13 ReflectionTypeSolver (com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver)9 ReflectionClassDeclaration (com.github.javaparser.symbolsolver.reflectionmodel.ReflectionClassDeclaration)7 Before (org.junit.Before)7 List (java.util.List)5 ResolvedArrayType (com.github.javaparser.resolution.types.ResolvedArrayType)4 ReflectionInterfaceDeclaration (com.github.javaparser.symbolsolver.reflectionmodel.ReflectionInterfaceDeclaration)4 ImmutableList (com.google.common.collect.ImmutableList)4 ResolvedTypeParameterDeclaration (com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration)3 ResolvedReferenceType (com.github.javaparser.resolution.types.ResolvedReferenceType)3 TypeSolver (com.github.javaparser.symbolsolver.model.resolution.TypeSolver)3 ReferenceTypeImpl (com.github.javaparser.symbolsolver.model.typesystem.ReferenceTypeImpl)3 Test (org.junit.Test)3 ResolvedType (com.github.javaparser.resolution.types.ResolvedType)2 AbstractTest (com.github.javaparser.symbolsolver.AbstractTest)2 HashMap (java.util.HashMap)2 AccessSpecifier (com.github.javaparser.ast.AccessSpecifier)1 MethodUsage (com.github.javaparser.resolution.MethodUsage)1 ResolvedInterfaceDeclaration (com.github.javaparser.resolution.declarations.ResolvedInterfaceDeclaration)1 ResolvedReferenceTypeDeclaration (com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration)1