You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the mixed Java/Scala below, foo’s static forwarder is created and can be invoked, but not bar, presumably because there is an instance method of the same name (though there is no ambiguity, and a similar mix of static/instance methods of same name in Java compiles).
[error] .../src/main/java/example/Calls.java:6:1: method bar in class example.Callees cannot be applied to given types;
[error] required: int
[error] found: no arguments
[error] reason: actual and formal argument lists differ in length
[error] Callees.bar();
[error] (compile:compileIncremental) javac returned non-zero exit code
And it compiles successfully after removing the bar instance method.
javac would not accept an instance and static method of same name like bar if they did not have different signatures as they do here, but does accept them when the signatures are different (FSVO different). This example is accepted by javac.
In the mixed Java/Scala below,
foo
’s static forwarder is created and can be invoked, but notbar
, presumably because there is an instance method of the same name (though there is no ambiguity, and a similar mix of static/instance methods of same name in Java compiles).Given source files:
Yields on compile
And it compiles successfully after removing the
bar
instance method.javac
would not accept an instance and static method of same name likebar
if they did not have different signatures as they do here, but does accept them when the signatures are different (FSVO different). This example is accepted byjavac
.Here’s the
javap
run on the originalCallees
:Tested against Scala 2.12.4.
The text was updated successfully, but these errors were encountered: