Re: Late binding of integer constants?
Mark Raynsford <[email protected]> Thu, 16 Nov 2017 13:50:31 +0000
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Organization | io7m.com |
| Message-ID | <[email protected]> |
On 2017-11-16T14:34:53 +0100 <[email protected]> wrote: > > In other words, the SpHttpStatus.SC_OK constant has been inlined and replaced > with its value. However, that constant is defined in a different module than > the calling code, meaning that if at runtime, a version with a different value > is used, things will break. I didn't expect that (I was expecting late > binding) - does anyone on this list know something about the rationale for > this? Unless I'm mistaken, this is ancient javac behaviour. The fact that the inlining crosses module boundaries is just coincidental, as there was obviously no such thing as a module boundary when the behaviour was first specified. I wrote a blog post about it a while back: http://blog.io7m.com/2017/06/30/mind-your-constants.xhtml It's documented in ยง13.4.9 of the JLS: https://docs.oracle.com/javase/specs/jls/se9/html/jls-13.html#jls-13.4.9 -- Mark Raynsford | http://www.io7m.com
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEgWja4isV0+3HIsI9DxW30G+oDLgFAloNl6cACgkQDxW30G+o DLjGBA//Swc66BcbyeWaRcdyW5InqvgniDNj7lDsnJ4YA97z+qYue2Bp+tzfSlh/ MGPF7IQ90rNQMtMBTjtQrtAMNvfA3rPaUMLiq/XJ1oBG3UU1W4bblq/3et86waQu vUMnn7AnPABpiaU1zbJ6+E1wjbrs41ulMfBKMRSmPZ3sGDJJYPLjlO4XSLZQAbXy YKtzGYIkd4lsNbXedqmjCDbzWfl0L8Owg/8HJ3++2oSaPqBMMm6tjpBDi9qcTQyt fXLCMEamxEuANRcdUN+kiQetSLlLV4SfGGEE0BYSpsEgAy8XC5bJv0IGLtMXgdOy /PMeiOCJMQ+zwzYqo28F7hCK4qPxXSO3gKmYKSvPZWm1HqYITCnDzGHMTD0+1MvA WKQXcpiuhHnYV1kJuhRpM8xa7i6rGZoSEuRlDbr4Z0cZygnGq4qv1T1TG3oVwQ+D vJcnczp5HRf6xTmuSmgVorjv6qk20RSa0Ah2nf8GWRJejIo0bD98Loat97gy0XLF MGvq1TlzZd3yaDYHYG1BUhUfc80VMHPqij4JQYDLxd7TX16UOy6kmgbiRA/PSgEj 8jsmvskbIJFAxEKGghflZCz4eel7uP52VAJ6zvbucxjFelYIaHZ+ZmtZttvz0WuE SuANTWDLDyRGJ9v5e+NRU1pe2ffeObolocS4jUbqvvd2/E6Cp0U= =cRdO -----END PGP SIGNATURE-----