Skip to main content

[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

Stéphane,
I was about to reply that I know about Execution Environments and already checked the plugin to make sure it specified one and months ago went through all the projects and set them up to use EE. Then I thought, this is a somewhat "rogue" plugin that I've never looked at in detail, so let me check…

Sure enough, you are correct, this project had "workspace default" selected for its JRE System Library. I had only looked at the B-REE in the manifest, not in the project's build path.

Thanks – now the warning shows up in the IDE and, hopefully, the team won't make the same mistake again.

Eric


On 11/28/12 11:29 AM, "Stéphane Bouchet" wrote:

HI,

this may be related to how is configured the project's JRE.

If you want eclipse to warn you about using com.sun.* internal package, do not set the "JRE system library" to a specific jre ( in your cas, sun jre ) but to an Execution environment ( JavaSE-1.6).
this is the way tycho does, and why it is complaining and not eclipse.

to do so, right click on the project > properties > Java build Path > librairies. you can see the current JRE used in the "[]" near "JRE System library". click on edit, then select the first option, then an execution environment.

for more informations : 

Cheers,


2012/11/28 Rizzo, Eric <Eric.Rizzo@xxxxxxx>
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



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





Back to the top