Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 269888 - [classpath] PDE does not seem to understand 'Import-Package' with a static import
Summary: [classpath] PDE does not seem to understand 'Import-Package' with a static im...
Status: RESOLVED INVALID
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 268881
  Show dependency tree
 
Reported: 2009-03-24 16:28 EDT by Ketan Padegaonkar CLA
Modified: 2009-03-26 17:52 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ketan Padegaonkar CLA 2009-03-24 16:28:14 EDT
Here's something to keep you folks busy for a while:

1. download org.hamcrest.* packages from orbit into the target platform
2. add an 
  Import-Package: org.hamcrest;version="1.1"
to the manifest:

stick in the following import statements:

import org.hamcrest.Matcher;
import static org.hamcrest.Matchers.anything;

PDE is not able to resolve the static import, although it resolves the regular import.

Some additional inputs if it helps:
- org.hamcrest.Matcher comes from org.hamcrest.library, and org.hamcrest bundles are split packages
Comment 1 Andrew Niefer CLA 2009-03-24 17:18:24 EDT
I've never seen static imports before, is this a 1.5/1.6 feature?

Is perhaps the JRE container or source/target levels not set properly?
Comment 2 Ketan Padegaonkar CLA 2009-03-24 19:44:12 EDT
From a conversation with zx, it seems that importing packages exported by split-packages is not supported. Marking as invalid.
Comment 3 Andrew Niefer CLA 2009-03-26 14:59:41 EDT
Split packages should work, they just need to be "joined" and re-exported so that you get wired to the combination instead of just half the split.
I found a short explanation here:
http://code9.com/2008/08/22/tip-split-packages-and-visibility/
Comment 4 Andrew Niefer CLA 2009-03-26 17:08:23 EDT
Another possiblity is that you don't have a Bundle-RequiredExecutionEnvironment set to 1.5
Comment 5 Ketan Padegaonkar CLA 2009-03-26 17:17:27 EDT
That is not the case. From my understanding:

- it is possible to use split package to export the same package
- the typical use case of such split package is to export the same package through multiple bundles, and create another bundle that depends on the split bundles and exports them all.
- the above does not work (is not supported ?) to work with import package; so if I import 'com.foo' eclipse does not seem to know which bundle(s) to wire it with, and the import need to be qualified with the specific bundle that contains the classes that I'm interested in.

I've added Chris to cc for him to add his inputs.
Comment 6 Andrew Niefer CLA 2009-03-26 17:52:13 EDT
Right, you need to use mandatory attributes to prevent the wiring of the partial packages so instead you get the one from the bundle that exports them all.