Search in sources :

Example 16 with ResolvedTypeParameterDeclaration

use of com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration in project javaparser by javaparser.

the class SubtypeOfBoundTest method recognizeProperUpperBound1.

@Test
public void recognizeProperUpperBound1() {
    ResolvedTypeParameterDeclaration typeParameterDeclaration = mock(ResolvedTypeParameterDeclaration.class);
    // { Integer <: α, Double <: α, α <: Object } describes two proper lower bounds and one proper upper bound for α.
    InferenceVariable inferenceVariable = new InferenceVariable("α", typeParameterDeclaration);
    Bound bound = new SubtypeOfBound(inferenceVariable, objectType);
    assertEquals(Optional.of(new ProperUpperBound(inferenceVariable, objectType)), bound.isProperUpperBound());
}
Also used : ResolvedTypeParameterDeclaration(com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration) Test(org.junit.Test)

Example 17 with ResolvedTypeParameterDeclaration

use of com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration in project javaparser by javaparser.

the class SubtypeOfBoundTest method recognizeProperLowerBound2.

@Test
public void recognizeProperLowerBound2() {
    ResolvedTypeParameterDeclaration typeParameterDeclaration = mock(ResolvedTypeParameterDeclaration.class);
    // { Integer <: α, Double <: α, α <: Object } describes two proper lower bounds and one proper upper bound for α.
    InferenceVariable inferenceVariable = new InferenceVariable("α", typeParameterDeclaration);
    Bound bound = new SubtypeOfBound(doubleType, inferenceVariable);
    assertEquals(Optional.of(new ProperLowerBound(inferenceVariable, doubleType)), bound.isProperLowerBound());
}
Also used : ResolvedTypeParameterDeclaration(com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration) Test(org.junit.Test)

Example 18 with ResolvedTypeParameterDeclaration

use of com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration in project javaparser by javaparser.

the class SubtypeOfBoundTest method recognizeProperLowerBound1.

@Test
public void recognizeProperLowerBound1() {
    ResolvedTypeParameterDeclaration typeParameterDeclaration = mock(ResolvedTypeParameterDeclaration.class);
    // { Integer <: α, Double <: α, α <: Object } describes two proper lower bounds and one proper upper bound for α.
    InferenceVariable inferenceVariable = new InferenceVariable("α", typeParameterDeclaration);
    Bound bound = new SubtypeOfBound(integerType, inferenceVariable);
    assertEquals(Optional.of(new ProperLowerBound(inferenceVariable, integerType)), bound.isProperLowerBound());
}
Also used : ResolvedTypeParameterDeclaration(com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration) Test(org.junit.Test)

Aggregations

ResolvedTypeParameterDeclaration (com.github.javaparser.resolution.declarations.ResolvedTypeParameterDeclaration)18 Test (org.junit.Test)10 ResolvedType (com.github.javaparser.resolution.types.ResolvedType)6 ResolvedMethodDeclaration (com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration)4 TypeSolver (com.github.javaparser.symbolsolver.model.resolution.TypeSolver)4 ReflectionTypeSolver (com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver)3 MethodUsage (com.github.javaparser.resolution.MethodUsage)2 ResolvedInterfaceDeclaration (com.github.javaparser.resolution.declarations.ResolvedInterfaceDeclaration)2 ResolvedReferenceTypeDeclaration (com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration)2 ResolvedReferenceType (com.github.javaparser.resolution.types.ResolvedReferenceType)2 ResolvedTypeVariable (com.github.javaparser.resolution.types.ResolvedTypeVariable)2 ReferenceTypeImpl (com.github.javaparser.symbolsolver.model.typesystem.ReferenceTypeImpl)2 ReflectionClassDeclaration (com.github.javaparser.symbolsolver.reflectionmodel.ReflectionClassDeclaration)2 ReflectionInterfaceDeclaration (com.github.javaparser.symbolsolver.reflectionmodel.ReflectionInterfaceDeclaration)2 ArrayList (java.util.ArrayList)2 AccessSpecifier (com.github.javaparser.ast.AccessSpecifier)1 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1 Expression (com.github.javaparser.ast.expr.Expression)1