diff --git a/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java b/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java index 4db453c9b7f..a6ef4fa289c 100644 --- a/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java +++ b/src/java.base/share/classes/java/lang/reflect/InvocationTargetException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ public class InvocationTargetException extends ReflectiveOperationException { * @serial * */ - private Throwable target; + private final Throwable target; /** * Constructs an {@code InvocationTargetException} with @@ -56,6 +56,7 @@ public class InvocationTargetException extends ReflectiveOperationException { */ protected InvocationTargetException() { super((Throwable)null); // Disallow initCause + this.target = null; } /**