This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | [71cat] ClassCastException: class com.sun.tools.javac.api.JavacTool | ||
---|---|---|---|
Product: | java | Reporter: | sunbiz <sunbiz> |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | sj-nb |
Priority: | P3 | ||
Version: | 7.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 181893 |
Attachments: | stacktrace |
Description
sunbiz
2011-10-11 17:15:46 UTC
Created attachment 111880 [details]
stacktrace
*** Bug 204071 has been marked as a duplicate of this bug. *** Looks like nb javac issue, as it's just call to ToolProvider.getSystemJavaCompiler(). But feel free to push back for more investigation. Hm, I would be happier if noone (except java.source) wouldn't use nb-javac for compiling - using the platform's javac should be much safer. But it is currently not possible to use the Java infrastructure and the platform's javac in one module. I guess we need to find a way out from this. In the mean time, a workaround is to wrap the invocation of ToolProvider.getSystemJavaCompiler with: ClassLoader orig = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(ClasspathInfo.class.getClassLoader()); JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); } finally { Thread.currentThread().setContextClassLoader(orig); } I would recommend using this workaround for 7.1 - it depends on a non-guaranteed implementation detail, but should work, and we will have more time to come up with a real solution. Sorry for the trouble. Jan, thanks, http://hg.netbeans.org/web-main/rev/e3e13e0a83c0 workaround. do you want this issue to remain open? (In reply to comment #5) > Jan, thanks, > http://hg.netbeans.org/web-main/rev/e3e13e0a83c0 workaround. Thanks. > > do you want this issue to remain open? Yes, please. Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/e3e13e0a83c0 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #203540 implemet suggested workaround This bug already has 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=181893 Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1. |