| Summary: | [formatter]Infinite loop in CodeFormatter / Scribe | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | André Pankraz <andre> | ||||||
| Component: | Core | Assignee: | Manoj N Palat <manoj.palat> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | manoj.palat, srikanth_sankaran | ||||||
| Version: | 4.4 | ||||||||
| Target Milestone: | 4.5 M7 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Problem dates back to Helios - 3.6.2 (atleast - yet to check earlier) - able to reproduce. Too late to get into M7, but would continue on this to get this into 4.4 moving to 4.5 Created attachment 245419 [details]
workaround wip
This workaround avoids infinite loop by graceful(?) bail-out after trying out for some n times - wip
Moving it out of M1 since no solution found yet. Would commit the workaround post M1. moving out of M2 Fixed via formatter redesign bug 303519 commit - see bug 303519 comment 106 as well. test case committed via : http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=aa1251a9bb09d2814faa35f8263b76de31ef315e Verified for M7 using I20150426-2000 build |
Created attachment 241873 [details] Source to Paste into Eclipse with 1.5 Source Project Setting The following test starts an infinite loop with the attached document in CodeFormatter. I can also paste this into eclipse and get the same problem. If I deactivate the option 1.5, it runs without the loop. the attached file is not syntactically correct, but shouldn't create such a loop anyway. I have Kepler SR2 64 bit with JDK 8 extension. void test() throws IOException { StringBuffer src = new StringBuffer(); for (String line : Files .readAllLines(Paths .get(".../reformatExample.txt"))) { src.append(line); } String source = src.toString(); final Map<String, String> options = JavaCore.getOptions(); options.put(JavaCore.COMPILER_SOURCE, "1.5"); final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(options); final TextEdit edit = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, "\r\n"); assert edit != null; }