Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27592

Re: praise

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: praise
Date Tue, 25 Feb 2014 16:46:32 -0800
Organization A noiseless patient Spider
Lines 30
Message-ID <lejdhe$9m5$1@dont-email.me> (permalink)
References <praise-20140225152547@ram.dialup.fu-berlin.de> <b19ab8ff-6c01-4435-a38e-ab2b92dd584d@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Injection-Date Wed, 26 Feb 2014 00:46:38 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="cf1bf8d9b7c3a87486f91ce5582b1426"; logging-data="9925"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IOWTtQs4FnLSkj8ag/nA0RV6oA3LQ+k8="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
In-Reply-To <b19ab8ff-6c01-4435-a38e-ab2b92dd584d@googlegroups.com>
Cancel-Lock sha1:aa4UhDPUGoOm27hyun0FSjTrQYw=
Xref csiph.com comp.lang.java.programmer:27592

Show key headers only | View raw


On 2/25/2014 3:01 PM, Lew wrote:

> Stefan Ram wrote:
>>    One can even learn from it notions such as »package-tree
>>    semantics« versus »traditional package semantics« or facts
>>    such as »a class's constructors and methods can run prior to
>>    its initialization« (»its« = »the class'«).

>
> Strange. The JLS says:
> http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4
> "A class or interface type T will be initialized immediately before the first occurrence of any one of the following:
>  [the class is used]
> So that contradicts.
>

The paragraph Stefan is referring to, I think, is:

" There is, however, one corner case that demands special treatment. It 
is possible, though generally not desirable, to execute methods or 
constructors prior to initialization. This can happen when a class 
hierarchy contains a circularity in its static initialization."

So it looks to me like the JLS is implying a "best effort" to initialize 
a class before it is used, but can't absolutely guarantee it in all cases.

It would be an interesting experiment to try to write some code to 
reproduce the case where a ctor is called before its initialization.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: praise Lew <lewbloch@gmail.com> - 2014-02-25 15:01 -0800
  Re: praise markspace <markspace@nospam.nospam> - 2014-02-25 16:46 -0800
    Re: praise Mike Amling <mamling@chaff.us> - 2014-03-04 13:06 -0600

csiph-web