Mill module / target overriding vs Java binary compatibility #2987
lefou
started this conversation in
Development
Replies: 1 comment 2 replies
-
I think it sounds reasonable. It should be easy to add an |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When overriding a target, it's possible to re-use the overridden target result. Unfortunately, referencing the
super.foo()
from apublic def foo
it is in most cases a binary incompatible change, when it wasn't referenced before. This is due to the fact howtrait
s are encoded in the JVM, I think. This has the downside that we aren't as free as we want when it comes to target implementations. At least not, if we want to stay binary compatible, which is IMHO crucial for Mill itself and some of it's more widely used plugins.I wonder it there is a way to prevent this by design?
Technically, it should be possible to always reference the super target without using it as a target. This should not have an impact on the target evaluation, as these targets are never executed as dependencies. So, whenever we override a target but do not plan to use the super value, we could still add a reference to the super target, but without using it's
apply
method.super.foo
instead ofsuper.foo()
. And since this is unused boilerplate code which doesn't make sense in a code review, we could automatically do this in theT
-macros. The question is, can detect whether it's needed at all, from inside the macro?@lihaoyi WDYT?
Beta Was this translation helpful? Give feedback.
All reactions