use of com.github.javaparser.resolution.types.ResolvedType in project javaparser by javaparser.
the class TypeExtractor method visit.
@Override
public ResolvedType visit(ClassExpr node, Boolean solveLambdas) {
// This implementation does not regard the actual type argument of the ClassExpr.
com.github.javaparser.ast.type.Type astType = node.getType();
ResolvedType jssType = facade.convertToUsage(astType, node.getType());
return new ReferenceTypeImpl(new ReflectionClassDeclaration(Class.class, typeSolver), ImmutableList.of(jssType), typeSolver);
}
use of com.github.javaparser.resolution.types.ResolvedType in project javaparser by javaparser.
the class FunctionInterfaceLogicTest method testGetFunctionalMethodPositiveCasesOnInterfaces.
@Test
public void testGetFunctionalMethodPositiveCasesOnInterfaces() {
TypeSolver typeSolver = new ReflectionTypeSolver();
ResolvedType function = new ReferenceTypeImpl(new ReflectionInterfaceDeclaration(Function.class, typeSolver), typeSolver);
assertEquals(true, FunctionalInterfaceLogic.getFunctionalMethod(function).isPresent());
assertEquals("apply", FunctionalInterfaceLogic.getFunctionalMethod(function).get().getName());
ResolvedType consumer = new ReferenceTypeImpl(new ReflectionInterfaceDeclaration(Consumer.class, typeSolver), typeSolver);
assertEquals(true, FunctionalInterfaceLogic.getFunctionalMethod(consumer).isPresent());
assertEquals("accept", FunctionalInterfaceLogic.getFunctionalMethod(consumer).get().getName());
}
use of com.github.javaparser.resolution.types.ResolvedType in project javaparser by javaparser.
the class FunctionInterfaceLogicTest method testGetFunctionalMethodNegativeCaseOnClass.
@Test
public void testGetFunctionalMethodNegativeCaseOnClass() {
TypeSolver typeSolver = new ReflectionTypeSolver();
ResolvedType string = new ReferenceTypeImpl(new ReflectionClassDeclaration(String.class, typeSolver), typeSolver);
assertEquals(false, FunctionalInterfaceLogic.getFunctionalMethod(string).isPresent());
}
use of com.github.javaparser.resolution.types.ResolvedType 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);
}
use of com.github.javaparser.resolution.types.ResolvedType in project javaparser by javaparser.
the class InferenceContextTest method noVariablesArePlacedWhenNotNeeded.
@Test
public void noVariablesArePlacedWhenNotNeeded() {
ResolvedType result = new InferenceContext(MyObjectProvider.INSTANCE).addPair(object, string);
assertEquals(object, result);
}
Aggregations