0

I have a requirement on my current project to produce uniform formatted Java Source code.

I have investigated the libraries listed here

with none of these resolving all my issues.

Required mandatory formatting

  • All method args must be final.
  • No line wrapping.
  • All unnecessary round brackets must be removed.

The desired library must have a Java API, I do not want to deal with IDE plugins or command line invocation.

The google-java-format library is very close to what I require however it is not configurable by design.

The Eclipse IDE save actions is also close however it doesn't remove unnecessary brackets.

Are there any libraries that satisfy all my requirements?

1 Answer 1

2

I would use IntelliJ IDEA and inspections for this. You can configure and select which inspections to run, and even scope them to just tests/production code/custom scope. There is a wide variety of inspections, and what you are looking for should be well within what can be offered. Also, you can do a full inspection of your entire project, as well as fix all problems of a certain type with the click of a button.

https://www.jetbrains.com/help/idea/code-inspection.html https://www.jetbrains.com/help/idea/running-inspections.html https://blog.jetbrains.com/idea/2014/07/try-intellij-idea-14-eap-138-1283-4-with-code-cleanup-android-studio-beta-features-and-more/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.