-
Notifications
You must be signed in to change notification settings - Fork 73
Add support for Java-defined static members #142
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
Conversation
Review by @2m @ktoso @SethTisue hat tip to @paplorinc over in scala/scala#5528 for trying to sneak (😜) binary incompatible changes to |
In the 2.11 and 2.12 test runs:
Sound familiar to anyone? |
I believe this is due to scala/scala#2951. It is a genuine new binary incompatibility, so we could just leave the reporting as is and change the expected results. Or you could argue that it should be subsumed under either one of the already reported errors:
But this would require a way to recognize that it is in fact an auto-generated |
On second glance, it's supposed to ignore Scala files. Here's the problem with the current approach:
There's a comment claiming "safe because attributes already parsed for |
Here's a fix for the problem: master...szeiger:retronym-topic/java-statics |
49bebc2
to
c81f343
Compare
We can reliably/simply determine whether a class if from scalac by the presence/absense of Scala/ScalaSig attributes. With this knowledge, we can include static methods from non Scala classfiles into MiMa's purview. I've added specific code to warn about static <-> non-static changes, which aren't binary compatible. In addition, the existing rules will now run for these members. In order to make this work, we also need to skip static members in Scala classes after parsing attributes Two other problems discovered and fixed while implementing this: - `Members.members` is only a `TraversableOnce` which is traversed in the constructor. It should not be exposed as a field. - The now inlined methods `parseFields` and `parseMethods` in `ClassfileParser` did not always skip the members in the class file even though attributes have to be parsed in all cases afterwards. Co-Authored-By: Stefan Zeiger <[email protected]>
c81f343
to
87db82f
Compare
@szeiger I've squashed your fix into this PR. |
I'm seeing something very weird in Akka on 0.1.12:
for: class JavaTestKit {
public static void shutdownActorSystem(ActorSystem actorSystem, Boolean verifySystemShutdown) {
shutdownActorSystem(actorSystem, null, verifySystemShutdown);
} |
I'll try to reproduce as a test in MiMa |
We can reliably/simply determine whether a class if from scalac
by the presence/absense of Scala/ScalaSig attributes. With this
knowledge, we can include static methods from non Scala classfiles
into MiMa's purview.
I've added specific code to warn about static <-> non-static changes,
which aren't binary compatible. In addition, the existing rules will
now run for these members.
In order to make this work, we also need to skip static members in
Scala classes after parsing attributes
Two other problems discovered and fixed while implementing this:
Members.members
is only aTraversableOnce
which is traversed inthe constructor. It should not be exposed as a field.
The now inlined methods
parseFields
andparseMethods
inClassfileParser
did not always skip the members in the class fileeven though attributes have to be parsed in all cases afterwards.
Co-Authored-By: Stefan Zeiger [email protected]