Bug 62697 - Need to know if a package reference match is in Javadoc or in Code
Summary: Need to know if a package reference match is in Javadoc or in Code
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-18 12:39 EDT by Frederic Fusier CLA
Modified: 2004-05-28 14:53 EDT (History)
2 users (show)

See Also:


Attachments
Implementation for new API on PackageReferenceMatch (2.75 KB, patch)
2004-05-24 09:37 EDT, Frederic Fusier CLA
no flags Details | Diff
Test cases modification to validate this new API (4.83 KB, patch)
2004-05-24 09:39 EDT, Frederic Fusier CLA
no flags Details | Diff
Implementation for new version of API changes (7.70 KB, patch)
2004-05-26 13:08 EDT, Frederic Fusier CLA
no flags Details | Diff
Modified test case for last implementation (4.82 KB, patch)
2004-05-26 13:09 EDT, Frederic Fusier CLA
no flags Details | Diff
Improved implementation of new version of API change (15.11 KB, patch)
2004-05-26 15:03 EDT, Jim des Rivieres CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Fusier CLA 2004-05-18 12:39:40 EDT
Using M9 build I200405180816.

While verifying bug 56449, I noticed that it was not possible to make this
distinction between Javadoc and Code for package references matches...

See also bug 54962...
Comment 1 Philipe Mulet CLA 2004-05-20 08:05:10 EDT
Does it require an API change ?
Comment 2 Frederic Fusier CLA 2004-05-23 12:14:34 EDT
Yes, it would imply to modify existing constructor on PackageReferenceLocator to
add boolean parameter which shows whether the location is inside a doc comment
or not.

So, existing constructor:
/**
 * Creates a new package reference match.
 * 
 * @param enclosingElement the inner-most enclosing member that references this
package
 * @param accuracy one of A_ACCURATE or A_INACCURATE
 * @param offset the offset the match starts at, or -1 if unknown
 * @param length the length of the match, or -1 if unknown
 * @param participant the search participant that created the match
 * @param resource the resource of the element
 */
public PackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int
offset, int length, SearchParticipant participant, IResource resource) {
    super(enclosingElement, accuracy, offset, length, participant, resource);
}

would become:
/**
 * Creates a new package reference match.
 * 
 * @param enclosingElement the inner-most enclosing member that references this
package
 * @param accuracy one of A_ACCURATE or A_INACCURATE
 * @param offset the offset the match starts at, or -1 if unknown
 * @param length the length of the match, or -1 if unknown
 * @param insideDocComment whether the match is inside a doc comment
 * @param participant the search participant that created the match
 * @param resource the resource of the element
 */
public PackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int
offset, int length, boolean insideDocComment, SearchParticipant participant,
IResource resource) {
    super(enclosingElement, accuracy, offset, length, participant, resource);
    this.insideDocComment = insideDocComment;
}
Comment 3 Frederic Fusier CLA 2004-05-24 09:37:05 EDT
Created attachment 11006 [details]
Implementation for new API on PackageReferenceMatch
Comment 4 Frederic Fusier CLA 2004-05-24 09:39:28 EDT
Created attachment 11007 [details]
Test cases modification to validate this new API
Comment 5 Philipe Mulet CLA 2004-05-24 10:31:10 EDT
Requested PMC approval:

All reference search matches do record the fact they are located inside 
javadoc, except for package references. We would like to have them all be 
consistent and take the insideDocComment flag as an argument in their 
constructor. We are the sole client to this API (used to construct search 
results for package references). 

If we do not fix it, then we don't have a way to record this information as 
our API is quite minimalistic and does not provide setter methods.
Comment 6 Philipe Mulet CLA 2004-05-26 12:19:25 EDT
We will actually propose a bigger change than originally anticipated so as to 
make the API more useable (after talking with Jim).

Plan is to:
- promote the insideDocComment flag onto SearchMatch itself
- add setters for all SearchMatch properties
- add insideDocComment argument to PackageReferenceMatch constructor (for 
being consistent with other refs).

Rational for setters & promotion is that more setters allow other participant 
to better interoperate with delegate client search results (think JSP 
delegating to Java). And in certain languages, there could be some 
declarations inside doc comments, where in Java it doesn't occur by default 
(this is why only our reference match constructors are equipped with this flag 
by default).

Frederic - pls prepare enhanced patch asap.
Comment 7 Frederic Fusier CLA 2004-05-26 13:08:04 EDT
Created attachment 11145 [details]
Implementation for new version of API changes

Jeem, please verify Javadoc on SearchMatch setters I've added and modify if you
think there are some information missing. Thx.
Comment 8 Frederic Fusier CLA 2004-05-26 13:09:58 EDT
Created attachment 11147 [details]
Modified test case for last implementation

Note that API changes didn't really change the test case. It's just a refresh
due to HEAD changes since last patch...
Comment 9 Jim des Rivieres CLA 2004-05-26 15:03:12 EDT
Created attachment 11153 [details]
Improved implementation of new version of API change

Frederic, I made the following minor changes to your patch:
- moved isInsideDocComment() to SearchMatch and made final
- made all new SearchMatch getters and setters final
- changed specs of setters to match getters with respect to null
Comment 10 Jim des Rivieres CLA 2004-05-26 15:06:01 EDT
These API changes approved for inclusion in 3.0 RC1.
Comment 11 Frederic Fusier CLA 2004-05-27 06:28:44 EDT
Thanks Jeem for your buddy check and last improvements.
All tests pass (jdt-core+jdt-ui) => released in HEAD.
Comment 12 Olivier Thomann CLA 2004-05-28 14:53:21 EDT
Verified in 200405281200 that isInsideDocComment has been promoted on SearchMatch