Search code examples
javaeclipseosgiosgi-bundle

Can we use java 8 features in plugins on equinox from Eclipse 3.7.2?


I am developing some plugins for equinox from Eclipse version 3.7.2. Unfortunatelly I cannot upgrade to the latest equinox platform. The provided equinox platform does not provides "Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))" entry in its manifest. So I cannot use "Bundle-RequiredExecutionEnvironment: JavaSE-1.8" in my plugins. According to the answer Java 8 & Missing required capability Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8))" I am using approach " to remove the header from my bundle Manifest" and bundle successfully compiles and works with java 8 features so far.

My question is - is it safe to workaround missing capability like this? I am running my old equinox platform on java 8 so java 8 features should be available. Is it possible to use java 8 features in my plugins even if I do not specify Bundle-RequiredExecutionEnvironment as java 8, but whole development and production run is on Java 8 ? Or does Osgi platform limit osgi.ee platform for some good reason and I have to stick with Java 1.6 ?


Solution

  • Yes it is safe. Eclipse tries to set the ee info based upon the JRE it is running in. Older versions of Eclipse don't know about version of java that came after they shipped.