< prev index next >

src/java.base/share/classes/jdk/internal/reflect/DelegatingMethodAccessorImpl.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2001, 2021, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -33,14 +33,15 @@
  /** Delegates its invocation to another MethodAccessorImpl and can
      change its delegate at run time. */
  
  class DelegatingMethodAccessorImpl extends MethodAccessorImpl {
      // initial non-null delegate
-     @Stable private final MethodAccessorImpl initialDelegate;
+     private final MethodAccessorImpl initialDelegate;
      // alternative delegate: starts as null;
      // only single change from null -> non-null is guaranteed
-     @Stable private  MethodAccessorImpl altDelegate;
+     @Stable
+     private MethodAccessorImpl altDelegate;
  
      DelegatingMethodAccessorImpl(MethodAccessorImpl delegate) {
          initialDelegate = Objects.requireNonNull(delegate);
      }
  

@@ -49,10 +50,17 @@
          throws IllegalArgumentException, InvocationTargetException
      {
          return delegate().invoke(obj, args);
      }
  
+     @Override
+     public Object invoke(Object obj, Object[] args, Class<?> caller)
+             throws IllegalArgumentException, InvocationTargetException
+     {
+         return delegate().invoke(obj, args, caller);
+     }
+ 
      private MethodAccessorImpl delegate() {
          var d = altDelegate;
          return  d != null ? d : initialDelegate;
      }
  
< prev index next >