From 5dd1bab5607d36a3bb53b6126c6ca4709aaf17dc Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sun, 25 Aug 2024 14:20:59 +0200 Subject: [PATCH] Remove empty hamcrest-core 2.x from 'JUnit 4/5' classpath container Since hamcrest version 2 the 'hamcrest-core' artifact only exists to redirect to the new 'hamcrest' artifact containing all of hamcrest. Therefore 'hamcrest-core' does only contains meteadata but no classes. For the 'JUnit 4/5' classpath container it is therefore useless in version 2 and later. References: - https://hamcrest.org/JavaHamcrest/distributables.html#previous-versions-of-hamcrest - https://github.com/hamcrest/JavaHamcrest/releases/tag/v2.1 --- .../jdt/internal/junit/buildpath/BuildPathSupport.java | 10 ---------- .../junit/buildpath/JUnitContainerInitializer.java | 2 -- 2 files changed, 12 deletions(-) diff --git a/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java b/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java index 7358ac37a53..4e3d38e93cb 100644 --- a/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java +++ b/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/BuildPathSupport.java @@ -304,9 +304,6 @@ public boolean accept(File dir, String name) { public static final JUnitPluginDescription JUNIT4_PLUGIN= new JUnitPluginDescription( "org.junit", new VersionRange("[4.13.0,5.0.0)"), null, "org.junit_4.*.jar", "org.junit.source", "source-bundle/", JUnitPreferencesConstants.JUNIT4_JAVADOC); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - private static final JUnitPluginDescription HAMCREST_CORE_PLUGIN= new JUnitPluginDescription( - "org.hamcrest.core", new VersionRange("[2.2.0,3.1.0)"), null, "org.hamcrest.core_2.*.jar", "org.hamcrest.core.source", "source-bundle/", JUnitPreferencesConstants.HAMCREST_CORE_JAVADOC); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - private static final JUnitPluginDescription HAMCREST_PLUGIN= new JUnitPluginDescription( "org.hamcrest", new VersionRange("[2.2.0,3.1.0)"), null, "org.hamcrest_2.*.jar", "org.hamcrest.source", "source-bundle/", JUnitPreferencesConstants.HAMCREST_JAVADOC); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ @@ -421,13 +418,6 @@ public static IClasspathEntry getJUnit4as3LibraryEntry() { return JUNIT4_AS_3_PLUGIN.getLibraryEntry(); } - /** - * @return the org.hamcrest.core library, or null if not available - */ - public static IClasspathEntry getHamcrestCoreLibraryEntry() { - return HAMCREST_CORE_PLUGIN.getLibraryEntry(); - } - /** * @return the org.hamcrest library, or null if not available */ diff --git a/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/JUnitContainerInitializer.java b/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/JUnitContainerInitializer.java index 7ee8fcdd9e3..79a64a59881 100644 --- a/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/JUnitContainerInitializer.java +++ b/org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/buildpath/JUnitContainerInitializer.java @@ -121,7 +121,6 @@ private static JUnitContainer getNewContainer(IPath containerPath, IClasspathAtt case JUNIT4: entriesList.add(BuildPathSupport.getJUnit4LibraryEntry()); entriesList.add(BuildPathSupport.getHamcrestLibraryEntry()); - entriesList.add(BuildPathSupport.getHamcrestCoreLibraryEntry()); break; case JUNIT5: boolean vintage = isVintage(attributes); @@ -145,7 +144,6 @@ private static JUnitContainer getNewContainer(IPath containerPath, IClasspathAtt entriesList.add(BuildPathSupport.getJUnit4LibraryEntry()); } entriesList.add(BuildPathSupport.getHamcrestLibraryEntry()); - entriesList.add(BuildPathSupport.getHamcrestCoreLibraryEntry()); // errors will be reported above entriesList.removeIf(e -> e == null); break;