IntelliJ allow brackets on same line when empty but not when single statement

Answered

Simply put, in reference to bracketed statements such as in try/catch, if/else if/else, methods, etc., I would like to allow :

try {
//Code that may throw an exception
}
catch(RandomException e) {}

And this:

try {
//Code that may throw an exception
}
catch(RandomException e) {
e.printStackTrace();
}

But not this:

try {
//Code that may throw an exception
}
catch(RandomException e) { e.printStackTrace(); }

Essentially, I want to be able to have brackets on the same line ONLY when the block is empty and not if there are any statements within the block.

Is there any way to configure the Java Code Style Scheme such that the constraints above are met?

1
1 comment

This seems to be a duplicate of IDEA-126070, which unfortunately would mean that this has not been implemented.

0

Please sign in to leave a comment.