Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 380570 - PerspectiveSwitcherCSSHandler.java refers to package not imported by bundle
Summary: PerspectiveSwitcherCSSHandler.java refers to package not imported by bundle
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2.1   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-24 13:43 EDT by John Arthorne CLA
Modified: 2012-11-06 23:42 EST (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 John Arthorne CLA 2012-05-24 13:43:34 EDT
PerspectiveSwitcherCSSHandler.java imports classes from package org.w3c.dom.css. However the org.eclipse.ui.workbench bundle does not import such a package. This is reported as a compile error if you enable the PDE API tools checks.

I suspect we are just getting lucky at runtime because most JRE's happen to have a copy of this package. Tom correct me if I'm wrong, but I believe the bundle should still be importing this package in the bundle manifest.
Comment 1 John Arthorne CLA 2012-05-24 13:44:10 EDT
(probably a change for 4.3 unless it is causing runtime problems)
Comment 2 Thomas Watson CLA 2012-05-24 15:35:41 EDT
(In reply to comment #0)
> PerspectiveSwitcherCSSHandler.java imports classes from package
> org.w3c.dom.css. However the org.eclipse.ui.workbench bundle does not import
> such a package. This is reported as a compile error if you enable the PDE API
> tools checks.
> 
> I suspect we are just getting lucky at runtime because most JRE's happen to
> have a copy of this package. Tom correct me if I'm wrong, but I believe the
> bundle should still be importing this package in the bundle manifest.

Correct, and it just happens to work by default at runtime in equinox because we have a compatibility flag enabled by default that does a last resort boot delegation before throwing a class loading exception.  I suspect if you set the following configuration property then you would see a runtime error:

osgi.compatibility.bootdelegation=false
Comment 3 Paul Webster CLA 2012-06-20 11:28:42 EDT
Does this package need to be imported for all css bundles then?  It seems that it's used heavily in the o.e.e4.css.* bundles as well

PW
Comment 4 Thomas Watson CLA 2012-06-20 11:52:49 EDT
(In reply to comment #3)
> Does this package need to be imported for all css bundles then?  It seems that
> it's used heavily in the o.e.e4.css.* bundles as well
> 
> PW

It should be imported by all bundles that use the org.w3c.dom.css package.  The only possible exception would be if the bundle happens to require org.eclipse.osgi.  In that case the bundle does get "wired" to all the packages exported by the system bundle as part of the execution environment.  Even that is not really a best practice though.  So I would recommend that bundles import stuff they need from the execution environment (except java.* packages).
Comment 5 Paul Webster CLA 2012-07-26 13:27:20 EDT
Fixed in master for SR1

PW
Comment 6 Brian de Alwis CLA 2012-08-24 10:00:03 EDT
The change causes our bundles to require org.w3c.dom.css >= 2.0.0.  This change means that we *have* to pull in and ship the javax.xml from Orbit as the version from the system bundle will always be 0.0.0.  Must we be specify a package version here?  Was there a org.w3c.dom.css version 1.0?
Comment 7 Paul Webster CLA 2012-08-27 09:29:16 EDT
(In reply to comment #6)
> the version from the system bundle will always be 0.0.0.  Must we be specify
> a package version here?  Was there a org.w3c.dom.css version 1.0?

Tom, do you know if it's OK to just import the package and get rid of the version? I remember from before that exports from the system bundle tend to have 0.0.0.

PW
Comment 8 Thomas Watson CLA 2012-08-27 10:01:26 EDT
(In reply to comment #7)
> Tom, do you know if it's OK to just import the package and get rid of the
> version? I remember from before that exports from the system bundle tend to
> have 0.0.0.
> 
> PW


Yes, I would simply not have the version range for these types of packages.  Unfortunately we have never been able to get correct version information for the packages provided by the various Java SE versions.
Comment 9 Paul Webster CLA 2012-08-27 14:33:45 EDT
(In reply to comment #6)
> The change causes our bundles to require org.w3c.dom.css >= 2.0.0. 

Brian, do you want to remove the version attribute from the import?

PW
Comment 10 Paul Webster CLA 2012-08-30 11:23:55 EDT
in M20120829-1200
PW
Comment 11 Brian de Alwis CLA 2012-11-06 23:42:29 EST
(In reply to comment #10)
> in M20120829-1200
> PW

I mis-interpreted Paul's remark to mean that he had committed a fix.  But this issue happened to me again and is happening to others as evidenced by bugs like bug 387869.  Rather than re-opening this bug, I've filed bug 393739.