8187362: Nashorn unsigned right shift operator unexpectedly returns floating-point

Reviewed-by: sundar, hannesw
This commit is contained in:
Priya Lakshmi Muthuswamy 2017-09-22 11:48:57 +02:00 committed by Hannes Wallnöfer
parent f22dd8323b
commit ea3a3f20d5
2 changed files with 54 additions and 1 deletions

View file

@ -804,7 +804,11 @@ public enum JSType {
* @return the value converted to Integer or Double
*/
public static Number toNarrowestNumber(final long l) {
return isRepresentableAsInt(l) ? Integer.valueOf((int) l) : Double.valueOf(l);
if (isRepresentableAsInt(l)) {
return Integer.valueOf((int) l);
} else {
return Double.valueOf(l);
}
}
/**