RFR: 8203892: Target interface added as marker interface in calls to altMetafactory

Vicente Romero vicente.romero at oracle.com
Mon May 28 20:09:10 UTC 2018


Please review the fix for [1], which is a regression provoked by [2]. 
The fix can be find at [3]. The regression could be reproduced with this 
test case:

import java.util.*;
import java.util.function.*;
import java.io.*;

class Test {
     public static <T> Comparator<T> comparingInt(ToIntFunction<? super 
T> keyExtractor) {
         Objects.requireNonNull(keyExtractor);
         return (Comparator<T> & Serializable)
             (c1, c2) -> Integer.compare(keyExtractor.applyAsInt(c1), 
keyExtractor.applyAsInt(c2));
     }
}

in this case javac generates a BSM to the alternative metafactory, but 
after the change for [2] the target type was included as one of the 
marker interfaces. This patch fixes that issue.

TIA,
Vicente

[1] https://bugs.openjdk.java.net/browse/JDK-8203892
[2] https://bugs.openjdk.java.net/browse/JDK-8148354
[3] http://cr.openjdk.java.net/~vromero/8203892/webrev.00/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180528/f416ca78/attachment.html>


More information about the compiler-dev mailing list