<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Avoid useless Plugin Initialization and/or Class Loading</title>
	<link>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/</link>
	<description>Eclipse, Product development, Java programming and Entrepreneurship</description>
	<pubDate>Fri, 21 Nov 2008 13:43:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: Ahti</title>
		<link>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/#comment-34723</link>
		<pubDate>Thu, 20 Dec 2007 09:47:55 +0000</pubDate>
		<guid>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/#comment-34723</guid>
					<description>Sometimes respective source code like eclipse runtime is so trustworthy that one stops thinking if it's really correct :P</description>
		<content:encoded><![CDATA[<p>Sometimes respective source code like eclipse runtime is so trustworthy that one stops thinking if it&#8217;s really correct :P
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ahti</title>
		<link>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/#comment-34722</link>
		<pubDate>Thu, 20 Dec 2007 09:43:05 +0000</pubDate>
		<guid>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/#comment-34722</guid>
					<description>Mark: Haha! How embarrassing, you were right :)

Plugin source code has a comment regarding this and it was clearly misleading:
// Performance: isolate PreferenceForwarder into
// an inner class so that it mere presence
// won't force the PreferenceForwarder class
// to be loaded (which triggers Preferences
// plugin activation).

True, of course it makes sense that class load happens only when it's actually needed.

Now I don't see any reason why this Runnable is in #getPluginPreferences after all.</description>
		<content:encoded><![CDATA[<p>Mark: Haha! How embarrassing, you were right :)</p>
<p>Plugin source code has a comment regarding this and it was clearly misleading:<br />
// Performance: isolate PreferenceForwarder into<br />
// an inner class so that it mere presence<br />
// won&#8217;t force the PreferenceForwarder class<br />
// to be loaded (which triggers Preferences<br />
// plugin activation).</p>
<p>True, of course it makes sense that class load happens only when it&#8217;s actually needed.</p>
<p>Now I don&#8217;t see any reason why this Runnable is in #getPluginPreferences after all.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Mark Hibberd</title>
		<link>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/#comment-34721</link>
		<pubDate>Wed, 19 Dec 2007 19:03:47 +0000</pubDate>
		<guid>http://ahtik.com/blog/2007/12/19/avoiding-useless-plugin-initialization-andor-class-loading/#comment-34721</guid>
					<description>In what circumstances do you think that PreferenceForwarder will load from the first example
&lt;code&gt;
if (isConfigurable()) {
  Bundle bundleCopy = bundle;
  Preferences[] preferencesCopy = new Preferences[1];
  preferencesCopy[0] = new org.eclipse.core.internal.
			preferences.legacy.PreferenceForwarder(
			this, bundleCopy.getSymbolicName());
  return preferencesCopy;
}
return null;
&lt;/code&gt;

My understanding is that classloading on most JVMs is so lazy that it will only happen if the condition is                           evaluated to true. A few tests on different JVMs (Sun 1.4.2, 5, 6 and IBM 1.4.2, 6) with -verbose:class confirmed this behavior for me.

It is not a big deal, but I am a little concerned with adding complexity (although not that much) for no reason.</description>
		<content:encoded><![CDATA[<p>In what circumstances do you think that PreferenceForwarder will load from the first example<br />
<code><br />
if (isConfigurable()) {<br />
  Bundle bundleCopy = bundle;<br />
  Preferences[] preferencesCopy = new Preferences[1];<br />
  preferencesCopy[0] = new org.eclipse.core.internal.<br />
			preferences.legacy.PreferenceForwarder(<br />
			this, bundleCopy.getSymbolicName());<br />
  return preferencesCopy;<br />
}<br />
return null;<br />
</code></p>
<p>My understanding is that classloading on most JVMs is so lazy that it will only happen if the condition is                           evaluated to true. A few tests on different JVMs (Sun 1.4.2, 5, 6 and IBM 1.4.2, 6) with -verbose:class confirmed this behavior for me.</p>
<p>It is not a big deal, but I am a little concerned with adding complexity (although not that much) for no reason.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
