【发布时间】:2018-09-11 16:31:42
【问题描述】:
在编写 Eclipse 插件时,如何从 ICompilationUnit 中找到所有方法,包括继承的方法?当我调用方法 getMethods() 时,没有继承方法。
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
IFile file = (IFile) receiver;
try {
IJavaElement element = JavaCore.create(file);
ICompilationUnit icu = (ICompilationUnit) element;
IType[] types = icu.getTypes();
return hasMethodCalledTest(types[0]);
} catch (Exception e) {
System.out.println();
}
return false;
}
public boolean hasMethodCalledTest(IType typeClass) {
typeClass.getMethods();//There is no inherited method here.
return false;
}
【问题讨论】:
标签: java eclipse plugins eclipse-jdt pde