JDT - 密钥形成不正确?

时间:2015-02-13 15:09:59

标签: java eclipse-jdt

我不知道如何获得正确的密钥?

IMethodBinding iMethodBinding = methodInvocation.resolveMethodBinding();
    if (iMethodBinding != null) {
        if (iMethodBinding.getDeclaringClass() != null) {
            methodCallExpression
                    .setIncludeUnitSource(extractJavaFile(iMethodBinding
                            .getDeclaringClass()));    
if (iMethodBinding.getKey() != null) {
                    org.eclipse.jdt.core.dom.CompilationUnit cu = null;
                    if (((CompilationUnit) methodInvocation.getRoot())
                            .findDeclaringNode(iMethodBinding) != null) {
                        cu = (CompilationUnit) methodInvocation.getRoot();
                    } else {
                        cu = resolveCompilationUnit(iMethodBinding);
                    }
                    ASTNode astNode = null;

if(iMethodBinding.getKey()  

iMethodBinding.getKey() Ljava / util / Arrays; .asList([TT;)Ljava / util / List;%

操作系统: Windows 8

修改

这是我的临时解决方案,但不适用于所有情况:

MethodBinding.getKey()
                                .indexOf("\\")!=-1){
                            astNode =(ASTNode) cu
                            .findDeclaringNode(iMethodBinding
                                    .getKey()
                                    .replace(
                                            iMethodBinding.getKey().substring(
                                                    iMethodBinding.getKey()
                                                            .indexOf("\\") - 2,
                                                    iMethodBinding.getKey()
                                                            .indexOf("~")), "")
                                    .replace("~", ""));

0 个答案:

没有答案