Fix the interface flag when re-writing a closure call to the body method#5452
Merged
adriaanm merged 1 commit intoscala:2.12.0from Oct 10, 2016
Merged
Fix the interface flag when re-writing a closure call to the body method#5452adriaanm merged 1 commit intoscala:2.12.0from
adriaanm merged 1 commit intoscala:2.12.0from
Conversation
Member
Author
|
I vote for putting this into RC2.. |
retronym
reviewed
Oct 9, 2016
| INVOKESPECIAL | ||
| } | ||
| val isInterface = bodyOpcode == INVOKEINTERFACE | ||
| val isInterface = classBTypeFromInternalName(lambdaBodyHandle.getOwner).isInterface.get |
Member
There was a problem hiding this comment.
Could we ever hit a case where we don't classBTypeFromInternalName.apply or .get fails, say if the lambda target class was not in the current compilation classpath? (Maybe a lambda had previously been inlined into the class from which we are inlining.)
Member
There was a problem hiding this comment.
Oh, we can just call lambdaBodyHandle.isInterface here!
When re-writing a closure invocation to the body method, the `itf` flag of the invocation instruction was incorrect: it needs to be true if the method is defined in an interface (including static methdos), not if the method is invoked through `INVOKEINTERFACE`. JDK 8 doesn't flag this inconsistency and executes the bytecode, but the verifier in JDK 9 throws an `IncompatibleClassChangeError`. Similar fixes went into e619b03.
Member
|
LGTM. 👍 for 2.12.0 |
retronym
added a commit
to retronym/scala
that referenced
this pull request
Oct 13, 2016
We need this to close the loop on scala#5452.
10 tasks
smarter
added a commit
to dotty-staging/scala
that referenced
this pull request
Sep 17, 2017
The itf flag of `visitMethodInsn` and `Handle` in ASM needs to be true when the method is defined in an interface. Java 8 ignores this but Java 9 fails at runtime with: java.lang.IncompatibleClassChangeError: Method ... must beInterfaceMethodref constant This commit is inspired by similar changes in scalac, in particular see 7d51b3f by Jason Zaugg (from scala#5251) and e619b03 by Lukas Rytz (from scala#5293). This issue was also discussed in scala#5452 (which does not matter for Dotty since we do not run the backend optimizer).
smarter
added a commit
to lampepfl/scala
that referenced
this pull request
Oct 12, 2017
The itf flag of `visitMethodInsn` and `Handle` in ASM needs to be true when the method is defined in an interface. Java 8 ignores this but Java 9 fails at runtime with: java.lang.IncompatibleClassChangeError: Method ... must beInterfaceMethodref constant This commit is inspired by similar changes in scalac, in particular see 7d51b3f by Jason Zaugg (from scala#5251) and e619b03 by Lukas Rytz (from scala#5293). This issue was also discussed in scala#5452 (which does not matter for Dotty since we do not run the backend optimizer).
smarter
added a commit
to dotty-staging/scala
that referenced
this pull request
Aug 23, 2018
The itf flag of `visitMethodInsn` and `Handle` in ASM needs to be true when the method is defined in an interface. Java 8 ignores this but Java 9 fails at runtime with: java.lang.IncompatibleClassChangeError: Method ... must beInterfaceMethodref constant This commit is inspired by similar changes in scalac, in particular see 7d51b3f by Jason Zaugg (from scala#5251) and e619b03 by Lukas Rytz (from scala#5293). This issue was also discussed in scala#5452 (which does not matter for Dotty since we do not run the backend optimizer).
smarter
added a commit
to dotty-staging/scala
that referenced
this pull request
Aug 23, 2018
The itf flag of `visitMethodInsn` and `Handle` in ASM needs to be true when the method is defined in an interface. Java 8 ignores this but Java 9 fails at runtime with: java.lang.IncompatibleClassChangeError: Method ... must beInterfaceMethodref constant This commit is inspired by similar changes in scalac, in particular see 7d51b3f by Jason Zaugg (from scala#5251) and e619b03 by Lukas Rytz (from scala#5293). This issue was also discussed in scala#5452 (which does not matter for Dotty since we do not run the backend optimizer).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When re-writing a closure invocation to the body method, the
itfflagof the invocation instruction was incorrect: it needs to be true if
the method is defined in an interface (including static methdos), not
if the method is invoked through
INVOKEINTERFACE.JDK 8 doesn't flag this inconsistency and executes the bytecode, but the
verifier in JDK 9 throws an
IncompatibleClassChangeError.Similar fixes went into e619b03.
Fixes scala/scala-dev#242