Lines 4603-4608
Link Here
|
4603 |
this.deleteProject("P2"); |
4603 |
this.deleteProject("P2"); |
4604 |
} |
4604 |
} |
4605 |
} |
4605 |
} |
|
|
4606 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=276890 |
4607 |
public void testBug276890_01() throws Exception { |
4608 |
Hashtable oldOptions = JavaCore.getOptions(); |
4609 |
|
4610 |
try { |
4611 |
Hashtable options = new Hashtable(oldOptions); |
4612 |
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); |
4613 |
JavaCore.setOptions(options); |
4614 |
|
4615 |
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB"}, "bin", "1.5"); |
4616 |
|
4617 |
createFolder("/P/src/p276890"); |
4618 |
|
4619 |
createFile( |
4620 |
"/P/src/p276890/Stuff.java", |
4621 |
"package p276890;\n" + |
4622 |
"public class Stuff<E> {\n"+ |
4623 |
" public Stuff(E e) {}\n"+ |
4624 |
" public Stuff(Object o, Object o2) {}\n"+ |
4625 |
" public Stuff(Stuff<E> ees) {}\n"+ |
4626 |
" public Stuff() {}\n"+ |
4627 |
"}"); |
4628 |
|
4629 |
refresh(p); |
4630 |
|
4631 |
waitUntilIndexesReady(); |
4632 |
|
4633 |
this.workingCopies = new ICompilationUnit[1]; |
4634 |
this.workingCopies[0] = getWorkingCopy( |
4635 |
"/P/src/test/Test.java", |
4636 |
"package test;\n"+ |
4637 |
"public class Test {\n" + |
4638 |
" void foo() {\n" + |
4639 |
" new Stuf\n" + |
4640 |
" }\n" + |
4641 |
"}"); |
4642 |
|
4643 |
// do completion |
4644 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); |
4645 |
requestor.allowAllRequiredProposals(); |
4646 |
NullProgressMonitor monitor = new NullProgressMonitor(); |
4647 |
|
4648 |
String str = this.workingCopies[0].getSource(); |
4649 |
String completeBehind = "Stuf"; |
4650 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
4651 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); |
4652 |
|
4653 |
assertResults( |
4654 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, ()V, Stuff, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4655 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4656 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (Ljava.lang.Object;Ljava.lang.Object;)V, Stuff, (o, o2), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4657 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4658 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (Lp276890.Stuff<TE;>;)V, Stuff, (ees), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4659 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4660 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (TE;)V, Stuff, (e), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4661 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
4662 |
requestor.getResults()); |
4663 |
} finally { |
4664 |
deleteProject("P"); |
4665 |
|
4666 |
JavaCore.setOptions(oldOptions); |
4667 |
} |
4668 |
} |
4669 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=276890 |
4670 |
public void testBug276890_02() throws Exception { |
4671 |
Hashtable oldOptions = JavaCore.getOptions(); |
4672 |
|
4673 |
try { |
4674 |
Hashtable options = new Hashtable(oldOptions); |
4675 |
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); |
4676 |
JavaCore.setOptions(options); |
4677 |
|
4678 |
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB"}, "bin", "1.5"); |
4679 |
|
4680 |
createFolder("/P/src/p276890"); |
4681 |
|
4682 |
refresh(p); |
4683 |
|
4684 |
waitUntilIndexesReady(); |
4685 |
|
4686 |
this.workingCopies = new ICompilationUnit[2]; |
4687 |
this.workingCopies[0] = getWorkingCopy( |
4688 |
"/P/src/test/Test.java", |
4689 |
"package test;\n"+ |
4690 |
"public class Test {\n" + |
4691 |
" void foo() {\n" + |
4692 |
" new Stuf\n" + |
4693 |
" }\n" + |
4694 |
"}"); |
4695 |
|
4696 |
this.workingCopies[1] = getWorkingCopy( |
4697 |
"/P/src/p276890/Stuff.java", |
4698 |
"package p276890;\n" + |
4699 |
"public class Stuff<E> {\n"+ |
4700 |
" public Stuff(E e) {}\n"+ |
4701 |
" public Stuff(Object o, Object o2) {}\n"+ |
4702 |
" public Stuff(Stuff<E> ees) {}\n"+ |
4703 |
" public Stuff() {}\n"+ |
4704 |
"}"); |
4705 |
|
4706 |
// do completion |
4707 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); |
4708 |
requestor.allowAllRequiredProposals(); |
4709 |
NullProgressMonitor monitor = new NullProgressMonitor(); |
4710 |
|
4711 |
String str = this.workingCopies[0].getSource(); |
4712 |
String completeBehind = "Stuf"; |
4713 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
4714 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); |
4715 |
|
4716 |
assertResults( |
4717 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, ()V, Stuff, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4718 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4719 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (Ljava.lang.Object;Ljava.lang.Object;)V, Stuff, (o, o2), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4720 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4721 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (Lp276890.Stuff<TE;>;)V, Stuff, (ees), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4722 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4723 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (TE;)V, Stuff, (e), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4724 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
4725 |
requestor.getResults()); |
4726 |
} finally { |
4727 |
deleteProject("P"); |
4728 |
|
4729 |
JavaCore.setOptions(oldOptions); |
4730 |
} |
4731 |
} |
4732 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=276890 |
4733 |
public void testBug276890_03() throws Exception { |
4734 |
Hashtable oldOptions = JavaCore.getOptions(); |
4735 |
|
4736 |
try { |
4737 |
Hashtable options = new Hashtable(oldOptions); |
4738 |
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); |
4739 |
JavaCore.setOptions(options); |
4740 |
|
4741 |
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib276890.jar"}, "bin", "1.5"); |
4742 |
|
4743 |
createFolder("/P/src/p276890"); |
4744 |
|
4745 |
createJar( |
4746 |
new String[] { |
4747 |
"p276890/Stuff.java", |
4748 |
"package p276890;\n" + |
4749 |
"public class Stuff<E> {\n"+ |
4750 |
" public Stuff(E e) {}\n"+ |
4751 |
" public Stuff(Object o, Object o2) {}\n"+ |
4752 |
" public Stuff(Stuff<E> ees) {}\n"+ |
4753 |
" public Stuff() {}\n"+ |
4754 |
"}" |
4755 |
}, |
4756 |
p.getProject().getLocation().append("lib276890.jar").toOSString(), |
4757 |
new String[]{getExternalJCLPathString("1.5")}, |
4758 |
"1.5"); |
4759 |
|
4760 |
refresh(p); |
4761 |
|
4762 |
waitUntilIndexesReady(); |
4763 |
|
4764 |
this.workingCopies = new ICompilationUnit[1]; |
4765 |
this.workingCopies[0] = getWorkingCopy( |
4766 |
"/P/src/test/Test.java", |
4767 |
"package test;\n"+ |
4768 |
"public class Test {\n" + |
4769 |
" void foo() {\n" + |
4770 |
" new Stuf\n" + |
4771 |
" }\n" + |
4772 |
"}"); |
4773 |
|
4774 |
// do completion |
4775 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); |
4776 |
requestor.allowAllRequiredProposals(); |
4777 |
NullProgressMonitor monitor = new NullProgressMonitor(); |
4778 |
|
4779 |
String str = this.workingCopies[0].getSource(); |
4780 |
String completeBehind = "Stuf"; |
4781 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
4782 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); |
4783 |
|
4784 |
assertResults( |
4785 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, ()V, Stuff, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4786 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4787 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (Ljava.lang.Object;Ljava.lang.Object;)V, Stuff, (o, o2), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4788 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4789 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (Lp276890.Stuff<TE;>;)V, Stuff, (ees), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4790 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4791 |
"Stuff[CONSTRUCTOR_INVOCATION]{(), Lp276890.Stuff;, (TE;)V, Stuff, (e), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
4792 |
" Stuff[TYPE_REF]{p276890.Stuff, p276890, Lp276890.Stuff;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
4793 |
requestor.getResults()); |
4794 |
} finally { |
4795 |
deleteProject("P"); |
4796 |
|
4797 |
JavaCore.setOptions(oldOptions); |
4798 |
} |
4799 |
} |
4606 |
/** |
4800 |
/** |
4607 |
* @bug 162621: [model][delta] Validation errors do not clear after replacing jar file |
4801 |
* @bug 162621: [model][delta] Validation errors do not clear after replacing jar file |
4608 |
* @test Ensures that changing an internal jar and refreshing takes the change into account |
4802 |
* @test Ensures that changing an internal jar and refreshing takes the change into account |