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


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

Re: What counts as a reference?

From Kevin McMurtrie <mcmurtrie@pixelmemory.us>
Newsgroups comp.lang.java.programmer
Subject Re: What counts as a reference?
References <mgt41aluh04qirbq20lrin09lbanr01shs@4ax.com>
Date 2014-09-12 21:53 -0700
Message-ID <mcmurtrie-4AEC22.21530012092014@news.sonic.net> (permalink)
Organization Sonic.Net

Show all headers | View raw


In article <mgt41aluh04qirbq20lrin09lbanr01shs@4ax.com>,
 Roedy Green <see_website@mindprod.com.invalid> wrote:

> I a suspicion that Java/genjar/Jet includes classes it does not really
> need to.
> I have not done full experiments.
> 
> I suspect an @see counts as a reference
> I suspect that private static X x; counts as a reference even if there
> is no mention of X or x elsewhere.
> 
> I wonder if anyone has ever dug into this or has read something on the
> topic.

@see, the JavaDoc annotation, has no influence on source code 
compilation.  Only a JavaDoc compiler uses it.

java.lang.annotation.Annotation (the @interface declarations) with 
RetentionPolicy of RUNTIME are loaded on demand for each class from 
bytecode then held in the java.lang.Class instance.

Unused static fields hold a reference to a class unless the source code 
compiler has been explicitly configured to remove them.  The reference 
begins when the class is initialized for use.

Referencing a class does not initialize the class; only using the class 
initializes it.  Therefore, a class referenced only by an unused static 
field may be loaded but not initialized.  A class that is loaded but not 
initialized will not load any other classes.  Loading old Apache 
spaghetti without this trick would be pretty much impossible.

-- 
I will not see posts from astraweb, theremailer, dizum, or google
because they host Usenet flooders.

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


Thread

What counts as a reference? Roedy Green <see_website@mindprod.com.invalid> - 2014-09-11 21:30 -0700
  Re: What counts as a reference? "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-09-12 11:19 +0100
  Re: What counts as a reference? Steven Simpson <ss@domain.invalid> - 2014-09-12 15:47 +0100
  Re: What counts as a reference? Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-09-12 21:53 -0700

csiph-web