Community
Participate
Working Groups
Referring to: https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833#c10 We missed one case. This is not related to the same problem, but should be fixed as well. public class X { /** * <pre> {@code * * public class X { * }}</pre> */ void foo() {} } which is both formatted with or without your patch as: public class X02b { /** * <pre> * @code * * public class X { * }} * </pre> */ void foo() { } } The '{' before @code disappears.
Since there is loss of data, this is a must fix for 3.6M6.
The problem existed before the fix for bug 287833. This is not a new problem, so a fix for 3.6 only is fine.
Created attachment 158488 [details] Proposed patch While fixing bug 239719, I missed to handle the inline tags cases...
Released for 3.6M6 in HEAD stream.
Frederic, I could verify that there is no data loss any more, i.e the '{' is not swallowed by the formatter. However, while formatting public class X { /** * <pre> {@code * * public class X { * }}</pre> */ void foo() {} } I now get public class X { /** * <pre> * { * @code * public class X { * } * } * </pre> */ void foo() { } } Is this kosher ? For the HTML pre tag aren't we supposed to preserve all line breaks and spaces ?
(In reply to comment #5) I agree this look weird, but this is the behavior of the formatter since 3.3, hence this was not a regression when the formatting of comments was re-written in 3.4... However, I tested this snippet with 3.2.2 and it worked properly, the formatter output is: public class X { /** * <pre> * { * @code * public class X { * } * } * </pre> */ public void foo() { } } It seems I missed to verify this when I implemented the fix. Could you open a new bug about this issue and close this one? TIA
(In reply to comment #6) > (In reply to comment #5) > > I agree this look weird, but this is the behavior of the formatter since 3.3, > hence this was not a regression when the formatting of comments was re-written > in 3.4... I wasn't quite referring to @ being transformed into the sequence @ but to the line breaks and spaces being changed. Upon reading the spec again, I don't think there is a bug here: Only the visual rendering tools are not allowed to alter line breaks and such. Verified for 3.6M6 using build I20100305-1011
(In reply to comment #7) > (In reply to comment #6) > > (In reply to comment #5) > > > > I agree this look weird, but this is the behavior of the formatter since 3.3, > > hence this was not a regression when the formatting of comments was re-written > > in 3.4... > > I wasn't quite referring to @ being transformed into the sequence > @ but to the line breaks and spaces being changed. Upon reading > the spec again, I don't think there is a bug here: Only the visual > rendering tools are not allowed to alter line breaks and such. > Oh, ok, hence the spaces and line breaks changes are expected because the formatter formats the code inside the <pre> tag according to the user profile...