use of com.github.javaparser.symbolsolver.core.resolution.Context in project javaparser by javaparser.
the class MethodCallExprContextResolutionTest method solveNestedMethodCallExprContextWithoutScope.
@Test
public void solveNestedMethodCallExprContextWithoutScope() {
MethodCallExpr methodCallExpr = getMethodCallExpr("bar1", "foo");
CombinedTypeSolver typeSolver = createTypeSolver();
Context context = new MethodCallExprContext(methodCallExpr, typeSolver);
Optional<MethodUsage> ref = context.solveMethodAsUsage("foo", Collections.emptyList(), typeSolver);
assertTrue(ref.isPresent());
assertEquals("MethodCalls", ref.get().declaringType().getQualifiedName());
}
use of com.github.javaparser.symbolsolver.core.resolution.Context in project javaparser by javaparser.
the class MethodContextResolutionTest method solveTypeRefToLocalClass.
@Test
public void solveTypeRefToLocalClass() {
CompilationUnit cu = parseSample("MethodWithTypes");
ClassOrInterfaceDeclaration cd = Navigator.demandClass(cu, "Main");
MethodDeclaration md = Navigator.demandMethod(cd, "methodWithLocalTypes");
Context context = new MethodContext(md, typeSolver);
SymbolReference<ResolvedTypeDeclaration> ref = context.solveType("LocalClass", new MemoryTypeSolver());
assertEquals(true, ref.isSolved());
}
Aggregations