| Summary: | [formatter] Wrong format of anonymous inner class declaration | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Marius Kleber <marius> | ||||||||
| Component: | Core | Assignee: | Mateusz Matela <mateusz.matela> | ||||||||
| Status: | VERIFIED DUPLICATE | QA Contact: | Manoj N Palat <manoj.palat> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | dusisarath, jarthana, mateusz.matela | ||||||||
| Version: | 4.4.1 | ||||||||||
| Target Milestone: | 4.6 M5 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows 7 | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 250665 [details]
screenshot of the messed up formatting
Created attachment 250666 [details]
test class to reproduce the issue
Bug doesn't occur in Mars 4.5.1 anymore Mateusz, any idea what fixed this? (In reply to Jay Arthanareeswaran from comment #4) > Mateusz, any idea what fixed this? Well, the bug was there in 4.4 so it looks like it simply no longer occurred after the formatter redesign in 4.5.0. I just tested with 4.5.0 and the problem occurs there too (same formatter preferences, same workspace) - then again, it doesn't occur in 4.5.1. If you want me to provide further information please let me know. (In reply to Marius Kleber from comment #6) I see an indentation problem with this formatter profile in 4.5.0, but it's not related to anonymous classes or empty lines. It's that everything that should be indented with 2 tabs is indented with 1 tab, because "Indentation size" and "Tab size" are not set to the same value - see bug 467229 and a workaround there. Let me know if I missed anything else. (In reply to Mateusz Matela from comment #7) > (In reply to Marius Kleber from comment #6) > > I see an indentation problem with this formatter profile in 4.5.0, but it's > not related to anonymous classes or empty lines. It's that everything that > should be indented with 2 tabs is indented with 1 tab, because "Indentation > size" and "Tab size" are not set to the same value - see bug 467229 and a > workaround there. > > Let me know if I missed anything else. Thanks Mateusz, that works for me! (tested with 4.5.0) *** This bug has been marked as a duplicate of bug 467229 *** Verified for 4.6 M5 using Version: Neon (4.6) Build id: I20160119-0800 |
Created attachment 250664 [details] Formatter preferences Overview Description: When declaring a member variable of an interface type and implementing that interface as an anonymous inner class at the declaration, the formatting of the following code is messed up. This happens not all the time; It just occurs at every second formatting. Variant 1: First format messes up Variant 2: First format is OK, but after adding a new line and formatting again, the source is messed up The code before the declaration of the anonymous inner class is completely fine. Steps to Reproduce: 1) Declare a member variable of an interface type 2) Implement the interface as an anonymous inner class at the declaration 3) Format the source code (If not messed up directly, continue with step 4) 4) Add a new line 5) Format again Actual Results: Messed up formatting of code lines following the declaration Expected Results: Properly formatted source code Reproducibility: Import the attached .java file into eclipse with the attached formatter profile and follow the "steps to reproduce" section Build Date & Platform Bug Found: First noticed in Luna 4.4.0 and confirmed to be in Luna 4.4.1 as well Additional Information: Does not happen with the built-in Java convention formatter but only with the profile attached, but the behavior of jumping between OK and messed up (see description) made me suspicious. The problem itself isn't that grave but, even tough one can ignore whitespaces at compare, comparing with revision from repository doesn't work properly. Also committing wrongly formatted source code into the repository isn't that nice. Attachments: formatter.xml - the formatter profiling causing the bug wrongly_formatted.jpg - an screenshot of the messed up formatting FormatTest.java - the java test class used to reproduce to bug