From 6839ee074e455cee6a9eae3c3442653fde988206 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 16 Jun 2015 20:37:20 -0700 Subject: [PATCH] Cosmetics. --- .../core/index/IndexCPPSignatureUtil.java | 48 ++++++++----------- .../core/pdom/dom/cpp/PDOMCPPMethod.java | 3 +- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java index daed2973029..007174568f8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IndexCPPSignatureUtil.java @@ -6,10 +6,10 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Bryan Wilkinson (QNX) - Initial API and implementation - * Andrew Ferguson (Symbian) - * Markus Schorn (Wind River Systems) - * Sergey Prigogin (Google) + * Bryan Wilkinson (QNX) - Initial API and implementation + * Andrew Ferguson (Symbian) + * Markus Schorn (Wind River Systems) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.core.index; @@ -42,15 +42,12 @@ import org.eclipse.core.runtime.CoreException; * siblings with the same name. */ public class IndexCPPSignatureUtil { - /** * Returns the signature for the binding. Returns an empty string if * a signature is not required for the binding. - * - * @param binding + * + * @param binding the binding * @return the signature or an empty string - * @throws CoreException - * @throws DOMException */ public static String getSignature(IBinding binding) throws CoreException, DOMException { StringBuilder buffer = new StringBuilder(); @@ -66,8 +63,8 @@ public class IndexCPPSignatureUtil { } else if (binding instanceof ICPPClassTemplatePartialSpecialization) { ICPPClassTemplatePartialSpecialization partial = (ICPPClassTemplatePartialSpecialization) binding; buffer.append(getTemplateArgString(partial.getTemplateArguments(), false)); - } - + } + if (binding instanceof ICPPFunction) { IFunction function = (ICPPFunction) binding; final IFunctionType ftype = function.getType(); @@ -85,10 +82,10 @@ public class IndexCPPSignatureUtil { if (ft.isVolatile()) buffer.append('v'); } - + return buffer.toString(); } - + private static void appendTemplateParameters(ICPPTemplateParameter[] tpars, StringBuilder buffer) { buffer.append('<'); for (ICPPTemplateParameter tpar : tpars) { @@ -119,7 +116,7 @@ public class IndexCPPSignatureUtil { throws CoreException, DOMException { return ASTTypeUtil.getArgumentListString(args, true); } - + /** * Constructs a string in the format: * (paramName1,paramName2,...) @@ -146,14 +143,12 @@ public class IndexCPPSignatureUtil { result.append(')'); return result.toString(); } - + /** - * Gets the signature hash for the passed binding. - * - * @param binding + * Returns the signature hash for the passed binding. + * + * @param binding the binding * @return the hash code of the binding's signature string - * @throws CoreException - * @throws DOMException */ public static Integer getSignatureHash(IBinding binding) throws CoreException, DOMException { String sig = getSignature(binding); @@ -161,19 +156,18 @@ public class IndexCPPSignatureUtil { } /** - * @return compares two bindings for signature information. Signature information covers - * function signatures, or template specialization/instance arguments. - * @param a - * @param b + * Compares signature hashes of the two given bindings. + * + * @param a the first binding + * @param b the second binding + * @return sgn(signature_hash(a) - signature_hash(b)) */ public static int compareSignatures(IBinding a, IBinding b) { try { int siga= getSignature(a).hashCode(); int sigb= getSignature(b).hashCode(); return siga < sigb ? -1 : siga > sigb ? 1 : 0; - } catch (CoreException e) { - CCorePlugin.log(e); - } catch (DOMException e) { + } catch (CoreException | DOMException e) { CCorePlugin.log(e); } return 0; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java index 600082de250..2de997b6aea 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPMethod.java @@ -41,10 +41,9 @@ import org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCAnnotation; import org.eclipse.core.runtime.CoreException; /** - * Method + * Method. */ class PDOMCPPMethod extends PDOMCPPFunction implements ICPPMethod { - /** * Offset of remaining annotation information (relative to the beginning of * the record).