Community
Participate
Working Groups
We have project with 3 source folders - src, test, test2. When you are running test on test folder (through right click on folder -> run as -> JUnitTest, eclipse starts also some tests, which are in test2 folder.
Move to JDT/UI
Created attachment 23605 [details] Testing project Testing project containing bug situation. When you open this project, click on test -> Run As -> JUnit Tests, it will run a test located in test2/mypackage/MyTestCase.
It looks like that the problem lies in the search engine reporting matches although they are not contained in the scope.
The JUnit launcher uses the search engine to search for class having a suite method. To reproduce the problem using search only do the following: - install the attached project - select source folder test - open search dialog - type in >>suite() Test<< in the pattern field - select method and declaration - as scope select "Selected Resource" observe: it finds one match in test2 source folder Setting a breakpoint in SearchEngine#search shows that the correct search scope was created. It is: JavaSearchScope on [ /testbug/test ] Renaming test2 to tesx2 doesn't find any matches. So this seems to be a prefix problem. Moving to JDT/Core
I confirm this is a JavaSearchScope issue with prefixes. Currently when selecting "Selected Resources", created JavaSearchScope includes sub-folders. While verifying if scope encloses an element, it just look if its path starts with scope path. That's why currently it (wrongly) returns true while asking if "test" scope encloses "test2/mypackage/MyTestCase.java".
Unfortunately, this is a regression from 3.0.2 since JavaSearchScope uses Strings instead of IPaths for paths. I'm currently testing a possible fix...
Created attachment 23720 [details] Patch to fix this issue Rewrite enclosing test to take verify that even if path starts with scope path, rest of path is a *real* sub-folder... This patch pass all JavaModel tests.
Please provide the minimal patch we discussed (reviewed by Jerome&Philippe). Since the fix is quite simple, and it is a regression; we will candidate it for RC4. Dirk/Dani : pls cast your votes.
Created attachment 23726 [details] Minimal patch to fix this issue I've added TODO to apply similar change post 3.1 even if not looking at subfolders
+1 for 3.1 RC4
Comment 9 Minimal patch released in HEAD. All JDT/Core and JDT/UI tests pass. Specific test #testJavaSearchScopeBug101022 added in JavaSearchMultipleProjectsTests.
Verified for Build id: I20050624-0010.