< prev index next >

src/java.base/share/classes/java/lang/invoke/SerializedLambda.java

Print this page




 201 
 202     /**
 203      * Get the count of dynamic arguments to the lambda capture site.
 204      * @return the count of dynamic arguments to the lambda capture site
 205      */
 206     public int getCapturedArgCount() {
 207         return capturedArgs.length;
 208     }
 209 
 210     /**
 211      * Get a dynamic argument to the lambda capture site.
 212      * @param i the argument to capture
 213      * @return a dynamic argument to the lambda capture site
 214      */
 215     public Object getCapturedArg(int i) {
 216         return capturedArgs[i];
 217     }
 218 
 219     private Object readResolve() throws ReflectiveOperationException {
 220         try {
 221             Method deserialize = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
 222                 @Override
 223                 public Method run() throws Exception {
 224                     Method m = capturingClass.getDeclaredMethod("$deserializeLambda$", SerializedLambda.class);
 225                     m.setAccessible(true);
 226                     return m;
 227                 }
 228             });
 229 
 230             return deserialize.invoke(null, this);
 231         }
 232         catch (PrivilegedActionException e) {
 233             Exception cause = e.getException();
 234             if (cause instanceof ReflectiveOperationException)
 235                 throw (ReflectiveOperationException) cause;
 236             else if (cause instanceof RuntimeException)
 237                 throw (RuntimeException) cause;
 238             else
 239                 throw new RuntimeException("Exception in SerializedLambda.readResolve", e);
 240         }
 241     }


 201 
 202     /**
 203      * Get the count of dynamic arguments to the lambda capture site.
 204      * @return the count of dynamic arguments to the lambda capture site
 205      */
 206     public int getCapturedArgCount() {
 207         return capturedArgs.length;
 208     }
 209 
 210     /**
 211      * Get a dynamic argument to the lambda capture site.
 212      * @param i the argument to capture
 213      * @return a dynamic argument to the lambda capture site
 214      */
 215     public Object getCapturedArg(int i) {
 216         return capturedArgs[i];
 217     }
 218 
 219     private Object readResolve() throws ReflectiveOperationException {
 220         try {
 221             Method deserialize = AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
 222                 @Override
 223                 public Method run() throws Exception {
 224                     Method m = capturingClass.getDeclaredMethod("$deserializeLambda$", SerializedLambda.class);
 225                     m.setAccessible(true);
 226                     return m;
 227                 }
 228             });
 229 
 230             return deserialize.invoke(null, this);
 231         }
 232         catch (PrivilegedActionException e) {
 233             Exception cause = e.getException();
 234             if (cause instanceof ReflectiveOperationException)
 235                 throw (ReflectiveOperationException) cause;
 236             else if (cause instanceof RuntimeException)
 237                 throw (RuntimeException) cause;
 238             else
 239                 throw new RuntimeException("Exception in SerializedLambda.readResolve", e);
 240         }
 241     }
< prev index next >