JDK-8025475 : invokespecial to a private super-interface instance (default) method gives NoSuchMethodError
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2013-09-26
  • Updated: 2013-09-27
  • Resolved: 2013-09-27
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.
Other
hs25Resolved
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Description
This appears to because resolution seems to be based on the current class.

That in:
   final class IDo$$Lambda$1 extends java.lang.invoke.MagicLambdaImpl implements IDo

This call in val():
         4: invokespecial #19                 // Method IDo.lambda$guts$0:()V

To this method in IDo:
  private void lambda$guts$0();
    descriptor: ()V
    flags: ACC_PRIVATE, ACC_SYNTHETIC

Fails with:
  Exception in thread "main" java.lang.NoSuchMethodError: IDo$$Lambda$1.lambda$guts$0()V
        at IDo$$Lambda$1.val(Unknown Source)

It appears to be trying to find the class in the current class rather than the class containing the private method.

A slightly altered version where IDo$$Lambda$1 does not implement IDo (and thus the bytecodes look identical) succeeds.

Attachments:
  Source files: Source_*.java
  javap output: *.javap
  Calling class: IDoLambda_*.javap (this is the generated output class for a lambda, but that doesn't matter in this case)
  Called interface: IDo_*.javap
  Code/output demonstrating the bug: *_Fail.*
  Code/output of the version that works: *_Succeed.*





Comments
This was a problem in an early internal prototype for 8011311. Merging the fix for 8014013 and updating the 8011311 prototype to match the 0.6.3 JVMS spec update (as agreed upon 9/20/13) fixes this problem.
27-09-2013

This occurs in cases where the calling class is a subtype of the interface containing the private instance method. With Lambda goggles on: lambda in a default method of an interface that is the target functional interface for the lambda. The lambda references instance methods forcing it to be implemented in the private default method.
26-09-2013

Assigned to John on Karen's request
26-09-2013

Succeeding version -- calling class (generated lambda class)
26-09-2013