An abrupt completion always has an associated reason, which is one of the following:
A break with no label
A break with a given label
A continue with no label
A continue with a given label
A return with no value
A return with a given value
A throw with a given value, including exceptions thrown by the Java virtual machine
but later, talking about the for statement (188.8.131.52), it says
If the Expression is not present, then the only way a for statement can complete normally is by use of a break statement.
Is this incoherent or am I misunderstanding something?
It looks like you think that "abrupt completion" means "abnormal completion", as opposed to the words "complete normally" that you read about the for-statement. But I think that "abrupt completion" does not really mean "abnormal completion", and the statement that describes the for-statement doesn't directly have anything to do with the first description about abrupt completion. The statements are not contradicting each other, they are just talking about different things.
14.1 Normal and Abrupt Completion of Statements
If all the steps are carried out as described, with no indication of abrupt completion, the statement is said to complete normally. (...)
There is also a section about the break statement, but tt is also obscure to me...
14.15 The break Statement
A break statement with no label attempts to transfer control to the innermost enclosing switch, while, do, or for statement of the immediately enclosing method or initializer block; this statement, which is called the break target, then immediately completes normally.
To be precise, a break statement with no label always completes abruptly, the reason being a break with no label. If no switch, while, do, or for statement in the immediately enclosing method, constructor or initializer encloses the break statement, a compile-time error occurs.
After rereading the chapter, I think that the break statement makes the body of the for statement (what is in parenthesis after the for(...) line ) complete abruptly, giving control to the for statement (or switch, while, do), which completes normally. Maybe an English native speaker understands it more clearly
Federico Cardelle wrote:Maybe an English native speaker understands it more clearly
Maybe the keyword here is "speaker". The Java Language Specification, like all specifications, is written in a form of legalese. It can hardly be considered as written in the spoken form of english -- unless of course, you are a lawyer.
If you're trying to learn this because you want to do a certification exam, then don't worry about the exact definitions of words like "abrupt completion" and "normal completion" too much. You are not going to get questions on the exam that uses these terms. These are also not terms that a Java developer uses everyday to reason about code.