Java Code Examples for org.eclipse.jdt.core.dom.IMethodBinding#isDeprecated()

The following examples show how to use org.eclipse.jdt.core.dom.IMethodBinding#isDeprecated() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SemanticHighlightingReconciler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@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;
}
 
Example 2
Source File: SemanticHighlightingReconciler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@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;
}
 
Example 3
Source File: ExtractSupertypeProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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));
						}
					}
				}
			}
		}
	}
}
 
Example 4
Source File: SemanticHighlightingReconciler.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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;
}
 
Example 5
Source File: SemanticHighlightingReconciler.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@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;
}