src/java.base/share/classes/java/lang/invoke/ConstantBootstraps.java
changeset 48834 19ef3f64bc10
parent 48827 8772acd913e5
child 48878 2f265d2ac735
equal deleted inserted replaced
48833:614c7e117327 48834:19ef3f64bc10
     1 /*
     1 /*
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   230         requireNonNull(type);
   230         requireNonNull(type);
   231         requireNonNull(handle);
   231         requireNonNull(handle);
   232         requireNonNull(args);
   232         requireNonNull(args);
   233 
   233 
   234         if (type != handle.type().returnType()) {
   234         if (type != handle.type().returnType()) {
   235             handle = handle.asType(handle.type().changeReturnType(type));
   235             // Adjust the return type of the handle to be invoked while
       
   236             // preserving variable arity if present
       
   237             handle = handle.asType(handle.type().changeReturnType(type)).
       
   238                     withVarargs(handle.isVarargsCollector());
   236         }
   239         }
   237 
   240 
   238         return handle.invokeWithArguments(args);
   241         return handle.invokeWithArguments(args);
   239     }
   242     }
   240 
   243