View | Details | Raw Unified | Return to bug 322789 | Differences between
and this patch

Collapse All | Expand All

(-)antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java (-8 / +8 lines)
Lines 119-126 Link Here
119
			}
119
			}
120
		}
120
		}
121
121
122
		Path classpath = new Path(this.project);
123
124
		/*
122
		/*
125
		 * Eclipse compiler doesn't support -extdirs.
123
		 * Eclipse compiler doesn't support -extdirs.
126
		 * It is emulated using the classpath. We add extdirs entries after the
124
		 * It is emulated using the classpath. We add extdirs entries after the
Lines 131-141 Link Here
131
			cmd.createArgument().setPath(this.extdirs);
129
			cmd.createArgument().setPath(this.extdirs);
132
		}
130
		}
133
131
132
		Path classpath = new Path(this.project);
134
		/*
133
		/*
135
		 * The java runtime is already handled, so we simply want to retrieve the
134
		 * The java runtime is already handled, so we simply want to retrieve the
136
		 * ant runtime and the compile classpath.
135
		 * ant runtime and the compile classpath.
137
		 */
136
		 */
138
		classpath.append(getCompileClasspath());
137
		classpath.append(getCompileClasspath());
138
		/*
139
		 * Set the classpath for the Eclipse compiler.
140
		 */
141
		cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
142
		createClasspathArgument(cmd, classpath);
139
143
140
		// For -sourcepath, use the "sourcepath" value if present.
144
		// For -sourcepath, use the "sourcepath" value if present.
141
		// Otherwise default to the "srcdir" value.
145
		// Otherwise default to the "srcdir" value.
Lines 164-175 Link Here
164
		} else {
168
		} else {
165
			sourcepath = this.src;
169
			sourcepath = this.src;
166
		}
170
		}
167
		classpath.append(sourcepath);
171
		cmd.createArgument().setValue("-sourcepath"); //$NON-NLS-1$
168
		/*
172
		createClasspathArgument(cmd, sourcepath);
169
		 * Set the classpath for the Eclipse compiler.
170
		 */
171
		cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
172
		createClasspathArgument(cmd, classpath);
173
173
174
		final String javaVersion = JavaEnvUtils.getJavaVersion();
174
		final String javaVersion = JavaEnvUtils.getJavaVersion();
175
		String memoryParameterPrefix = javaVersion.equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
175
		String memoryParameterPrefix = javaVersion.equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
(-)batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java (-1 / +1 lines)
Lines 28-34 Link Here
28
28
29
private Hashtable directoryCache;
29
private Hashtable directoryCache;
30
private String[] missingPackageHolder = new String[1];
30
private String[] missingPackageHolder = new String[1];
31
private int mode; // ability to only consider one kind of files (source vs. binaries), by default use both
31
int mode; // ability to only consider one kind of files (source vs. binaries), by default use both
32
private String encoding; // only useful if referenced in the source path
32
private String encoding; // only useful if referenced in the source path
33
33
34
ClasspathDirectory(File directory, String encoding, int mode,
34
ClasspathDirectory(File directory, String encoding, int mode,
(-)batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java (-5 / +26 lines)
Lines 201-213 Link Here
201
			fileName = CharOperation.subarray(fileName, 0, lastIndexOf);
201
			fileName = CharOperation.subarray(fileName, 0, lastIndexOf);
202
		}
202
		}
203
		CharOperation.replace(fileName, '\\', '/');
203
		CharOperation.replace(fileName, '\\', '/');
204
		boolean globalPathMatches = false;
205
		// the most nested path should be the selected one
204
		for (int j = 0, max = this.classpaths.length; j < max; j++) {
206
		for (int j = 0, max = this.classpaths.length; j < max; j++) {
205
			char[] matchCandidate = this.classpaths[j].normalizedPath();
207
			char[] matchCandidate = this.classpaths[j].normalizedPath();
206
			if (this.classpaths[j] instanceof  ClasspathDirectory &&
208
			boolean currentPathMatch = false;
207
					CharOperation.prefixEquals(matchCandidate, fileName) &&
209
			if (this.classpaths[j] instanceof ClasspathDirectory
208
					(matchingPathName == null ||
210
					&& CharOperation.prefixEquals(matchCandidate, fileName)) {
209
							matchCandidate.length < matchingPathName.length)) {
211
				currentPathMatch = true;
210
				matchingPathName = matchCandidate;
212
				if (matchingPathName == null) {
213
					matchingPathName = matchCandidate;
214
				} else {
215
					// if not null, we must keep the current classpath directory if this is a source path folder
216
					if (currentPathMatch) {
217
						// we have a second source folder that matches the path of the source file
218
						if (matchCandidate.length > matchingPathName.length) {
219
							// we want to preserve the shortest possible path
220
							matchingPathName = matchCandidate;
221
						}
222
					} else {
223
						// if (sourcePathMatches) one former source paths matched - ignore the current match
224
						if (!globalPathMatches && matchCandidate.length < matchingPathName.length) {
225
							matchingPathName = matchCandidate;
226
						}
227
					}
228
				}
229
				if (currentPathMatch) {
230
					globalPathMatches = true;
231
				}
211
			}
232
			}
212
		}
233
		}
213
		if (matchingPathName == null) {
234
		if (matchingPathName == null) {

Return to bug 322789