Bug 385858 - Add token location for constructor start (TL_CONSTRUCTOR_START)
Summary: Add token location for constructor start (TL_CONSTRUCTOR_START)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.3 M1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 385504
  Show dependency tree
 
Reported: 2012-07-24 10:04 EDT by Dani Megert CLA
Modified: 2012-08-06 05:15 EDT (History)
2 users (show)

See Also:


Attachments
proposed fix v1.0 + regression tests (10.58 KB, patch)
2012-07-26 06:20 EDT, Ayushman Jain CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2012-07-24 10:04:14 EDT
3.8.

Add token location for constructor start (CompletionContext.TL_CONSTRUCTOR_START).
Comment 1 Ayushman Jain CLA 2012-07-26 06:20:18 EDT
Created attachment 219203 [details]
proposed fix v1.0 + regression tests

Dani, let me know if this patch suffices. The TL_CONSTRUCTOR_START will be set for all of new |, new M| or new Ma| in the case below.

class Main {
   void foo() {
      new |
   }
}
Comment 2 Dani Megert CLA 2012-07-30 06:44:16 EDT
(In reply to comment #1)
> Created attachment 219203 [details] [diff]
> proposed fix v1.0 + regression tests
> 
> Dani, let me know if this patch suffices. The TL_CONSTRUCTOR_START will be
> set for all of new |, new M| or new Ma| in the case below.
> 
> class Main {
>    void foo() {
>       new |
>    }
> }

Yes, if the space between "new" and | stands for any number of whitespace.
Comment 3 Ayushman Jain CLA 2012-07-30 07:20:24 EDT
(In reply to comment #2)
> Yes, if the space between "new" and | stands for any number of whitespace.

Yup. 

Released via commit cfc5eb85d262e7fc676968dac1dbb5e48659f078 and also added a new test to confirm that any number of whitespaces work between new and |
Comment 4 Dani Megert CLA 2012-08-02 10:35:56 EDT
Thanks. Using new API now in jdt.ui (master) and verified that it works.
Comment 5 Srikanth Sankaran CLA 2012-08-06 02:46:56 EDT
The javadoc reads for the new completion context reads

"The completed token is the first token of a constructor." it is better worded
as "The completed token is the first token of a constructor invocation 
expression".

Verified for 4.3 M1 using Build id: I20120805-2000
Comment 6 Ayushman Jain CLA 2012-08-06 05:15:43 EDT
(In reply to comment #5)
> [..]
> "The completed token is the first token of a constructor." it is better
> worded
> as "The completed token is the first token of a constructor invocation 
> expression".

Good point. Fixed via commit 5b4b5a81d63f2a4115a13f4d0d483f456163707a