Open fedejeanne opened 1 year ago
On quick google search I found this comment in a bug which has code to reproduce the bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=471825#c11
It fails when we try to Save an syntactically incorrect code.
As far I can understand, it fails because we ignore errors if kind is K_COMPILATION_UNIT
: https://github.com/eclipse-jdt/eclipse.jdt.core/blob/master/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java#L317
For me if a code is not syntactically we should not format it at all but I can't find any comment on why ignoreErrors
was set to true for K_COMPILATION_UNIT
in the original code which was introduced in this commit: https://github.com/eclipse-jdt/eclipse.jdt.core/commit/b0e753009ffb9bf0d92f75f621fb0d6188adb57e
Submitted issue in jdt.core repo: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1437
Pushed back to ready. Can be picked again.
This exception popped up when saving content in a Java class
Expected behavior
The exception shouldn't happen
How to reproduce
The problem happens seldom but a possible way of reproducing it could be: