RFR: 7903711: Rewrite simple methods ANC plugin to classfile API [v2]
Alexandre Iline
shurailine at openjdk.org
Mon Apr 15 18:55:58 UTC 2024
On Mon, 15 Apr 2024 18:46:40 GMT, Leonid Kuskov <lkuskov at openjdk.org> wrote:
>> I think OpenJDK style is to only not use curly brackets in statement is on the same line as the if. If the statement is on another line, you were supposed to use the curly brackets. I do not remember where I saw this.
>
> Jcov uses '2-lines' if statements in many places, which, although more readable, is incorrect. The OpenJDK Java code style recommends using curly braces syntax instead - [https://cr.openjdk.org/~alundblad/styleguide/index-v6.html#toc-braces](https://cr.openjdk.org/~alundblad/styleguide/index-v6.html#toc-braces)
This, then is also against the openjdk code style:
if (m.code().isPresent()) {
Instruction next = new InstructionIterator(m.code().get()).next(i -> !isSimpleInstruction(i.opcode()));
return next.opcode() == Opcode.RETURN;
} else return false;
"If one of the blocks in a if / else statement has braces, the other block must too."
-------------
PR Review Comment: https://git.openjdk.org/jcov/pull/44#discussion_r1566293223
More information about the jcov-dev
mailing list