Bug 24001 - Classpath variable/container initializer should activate plugins
Summary: Classpath variable/container initializer should activate plugins
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-23 17:48 EDT by Richard Kulp CLA
Modified: 2002-10-17 10:22 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Kulp CLA 2002-09-23 17:48:44 EDT
Currently when needing to use a classpath variable or container initializer, it 
only looks in plugins that already have been activated. This is a problem. If 
there is a variable or container in the classpath, but the user has not somehow 
figured out how to active that plugin on their own (which is actually a 
difficult thing to figure out), the initializer will not be called, and the 
variable/container will be invalid!

On a similiar vein, I think that if there is a classpath variable initializer 
for a variable, that initializer should be called once per session, like it 
does for containers, and not only once per workspace lifetime to set the 
variable. If the plugin decides it needs a classpath variable, it may need to 
have a different value for that session. For example there may of been an 
updated plugin installed and it wants to use a new jar in the variable. 
Currently it can't do that because the initializer will only be called once. If 
an update occurs the variable is already set and won't be changed.

Thanks,
Rich Kulp
Comment 1 Richard Kulp CLA 2002-09-23 17:52:33 EDT
Just to be clear, I meant it should activate the plugin only if there is an 
initializer for the desired variable/container in that plugin. I didn't mean to 
imply activate all of the plugins with initializer extension points and then 
search for an initializer.
Comment 2 Philipe Mulet CLA 2002-09-24 05:09:42 EDT
Variable values are cached in between session, thus it will not request an 
extension point call to awake the plug-in owning the variable, if it was bound 
previously. This was meant to avoid eager plug-in loading.
However, this causes problem in case the plug-in owning the variable would need 
to bind the variable differently that in the past, as you correctly stated it. 
We may want to revisit this behavior.

For containers, we do not persist container values in between sessions, so each 
time a container needs to be resolved, its registered initializer is activated; 
no matter if its declaring plug-in is already loaded or not.

What makes you think we do not find all registered initializers ? Do you have 
steps to reproduce the problem ?
Comment 3 Richard Kulp CLA 2002-09-24 09:32:07 EDT
I have Eclipse 2.0.1: This is the code itself, which shows that it only looks 
in plugins that are already activated:

JavaCore.getClasspathVariableInitializer(String variable){
 ...
  IPluginDescriptor plugin = extension.getDeclaringPluginDescriptor();
  if (plugin.isPluginActivated()) {
 ...

And the same test is made in JavaCore.getClasspathVariableInitializer(String 
variable);

So it only looks at initializers that are in plugins that are already activated.
Comment 4 Philipe Mulet CLA 2002-09-27 06:10:33 EDT
You are completely right, will change this asap.

Will also likely remove registered variables value caching (in between 
sessions) as well.
Comment 5 Jerome Lanneluc CLA 2002-09-27 09:43:05 EDT
Actually, the plugin is the one defining the extension point (i.e. jdtcore) so 
it is always activated at this point. So if "(plugin.isPluginActivated())" was 
always true.
Comment 6 Philipe Mulet CLA 2002-09-27 09:55:13 EDT
Thanks Jerome for pointing this out.

This being said, we still have the issue about persisted CP variable values 
taking precedence over registered initializers, and we are going to change it.

Richard - Do you confirm that this is the only offending behavior you are 
seeing ?
Comment 7 Richard Kulp CLA 2002-09-27 10:10:10 EDT
I got confused, I saw extension.getDeclaringPluginDescriptor() inside the loop, 
so on a quick glance I thought it was for extensions[i], the current extension, 
which would be for different plugins. In the position that piece of code is at 
it is an invarient, it never changes during the loop. It should probably be 
removed since it is always true.

Sounds good about not caching, but removing caching can only be done on 
variables that have initializers. Those that don't were created in some other 
way, such as by the user, and should still be cached.
Comment 8 Philipe Mulet CLA 2002-09-30 06:19:44 EDT
Of course <g>, and we removed the unnecessary activation check as well.

The new behavior, wrt caching, is to only consider persisted values for 
variables which have no registered initializer. This means that even if at some 
a variable had one, its last value will be preserved if it ends up on a 
platform where no such initializer is available anymore.

Comment 9 Richard Kulp CLA 2002-09-30 10:42:14 EDT
Then I'm satisfied that my requirements will be met.

Thanks,
Rich
Comment 10 Philipe Mulet CLA 2002-10-02 05:42:06 EDT
*** Bug 24233 has been marked as a duplicate of this bug. ***
Comment 11 David Audel CLA 2002-10-17 10:22:06 EDT
Verified.