/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.model;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.StringTokenizer;
import junit.framework.Test;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.CompletionContext;
import org.eclipse.jdt.core.CompletionProposal;
import org.eclipse.jdt.core.CompletionRequestor;
import org.eclipse.jdt.core.IAccessRule;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.codeassist.InternalCompletionContext;
import org.eclipse.jdt.internal.codeassist.RelevanceConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.SourceType;
import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
@SuppressWarnings({"rawtypes", "unchecked", "hiding"})
public class CompletionTests2 extends AbstractJavaModelCompletionTests {
static {
// TESTS_NAMES = new String[]{"testBug373409"};
}
public static class CompletionContainerInitializer implements ContainerInitializer.ITestInitializer {
public static class DefaultContainer implements IClasspathContainer {
char[][] libPaths;
boolean[] areExported;
String[] forbiddenReferences;
public DefaultContainer(char[][] libPaths, boolean[] areExported, String[] forbiddenReferences) {
this.libPaths = libPaths;
this.areExported = areExported;
this.forbiddenReferences = forbiddenReferences;
}
public IClasspathEntry[] getClasspathEntries() {
int length = this.libPaths.length;
IClasspathEntry[] entries = new IClasspathEntry[length];
for (int j = 0; j < length; j++) {
IPath path = new Path(new String(this.libPaths[j]));
boolean isExported = this.areExported[j];
IAccessRule[] accessRules;
if(this.forbiddenReferences != null && this.forbiddenReferences[j]!= null && this.forbiddenReferences[j].length() != 0) {
StringTokenizer tokenizer = new StringTokenizer(this.forbiddenReferences[j], ";");
int count = tokenizer.countTokens();
accessRules = new IAccessRule[count];
String token = null;
for (int i = 0; i < count; i++) {
token = tokenizer.nextToken();
accessRules[i] = JavaCore.newAccessRule(new Path(token), IAccessRule.K_NON_ACCESSIBLE);
}
} else {
accessRules = new IAccessRule[0];
}
if (path.segmentCount() == 1) {
entries[j] = JavaCore.newProjectEntry(path, accessRules, true, new IClasspathAttribute[0], isExported);
} else {
entries[j] = JavaCore.newLibraryEntry(path, null, null, accessRules, new IClasspathAttribute[0], isExported);
}
}
return entries;
}
public String getDescription() {
return "Test container";
}
public int getKind() {
return IClasspathContainer.K_APPLICATION;
}
public IPath getPath() {
return new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER");
}
}
Map containerValues;
CoreException exception;
public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported) {
this(projectName, libPaths, areExported, null);
}
public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported, String[] forbiddenRefrences) {
this.containerValues = new HashMap();
int libPathsLength = libPaths.length;
char[][] charLibPaths = new char[libPathsLength][];
for (int i = 0; i < libPathsLength; i++) {
charLibPaths[i] = libPaths[i].toCharArray();
}
this.containerValues.put(
projectName,
newContainer(charLibPaths, areExported, forbiddenRefrences)
);
}
protected DefaultContainer newContainer(final char[][] libPaths, final boolean[] areExperted, final String[] forbiddenRefrences) {
return new DefaultContainer(libPaths, areExperted, forbiddenRefrences);
}
public boolean allowFailureContainer() {
return true;
}
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
if (this.containerValues == null) return;
try {
JavaCore.setClasspathContainer(
containerPath,
new IJavaProject[] {project},
new IClasspathContainer[] {(IClasspathContainer)this.containerValues.get(project.getElementName())},
null);
} catch (CoreException e) {
this.exception = e;
throw e;
}
}
}
public CompletionTests2(String name) {
super(name);
}
public void setUpSuite() throws Exception {
if (AbstractJavaModelCompletionTests.COMPLETION_PROJECT == null) {
AbstractJavaModelCompletionTests.COMPLETION_PROJECT = setUpJavaProject("Completion");
} else {
setUpProjectCompliance(AbstractJavaModelCompletionTests.COMPLETION_PROJECT, "1.4");
this.currentProject = AbstractJavaModelCompletionTests.COMPLETION_PROJECT;
}
super.setUpSuite();
}
public void tearDownSuite() throws Exception {
if (AbstractJavaModelCompletionTests.COMPLETION_SUITES == null) {
deleteProject("Completion");
} else {
AbstractJavaModelCompletionTests.COMPLETION_SUITES.remove(getClass());
if (AbstractJavaModelCompletionTests.COMPLETION_SUITES.size() == 0) {
deleteProject("Completion");
AbstractJavaModelCompletionTests.COMPLETION_SUITES = null;
}
}
if (AbstractJavaModelCompletionTests.COMPLETION_SUITES == null) {
AbstractJavaModelCompletionTests.COMPLETION_PROJECT = null;
}
super.tearDownSuite();
}
static {
// TESTS_NAMES = new String[] { "testBug96950" };
}
public static Test suite() {
return buildModelTestSuite(CompletionTests2.class);
}
File createFile(File parent, String name, String content) throws IOException {
File file = new File(parent, name);
FileOutputStream out = new FileOutputStream(file);
try {
out.write(content.getBytes());
} finally {
out.close();
}
return file;
}
File createDirectory(File parent, String name) {
File dir = new File(parent, name);
dir.mkdirs();
return dir;
}
/**
* Test for bug 29832
*/
public void testBug29832() throws Exception {
try {
// create variable
// JavaCore.setClasspathVariables(
// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
// null);
// create P1
IFile f = getFile("/Completion/lib.jar");
IJavaProject p = this.createJavaProject(
"P1",
new String[]{},
new String[]{"JCL_LIB"},
"");
this.createFile("/P1/lib.jar", f.getContents());
this.addLibraryEntry(p, "/P1/lib.jar", true);
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
new String[]{"JCL_LIB"},
new String[]{"/P1"},
"bin");
this.createFile(
"/P2/src/X.java",
"public class X {\n"+
" ZZZ z;\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor requestor = new CompletionTestsRequestor();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "ZZZ";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
// delete P1
p.getProject().delete(true, false, null);
// create P1
File dest = getWorkspaceRoot().getLocation().toFile();
File pro = createDirectory(dest, "P1");
this.createFile(pro, ".classpath", "\n" +
"\n" +
" \n" +
" \n" +
" \n" +
"");
this.createFile(pro, ".project",
"\n" +
"\n" +
" org.eclipse.jdt.core\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" org.eclipse.jdt.core.javabuilder\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" org.eclipse.jdt.core.javanature\n" +
" \n" +
"");
File src = createDirectory(pro, "src");
File pz = createDirectory(src, "pz");
this.createFile(pz, "ZZZ.java",
"package pz;\n" +
"public class ZZZ {\n" +
"}");
final IProject project = getWorkspaceRoot().getProject("P1");
IWorkspaceRunnable populate = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
project.create(null);
project.open(null);
}
};
getWorkspace().run(populate, null);
JavaCore.create(project);
waitUntilIndexesReady();
// do completion
requestor = new CompletionTestsRequestor();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
}
}
/**
* Test for bug 33560
*/
public void testBug33560() throws Exception {
try {
// create variable
// JavaCore.setClasspathVariables(
// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
// null);
// create P1
IFile f = getFile("/Completion/lib.jar");
IJavaProject p = this.createJavaProject(
"P1",
new String[]{},
new String[]{"JCL_LIB"},
"");
this.createFile("/P1/lib.jar", f.getContents());
this.addLibraryEntry(p, "/P1/lib.jar", true);
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
new String[]{"JCL_LIB"},
new String[]{"/P1"},
new boolean[]{true},
"bin");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
new String[]{"JCL_LIB"},
new String[]{"/P2"},
"bin");
this.createFile(
"/P3/src/X.java",
"public class X {\n"+
" ZZZ z;\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor requestor = new CompletionTestsRequestor();
ICompilationUnit cu= getCompilationUnit("P3", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "ZZZ";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
// delete P1
p.getProject().delete(true, false, null);
// create P1
File dest = getWorkspaceRoot().getLocation().toFile();
File pro = createDirectory(dest, "P1");
this.createFile(pro, ".classpath", "\n" +
"\n" +
" \n" +
" \n" +
" \n" +
"");
this.createFile(pro, ".project",
"\n" +
"\n" +
" org.eclipse.jdt.core\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" org.eclipse.jdt.core.javabuilder\n" +
" \n" +
" \n" +
" \n" +
" \n" +
" \n" +
" org.eclipse.jdt.core.javanature\n" +
" \n" +
"");
File src = createDirectory(pro, "src");
File pz = createDirectory(src, "pz");
this.createFile(pz, "ZZZ.java",
"package pz;\n" +
"public class ZZZ {\n" +
"}");
final IProject project = getWorkspaceRoot().getProject("P1");
IWorkspaceRunnable populate = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
project.create(null);
project.open(null);
}
};
getWorkspace().run(populate, null);
JavaCore.create(project);
waitUntilIndexesReady();
// do completion
requestor = new CompletionTestsRequestor();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
}
}
public void testBug6930_01() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin");
createFolder("/P/src/p6930");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[1] = getWorkingCopy("/P/src/p6930/AllConstructors01.java",
"package p6930;\n" +
"public class AllConstructors01 {\n" +
" public AllConstructors01() {}\n" +
" public AllConstructors01(Object o) {}\n" +
" public AllConstructors01(int o) {}\n" +
" public AllConstructors01(Object o, String s) {}\n" +
"}\n"
);
this.workingCopies[2] = getWorkingCopy("/P/src/p6930/AllConstructors01b.java",
"package p6930;\n" +
"public class AllConstructors01b {\n" +
"}\n"
);
refresh(p);
waitUntilIndexesReady();
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors01[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors01;, ()V, AllConstructors01, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors01[TYPE_REF]{p6930.AllConstructors01, p6930, Lp6930.AllConstructors01;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors01[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors01;, (I)V, AllConstructors01, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors01[TYPE_REF]{p6930.AllConstructors01, p6930, Lp6930.AllConstructors01;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors01[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors01;, (Ljava.lang.Object;)V, AllConstructors01, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors01[TYPE_REF]{p6930.AllConstructors01, p6930, Lp6930.AllConstructors01;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors01[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors01;, (Ljava.lang.Object;Ljava.lang.String;)V, AllConstructors01, (o, s), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors01[TYPE_REF]{p6930.AllConstructors01, p6930, Lp6930.AllConstructors01;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors01b[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors01b;, ()V, AllConstructors01b, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors01b[TYPE_REF]{p6930.AllConstructors01b, p6930, Lp6930.AllConstructors01b;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_02() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createJar(new String[] {
"p6930/AllConstructors02.java",
"package p6930;\n" +
"public class AllConstructors02 {\n" +
" public AllConstructors02() {}\n" +
" public AllConstructors02(Object o) {}\n" +
" public AllConstructors02(int o) {}\n" +
" public AllConstructors02(Object o, String s) {}\n" +
"}",
"p6930/AllConstructors02b.java",
"package p6930;\n" +
"public class AllConstructors02b {\n" +
"}"
}, p.getProject().getLocation().append("lib6930.jar").toOSString());
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors02[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors02;, ()V, AllConstructors02, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors02[TYPE_REF]{p6930.AllConstructors02, p6930, Lp6930.AllConstructors02;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors02[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors02;, (I)V, AllConstructors02, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors02[TYPE_REF]{p6930.AllConstructors02, p6930, Lp6930.AllConstructors02;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors02[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors02;, (Ljava.lang.Object;)V, AllConstructors02, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors02[TYPE_REF]{p6930.AllConstructors02, p6930, Lp6930.AllConstructors02;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors02[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors02;, (Ljava.lang.Object;Ljava.lang.String;)V, AllConstructors02, (o, s), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors02[TYPE_REF]{p6930.AllConstructors02, p6930, Lp6930.AllConstructors02;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors02b[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors02b;, ()V, AllConstructors02b, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors02b[TYPE_REF]{p6930.AllConstructors02b, p6930, Lp6930.AllConstructors02b;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_03() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors03.java",
"package p6930;\n" +
"public class AllConstructors03 {\n" +
" public AllConstructors03() {}\n" +
" public AllConstructors03(Object o) {}\n" +
" public AllConstructors03(int o) {}\n" +
" public AllConstructors03(Object o, String s) {}\n" +
"}");
createFile(
"/P/src/p6930/AllConstructors03b.java",
"package p6930;\n" +
"public class AllConstructors03b {\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors03[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors03;, ()V, AllConstructors03, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors03[TYPE_REF]{p6930.AllConstructors03, p6930, Lp6930.AllConstructors03;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors03[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors03;, (I)V, AllConstructors03, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors03[TYPE_REF]{p6930.AllConstructors03, p6930, Lp6930.AllConstructors03;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors03[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors03;, (Ljava.lang.Object;)V, AllConstructors03, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors03[TYPE_REF]{p6930.AllConstructors03, p6930, Lp6930.AllConstructors03;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors03[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors03;, (Ljava.lang.Object;Ljava.lang.String;)V, AllConstructors03, (o, s), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors03[TYPE_REF]{p6930.AllConstructors03, p6930, Lp6930.AllConstructors03;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors03b[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors03b;, ()V, AllConstructors03b, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors03b[TYPE_REF]{p6930.AllConstructors03b, p6930, Lp6930.AllConstructors03b;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_04() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;"+
"class AllConstructors04a {\n" +
" public class AllConstructors0b {\n" +
" }\n" +
"}\n" +
"public class Test {\n" +
" public class AllConstructors04c {\n" +
" public class AllConstructors04d {\n" +
" }\n" +
" }\n" +
" void foo() {\n" +
" class AllConstructors04e {\n" +
" class AllConstructors04f {\n" +
" }\n" +
" }\n" +
" new AllConstructors\n" +
" }\n" +
"}");
this.workingCopies[1] = getWorkingCopy(
"/P/src/test/AllConstructors04g.java",
"package test;"+
"public class AllConstructors04g {\n" +
" public class AllConstructors0h {\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors04a[CONSTRUCTOR_INVOCATION]{(), Ltest.AllConstructors04a;, ()V, AllConstructors04a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors04a[TYPE_REF]{AllConstructors04a, test, Ltest.AllConstructors04a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors04c[CONSTRUCTOR_INVOCATION]{(), Ltest.Test$AllConstructors04c;, ()V, AllConstructors04c, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" Test.AllConstructors04c[TYPE_REF]{AllConstructors04c, test, Ltest.Test$AllConstructors04c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors04e[CONSTRUCTOR_INVOCATION]{(), LAllConstructors04e;, ()V, AllConstructors04e, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors04e[TYPE_REF]{AllConstructors04e, null, LAllConstructors04e;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors04g[CONSTRUCTOR_INVOCATION]{(), Ltest.AllConstructors04g;, ()V, AllConstructors04g, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors04g[TYPE_REF]{AllConstructors04g, test, Ltest.AllConstructors04g;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_05() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;"+
"class AllConstructors05a {\n" +
" public static class AllConstructors0b {\n" +
" }\n" +
"}\n" +
"public class Test {\n" +
" public static class AllConstructors05c {\n" +
" public static class AllConstructors05d {\n" +
" }\n" +
" }\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
this.workingCopies[1] = getWorkingCopy(
"/P/src/test/AllConstructors05g.java",
"package test;"+
"public class AllConstructors05g {\n" +
" public static class AllConstructors0h {\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors05a[TYPE_REF]{AllConstructors05a, test, Ltest.AllConstructors05a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"AllConstructors05g[TYPE_REF]{AllConstructors05g, test, Ltest.AllConstructors05g;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"Test.AllConstructors05c[TYPE_REF]{AllConstructors05c, test, Ltest.Test$AllConstructors05c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"AllConstructors05a[CONSTRUCTOR_INVOCATION]{(), Ltest.AllConstructors05a;, ()V, AllConstructors05a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors05a[TYPE_REF]{AllConstructors05a, test, Ltest.AllConstructors05a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors05c[CONSTRUCTOR_INVOCATION]{(), Ltest.Test$AllConstructors05c;, ()V, AllConstructors05c, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" Test.AllConstructors05c[TYPE_REF]{AllConstructors05c, test, Ltest.Test$AllConstructors05c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors05g[CONSTRUCTOR_INVOCATION]{(), Ltest.AllConstructors05g;, ()V, AllConstructors05g, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors05g[TYPE_REF]{AllConstructors05g, test, Ltest.AllConstructors05g;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_06() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors06a.java",
"package p6930;\n" +
"public class AllConstructors06a {\n" +
"}");
createJar(new String[] {
"p6930/AllConstructors06b.java",
"package p6930;\n" +
"public class AllConstructors06b {\n" +
"}"
}, p.getProject().getLocation().append("lib6930.jar").toOSString());
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"import p6930.AllConstructors06a;\n"+
"import p6930.AllConstructors06b;\n"+
"import p6930.AllConstructors06c;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
this.workingCopies[1] = getWorkingCopy(
"/P/src/p6930/AllConstructors06c.java",
"package p6930;"+
"public class AllConstructors06c {\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors06a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors06a;, ()V, AllConstructors06a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors06a[TYPE_REF]{AllConstructors06a, p6930, Lp6930.AllConstructors06a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors06b[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors06b;, ()V, AllConstructors06b, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors06b[TYPE_REF]{AllConstructors06b, p6930, Lp6930.AllConstructors06b;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors06c[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors06c;, ()V, AllConstructors06c, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors06c[TYPE_REF]{AllConstructors06c, p6930, Lp6930.AllConstructors06c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_07() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors07a.java",
"package p6930;\n" +
"public class AllConstructors07a {\n" +
" public class AllConstructors07b {\n" +
" }\n" +
" public static class AllConstructors07c {\n" +
" }\n" +
"}");
createFile(
"/P/src/p6930/AllConstructors07d.java",
"package p6930;\n" +
"public class AllConstructors07d {\n" +
" public class AllConstructors07e {\n" +
" }\n" +
" public static class AllConstructors07f {\n" +
" }\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"import p6930.*;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors07a[TYPE_REF]{p6930.AllConstructors07a, p6930, Lp6930.AllConstructors07a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors07d[TYPE_REF]{p6930.AllConstructors07d, p6930, Lp6930.AllConstructors07d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors07a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors07a;, ()V, AllConstructors07a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors07a[TYPE_REF]{p6930.AllConstructors07a, p6930, Lp6930.AllConstructors07a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors07d[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors07d;, ()V, AllConstructors07d, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors07d[TYPE_REF]{p6930.AllConstructors07d, p6930, Lp6930.AllConstructors07d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_08() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib6930.jar"}, "bin", "1.5");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors08a.java",
"package p6930;\n" +
"public class AllConstructors08a {\n" +
" public class AllConstructors08b {\n" +
" }\n" +
" public static class AllConstructors08c {\n" +
" }\n" +
"}");
createFile(
"/P/src/p6930/AllConstructors08d.java",
"package p6930;\n" +
"public class AllConstructors08d {\n" +
" public class AllConstructors08e {\n" +
" }\n" +
" public static class AllConstructors08f {\n" +
" }\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"import p6930.AllConstructors08a;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors08d[TYPE_REF]{p6930.AllConstructors08d, p6930, Lp6930.AllConstructors08d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors08a[TYPE_REF]{AllConstructors08a, p6930, Lp6930.AllConstructors08a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"AllConstructors08d[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors08d;, ()V, AllConstructors08d, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors08d[TYPE_REF]{p6930.AllConstructors08d, p6930, Lp6930.AllConstructors08d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors08a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors08a;, ()V, AllConstructors08a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors08a[TYPE_REF]{AllConstructors08a, p6930, Lp6930.AllConstructors08a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_09() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib6930.jar"}, "bin", "1.5");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors09a.java",
"package p6930;\n" +
"public class AllConstructors09a {\n" +
" public class AllConstructors09b {\n" +
" }\n" +
" public static class AllConstructors09c {\n" +
" }\n" +
"}");
createFile(
"/P/src/p6930/AllConstructors09d.java",
"package p6930;\n" +
"public class AllConstructors09d {\n" +
" public class AllConstructors09e {\n" +
" }\n" +
" public static class AllConstructors09f {\n" +
" public static class AllConstructors09g {\n" +
" }\n" +
" }\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"import p6930.AllConstructors09a.*;\n"+
"import static p6930.AllConstructors09d.*;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors09a[TYPE_REF]{p6930.AllConstructors09a, p6930, Lp6930.AllConstructors09a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors09d[TYPE_REF]{p6930.AllConstructors09d, p6930, Lp6930.AllConstructors09d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors09a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors09a;, ()V, AllConstructors09a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors09a[TYPE_REF]{p6930.AllConstructors09a, p6930, Lp6930.AllConstructors09a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors09d[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors09d;, ()V, AllConstructors09d, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors09d[TYPE_REF]{p6930.AllConstructors09d, p6930, Lp6930.AllConstructors09d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors09d.AllConstructors09f[TYPE_REF]{AllConstructors09f, p6930, Lp6930.AllConstructors09d$AllConstructors09f;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"AllConstructors09f[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors09d$AllConstructors09f;, ()V, AllConstructors09f, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors09d.AllConstructors09f[TYPE_REF]{AllConstructors09f, p6930, Lp6930.AllConstructors09d$AllConstructors09f;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_10() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib6930.jar"}, "bin", "1.5");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors10a.java",
"package p6930;\n" +
"public class AllConstructors10a {\n" +
" public class AllConstructors10b {\n" +
" public static class AllConstructors10bs {\n" +
" }\n" +
" }\n" +
" public static class AllConstructors10c {\n" +
" public static class AllConstructors10cs {\n" +
" }\n" +
" }\n" +
"}");
createFile(
"/P/src/p6930/AllConstructors10d.java",
"package p6930;\n" +
"public class AllConstructors10d {\n" +
" public class AllConstructors10e {\n" +
" public static class AllConstructors10es {\n" +
" }\n" +
" }\n" +
" public static class AllConstructors10f {\n" +
" public static class AllConstructors10fs {\n" +
" }\n" +
" }\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"import p6930.AllConstructors10a.AllConstructors10b;\n"+
"import p6930.AllConstructors10a.AllConstructors10c;\n"+
"import static p6930.AllConstructors10d.AllConstructors10e;\n"+
"import static p6930.AllConstructors10d.AllConstructors10f;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors10a[TYPE_REF]{p6930.AllConstructors10a, p6930, Lp6930.AllConstructors10a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors10d[TYPE_REF]{p6930.AllConstructors10d, p6930, Lp6930.AllConstructors10d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors10a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors10a;, ()V, AllConstructors10a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors10a[TYPE_REF]{p6930.AllConstructors10a, p6930, Lp6930.AllConstructors10a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors10a.AllConstructors10c[TYPE_REF]{AllConstructors10c, p6930, Lp6930.AllConstructors10a$AllConstructors10c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"AllConstructors10d[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors10d;, ()V, AllConstructors10d, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors10d[TYPE_REF]{p6930.AllConstructors10d, p6930, Lp6930.AllConstructors10d;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors10d.AllConstructors10f[TYPE_REF]{AllConstructors10f, p6930, Lp6930.AllConstructors10d$AllConstructors10f;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED)+"}\n" +
"AllConstructors10c[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors10a$AllConstructors10c;, ()V, AllConstructors10c, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors10a.AllConstructors10c[TYPE_REF]{AllConstructors10c, p6930, Lp6930.AllConstructors10a$AllConstructors10c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors10f[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors10d$AllConstructors10f;, ()V, AllConstructors10f, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors10d.AllConstructors10f[TYPE_REF]{AllConstructors10f, p6930, Lp6930.AllConstructors10d$AllConstructors10f;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_11() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors11a.java",
"package p6930;\n" +
"public class AllConstructors11a {\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"public class Test {\n" +
" void foo() {\n" +
" p6930.AllConstructors11a a = new \n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "new ";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"Test[CONSTRUCTOR_INVOCATION]{(), Ltest.Test;, ()V, Test, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors11a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors11a;, ()V, AllConstructors11a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors11a[TYPE_REF]{p6930.AllConstructors11a, p6930, Lp6930.AllConstructors11a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_12() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors12a.java",
"package p6930;\n" +
"public class AllConstructors12a {\n" +
" public static class AllConstructors12b {\n" +
" }\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"public class Test {\n" +
" void foo() {\n" +
" p6930.AllConstructors12a a = new \n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "new ";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"Test[CONSTRUCTOR_INVOCATION]{(), Ltest.Test;, ()V, Test, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors12a[TYPE_REF]{p6930.AllConstructors12a, p6930, Lp6930.AllConstructors12a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors12a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors12a;, ()V, AllConstructors12a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors12a[TYPE_REF]{p6930.AllConstructors12a, p6930, Lp6930.AllConstructors12a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_13() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors13a.java",
"package p6930;\n" +
"public class AllConstructors13a {\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"public class Test {\n" +
" void foo() {\n" +
" p6930.AllConstructors13a a = new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "new AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors13a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors13a;, ()V, AllConstructors13a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors13a[TYPE_REF]{p6930.AllConstructors13a, p6930, Lp6930.AllConstructors13a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_14() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB", "/P/lib6930.jar"}, "bin");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors14a.java",
"package p6930;\n" +
"public class AllConstructors14a {\n" +
" public static class AllConstructors14b {\n" +
" }\n" +
"}");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[1];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"public class Test {\n" +
" void foo() {\n" +
" p6930.AllConstructors14a a = new AllConstructors\n" +
" }\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "new AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors14a[TYPE_REF]{p6930.AllConstructors14a, p6930, Lp6930.AllConstructors14a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED)+"}\n" +
"AllConstructors14a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors14a;, ()V, AllConstructors14a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors14a[TYPE_REF]{p6930.AllConstructors14a, p6930, Lp6930.AllConstructors14a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_15() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib6930.jar"}, "bin", "1.5");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors15a.java",
"package p6930;\n" +
"public class AllConstructors15a {\n" +
"}");
createJar(
new String[] {
"p6930/AllConstructors15b.java",
"package p6930;\n" +
"public class AllConstructors15b {\n" +
"}"
},
p.getProject().getLocation().append("lib6930.jar").toOSString(),
new String[]{getExternalJCLPathString("1.5")},
"1.5");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
this.workingCopies[1] = getWorkingCopy(
"/P/src/p6930/AllConstructors15c.java",
"package p6930;"+
"public class AllConstructors15c {\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors15a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors15a;, ()V, AllConstructors15a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors15a[TYPE_REF]{p6930.AllConstructors15a, p6930, Lp6930.AllConstructors15a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors15b[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors15b;, ()V, AllConstructors15b, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors15b[TYPE_REF]{p6930.AllConstructors15b, p6930, Lp6930.AllConstructors15b;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors15c[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors15c;, ()V, AllConstructors15c, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors15c[TYPE_REF]{p6930.AllConstructors15c, p6930, Lp6930.AllConstructors15c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_16() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib6930.jar"}, "bin", "1.5");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors16a.java",
"package p6930;\n" +
"public class AllConstructors16a{\n" +
" public AllConstructors16a(){}\n" +
"}");
createJar(
new String[] {
"p6930/AllConstructors16b.java",
"package p6930;\n" +
"public class AllConstructors16b {\n" +
" public AllConstructors16b(){}\n" +
"}"
},
p.getProject().getLocation().append("lib6930.jar").toOSString(),
new String[]{getExternalJCLPathString("1.5")},
"1.5");
refresh(p);
waitUntilIndexesReady();
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/test/Test.java",
"package test;\n"+
"public class Test {\n" +
" void foo() {\n" +
" new AllConstructors\n" +
" }\n" +
"}");
this.workingCopies[1] = getWorkingCopy(
"/P/src/p6930/AllConstructors16c.java",
"package p6930;"+
"public class AllConstructors16c {\n" +
" public AllConstructors16c(){}\n" +
"}");
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true);
requestor.allowAllRequiredProposals();
NullProgressMonitor monitor = new NullProgressMonitor();
String str = this.workingCopies[0].getSource();
String completeBehind = "AllConstructors";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor);
assertResults(
"AllConstructors16a[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors16a;, ()V, AllConstructors16a, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors16a[TYPE_REF]{p6930.AllConstructors16a, p6930, Lp6930.AllConstructors16a;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors16b[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors16b;, ()V, AllConstructors16b, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors16b[TYPE_REF]{p6930.AllConstructors16b, p6930, Lp6930.AllConstructors16b;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
"AllConstructors16c[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors16c;, ()V, AllConstructors16c, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}\n" +
" AllConstructors16c[TYPE_REF]{p6930.AllConstructors16c, p6930, Lp6930.AllConstructors16c;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_CONSTRUCTOR)+"}",
requestor.getResults());
} finally {
deleteProject("P");
JavaCore.setOptions(oldOptions);
}
}
public void testBug6930_17() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED);
JavaCore.setOptions(options);
IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL15_LIB", "/P/lib6930.jar"}, "bin", "1.5");
createFolder("/P/src/p6930");
createFile(
"/P/src/p6930/AllConstructors17a.java",
"package p6930;\n" +
"public class AllConstructors17a{\n" +
" public AllConstructors17a(java.util.Collection