Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,27 @@ public static PackageBinding combineAll(List<PackageBinding> bindings, ModuleBin
split.add(packageBinding);
}
}
if (split.incarnations.size() == 1) // we don't want singleton SplitPackageBinding
return split.incarnations.iterator().next(); // simply peel the only incarnation
return split;
return split.reduce();
}
}
return null;
}
private PackageBinding reduce() {
switch (this.incarnations.size()) {
case 1: // we don't want singleton SplitPackageBinding
return this.incarnations.iterator().next(); // simply peel the only incarnation
case 2: // also a pair of packages from Source and Binary variants of the same module is not a split package
Iterator<PlainPackageBinding> iterator = this.incarnations.iterator();
PlainPackageBinding pack1 = iterator.next();
PlainPackageBinding pack2 = iterator.next();
ModuleBinding mod1 = pack1.enclosingModule;
ModuleBinding mod2 = pack2.enclosingModule;
if (mod1.getClass() != mod2.getClass() && CharOperation.equals(mod1.name(), mod2.name())) {
return pack1;
}
}
return this;
}
private static int RANK_VALID = 3;
private static int rank(PackageBinding candidate) {
if (candidate == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ public void testBug574870_4() throws CoreException {
* https://github.com/eclipse-jdt/eclipse.jdt.core/issues/790
*/
public void testAIOOBEForRecordClassGh790() throws Exception {
if (isJRE25) return; // FIXME see https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3976
String testProjectName = "gh790AIOOBEForRecordClass";
try {
IJavaProject project = createJava16Project(testProjectName, new String[] {"src"});
Expand All @@ -653,9 +652,14 @@ public void testAIOOBEForRecordClassGh790() throws Exception {
IType type = project.findType("test.Test");
IField field = type.getField("internal");
search(field, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector);
assertSearchResults(
String expectedMatches =
"src/test/Test.java test.Test() [internal] EXACT_MATCH\n" +
"src/test/Test.java test.Test() [internal] EXACT_MATCH");
"src/test/Test.java test.Test() [internal] EXACT_MATCH";
if (isJRE25) {
expectedMatches += "\n" +
System.getProperty("java.home")+"/lib/jrt-fs.jar java.security.PrivateKey sun.security.pkcs.PKCS8Key.parseKey(byte[]) POTENTIAL_MATCH";
}
assertSearchResults( expectedMatches);
} finally {
deleteProject(testProjectName);
}
Expand Down