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);
}