Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13461
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | Lew <lewbloch@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: trigger static init |
| Date | Mon, 9 Apr 2012 10:33:56 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 21 |
| Message-ID | <1103350.523.1333992836819.JavaMail.geo-discussion-forums@pbvs10> (permalink) |
| References | <5605o7di8le7conanmf0g70p1ltipeqct4@4ax.com> <m2zkalqs1m.fsf@ipa.eternal-september.org> <jpn5o7t4jboj42onjom1adb45s6kaejed8@4ax.com> |
| NNTP-Posting-Host | 69.28.149.29 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1333992914 9290 127.0.0.1 (9 Apr 2012 17:35:14 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Mon, 9 Apr 2012 17:35:14 +0000 (UTC) |
| In-Reply-To | <jpn5o7t4jboj42onjom1adb45s6kaejed8@4ax.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T |
| User-Agent | G2/1.0 |
| Xref | csiph.com comp.lang.java.programmer:13461 |
Show key headers only | View raw
Roedy Green wrote: > Jukka Lahtinen wrote, quoted or indirectly quoted someone who said : >>, you can refer to some public static attribute >>of the class. > > But it had better not be a static final known at compile time, or it > will be optimised to a literal and referencing it won't load the > class. > > I decided to handle it by putting in dummy public static void fireup() > methods that as a side effect load the class and run static init. If I > fail to call them, class loading is just procrastinated until first > use. Two questions: Why is it important to control when the class loads, instead of using the default? What was wrong with 'Class#forName()', which is intended for the purpose and is not a hack? -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
trigger static init Roedy Green <see_website@mindprod.com.invalid> - 2012-04-08 23:28 -0700
Re: trigger static init Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2012-04-09 10:32 +0300
Re: trigger static init Roedy Green <see_website@mindprod.com.invalid> - 2012-04-09 06:09 -0700
Re: trigger static init markspace <-@.> - 2012-04-09 09:19 -0700
Re: trigger static init Lew <lewbloch@gmail.com> - 2012-04-09 10:33 -0700
Re: trigger static init Lew <lewbloch@gmail.com> - 2012-04-09 10:36 -0700
Re: trigger static init Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-04-11 12:52 +0000
Re: trigger static init Patricia Shanahan <pats@acm.org> - 2012-04-11 07:04 -0700
Re: trigger static init Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-04-11 15:30 +0000
Re: trigger static init Patricia Shanahan <pats@acm.org> - 2012-04-11 09:32 -0700
Re: trigger static init Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-04-22 16:09 +0000
Re: trigger static init Steven Simpson <ss@domain.invalid> - 2012-04-12 07:38 +0100
Re: trigger static init Patricia Shanahan <pats@acm.org> - 2012-04-12 00:36 -0700
Re: trigger static init Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-04-11 09:39 -0500
Re: trigger static init Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-04-11 14:56 +0000
Re: trigger static init Lew <noone@lewscanon.com> - 2012-04-11 08:08 -0700
Re: trigger static init glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-04-09 09:18 +0000
Re: trigger static init Roedy Green <see_website@mindprod.com.invalid> - 2012-04-09 04:57 -0700
Re: trigger static init Lew <lewbloch@gmail.com> - 2012-04-09 10:31 -0700
Re: trigger static init Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-04-10 12:22 -0700
csiph-web