Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8083245 | emb-9 | Stefan Karlsson | P2 | Resolved | Fixed | team |
JDK-8214622 | 8u211 | Paul Hohensee | P2 | Resolved | Fixed | b01 |
JDK-8212241 | 8u202 | Paul Hohensee | P2 | Resolved | Fixed | b02 |
JDK-8220875 | emb-8u211 | Paul Hohensee | P2 | Resolved | Fixed | master |
Klass* ConstantPool::klass_ref_at(int which, TRAPS) {
return klass_at(klass_ref_index_at(which), CHECK_NULL);
}
This will expand into:
Klass* ConstantPool::klass_ref_at(int which, TRAPS) {
return klass_at(klass_ref_index_at(which), THREAD);
if (HAS_PENDING_EXCEPTIONS) {
return NULL;
}
(void)(0);
}
The if-statement will never be reached.
We have seen cases where the compiler warns about this, and the recent change to enable -Wreturn-type will make this more likely to happen.
The suggested solution is to change the example above into:
Klass* ConstantPool::klass_ref_at(int which, TRAPS) {
return klass_at(klass_ref_index_at(which), THREAD);
}
- backported by
-
JDK-8083245 Use THREAD instead of CHECK_NULL in return statements
- Resolved
-
JDK-8212241 Use THREAD instead of CHECK_NULL in return statements
- Resolved
-
JDK-8214622 Use THREAD instead of CHECK_NULL in return statements
- Resolved
-
JDK-8220875 Use THREAD instead of CHECK_NULL in return statements
- Resolved
- duplicates
-
JDK-6889002 CHECK macros in return constructs lead to unreachable code
- Closed
- relates to
-
JDK-6889002 CHECK macros in return constructs lead to unreachable code
- Closed
-
JDK-8225137 Clean up remaining CHECK_NULL -> THREAD return issues
- Closed