Community
Participate
Working Groups
Using I20091027-0100, 1) Create a new project and set the formatter options to use a 0 size for tab length 2) Set the mode to be mixed mode for tabs and spaces 3) Create a class that implements java.io.Serializable, but don't add the serialVersionUID field 4) Try to use the quick fix to add the field. 5) You should get an error. Caused by: java.lang.ArithmeticException: / by zero at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.createIndentationString(DefaultCodeFormatter.java:144) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.createIndentString(ASTRewriteFormatter.java:196) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.createIndentString(ASTRewriteAnalyzer.java:278) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ParagraphListRewriter.getSeparatorString(ASTRewriteAnalyzer.java:878) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ParagraphListRewriter.getSeparatorString(ASTRewriteAnalyzer.java:867) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ListRewriter.rewriteList(ASTRewriteAnalyzer.java:574) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteParagraphList(ASTRewriteAnalyzer.java:997) at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1575) at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:467) at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2480) at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.internalRewriteAST(ASTRewrite.java:271) at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST(ASTRewrite.java:260) at org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite.attachChange(CompilationUnitRewrite.java:248) at org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite.createChange(CompilationUnitRewrite.java:213) at org.eclipse.jdt.internal.corext.fix.CompilationUnitRewriteOperationsFix.createChange(CompilationUnitRewriteOperationsFix.java:103) at org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposal.createTextChange(FixCorrectionProposal.java:155) at org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal.createChange(CUCorrectionProposal.java:389) at org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeCorrectionProposal.getChange(ChangeCorrectionProposal.java:301) at org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeCorrectionProposal.performChange(ChangeCorrectionProposal.java:119) at org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal.performChange(CUCorrectionProposal.java:323) at org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal.apply(CUCorrectionProposal.java:301) at org.eclipse.jdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator$CorrectionMarkerResolution.run(CorrectionMarkerResolutionGenerator.java:117) at org.eclipse.jdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator$CorrectionMarkerResolution.run(CorrectionMarkerResolutionGenerator.java:130) at org.eclipse.ui.internal.views.markers.QuickFixPage$11.run(QuickFixPage.java:560) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
Created attachment 150670 [details] Proposed fix
Created attachment 150686 [details] Proposed fix + regression test Same patch with a regression test.
(In reply to comment #2) > Created an attachment (id=150686) [details] > Proposed fix + regression test > > Same patch with a regression test. Patch looks good. I'll just move the test to FormatterBugTests test suite instead as there's no data used from the test 'Formatter' workspace, hence there's no need to initialize this workspace while running the test...
Created attachment 150711 [details] Released patch This patch is the same fix than Olivier's patch with the test moved to the FormatterBugTests test suite.
(In reply to comment #4) > Created an attachment (id=150711) [details] > Released patch > Released for 3.6M3 in HEAD stream.
Verified for 3.6M3 using I20091029-0840.