Lines 11-24
Link Here
|
11 |
package org.eclipse.jdt.core.tests.model; |
11 |
package org.eclipse.jdt.core.tests.model; |
12 |
|
12 |
|
13 |
import org.eclipse.core.resources.*; |
13 |
import org.eclipse.core.resources.*; |
14 |
import org.eclipse.core.resources.IFile; |
|
|
15 |
import org.eclipse.core.resources.IFolder; |
16 |
import org.eclipse.core.resources.IWorkspaceRunnable; |
17 |
import org.eclipse.core.runtime.CoreException; |
14 |
import org.eclipse.core.runtime.CoreException; |
18 |
import org.eclipse.core.runtime.IProgressMonitor; |
15 |
import org.eclipse.core.runtime.IProgressMonitor; |
19 |
import org.eclipse.core.runtime.Path; |
16 |
import org.eclipse.core.runtime.Path; |
20 |
import org.eclipse.jdt.core.*; |
17 |
import org.eclipse.jdt.core.*; |
21 |
import org.eclipse.jdt.core.IJavaProject; |
|
|
22 |
import org.eclipse.jdt.core.search.IJavaSearchConstants; |
18 |
import org.eclipse.jdt.core.search.IJavaSearchConstants; |
23 |
import org.eclipse.jdt.core.search.IJavaSearchScope; |
19 |
import org.eclipse.jdt.core.search.IJavaSearchScope; |
24 |
import org.eclipse.jdt.core.search.SearchEngine; |
20 |
import org.eclipse.jdt.core.search.SearchEngine; |
Lines 32-38
Link Here
|
32 |
} |
28 |
} |
33 |
|
29 |
|
34 |
static { |
30 |
static { |
35 |
// TESTS_NAMES = new String[] { "testSearchWithIncludedPackage2" }; |
31 |
// TESTS_NAMES = new String[] { "testIncludeCUOnly02" }; |
36 |
} |
32 |
} |
37 |
public static Test suite() { |
33 |
public static Test suite() { |
38 |
return buildTestSuite(InclusionPatternsTests.class); |
34 |
return buildTestSuite(InclusionPatternsTests.class); |
Lines 373-378
Link Here
|
373 |
root.getNonJavaResources()); |
369 |
root.getNonJavaResources()); |
374 |
} |
370 |
} |
375 |
/* |
371 |
/* |
|
|
372 |
* Ensure that a type can be resolved if it is included but not its super packages. |
373 |
* (regression test for bug 119161 classes in "deep" packages not fully recognized when using tight inclusion filters) |
374 |
*/ |
375 |
public void testIncludeCUOnly01() throws CoreException { |
376 |
setClasspath(new String[] {"/P/src", "p1/p2/*.java|q/*.java"}); |
377 |
addLibraryEntry(getJavaProject("P"), getExternalJCLPathString(), false); |
378 |
createFolder("/P/src/p1/p2"); |
379 |
createFile( |
380 |
"/P/src/p1/p2/X.java", |
381 |
"package p1.p2;\n" + |
382 |
"public class X {\n" + |
383 |
"}" |
384 |
); |
385 |
ICompilationUnit workingCopy = null; |
386 |
try { |
387 |
ProblemRequestor problemRequestor = new ProblemRequestor(); |
388 |
workingCopy = getWorkingCopy( |
389 |
"/P/src/Y.java", |
390 |
"import p1.p2.X;\n" + |
391 |
"public class Y extends X {\n" + |
392 |
"}", |
393 |
null/*primary owner*/, |
394 |
problemRequestor); |
395 |
assertProblems( |
396 |
"Unepected problems", |
397 |
"----------\n" + |
398 |
"----------\n", |
399 |
problemRequestor); |
400 |
} finally { |
401 |
if (workingCopy != null) |
402 |
workingCopy.discardWorkingCopy(); |
403 |
} |
404 |
} |
405 |
/* |
406 |
* Ensure that a type can be resolved if it is included but not its super packages. |
407 |
* (regression test for bug 119161 classes in "deep" packages not fully recognized when using tight inclusion filters) |
408 |
*/ |
409 |
public void testIncludeCUOnly02() throws CoreException { |
410 |
setClasspath(new String[] {"/P/src", "p1/p2/p3/*.java|q/*.java"}); |
411 |
addLibraryEntry(getJavaProject("P"), getExternalJCLPathString(), false); |
412 |
createFolder("/P/src/p1/p2/p3"); |
413 |
createFile( |
414 |
"/P/src/p1/p2/p3/X.java", |
415 |
"package p1.p2.p3;\n" + |
416 |
"public class X {\n" + |
417 |
"}" |
418 |
); |
419 |
ICompilationUnit workingCopy = null; |
420 |
try { |
421 |
ProblemRequestor problemRequestor = new ProblemRequestor(); |
422 |
workingCopy = getWorkingCopy( |
423 |
"/P/src/Y.java", |
424 |
"import p1.p2.p3.X;\n" + |
425 |
"public class Y extends X {\n" + |
426 |
"}", |
427 |
null/*primary owner*/, |
428 |
problemRequestor); |
429 |
assertProblems( |
430 |
"Unepected problems", |
431 |
"----------\n" + |
432 |
"----------\n", |
433 |
problemRequestor); |
434 |
} finally { |
435 |
if (workingCopy != null) |
436 |
workingCopy.discardWorkingCopy(); |
437 |
} |
438 |
} |
439 |
/* |
376 |
* Ensures that a cu that is not included is not on the classpath of the project. |
440 |
* Ensures that a cu that is not included is not on the classpath of the project. |
377 |
*/ |
441 |
*/ |
378 |
public void testIsOnClasspath1() throws CoreException { |
442 |
public void testIsOnClasspath1() throws CoreException { |