Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336453 - Import package does not work with hamcrest
Summary: Import package does not work with hamcrest
Status: CLOSED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-06 10:57 EST by Bryan Hunt CLA
Modified: 2019-08-16 17:20 EDT (History)
3 users (show)

See Also:


Attachments
source projects (9.31 KB, application/zip)
2011-02-08 18:05 EST, Bryan Hunt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan Hunt CLA 2011-02-06 10:57:37 EST
Eclipse 3.7 M5

I have a unit test that uses hamcrest and and the dependency is declared with import package on the pakcage org.hamcrest;version="1.1.0"  The code fails to compile with the error message The import org.hamcrest cannot be found.

To reproduce, you can extract the code from the mongo-emf project 

https://github.com/BryanHunt/mongo-emf

Change the org.eclipselabs.mongo.junit mainfest by removing the bundle dependency on org.hamcrest.core and add the include package org.hamcrest.
Comment 1 Ankur Sharma CLA 2011-02-07 04:00:52 EST
Can you attach the required projects (to reproduce the problem) here. I don't have EGit in my eclipse instances.
Comment 2 Bryan Hunt CLA 2011-02-08 18:05:19 EST
Created attachment 188557 [details]
source projects

Here are the source projects.  org.eclipselabs.mongo.junit should not build due to the problem described.  You will need the target platform as described on the project page:

http://code.google.com/a/eclipselabs.org/p/mongo-emf/

You do not need the mongo_emf.zip bundles in your target platform to reproduce this problem.
Comment 3 Bryan Hunt CLA 2011-02-21 19:33:45 EST
Additional info:

If you add both the org.hamcrest and org.hamcrest.core as imported packages, the error message changes to:

Access restriction: The method is(Matcher<Object>) from the type CoreMatchers is not accessible due to restriction on required library /Users/bhunt/Documents/Programming/Code/Targets/Eclipse SDK 3.7M5/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar

If you add the org.hamcrest.core bundle to the list of Automated Management of Dependencies, the compile errors will be fixed, but the unit test will not run.  You get the following errors:


!ENTRY org.eclipse.osgi 2 0 2011-02-21 18:33:03.564
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-02-21 18:33:03.564
!MESSAGE Bundle initial@reference:file:../../Workspaces/EclipseLabs/mongo-emf/mongo-emf/tests/org.eclipselabs.mongo.junit/ was not resolved.
!SUBENTRY 2 org.eclipselabs.mongo.junit 2 0 2011-02-21 18:33:03.564
!MESSAGE Missing imported package org.hamcrest_1.1.0.
Comment 4 Patrick Paulin CLA 2012-01-25 13:06:25 EST
I think your issue may be related to bug 334540. Just ran into this myself...
Comment 5 Eclipse Genie CLA 2019-08-16 17:20:07 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.