Summary: | M7 Source formatter fails silently when assert present in source | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Colin Cooper <colin.cooper> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | martinae, wva |
Version: | 3.0 | ||
Target Milestone: | 3.0 M8 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Colin Cooper
2004-02-17 09:47:08 EST
Do you set your compiler settings per project or is it a global setting? Moving to JDT/UI. The code formatter is not called with the compiler settings. It has no idea that the source needs to be parsed in 1.4 mode. The method ToolFactory.createCodeFormatter(Map options) needs to be called with the options relative to the source that needs to be parsed. It could be project based or a global settings. The code formatter is using this option JavaCore.COMPILER_SOURCE defined on JavaCore to find out if assert is a keyword or an identifier. I verifuied that JavaCore.COMPILER_SOURCE = 1.4 is passed. The fomatter doesn't seems to look at it. - Set the compiler prefeences to source compatibility 1.4, class files 1.4, assert as identifier 'error'. - select the following code public class A { private void foo() { assert true : "Hello;"; int i = 9; } } nothing happens. - breakpoint at ToolFactory.createCodeFormatter shows that JavaCore.COMPILER_SOURCE = 1.4 is passed *** Bug 52771 has been marked as a duplicate of this bug. *** Fixed and released in HEAD. Regression test added. Verified for 3.0 using build I200403250010. Note that this work only when workspace compiler options are set. It does not work when only project options are set to 1.4 compliance. As code formatter rely on UI for these options, I've opened bug 56142 against jdt-ui for this issue... |