jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
changeset 22609 4c76e9557a15
parent 22586 dd49926cdfae
child 23010 6dadb192ad81
equal deleted inserted replaced
22608:55902b6456fa 22609:4c76e9557a15
   224             if (!implDefiningClass.isAssignableFrom(receiverClass)) {
   224             if (!implDefiningClass.isAssignableFrom(receiverClass)) {
   225                 throw new LambdaConversionException(
   225                 throw new LambdaConversionException(
   226                         String.format("Invalid receiver type %s; not a subtype of implementation type %s",
   226                         String.format("Invalid receiver type %s; not a subtype of implementation type %s",
   227                                       receiverClass, implDefiningClass));
   227                                       receiverClass, implDefiningClass));
   228             }
   228             }
       
   229 
       
   230            Class<?> implReceiverClass = implMethod.type().parameterType(0);
       
   231            if (implReceiverClass != implDefiningClass && !implReceiverClass.isAssignableFrom(receiverClass)) {
       
   232                throw new LambdaConversionException(
       
   233                        String.format("Invalid receiver type %s; not a subtype of implementation receiver type %s",
       
   234                                      receiverClass, implReceiverClass));
       
   235              }
   229         } else {
   236         } else {
   230             // no receiver
   237             // no receiver
   231             capturedStart = 0;
   238             capturedStart = 0;
   232             samStart = 0;
   239             samStart = 0;
   233         }
   240         }