JDK-8203892 : Target interface added as marker interface in calls to altMetafactory
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-05-28
  • Updated: 2018-06-05
  • Resolved: 2018-05-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b16Fixed
Related Reports
Relates :  
Description
Between 11+14 and 11+15, in calls to bootstrap this:

    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));
    }

... the parameters to altMetafactory for the indy has changed:

11+14:

  3: #159 REF_invokeStatic java/lang/invoke/LambdaMetafactory.altMetafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
    Method arguments:
      #160 (Ljava/lang/Object;Ljava/lang/Object;)I
      #185 REF_invokeStatic java/util/Comparator.lambda$comparingInt$7b0bb60$1:(Ljava/util/function/ToIntFunction;Ljava/lang/Object;Ljava/lang/Object;)I
      #160 (Ljava/lang/Object;Ljava/lang/Object;)I
      #162 5
      #163 0

11+15:

  3: #159 REF_invokeStatic java/lang/invoke/LambdaMetafactory.altMetafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
    Method arguments:
      #160 (Ljava/lang/Object;Ljava/lang/Object;)I
      #186 REF_invokeStatic java/util/Comparator.lambda$comparingInt$7b0bb60$1:(Ljava/util/function/ToIntFunction;Ljava/lang/Object;Ljava/lang/Object;)I
      #160 (Ljava/lang/Object;Ljava/lang/Object;)I
      #162 7
      #163 1
      #5 java/util/Comparator
      #164 0

Since the target type is java/util/Comparator, this change in behavior seems to be incorrect


Comments
the exact culprit is the fix for: JDK-8148354
28-05-2018

regression caused by JDK-8203486 and friends. The aray of additional interfaces in the BSM is bogus: it contains Comparator (which should be implicit from the indy dynamic type's return type). It also should not contain Serializable, as the LambdaMetafactory will add that one for free.
28-05-2018