Sometimes I want annotations on fields be in a single line and sometimes in a line each. Is there any way to make Eclipse formatter just ignore these annotations and leave the lines breaks just as I did?
Not quite sure what you mean, but you break up lines for field this way:
String text =
"cake" +
"more cake" +
"alot more cake";
This is also an option: You can go to Properties -> Java code style -> Formatter -> Edit: Then there should be some tags to on/off. Also include this line in your code:
/* @formatter:on */
I think so. In Preferences go to Java - Code Style - Wrapper. Then edit your active profile, click "Line Wrapping" and then "Annotations - Element-value pairs". Then set the Line wrapping policy to "Do not wrap".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.