2010-09-28 73 views
1

我在eclipse插件中发现了这个错误。这里是代码:指定元素类型不支持的操作

ICompilationUnit testCU = findTestUnit(type); 
// add some stuff to testCU 
testCU.commitWorkingCopy(false, null); // error happens here. 

回答

1

我猜你正在使用this interface。这里是有问题的方法签名:

void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws JavaModelException; 

或许你可以尝试流延nullIProgressMonitor

另一个想法是看通过该方法调用返回的类型,并确保它实现了正确的接口。也许这是不正确的。

+0

我没有得到'NullPointerException'。 – fastcodejava 2010-09-28 02:06:33

相关问题