Community
Participate
Working Groups
The implemetation of org.eclipse.jdt.internal.core.util.getResourceContentsAsCharArray(IFile file, String encoding) now limits the number of characters to read with the size of file. This leads to weird syntax errors due to tail of the file is skipped when custom encoding that produces more than one character per byte is used. To reproduce install Simple Java Preprocessor (http://www.vortoj.com/sjpp/readme.html) and create file public class A { public static void main( String[] args ) { #if ABC #endif } } After setting proper encoding the errors 'Syntax error, insert '}' to complete ClassBody' and 'Syntax error, insert '}' to complete MethodBody' will occur. This error was found in Eclipse 3.2RC7, version 3.1.2 reads file until EOF and all work fine.
Sorry, the name of the class was missed. the proper name of the method is org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(IFile file, String encoding)
Too bad only discovered now. Will queue it for 3.2.1.
This is a consequence of a performance change, which caused this one scenario. We will provide a fix which preserves the performance characteristics. Wondering about 3.2.0 late escalating...
Note that the batch compiler always had this bug. The bug in the Java builder and other JDT tooling was also introduced with jdt.core v_645 during 3.2 M6.
Apparently, if you add newlines and/or spaces to the end of the file, you can work-around this problem. At least that worked for one of my sample files which had this problem (use of SJPP produced syntax errors at the end of the file).
Re: 3.2.0 escalation We had the same bug in batch compiler since ever, and no one ever complained. Now we made it more proeminent by breaking the builder as well as the entire JDT stack. So though it is bad, it is not a show stopper, considering there is a workaround (adding extra space at end of the file), and no one discovered it in a long time (the offending change has been in for months). Nevertheless, we will make a fix available for 3.2.1 and post a patch on our JDT/Core web page for early access to our 3.2.1 update (in progress). Jerome - pls advertize in this bug where to get the early patch
Created attachment 45560 [details] Proposed fix and regression test
Created attachment 45701 [details] Improved fix (with same regression test)
Patch and regression test released for 3.3 M1 in HEAD
Patch and regression test released for 3.2.1 in R3_2_maintenance branch.
A 3.2.1 preview (including the fix to this bug) is available at http://www.eclipse.org/jdt/core/r3.2/index.php#UPDATES
*** Bug 150745 has been marked as a duplicate of this bug. ***
Verified for 3.3 M1 using build I20060807-0010.
Verified for 3.2.1 using build M20060908-1655
*** Bug 151905 has been marked as a duplicate of this bug. ***