Bug 96588

Summary: Rename Signature#removeCaptureFromMethod(...) to removeCaptureFrom(..)
Product: [Eclipse Project] JDT Reporter: Jerome Lanneluc <jerome_lanneluc>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dirk_baeumer, jeem, martinae
Version: 3.1   
Target Milestone: 3.1 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jerome Lanneluc CLA 2005-05-25 07:13:38 EDT
N20050525

The APIs Signature#removeCaptureFromMethod(...) remove the capture information
from a method signature. To be consistent, we need to offer to clients the
hability to remove the capture information from a type signature.

Since the implementation of removeCaptureFromMethod(...) consists in removing
the '!' character from the given signature, this implementation will also work
for type signatures.

Propose to rename removeCaptureFromMethod(...) to removeCaptureFrom(...) that
would take a type or method signature. Note that several APIs on Signature
already take a type or method signature.
Comment 1 Jerome Lanneluc CLA 2005-05-25 07:16:27 EDT
Jim, can you please approve this ? There is currently no known clients in the
Eclipse SDK. But once the change is made, JDT UI would use it to remove the
capture information in the hover.
Comment 2 Jim des Rivieres CLA 2005-05-25 08:42:41 EDT
approved  - I assume you'll rename both the String and char[] methods, and fix 
their specs accordingly.

Also, the implementation appears to handle at most 1 capture per signature. 
I'm not sure that is sufficient for cleansing type signatures (or even method 
signatures, for that matter). Please review Philippe with Philippe to make 
sure that implementation is up to the task.
Comment 3 Philipe Mulet CLA 2005-05-25 08:46:52 EDT
I think the implementation removes all occurrences of a capture just fine.
Comment 4 Jim des Rivieres CLA 2005-05-25 08:55:52 EDT
You're right; code is fine (I was focussing on the System.arrayCopy, and 
didn't read it closely enough).
Comment 5 Jerome Lanneluc CLA 2005-05-25 10:12:45 EDT
Thanks Jim. I will make the change right away.
Comment 6 Jerome Lanneluc CLA 2005-05-25 10:16:53 EDT
Renamed both the String and char[] methods. The spec now looks like:
/**
 * Removes any capture information from the given type or method signature
 * and returns the resulting signature.
 * Returns the type or method signature itself if no capture information is
 * present.
 * <p>
 * For example:
 * <pre>
 * <code>
 * removeCapture("LTest<!+Ljava.lang.Throwable;>;")
 * will return: "LTest<+Ljava.lang.Throwable;>;"
 * </code>
 * </pre>
 * </p>
 *
 * @param methodOrTypeSignature the signature which may have been captured
 * @return a new signature without capture information or the signature itself
 * 	if no specific capture information is present
 * @exception NullPointerException if <code>methodOrTypeSignature</code> is null
 *
 * @since 3.1
 */
public static String removeCapture(String methodOrTypeSignature)
Comment 7 David Audel CLA 2005-05-27 09:27:06 EDT
Verified in i20050527-0010