question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

assignment of 'small' to non-'small' should not call 'Util.toInt()'

See original GitHub issue

I made a mistake during the discussion in #6038.

Answering quickly, I didn’t think through the implications of throwing an OverflowException.

Here’s the reasons why not to do that:

  1. We don’t generally check for numeric overflow. We generally wrap around silently.
  2. Calling a whole method has the potential to suddenly change the performance characteristics of a numeric algorithm, making them much worse, in a way that is not at all predictable to the programmer.
  3. The very first usecase for small that I ran into simply broke because of this.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gavinkingcommented, Sep 9, 2016

For everything, I think.

0reactions
quintessecommented, Sep 20, 2016

I guess this can be closed now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can I assign an integer literal to a short type variable but ...
In order to understand why the assignment type-conversion works whilst the invocation one is rejected, one has to refer to the Java Language ......
Read more >
parseInt() - JavaScript - MDN Web Docs
the radix as a 32-bit integer is smaller than 2 or bigger than 36 , or ... parseInt() does not treat strings beginning...
Read more >
Chapter 5. Conversions and Promotions
The conversion process for such operands is called numeric promotion. Promotion is special in that, in the case of binary operators, the conversion...
Read more >
Why don't Java's compound assignment operators require ...
The Problem When you assign two variables with different primitive types – for example long to int – you need to use casting....
Read more >
Java Basics - Java Programming Tutorial
This chapter explains the basic syntaxes of the Java programming language. I shall assume that you have written some simple Java programs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found