下面列出了org.eclipse.jdt.core.dom.IMethodBinding#isDeprecated ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public boolean visit(ConstructorInvocation node) {
// XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*))
if (fJobDeprecatedMemberHighlighting != null) {
IMethodBinding constructorBinding= node.resolveConstructorBinding();
if (constructorBinding != null && constructorBinding.isDeprecated()) {
int offset= node.getStartPosition();
int length= 4;
if (offset > -1 && length > 0) {
addPosition(offset, length, fJobDeprecatedMemberHighlighting);
}
}
}
return true;
}
@Override
public boolean visit(SuperConstructorInvocation node) {
// XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*))
if (fJobDeprecatedMemberHighlighting != null) {
IMethodBinding constructorBinding= node.resolveConstructorBinding();
if (constructorBinding != null && constructorBinding.isDeprecated()) {
int offset= node.getStartPosition();
int length= 5;
if (offset > -1 && length > 0) {
addPosition(offset, length, fJobDeprecatedMemberHighlighting);
}
}
}
return true;
}
/**
* Creates the necessary constructors for the extracted supertype.
*
* @param targetRewrite
* the target compilation unit rewrite
* @param superType
* the super type, or <code>null</code> if no super type (ie.
* <code>java.lang.Object</code>) is available
* @param targetDeclaration
* the type declaration of the target type
* @param status
* the refactoring status
*/
protected final void createNecessaryConstructors(final CompilationUnitRewrite targetRewrite, final IType superType, final AbstractTypeDeclaration targetDeclaration, final RefactoringStatus status) {
Assert.isNotNull(targetRewrite);
Assert.isNotNull(targetDeclaration);
if (superType != null) {
final ITypeBinding binding= targetDeclaration.resolveBinding();
if (binding != null && binding.isClass()) {
final IMethodBinding[] bindings= StubUtility2.getVisibleConstructors(binding, true, true);
int deprecationCount= 0;
for (int i= 0; i < bindings.length; i++) {
if (bindings[i].isDeprecated())
deprecationCount++;
}
final ListRewrite rewrite= targetRewrite.getASTRewrite().getListRewrite(targetDeclaration, TypeDeclaration.BODY_DECLARATIONS_PROPERTY);
if (rewrite != null) {
boolean createDeprecated= deprecationCount == bindings.length;
for (int i= 0; i < bindings.length; i++) {
IMethodBinding curr= bindings[i];
if (!curr.isDeprecated() || createDeprecated) {
MethodDeclaration stub;
try {
ImportRewriteContext context= new ContextSensitiveImportRewriteContext(targetDeclaration, targetRewrite.getImportRewrite());
stub= StubUtility2.createConstructorStub(targetRewrite.getCu(), targetRewrite.getASTRewrite(), targetRewrite.getImportRewrite(), context, curr, binding.getName(),
Modifier.PUBLIC, false, false, fSettings);
if (stub != null)
rewrite.insertLast(stub, null);
} catch (CoreException exception) {
JavaPlugin.log(exception);
status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractSupertypeProcessor_unexpected_exception_on_layer));
}
}
}
}
}
}
}
@Override
public boolean visit(ConstructorInvocation node) {
// XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*))
if (fJobDeprecatedMemberHighlighting != null) {
IMethodBinding constructorBinding= node.resolveConstructorBinding();
if (constructorBinding != null && constructorBinding.isDeprecated()) {
int offset= node.getStartPosition();
int length= 4;
if (offset > -1 && length > 0)
addPosition(offset, length, fJobDeprecatedMemberHighlighting);
}
}
return true;
}
@Override
public boolean visit(SuperConstructorInvocation node) {
// XXX Hack for performance reasons (should loop over fJobSemanticHighlightings can call consumes(*))
if (fJobDeprecatedMemberHighlighting != null) {
IMethodBinding constructorBinding= node.resolveConstructorBinding();
if (constructorBinding != null && constructorBinding.isDeprecated()) {
int offset= node.getStartPosition();
int length= 5;
if (offset > -1 && length > 0)
addPosition(offset, length, fJobDeprecatedMemberHighlighting);
}
}
return true;
}