Community
Participate
Working Groups
Created attachment 79190 [details] error log Build ID: I20070625-1500 Steps To Reproduce: 1. Create a Java project and include the attached source file BadClass.java 2. Compile it More information: The attached example was simplified and it only contains the error cause. The intent of the method is to do the following assignment People oPeople; {oPeople= (People) obj;} Since the automated tool which made the source invoked Class.toString() instead of Class.getName() the resulting code was class People oPeople; {oPeople= (class People) obj;} When compiling, an internal compiler error occurs. It DOES NOT occur unless the assignment is done inside its own scope. (i.e, the following example do not compiles, but the compiler errors are fine) class People oPeople; oPeople= (class People) obj; All this examples are included into the attachment. You may also need a People class which may be implemented as: public class People {}
Created attachment 79192 [details] javac_1-6-0_02 log Both javac 1.6.0_02 and javac 1.4.2 compile the example as expected (they correctly report the errors). The log for javac 1.4.2 is the same, except for the last error "reached end of file while parsing") which only occurs with 1.6.0_02
Created attachment 79193 [details] Bug example source code
I reproduce the problem with build I20070925-1406. Simpler test case public class X { public void foo() { class Y ; { class Z ; } } }
Created attachment 79275 [details] Proposed fix
Created attachment 79355 [details] Better fix
Released for 3.4M3. Tests added StatementRecoveryTests#test0045() -> test0047()
*** Bug 152883 has been marked as a duplicate of this bug. ***
Verified for 3.4M3 using I20071029-0800
*** Bug 188053 has been marked as a duplicate of this bug. ***