Sniper printer code formatting problems
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
I am testing Spoon on our project and there were a number of formatting changes (some with functional impact). I decided too check what happened when rewriting all elements in all files of our projects.
I used the following processor:
``` java
new AbstractProcessor() {
public void process(CtElement element) {
// Do a no-op change, this will force the sniper printer to update the source
SourcePosition pos = element.getPosition();
element.setPosition(SourcePosition.NOPOSITION);
element.setPosition(pos);
};
}
```
I checked the most important problems and made testcases for them.
The kind of problems:
- Brackets being removed/inserted
- Exception class names being fully qualified
- Comments in conditional statements being incorrectly handled
- Semicolon at end of enums being added
- Comments in enum arguments (causes crash)
- Comment formatting being changed
For details see tests in #3812
I suspect there are more issues, but these are the most frequent ones.
Contributor guide
Assessment
This issue has not been assessed yet.