Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 402174 - [1.8][formatter] Code formatter should understand method and constructor references.
Summary: [1.8][formatter] Code formatter should understand method and constructor refe...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Jesper Moller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 400830
  Show dependency tree
 
Reported: 2013-03-01 13:25 EST by Srikanth Sankaran CLA
Modified: 2013-03-11 08:16 EDT (History)
2 users (show)

See Also:


Attachments
Format support for method and constructor references (2.66 KB, patch)
2013-03-11 03:38 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2013-03-01 13:25:25 EST
Method and constructor references should be understood by the formatter
and processed properly.
Comment 1 Jesper Moller CLA 2013-03-03 17:01:05 EST
Srinkanth, I'm ready to submit the patch for this -- would you prefer this as a cumulative patch to the patches in bug 402173 (formatter for lambda), or do you want an independent patch for this.
(Silly me, I'd clumped all of the formatting for 1.8 into one test case, so now I'm picking it apart).
Comment 2 Srikanth Sankaran CLA 2013-03-09 14:31:46 EST
(In reply to comment #1)
> Srinkanth, I'm ready to submit the patch for this -- would you prefer this
> as a cumulative patch to the patches in bug 402173 (formatter for lambda),
> or do you want an independent patch for this.
> (Silly me, I'd clumped all of the formatting for 1.8 into one test case, so
> now I'm picking it apart).

Sorry, I didn't see this question earlier. But it is answered by the fact that
the lambda work is released already. If you post a patch for reference expressions
alone, I'll take it forward.
Comment 3 Srikanth Sankaran CLA 2013-03-11 03:38:25 EDT
Created attachment 228178 [details]
Format support for method and constructor references

This is extracted from the patch posted by Jesper
(https://bugs.eclipse.org/bugs/attachment.cgi?id=227503) at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400830.

I did not extract the tests from there since all of the tests
involve 308 annotations.

I'll add fresh tests to verify the functionality.
Comment 4 Srikanth Sankaran CLA 2013-03-11 04:41:34 EDT
(In reply to comment #3)
> Created attachment 228178 [details]
> Format support for method and constructor references

I made the following changes and released the fix here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=c4e062ebcfc48b14b7c36c591e88d44ce5b3b5c0 - Thanks Jesper.
Tests will follow in a separate patch.

(1) Since the posting of the patch at (https://bugs.eclipse.org/bugs/attachment.cgi?id=227503) at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400830, the fields of
ReferenceExpression have undergone a change. The field method which used
to be a SingleNameReference does not exist any more and has been replaced
with 'selector' which a char [] that stores the identifier. Adjusted the
patch accordingly.

(2) The type argument printing code appears to be copied from PSTR/PQTR
processing code - this is incorrect. We should adapt it from formatMessageSend.
Comment 5 Srikanth Sankaran CLA 2013-03-11 08:16:22 EDT
Tests released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=4da206fbf61a10e973b62f504ebc9e4e8671589b

Thanks Jesper. Please include the tests that combine 335 and 308 as part of
type annotations formatting work.