Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] Respect interface methods with Code attributes #10466

Merged
merged 2 commits into from Nov 4, 2021
Merged

Conversation

Simn
Copy link
Member

@Simn Simn commented Nov 3, 2021

This consists of these steps:

  • If while loading a jar we come across an interface method that has a Code attribute, add the @:java.default metadata to the field.
  • If while typing a field we come across the @:java.default metadata, add the CfDefault flag to the class field.
  • While checking interface implementations, if there's a missing interface method that has the CfDefault flag, create a copy of it on the implementing class the same way we would for abstract classes implementing interfaces. This step is necessary to satisfy the compiler's field resolution semantics.

Interestingly, I had to add a check to both the Java and the JVM generators to ignore methods with the CfExtern flag. That's probably because our post-processing doesn't touch interface fields.

TODO:

  • Figure out if we have to do something special when interfaces extend each other. Also check the situation where a non-extern interface extends an extern interface with a default method.
  • Write more tests I guess.

@Simn Simn added platform-java Everything related to Java platform-jvm Everything related to JVM labels Nov 3, 2021
@skial skial mentioned this pull request Nov 3, 2021
1 task
@Simn Simn merged commit af28c66 into development Nov 4, 2021
@Simn Simn deleted the java.default branch November 4, 2021 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-java Everything related to Java platform-jvm Everything related to JVM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant