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: | "Uncompilable source code - cannot find symbol" thrown unnecessarily from <clinit> | ||
---|---|---|---|
Product: | java | Reporter: | Jesse Glick <jglick> |
Component: | Compiler | Assignee: | Dusan Balek <dbalek> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 8.2 | ||
Hardware: | HP | ||
OS: | Windows 10 x64 | ||
Issue Type: | DEFECT | Exception Reporter: | java.lang.RuntimeException: Uncompilable source code - cannot find symbol |
Bug Depends on: | |||
Bug Blocks: | 177537 |
Description
Jesse Glick
2009-11-24 10:25:31 UTC
Workaround: use FQNs in the method body rather than imports for the JDK 6-only classes. Well, the compiler is obliged to generate the executable code in such a way, that it throws an exception before the execution arrives at the point of the compile-time error (or not to generate the executable code at all for code with compile-time error). For un-resolvable imports, it may be non-trivial to throw the exception at some other point than in clinit (esp. for unused imports). For unused imports, do not generate anything; there is no executable code to fail. For used imports, I agree this could be trickier to implement, but at least the correct behavior is pretty clear: throw a NoClassDefFoundError immediately before the line that would have used that import. |