TypeVisitorAdapterTest.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:javalang-compiler 作者:
public void testTargetInference2() throws Exception {

        compile("import java.util.Collections; " + "import java.util.List; "
                + "public class A { public static void processAList(List<A> stringList) {}}");
        SymbolType st = new SymbolType(getClassLoader().loadClass("A"));
        SymbolTable symTable = getSymbolTable();
        symTable.pushScope();
        symTable.pushSymbol("A", ReferenceType.TYPE, st, null);

        MethodCallExpr expr =
                (MethodCallExpr) ASTManager.parse(Expression.class, "A.processAList(Collections.emptyList());");
        HashMap<String, Object> ctx = new HashMap<String, Object>();
        expressionAnalyzer.visit(expr, ctx);
        SymbolType type = (SymbolType) expr.getSymbolData();
        Assert.assertNotNull(type);
        Assert.assertEquals("void", type.getName());
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号