Skip to content
Merged
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 @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -41,6 +42,7 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.JavaCore;
Expand Down Expand Up @@ -137,10 +139,25 @@ public IClasspathEntry[] getClasspathEntries() {
System.out.println("\t" + entry); //$NON-NLS-1$
}
}
// see for example
// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4133
// we need to make sure that regular entries are before test
// entries, this is also the "natural" order of items in regular
// classpath
Arrays.sort(fEntries, Comparator.comparingInt(cpe -> isTestEntry(cpe) ? 1 : 0));
}
return fEntries;
}

private boolean isTestEntry(IClasspathEntry cpe) {
for (IClasspathAttribute attr : cpe.getExtraAttributes()) {
if (IClasspathAttribute.TEST.equals(attr.getName())) {
return Boolean.parseBoolean(attr.getValue());
}
}
return false;
}

private IClasspathEntry[] computePluginEntriesByProject() {
try {
Optional<Project> bndProject = BndProjectManager.getBndProject(project);
Expand Down
Loading