Yes, this is quite feasible, given that the autoblock is guaranteed to work at small values, and it is allowed to work with large values. For example, this is guaranteed to print true:
Object x = 5; Object y = 5; System.out.println(x == y);
This may print true, but is not guaranteed:
Object x = 10000; Object y = 10000; System.out.println(x == y);
I would definitely try not to rely on this in the code, although partly because when storing values between -128 and 127 inclusive (see JLS 5.1.7 ), the fact that some JVMs can reuse a wider range of values, may lead you to a false understanding of the security of your code.
In your case, we don’t know if you see the difference in the platforms (also having in mind that we are talking about Android, not the JVM) or simply that when it "worked", the value that is inserted into the box was small , and when he "did not work," it was not.
source share