Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Class loading mystery or debugger issue?
Class loading mystery or debugger issue? [message #265449] Wed, 04 August 2004 15:53 Go to next message
Eclipse UserFriend
I am trying to understand why a certain plugin is loaded because of an
action of mine. I have a breakpoint on that plugin class. The breakpoint
is hit after I invoke the action.

I can't explain the call stack I am seeing. Here is an abbreviated excerpt:

The break point line
<lots of calls>
org.eclipse.core.runtime.adaptor.EclipseClassLoader(java.lan g.ClassLoader).loadClass(java.lang.String)
line: 494
com.plugin.service.Util.<init>() line: 43 << strange things happening here
sun.reflect.NativeConstructorAccessorImpl.newInstance0(java. lang.reflect.Constructor,
java.lang.Object[]) line: not available [native method]
sun.reflect.NativeConstructorAccessorImpl.newInstance(java.l ang.Object[])
line: 80
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(ja va.lang.Object[])
line: 44
java.lang.reflect.Constructor.newInstance(java.lang.Object[] ) line: 315
java.lang.Class.newInstance3() line: 367
java.lang.Class.newInstance() line: 305
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(org.osgi.framework.Bundle,
java.lang.String, java.lang.Object,
org.eclipse.core.runtime.IConfigurationElement, java.lang.String) line: 141

I can't explain why the loadClass() called during Util.<init>() is
called. The class doesn't seem to be used in any direct way at all. The
only reference I find is in an import and a new within a function which
isn't being called yet (see also code sketch below). As far as I know
this should not cause the imported class to be loaded.

If this is the case why is the class loaded from within Util.<init>()?
What exactly is Util.<init>()?
Does the platform inject other perhaps concurrent class loadings there?
Is there any other reason why other classes than the one needed by Util
's default constructor would be loaded by the platform?

Could this be a debugger problem?

This is a mystery to me. How can this be explained?

Below is a code sketch:

My UI plugin contains an action that effectively does this:
....
void MyUI.Action.run() {
new Util().do(selection);
}

where Util is defined in a different plugin.
----------------------------------
package com.plugin.service;
....
class Util extends AbstractUtil {
public Util() {
super(UtilDomain.getInstance()); // A breakpoint here will be hit
before the strange class load
}
void do(IStructuredSelection ssel) {
...
}

}
in the same plugin is class UtilDomain:
....
import PluginZClass;
....
class UtilDomain extends AbstractDomain {
public static UtilDomain getInstance() {
if (_instance == null) {
// a break point set at the line above will hit AFTER the class load in
Util.init<>
_instance = new UtilDomain();
}
return _instance();
}
void addNewElement(PluginYClass e) {
....
PluginZClass x = new PluginZClass()
}
}
Re: Class loading mystery or debugger issue? [message #265461 is a reply to message #265449] Wed, 04 August 2004 18:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

It wasn't clear for your append, but what plugin do you think is being
activated from the Util ctor that shouldn't be loaded?

Util.<init> is your constructor. It says it was on line 43 within your
util class that it started to load another class.



--
Thanks, Rich Kulp

Re: Class loading mystery or debugger issue? [message #265464 is a reply to message #265461] Wed, 04 August 2004 19:59 Go to previous messageGo to next message
Eclipse UserFriend
Rich Kulp wrote:

> It wasn't clear for your append, but what plugin do you think is being
> activated from the Util ctor that shouldn't be loaded?
>
> Util.<init> is your constructor. It says it was on line 43 within your
> util class that it started to load another class.
>
>
>
It is the plugin that contains class PluginZClass.

I also just looked into this some more using the J9 JVM. That call stack
looked a little different as well as the exact sequence of when that
class was being loaded. One hint I got was that the class is loaded
inside java.lang.Class.verify() (I write this of the top of my head).

It looks like class verification may cause lots of classes to be loaded
before they are actually used. But I am not sure whether this is the
answer to the "mystery".
Re: Class loading mystery or debugger issue? [message #265540 is a reply to message #265464] Thu, 05 August 2004 12:40 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

That's what I was thing was happening. Most verifiers will load every
class that it sees in the code at load time rather than as needed.

However, turning off the verifier sometimes has other problems. I tried
it once and there was some subtle bugs that cropped up because the
classes were initialized through the verifier.

--
Thanks, Rich Kulp

Previous Topic:how to attach a dll to a plugin?
Next Topic:keyboard shortcut/macro
Goto Forum:
  


Current Time: Fri Sep 12 04:15:24 EDT 2025

Powered by FUDForum. Page generated in 0.05857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top