8256370: Add asserts to Reference.getInactive()

Reviewed-by: mchung
This commit is contained in:
Roman Kennke 2020-11-17 15:46:34 +00:00
parent c255b18cfc
commit f2a9d02de2
2 changed files with 4 additions and 1 deletions

View file

@ -83,7 +83,8 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
try { try {
Object finalizee = this.getInactive(); Object finalizee = this.getInactive();
if (finalizee != null && !(finalizee instanceof java.lang.Enum)) { assert finalizee != null;
if (!(finalizee instanceof java.lang.Enum)) {
jla.invokeFinalize(finalizee); jla.invokeFinalize(finalizee);
// Clear stack slot containing this variable, to decrease // Clear stack slot containing this variable, to decrease

View file

@ -353,6 +353,8 @@ public abstract class Reference<T> {
* null, and would subsequently not finalize the referent/finalizee. * null, and would subsequently not finalize the referent/finalizee.
*/ */
T getInactive() { T getInactive() {
assert this instanceof FinalReference;
assert next == this; // I.e. FinalReference is inactive
return this.referent; return this.referent;
} }