Lines 36-41
Link Here
|
36 |
import org.eclipse.jdt.core.JavaCore; |
36 |
import org.eclipse.jdt.core.JavaCore; |
37 |
import org.eclipse.jdt.core.tests.util.Util; |
37 |
import org.eclipse.jdt.core.tests.util.Util; |
38 |
import org.eclipse.jdt.internal.codeassist.RelevanceConstants; |
38 |
import org.eclipse.jdt.internal.codeassist.RelevanceConstants; |
|
|
39 |
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; |
39 |
import org.eclipse.jdt.internal.core.JavaModelManager; |
40 |
import org.eclipse.jdt.internal.core.JavaModelManager; |
40 |
|
41 |
|
41 |
import junit.framework.*; |
42 |
import junit.framework.*; |
Lines 2614-2620
Link Here
|
2614 |
assertResults( |
2615 |
assertResults( |
2615 |
"AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_1.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p21, p22), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2616 |
"AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_1.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p21, p22), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2616 |
" AllConstructors33[TYPE_REF]{p6930.AllConstructors33, p6930, Lp6930.AllConstructors33;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2617 |
" AllConstructors33[TYPE_REF]{p6930.AllConstructors33, p6930, Lp6930.AllConstructors33;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2617 |
"AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_1.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p11, p12), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2618 |
"AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_2.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p11, p12), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2618 |
" AllConstructors33[TYPE_REF]{p6930.AllConstructors33, p6930, Lp6930.AllConstructors33;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
2619 |
" AllConstructors33[TYPE_REF]{p6930.AllConstructors33, p6930, Lp6930.AllConstructors33;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
2619 |
requestor.getResults()); |
2620 |
requestor.getResults()); |
2620 |
} finally { |
2621 |
} finally { |
Lines 2623-2628
Link Here
|
2623 |
JavaCore.setOptions(oldOptions); |
2624 |
JavaCore.setOptions(oldOptions); |
2624 |
} |
2625 |
} |
2625 |
} |
2626 |
} |
|
|
2627 |
public void testBug6930_34() throws Exception { |
2628 |
Hashtable oldOptions = JavaCore.getOptions(); |
2629 |
|
2630 |
try { |
2631 |
Hashtable options = new Hashtable(oldOptions); |
2632 |
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); |
2633 |
JavaCore.setOptions(options); |
2634 |
|
2635 |
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin"); |
2636 |
|
2637 |
Map compileOptions = new HashMap(); |
2638 |
compileOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE); |
2639 |
|
2640 |
String[] pathsAndContents = |
2641 |
new String[] { |
2642 |
"p6930/AllConstructors34.java", |
2643 |
"package p6930;\n" + |
2644 |
"public class AllConstructors34 {\n" + |
2645 |
" public AllConstructors34(Object o) {}\n" + |
2646 |
"}" |
2647 |
}; |
2648 |
createJar( |
2649 |
pathsAndContents, |
2650 |
p.getProject().getLocation().append("lib6930.jar").toOSString(), |
2651 |
compileOptions); |
2652 |
|
2653 |
addLibraryEntry(p, "/P/lib6930.jar", null); |
2654 |
|
2655 |
refresh(p); |
2656 |
|
2657 |
waitUntilIndexesReady(); |
2658 |
|
2659 |
this.workingCopies = new ICompilationUnit[1]; |
2660 |
this.workingCopies[0] = getWorkingCopy( |
2661 |
"/P/src/test/Test.java", |
2662 |
"package test;"+ |
2663 |
"public class Test {\n" + |
2664 |
" void foo() {\n" + |
2665 |
" new AllConstructors\n" + |
2666 |
" }\n" + |
2667 |
"}"); |
2668 |
|
2669 |
// do completion |
2670 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); |
2671 |
requestor.allowAllRequiredProposals(); |
2672 |
NullProgressMonitor monitor = new NullProgressMonitor(); |
2673 |
|
2674 |
String str = this.workingCopies[0].getSource(); |
2675 |
String completeBehind = "AllConstructors"; |
2676 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
2677 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); |
2678 |
|
2679 |
assertResults( |
2680 |
"AllConstructors34[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors34;, (Ljava.lang.Object;)V, AllConstructors34, (arg0), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2681 |
" AllConstructors34[TYPE_REF]{p6930.AllConstructors34, p6930, Lp6930.AllConstructors34;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
2682 |
requestor.getResults()); |
2683 |
} finally { |
2684 |
deleteProject("P"); |
2685 |
|
2686 |
JavaCore.setOptions(oldOptions); |
2687 |
} |
2688 |
} |
2689 |
public void testBug6930_35() throws Exception { |
2690 |
Hashtable oldOptions = JavaCore.getOptions(); |
2691 |
|
2692 |
try { |
2693 |
Hashtable options = new Hashtable(oldOptions); |
2694 |
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); |
2695 |
JavaCore.setOptions(options); |
2696 |
|
2697 |
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin"); |
2698 |
|
2699 |
Map compileOptions = new HashMap(); |
2700 |
compileOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE); |
2701 |
|
2702 |
String[] pathsAndContents = |
2703 |
new String[] { |
2704 |
"p6930/AllConstructors35.java", |
2705 |
"package p6930;\n" + |
2706 |
"public class AllConstructors35 {\n" + |
2707 |
" public AllConstructors35(Object o) {}\n" + |
2708 |
"}" |
2709 |
}; |
2710 |
createJar( |
2711 |
pathsAndContents, |
2712 |
p.getProject().getLocation().append("lib6930.jar").toOSString(), |
2713 |
compileOptions); |
2714 |
|
2715 |
createSourceZip( |
2716 |
pathsAndContents, |
2717 |
p.getProject().getLocation().append("lib6930src.zip").toOSString()); |
2718 |
|
2719 |
addLibraryEntry(p, "/P/lib6930.jar", "/P/lib6930src.zip"); |
2720 |
|
2721 |
refresh(p); |
2722 |
|
2723 |
waitUntilIndexesReady(); |
2724 |
|
2725 |
this.workingCopies = new ICompilationUnit[1]; |
2726 |
this.workingCopies[0] = getWorkingCopy( |
2727 |
"/P/src/test/Test.java", |
2728 |
"package test;"+ |
2729 |
"public class Test {\n" + |
2730 |
" void foo() {\n" + |
2731 |
" new AllConstructors\n" + |
2732 |
" }\n" + |
2733 |
"}"); |
2734 |
|
2735 |
// do completion |
2736 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); |
2737 |
requestor.allowAllRequiredProposals(); |
2738 |
NullProgressMonitor monitor = new NullProgressMonitor(); |
2739 |
|
2740 |
String str = this.workingCopies[0].getSource(); |
2741 |
String completeBehind = "AllConstructors"; |
2742 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
2743 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); |
2744 |
|
2745 |
assertResults( |
2746 |
"AllConstructors35[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors35;, (Ljava.lang.Object;)V, AllConstructors35, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + |
2747 |
" AllConstructors35[TYPE_REF]{p6930.AllConstructors35, p6930, Lp6930.AllConstructors35;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", |
2748 |
requestor.getResults()); |
2749 |
} finally { |
2750 |
deleteProject("P"); |
2751 |
|
2752 |
JavaCore.setOptions(oldOptions); |
2753 |
} |
2754 |
} |
2626 |
public void testBug79288() throws Exception { |
2755 |
public void testBug79288() throws Exception { |
2627 |
try { |
2756 |
try { |
2628 |
// create variable |
2757 |
// create variable |