Bug 109691 - Importing preferences does not update classpath variables
Summary: Importing preferences does not update classpath variables
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-15 21:51 EDT by Mirko Raner CLA
Modified: 2006-04-13 12:33 EDT (History)
0 users

See Also:


Attachments
Proposed patch and regression test (9.62 KB, patch)
2006-04-06 10:41 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mirko Raner CLA 2005-09-15 21:51:15 EDT
The importing of preferences files that contain new classpath variable
definitions does not take effect for projects in the workspace that already
reference those variables.

For example, let's say one checks out from CVS a Java project whose build path
refers to the variable WAS_PLUGINDIR, but that variable is not currently set in
the workspace. The project will have a build error because of the missing
variables. Let's further say that there is a preferences file that contains the
definition for WAS_PLUGINDIR:

#Thu Sep 15 16:55:30 PDT 2005
org.eclipse.jdt.core/org.eclipse.jdt.core.classpathVariable.WAS_PLUGINDIR=C\:/users/mirko/e3/MinibankWSAD/WAS_PLUGINDIR

After this file was imported using "Import -> Preferences" the new classpath
variable shows up in the list ("Preferences -> Java -> Build Path -> Classpath
Variables") but the project that refers to WAS_PLUGINDIR still shows a build
error. Cleaning the project does not help; the project does not build even
though all variables are properly set. The only work-around for this is going to
the "Preferences -> Java -> Build Path -> Classpath Variables" dialog, and make
a minor change to the variable's path value (for example, changing "C:" to
"c:"). After that, the project will build properly. It does not matter whether
one answers Yes or No to the question of whether a full build should be performed.

It seems that the project somehow caches the information that the variable is
undefined and that information does not get properly updated when the variable
definition is imported into the workspace. The correct behavior that I would
expect is that all projects build properly right after the classpath variable
was imported.

Unfortunately, the same problem happens when importing preferences via
Preferences.importPreferences(...). We need to be able to import classpath
variables programatically, so I'd definitely appreciate it if someone could let
me know a programmatic work-around that would cause the dependent projects to be
rebuilt properly.
Comment 1 Jerome Lanneluc CLA 2006-04-06 10:41:40 EDT
Created attachment 37884 [details]
Proposed patch and regression test
Comment 2 Philipe Mulet CLA 2006-04-06 11:12:20 EDT
+1 for 3.2RC1
Comment 3 Jerome Lanneluc CLA 2006-04-06 11:29:55 EDT
Released patch and test
Comment 4 Frederic Fusier CLA 2006-04-13 12:33:23 EDT
Verified for 3.2 RC1 using build I20060413-0010.