List of usage examples for org.eclipse.jdt.core.util IMethodInfo isDeprecated
boolean isDeprecated();
From source file:org.eclipse.pde.tools.internal.versioning.JavaClassVersionCompare.java
License:Open Source License
/** * compares two IMethodInfo instances to find any change from <code>method2</code> to <code>method1</code> * /*from www.ja v a2 s . c o m*/ * @param className name of class to which <code>method1</code>(and <code>method2</code>) belongs * @param method1 IMethodInfo instance * @param method2 IMethodInfo instance */ private void compareMethodInfos(String className, IMethodInfo method1, IMethodInfo method2) { // compare AccessFlags (AccessFlags defines the modifiers of a method (e.g. public static final compareTo()) int accessFlag1 = method1.getAccessFlags(); int accessFlag2 = method2.getAccessFlags(); // we just care about field who was public or protected if (!(Flags.isPublic(accessFlag2) || Flags.isProtected(accessFlag2))) return; if (isModifierNarrowed(accessFlag1, accessFlag2)) { // get what modifiers have been changed int change = accessFlag1 ^ accessFlag2; // if the visibility of a method has been narrowed, it is a change should be caught Object[] msg = { METHOD_TITLE, getSignatureString(method1), createChangedModifierString(accessFlag2, change), createChangedModifierString(accessFlag1, change), className }; finalResult.merge(resultStatusHandler(IStatus.INFO, IVersionCompare.CLASS_DETAIL_STATUS | IVersionCompare.MAJOR_CHANGE, NLS.bind(Messages.JavaClassVersionCompare_ModifierChangedMsg, msg), null)); } // compare isDeprecated(if a method has been deprecated) if (method1.isDeprecated() && !method2.isDeprecated()) { Object[] msg = { METHOD_TITLE, getSignatureString(method1), className }; finalResult.merge(resultStatusHandler(IStatus.INFO, IVersionCompare.CLASS_DETAIL_STATUS | IVersionCompare.MICRO_CHANGE, NLS.bind(Messages.JavaClassVersionCompare_deprecatedChangedMsg, msg), null)); } // compare exceptions IExceptionAttribute exceptionAtrributes1 = method1.getExceptionAttribute(); IExceptionAttribute exceptionAtrributes2 = method2.getExceptionAttribute(); checkExceptions(className, getSignatureString(method1), exceptionAtrributes1, exceptionAtrributes2); }