Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37443
| From | j4n bur53 <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Are Outer Classes Loaded Lazily? |
| Date | 2017-09-21 09:40 +0200 |
| Organization | albasani.net |
| Message-ID | <opvqcp$o4n$1@news.albasani.net> (permalink) |
| References | <opu86b$k29$1@news.albasani.net> <opunhc$c73$1@dont-email.me> <opusvk$5se$1@news.albasani.net> <86b111bd-47de-45c4-8132-d3a5b67ce4f4@googlegroups.com> <opvppn$ki7$1@news.albasani.net> |
Original question was for
getEnclosingClass(), but:
public Class<?> getEnclosingClass() throws SecurityException {
Class.EnclosingMethodInfo var1 = this.getEnclosingMethodInfo();
Class var2;
if(var1 == null) {
var2 = this.getDeclaringClass();
[...]
}
public native Class<?> getDeclaringClass();
The above is OpenJDK 1.6, in OpenJDK 1.8, there is native
getDeclaringClass0() and some extra package checks.
j4n bur53 schrieb:
> But not all class properties. For example the super class
> is loaded before the class. So this API method of Class:
>
> getSuperclass()
>
> is not lazy. Now question is whether for named nested
> classes, that are static (or non-static without references
> to the outer class), whether this method, is lazy or not:
>
> getDeclaringClass()
>
> lewbloch@gmail.com schrieb:
>> Pretty much all classes in Java are lazily loaded and lazily initialized.
>>
>> Since an inner class by definition in Java is non-static, I don't know
>> how you could get the inner class without initializing the outer, but
>> I have yet to peruse the JLS to explore that.
>>
>> For static nested classes it makes sense that getting the enclosing
>> class would load the class, but since that's not one of the actions
>> that initializes a class it would be improper for that to initialize
>> the outer class.
>>
>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-20 19:23 +0200
Re: Are Outer Classes Loaded Lazily? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-20 17:45 -0400
Re: Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-21 01:18 +0200
Re: Are Outer Classes Loaded Lazily? lewbloch@gmail.com - 2017-09-20 17:28 -0700
Re: Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-21 09:29 +0200
Re: Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-21 09:40 +0200
Re: Are Outer Classes Loaded Lazily? lewbloch@gmail.com - 2017-09-21 11:44 -0700
Re: Are Outer Classes Loaded Lazily? Marcel Mueller <news.5.maazl@spamgourmet.org> - 2017-09-21 21:18 +0200
Re: Are Outer Classes Loaded Lazily? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-21 16:20 -0400
Re: Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-22 11:12 +0200
Re: Are Outer Classes Loaded Lazily? Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2017-09-22 15:55 -0400
Re: Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-23 18:33 +0200
Re: Are Outer Classes Loaded Lazily? lewbloch@gmail.com - 2017-09-22 13:48 -0700
Re: Are Outer Classes Loaded Lazily? Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2017-09-22 23:46 -0400
Re: Are Outer Classes Loaded Lazily? lewbloch@gmail.com - 2017-09-25 13:23 -0700
Re: Are Outer Classes Loaded Lazily? j4n bur53 <janburse@fastmail.fm> - 2017-09-24 17:39 +0200
Re: Are Outer Classes Loaded Lazily? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-09-25 07:38 -0400
Re: Are Outer Classes Loaded Lazily? lewbloch@gmail.com - 2017-09-25 13:25 -0700
csiph-web