See comment (below) for clarification.
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]
EXTRA RELEVANT SYSTEM CONFIGURATION :
No special configuration
A DESCRIPTION OF THE PROBLEM :
I defined a method and when i then called it, JShell offerred another one.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Enter in the JShell:
boolean equals(double d1, double d2) {
return d1 == d2;
}
equals(.1+.2, .3)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Method call returning false
ACTUAL -
jshell> equals(.1+.2, .3)
| Error:
| method equals in class java.lang.Object cannot be applied to given types;
| required: java.lang.Object
| found: double,double
| reason: actual and formal argument lists differ in length
| equals(.1+.2, .3)
| ^----^
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Error:
| method equals in class java.lang.Object cannot be applied to given types;
| required: java.lang.Object
| found: double,double
| reason: actual and formal argument lists differ in length
| equals(.1+.2, .3)
| ^----^
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
boolean equals(double d1, double d2) {
return d1 == d2;
}
equals(.1+.2, .3)
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I do not know
-------------------------------------------------------------
Workaround: use another method name
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]
EXTRA RELEVANT SYSTEM CONFIGURATION :
No special configuration
A DESCRIPTION OF THE PROBLEM :
I defined a method and when i then called it, JShell offerred another one.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Enter in the JShell:
boolean equals(double d1, double d2) {
return d1 == d2;
}
equals(.1+.2, .3)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Method call returning false
ACTUAL -
jshell> equals(.1+.2, .3)
| Error:
| method equals in class java.lang.Object cannot be applied to given types;
| required: java.lang.Object
| found: double,double
| reason: actual and formal argument lists differ in length
| equals(.1+.2, .3)
| ^----^
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Error:
| method equals in class java.lang.Object cannot be applied to given types;
| required: java.lang.Object
| found: double,double
| reason: actual and formal argument lists differ in length
| equals(.1+.2, .3)
| ^----^
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
boolean equals(double d1, double d2) {
return d1 == d2;
}
equals(.1+.2, .3)
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I do not know
-------------------------------------------------------------
Workaround: use another method name
- relates to
-
JDK-8187359 JShell: Give comprehensible error when user method name matches Object method
- Resolved
-
JDK-8129843 JShell: method cannot call method with different number of arguments
- Closed