Please reply to my JDK-8059640 issue comment

Dan Smith daniel.smith at oracle.com
Wed Jul 8 23:23:41 UTC 2015


> On Jul 6, 2015, at 10:13 AM, Georgiy Rakov <georgiy.rakov at oracle.com> wrote:
> 
> Hello,
> 
> could you please reply to my following comment <https://bugs.openjdk.java.net/browse/JDK-8059640?focusedCommentId=13817637&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13817637> I made to JDK-8059640; quoting it:
> Suggested spec change states that 15.13.3 will contain following assertion:
> 
> LinkageError may occur due to inconsistencies between compile time and run time (in the referenced method, the functional interface, or the argument types of either). 
> 
> The details are provided in parenthesis: "in the referenced method, the functional interface, or the argument types of either". It seems that these details don't extend to following case specified in jls-15.12.4.3-120:
> 
> If the invocation mode is interface, then the implementation must also check that the target reference type still implements the specified interface. If the target reference type does not still implement the interface, then an IncompatibleClassChangeError occurs.
> 
> I believe they should.
> 
> Namely, could you please tell if you agree that spec change suggested in the issue description doesn't extend to the case specified in jls-15.12.4.3-120. If you agree I would appreciate greatly if you could modify the suggested spec change so that it extends to jls-15.12.4.3-120 case.
> 

I think these are two different kinds of errors.

JDK-8059640 is about BootstrapMethodErrors that can occur upon *evaluation of* a method reference expression, but that aren't specified to occur.

The check you describe is an ICCE that can happen upon *invocation of* the method of an object derived from a method reference expression.

Please correct me if you're seeing different behavior, but my expectation is that the invocation will behave exactly as specified: per 15.13.3, the body of the method is via an invocation that proceeds according to 15.12.4.3; per 15.12.4.3, the ICCE can occur.

Example:

interface I { int x(); }
interface Func { int apply(I arg); }

Func f2 = I::x;
System.out.println(f2);
// no errors yet
System.out.println(f2.apply(new C()));
// ICCE if C was originally declared to implement I, but no longer does

So I don't think there's a bug here, either in the spec or the implementation.

—Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20150708/2860d972/attachment.html>


More information about the compiler-dev mailing list