This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 270934
Collapse All | Expand All

(-)a/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java (-1 / +1 lines)
Lines 2321-2327 Link Here
2321
            StatementTree elseStat = node.getElseStatement();
2321
            StatementTree elseStat = node.getElseStatement();
2322
            CodeStyle.BracesGenerationStyle redundantIfBraces = cs.redundantIfBraces();
2322
            CodeStyle.BracesGenerationStyle redundantIfBraces = cs.redundantIfBraces();
2323
            if ((elseStat != null && redundantIfBraces == CodeStyle.BracesGenerationStyle.ELIMINATE && danglingElseChecker.hasDanglingElse(node.getThenStatement())) ||
2323
            if ((elseStat != null && redundantIfBraces == CodeStyle.BracesGenerationStyle.ELIMINATE && danglingElseChecker.hasDanglingElse(node.getThenStatement())) ||
2324
                    (redundantIfBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node) || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)))
2324
                    (redundantIfBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset <= sp.getEndPosition(root, node) || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)))
2325
                redundantIfBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE;
2325
                redundantIfBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE;
2326
            lastIndent = indent;
2326
            lastIndent = indent;
2327
            boolean prevblock = wrapStatement(cs.wrapIfStatement(), redundantIfBraces, cs.spaceBeforeIfLeftBrace() ? 1 : 0, node.getThenStatement());
2327
            boolean prevblock = wrapStatement(cs.wrapIfStatement(), redundantIfBraces, cs.spaceBeforeIfLeftBrace() ? 1 : 0, node.getThenStatement());

Return to bug 270934