[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] What is the latest on "Access restriction" compilation errors

Tonny's suggestion is basically what I've done, but it sure feels "icky" and I don't like that it means any further usage of com.sun.* packages in that plugin will be masked/ignored. What I really don't get is why Eclipse (and PDE) don't warn about it? As I said, I definitely have the compiler settings configured to create warning markers for accessing restricted classes; it's frustrating that Tycho and Eclipse aren't in sync on this. Doesn't Eclipse normally flag such access with a warning?

More below…

On 11/28/12 1:29 AM, "Mickael Istria" wrote:

Extensions Bundle are the only good way to go with clean OSGi.
It may seem to be a big pain, but it's not. It's just a matter of putting to fragment on system-bundle and use Export-Package. Just a Tycho "eclipse-plugin" with a MANIFEST.MF.
Moreover your software does not run against Java, it runs against a com.sun.* JRE. It is possible that it fails in other environment or in future releases of JREs (IBM JDK's, JRockit, IcedTea...). So you should consider remocing this dependency to internal JVM packages.

Actually, our software does in fact run against a specific JRE; we bundle the JRE with the product. I have asked the team responsible for the code to investigate removing the com.sun.* usage, but there is no guarantee that a reasonable alternative exists (I've yet to find another implementation of CachedRowSet other than vendor-specific ones).

If an extension bundle is really what OSGi wants to push me to, why doesn't Eclipse PDE complain about the access? Where is it configured that the com.sun.rowset package (or any package, for that matter) is "restricted" in the JRE? How can we expect a team of 100+ developers  to know what Tycho or OSGi is going to be sensitive to when the IDE doesn't provide guidance?

Eric



On 11/28/12 3:15 AM, "Tonny Madsen" wrote:

If removing the dependency or adding an OSGi extension bundle is too difficult right now, you can also change the warning levels of the compiler with the following snippet:

<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<compilerArgument>-warn:+discouraged,forbidden</compilerArgument>
</configuration>
</plugin>

Works for me :-)

/Tonny


On Wed, Nov 28, 2012 at 7:29 AM, Mickael Istria <mistria@xxxxxxxxxx> wrote:
On 11/27/2012 09:23 PM, Rizzo, Eric wrote:
I've tried searching and reading about other similar problems, but quickly got lost in the weeds of bug reports and discussions about OSGi. I found a reference to a blog post about creating an OSGi Extension Bundle (http://blog.meschberger.ch/2008/10/osgi-bundles-require-classes-from.html) but honestly that seems like a big pain just to get Tycho to compile against a class I know exists in JRE 1.6.
Extensions Bundle are the only good way to go with clean OSGi.
It may seem to be a big pain, but it's not. It's just a matter of putting to fragment on system-bundle and use Export-Package. Just a Tycho "eclipse-plugin" with a MANIFEST.MF.
Moreover your software does not run against Java, it runs against a com.sun.* JRE. It is possible that it fails in other environment or in future releases of JREs (IBM JDK's, JRockit, IcedTea...). So you should consider remocing this dependency to internal JVM packages.

HTH
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user