Re: Late binding of integer constants?

Petter Måhlén <[email protected]> Thu, 16 Nov 2017 14:28:03 +0000
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CAGpHYSUim=XkF3WFReeg93uFssLH7ymt2fPHnVhrEM99Cm8GGQ@mail.gmail.com>
Got it, thanks for the fast and informative explanation!

/ Petter

On Thu, 16 Nov 2017 at 14:46 Mark Raynsford <[email protected]> wrote:

> 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
>
>


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws