Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 391433

Summary: [JUnit] Remove JUnit 3 from Eclipse
Product: [Eclipse Project] JDT Reporter: Krzysztof Daniel <krzysztof.daniel>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: akurtakov, curtis.windatt.public, daniel_megert, david_williams, john.arthorne, Lars.Vogel, nobody, remy.suen, srikanth_sankaran
Version: 3.8Flags: daniel_megert: pmc_approved+
Target Milestone: 4.3 M6   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 400363, 400364, 400441, 401740    
Attachments:
Description Flags
Fix for eclipse.platform.releng
none
Fix for eclipse.jdt none

Description Krzysztof Daniel CLA 2012-10-09 08:11:42 EDT
I know this has been reported previously and closed as wontfix, but...

(1) The official webpage of junit no longer lists 3.8

(2) The official repo of junit no longer contains 3.8
https://github.com/KentBeck/junit

(3) Junit 3 is 6 years old, and even old repo downloads are going down
http://sourceforge.net/projects/junit/files/junit/3.8.2/junit3.8.2.zip/stats/timeline?dates=2006-10-03+to+2012-10-09

(4) Junit 4 contains a compatibility layer. If there are any known problems with this layer that block the migration I would be really happy to fix them in the upstream junit 4.

(5) It's simply dangerous to have such an old library that may require 10 years maintenance via Eclipse LTS.
Comment 1 Lars Vogel CLA 2012-10-09 08:20:08 EDT
+1 fore removal
Comment 2 Alexander Kurtakov CLA 2012-10-09 08:23:15 EDT
+1 from me too. It's high time to start getting rid of some legacy.
Comment 3 Alexander Kurtakov CLA 2012-10-09 08:27:40 EDT
In Fedora we ship only junit 4.x and eclipse is shipped with a manifest only junit3 bundle where the actual jar is the junit4 and we never got a bug report about some incompatibility for the last 2 release since we did that.
Comment 4 Dani Megert CLA 2012-10-10 04:54:04 EDT
I'm also in favor of doing this and will take this up in our PMC call today.

Note that we can't just remove the bundle from the SDK but also have to adjust our code:
- Currently when 'TestCase' is used but not found on the build path we
  offer a 'Add JUnit 3 library to the build path' quick fix. This needs to 
  changed.
- If 'JUnit 3' is used in the JUnit library container then we currently show
  an empty node (no fallback to another/newer version) and the project has
  compile errors. This is especially confusing because
  - we hide the JUnit container as it is considered empty
  - no build path error (red !) appears on the project
  We need to fix the container to gracefully handle the removal or JUnit 3.
- The launching story also needs to be tested and adapted if necessary.
Comment 5 Dani Megert CLA 2012-10-11 04:02:42 EDT
(In reply to comment #4)
> I'm also in favor of doing this and will take this up in our PMC call today.

The PMC approved it.
Comment 6 Markus Keller CLA 2013-02-04 11:58:07 EST
Pushed http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=586eb3388af84b4262f1ffc03f6ee8d4d8f899aa to make the Eclipse JUnit support work without JUnit 3.

I kept the JUnit 3 classpath container (aka "Library"), but added access restrictions if the JUnit 4 JAR is used underneath.

After this, we're ready to remove org.junit 3.8.2 from the SDK, from the JDT feature, and from the build. Clients don't need to do anything, but they may get a JUnit 4 JAR where they previously got JUnit 3.

We should remove the org.junit4 stub bundle at the same time.
Comment 7 Markus Keller CLA 2013-02-06 11:08:29 EST
Created attachment 226637 [details]
Fix for eclipse.platform.releng
Comment 8 Markus Keller CLA 2013-02-06 11:15:26 EST
Created attachment 226638 [details]
Fix for eclipse.jdt
Comment 9 Dani Megert CLA 2013-02-06 11:26:56 EST
(In reply to comment #7)
> Created attachment 226637 [details] [diff]
> Fix for eclipse.platform.releng

Fixed with http://git.eclipse.org/c/platform/eclipse.platform.releng.git/commit/?id=7250731cc69099d8ee85adc89bc942f417a0c2bb
Comment 11 Markus Keller CLA 2013-02-06 11:51:41 EST
> Fix for eclipse.jdt

Released as http://git.eclipse.org/c/jdt/eclipse.jdt.git/commit/?id=a1c52110b95022a60ac53e6d37926b3f5a9073f0 and also removed a reference in pom.xml: http://git.eclipse.org/c/jdt/eclipse.jdt.git/commit/?id=58e4e4946d85fbdda459e274751657dcc126af11

Removed org.junit4 and org.junit,3.8.2 from the map files:
http://git.eclipse.org/c/platform/eclipse.platform.releng.maps.git/commit/?id=bf1bf1044f9d349bb8a13c1a6b0561d5d35ef9b2

That's all we found. org.junit4 and org.junit version 3 should be gone now.

Crossing fingers for the next N-build...
Comment 12 David Williams CLA 2013-02-06 21:10:56 EST
(In reply to comment #11)
> > Fix for eclipse.jdt
> 
> Released as
> http://git.eclipse.org/c/jdt/eclipse.jdt.git/commit/
> ?id=a1c52110b95022a60ac53e6d37926b3f5a9073f0 and also removed a reference in
> pom.xml:
> http://git.eclipse.org/c/jdt/eclipse.jdt.git/commit/
> ?id=58e4e4946d85fbdda459e274751657dcc126af11
> 
> Removed org.junit4 and org.junit,3.8.2 from the map files:
> http://git.eclipse.org/c/platform/eclipse.platform.releng.maps.git/commit/
> ?id=bf1bf1044f9d349bb8a13c1a6b0561d5d35ef9b2
> 
> That's all we found. org.junit4 and org.junit version 3 should be gone now.
> 
> Crossing fingers for the next N-build...

Looks like you missed the "tests feature"? 

N build failed with 

 Processing inclusion from feature org.eclipse.test: Unable to find plug-in: org.junit4_0.0.0.
Comment 13 David Williams CLA 2013-02-06 21:28:37 EST
And, no wonder it was missed ... as far as I can tell, only the R3_8_maintenance branch has a .project file in it, not R4_2_maintenance nor master. (Plus a few smaller things missing) ... but, that causes the project to "close" when you "switch to master". 

I'll push up a .project file to master, and then let you take over from there to remove/fix up what needs to be done (and we can do .project file for R4_2_maintenance later ... not that you'll be removing anything from there.
Comment 14 David Williams CLA 2013-02-06 21:43:55 EST
I've opened bug 400170 to cover .project file in R4_2_maintenance. 

Now ... I'll let you get back to junit4 :)
Comment 15 Dani Megert CLA 2013-02-07 03:42:04 EST
(In reply to comment #12)
> Looks like you missed the "tests feature"? 
> 
> N build failed with 
> 
>  Processing inclusion from feature org.eclipse.test: Unable to find plug-in:
> org.junit4_0.0.0.

Fixed with http://git.eclipse.org/c/platform/eclipse.platform.releng.git/commit/?id=3c44ac2db066d620406c5fca36dd29b948a903cd
Comment 16 Dani Megert CLA 2013-02-07 03:42:26 EST
.
Comment 17 Dani Megert CLA 2013-02-07 07:31:22 EST
Also fixed some failing PDE tests:

http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=63952410c4579490ba3f706a2905fabbd38ef744
Comment 18 Markus Keller CLA 2013-02-07 09:59:40 EST
*** Bug 383240 has been marked as a duplicate of this bug. ***
Comment 19 Dani Megert CLA 2013-02-11 08:19:33 EST
Verified in N20130208-2000.
Comment 20 Dani Megert CLA 2013-02-19 05:10:01 EST
The CBI build failed after removal of 'org.junit4', see bug 401120 for details.