Bug 20197 - Classpath Variables pref page does not refresh with latest variables [build path]
Summary: Classpath Variables pref page does not refresh with latest variables [build p...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 20994 20999 24600 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-06-13 11:19 EDT by Veronika Irvine CLA
Modified: 2002-10-17 10:11 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Veronika Irvine CLA 2002-06-13 11:19:23 EDT
Eclipse F3 0612
Linux Motif

Fresh install, brand new workspace.
Window -> Preferences -> Java -> ClassPath Variables
For ECLIPSE_HOME the value is "Variable Initialization In Progress".

Eclipse was installed in /home/torres/Eclipse/ide/motif
Comment 1 Dirk Baeumer CLA 2002-06-13 11:22:27 EDT
The variable is contributed by PDE
Comment 2 Dejan Glozic CLA 2002-06-13 12:34:34 EDT
This is not an error - ECLIPSE_HOME is programmatically set by PDE but PDE is 
not loaded on startup. ECLIPSE_HOME variable will be defined by PDE on demand 
(if not already defined). If a project's classpath contains entries with 
ECLIPSE_HOME, JDT Core will load PDE Core plug-in to initialize the variable 
because PDE Core registers variable initializer for it.
Comment 3 Veronika Irvine CLA 2002-06-13 12:56:09 EDT
How exactly does this get triggered? The reason I found the error was that I 
had loaded some SWT examples from CVS (see org.eclipse.swt.examples.launcher 
for example). The .classpath referenced ECLIPSE_HOME and the project didn't 
compile.  When I did the exact same thing on Windows and GTK the ECLIPSE_HOME 
variable was set for me and everything compiled.
Comment 4 Dejan Glozic CLA 2002-06-13 13:36:53 EDT
JDT Core declares an extension point for classpath variable initializers. PDE 
Core register an initializer. When JDT Core tries to compile something and 
notices that a variable that is on the classpath is not initialized, it loads 
the initializer to do it. If this didn't happen, it is a JDT Core bug.
Comment 5 Philipe Mulet CLA 2002-06-14 04:47:04 EDT
The fact it did work on Windows makes me think that some badness occurred while 
initializing the CP variable registered by PDE. The value which is 
persisted "Variable Initialization In Progress" should never be visible (need 
to investigate why) like if the initializer did not complete.

The way to figure that the initializer got invoked is to enable the CP variable 
tracing:

# Turn on debug tracing for org.eclipse.jdt.core plugin
org.eclipse.jdt.core/debug=true
# Reports classpath variable initialization, and classpath container resolution
org.eclipse.jdt.core/debug/cpresolution=true

For variables, failed initialization are cached, and therefore the initializer 
should not be called more than once per session.
Comment 6 Philipe Mulet CLA 2002-06-14 07:02:12 EDT
Found some guilty code persistent this temporary value, which is only visible 
if the cp initializer did not succeed to bind the variable.

Failure should however not be cached.
Fix is available for F4

However, PDE should investigate why their initializer did not succeed.
Comment 7 Philipe Mulet CLA 2002-06-14 07:11:20 EDT
Actually, logged bug 20325 for JDT/Core issue. This one PR belongs to PDE for 
addressing the initializer failure.
Comment 8 Alan Boxall CLA 2002-06-25 11:33:16 EDT
I believe this related so instead of opening a new bug I will append my 
findings here.
Reproducable on F3,GM1 and GM2

The order of operations affect the setting of the ECLIPSE_HOME variable.
If I unzip a new eclipse and on startup immediately go to the preferences 
page.  Goto Java->Classpath variables I will see 3 (all JRE_...) no ECLIPSE_HOME

Next go to Plug-In development->Target platform and press "Not in workspace" on 
selecting OK I see a message saying that classpath variables have changed.  If 
I go back to the Java-Classpath page it doesn't have ECLIPSE_HOME set.

If I reverse the order and go to the PDE setting first then go to the classpath 
variables the ECLIPSE_HOME will be set and everything works as expected.

I had to manually add ECLIPSE_HOME to make my projects build.
Comment 9 Erich Gamma CLA 2002-07-17 18:19:30 EDT
*** Bug 20999 has been marked as a duplicate of this bug. ***
Comment 10 Wassim Melhem CLA 2002-08-15 09:52:09 EDT
*** Bug 20994 has been marked as a duplicate of this bug. ***
Comment 11 Wassim Melhem CLA 2002-08-15 10:57:06 EDT
I just fixed our ECLIPSE_HOME initialization problem and released the code in 
HEAD.  So people should no longer run into compilation problems.

However, JDT UI needs to look at the problem that Alan points out above:
Using a fresh workspace, if the user performs the sequence Window->Preferences-
>Plug-in Development->Target Platform, and then go the classpath variables 
page, he will see all the variables as expected.
However, if the user goes to the classpath variables page first, then the 
Target Platform page, and then back to the classpath variables page, he will 
only see the three reserved variables!!! 
So even though, PDE set all the variables correctly when the user selected the 
Target Platform page (as I verified by a call to JavaCore.getClasspathVariables
()), when he selects the classpath variables page for the second time, that 
page does NOT refresh its contents by a new call to 
JavaCore.getClasspathVariables().  Even worse, the class VariableBlock will 
remove all PDE classpath variables from the VM upon pressing OK, because they 
are not explicitly in its list.
Comment 12 Martin Aeschlimann CLA 2002-09-24 05:36:20 EDT
Philippe, question: If the variable is not created yet, will jdt.core create it 
if it finds it in the contribution? I think it should.
(It shouldn't initialize it, but simply declare it (with null value)).

So when the jdt.ui preference page comes up, JavaCore.getClasspathVariableNames 
includes this name and will be correctly initalized.
Comment 13 Philipe Mulet CLA 2002-09-27 10:00:39 EDT
Currently it does not, but I agree it should infer variable names by looking at 
all registered initializers... 

Don't we have the same issue for containers ?
Comment 14 Jerome Lanneluc CLA 2002-09-27 11:27:50 EDT
Fixed JavaModelManager.loadVariables() to also include variables for which 
there are extensions points defined. This fixes the scenario Alan described: 
when going to the Classpath Variables preferences, the ECLIPSE_HOME variable is 
listed and initialized by PDE.
Comment 15 Philipe Mulet CLA 2002-10-10 06:32:44 EDT
*** Bug 24600 has been marked as a duplicate of this bug. ***
Comment 16 David Audel CLA 2002-10-17 10:11:28 EDT
Verified.