Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 289567

Summary: IllegalArgumentException on Save when "always use blocks" save action is enabled
Product: [Eclipse Project] JDT Reporter: bugzilla
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: benno.baumgartner, daniel_megert
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
The stacktrace of the IllegalStateException
none
The stacktrace of the AssertionFailedException none

Description bugzilla CLA 2009-09-16 05:39:57 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: M20090211-1700

When the additional save action "use blocks in if/while/for/do statements" ist enabled and set to "always" and an a java-file is saved in a state where the conditions of the (for example) if-statement doesn't compile, an error dialog comes up, informing you, that the file was saved, but one of the save participants caused a problem.
The details say the following:

"A save participant caused problems.
  The save participant 'Code Clean Up' caused an exception: java.lang.IllegalArgumentException: Document does not match the AST. See the error Log for details."


Reproducible: Always

Steps to Reproduce:
1. Change the preferences to use "use blocks in if/while/for/do statements" and set to "always"
2. put the following code somewhere:

if (true
    return;

3. Save the whole thing.




I did get this error earlier, except that then I got an AssertionFailedException. When reproducing the error, I then got stuck with the IllegalArgumentException
Comment 1 bugzilla CLA 2009-09-16 05:42:52 EDT
Created attachment 147286 [details]
The stacktrace of the IllegalStateException
Comment 2 bugzilla CLA 2009-09-16 05:43:40 EDT
Created attachment 147288 [details]
The stacktrace of the AssertionFailedException
Comment 3 Dani Megert CLA 2009-09-16 06:14:11 EDT
This works for me using R3.5 or 3.6 build (e.g. I20090915-0100). Please reopen if you can reproduce with such a build and provide a complete sample source.

*** This bug has been marked as a duplicate of bug 257057 ***