| Summary: | tycho does not compile classes from the rt.jar | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Borislav Arnaudov <borislavarnaudov> | ||||
| Component: | Tycho | Assignee: | Project Inbox <tycho-inbox> | ||||
| Status: | CLOSED DUPLICATE | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | igor, jan.sievers | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
some observations: * the project does compile with tycho 0.13.0 and fails with forbidden access restriction compiler error with 0.14.0-SNAPSHOT * when importing the project into eclipse, I get the same error from PDE so it seems consistent It looks like this new behaviour is intended, probably Igor can clarify as I suppose commit http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=d5faf8f7be6b98c771a92476554e258beb9573da changed this. That said, as a workaround you can configure forbidden package access not to be an error: <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-compiler-plugin</artifactId> <version>${tycho-version}</version> <configuration> <compilerArgument>-err:-forbidden</compilerArgument> </configuration> </plugin> I also have it in eclipse and it does compile fine , even without warnings. My eclipse version is 3.7.1.r37x_v20110729 Is there some configuration in eclipse for such packages? (In reply to comment #2) > I also have it in eclipse and it does compile fine , even without warnings. My > eclipse version is 3.7.1.r37x_v20110729 > Is there some configuration in eclipse for such packages? BTW the workaround works fine, but an explanation will be nice, so that I can inform the developers what they should or should not do. Thanks The project does not declare dependency on com.sun.jmx.remote.util package and the bundle can theoretically fail at runtime because the package is not officially part of JavaSE-1.6 java profile, so it can be completely absent from the JVM runtime libraries or OSGi runtime can block access to the package. There are references in bug 367431 that explain correct way to use com.sun.* and other JDK implementation classes from an OSGi bundle. *** This bug has been marked as a duplicate of bug 367431 *** (In reply to comment #2) > I also have it in eclipse and it does compile fine , even without warnings. My > eclipse version is 3.7.1.r37x_v20110729 > Is there some configuration in eclipse for such packages? That's because you don't have a specific JRE container in your .classpath file. <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> If you change this line to what m2e or PDE generates during "import as maven project": <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> then you get the compilation errors. Access rules are only applied for packages of a specific JDK version/OSGi execution profile. |
Created attachment 209792 [details] sample project I have a project that uses classes from com.sun.jmx.* package. It compiles well in eclipse as well as with tycho 0.13.0 but when I try to compile it with tycho 0.14.0-SNAPSHOT I get and error. Access restriction: The type OrderClassLoaders is not accessible due to restriction on classpath entry C:\jdk1.6.0_22\jre\lib\rt.jar I tried with different JDK but no luck. I am attaching a small project that should be sufficient to see what the problem is. Thanks in advance for the help.