0
我目前正在處理的錯誤要求我在選擇關聯的快速修復程序時使用擴展替換實現器。無法用eclipse中的擴展JDT替換實現器JDT
例如:
public class R{
}
class Q implements R{ //error here
}
速戰速決將是改變以延長機具(這就是我重點)。但要做到這一點,我需要TypeDeclaration.SUPERCLASS_TYPE
作爲ChildListPropertyDiscriptor
而現在它是ChildPropertyDiscriptor
。這使得它無法作爲getListRewrite
的參數提供。
我想知道是否有任何方法可以讓TypeDeclaration.SUPERCLASS_TYPE
作爲ChildListPropertyDiscriptor
。否則有其他方式可以做到這一點。
我完整的代碼片段如下:
TypeDeclaration typeDecl= (TypeDeclaration) selectedNode.getParent();
{
ASTRewrite rewrite= ASTRewrite.create(root.getAST());
ASTNode placeHolder= rewrite.createMoveTarget(selectedNode);
ListRewrite interfaces= rewrite.getListRewrite(typeDecl, TypeDeclaration.SUPERCLASS_TYPE_PROPERTY); //problem here
interfaces.insertFirst(placeHolder, null);
String label= CorrectionMessages.LocalCorrectionsSubProcessor_implementstoextends_description;
Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, context.getCompilationUnit(), rewrite, IProposalRelevance.CHANGE_EXTENDS_TO_IMPLEMENTS, image);
proposals.add(proposal);
}