Skip to content

Formatting alters content #8483

Closed
Closed
@naren2605

Description

@naren2605

Apache NetBeans version

Apache NetBeans 25

What happened

formatter is altering content as pointed in jvsce-issue

attaching additional cases for reference

Image

Language / Project Type / NetBeans Component

No response

How to reproduce

open java file sample as below and format document

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 */

package com.mycompany.formatting.issue;

/**
 *
 * @author nbalyamm
 */
public class FormattingIssue {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
    
    public void case1(){
        if ("foo".contains("bar"))))) )))  {
                                System.out.println("bar");
                    }
        
    }
    
    public void case2(){
        
        if ("foo".contains("bar"))))) )))
        
    }
    
    public void case3(){
        if ("foo".contains("bar"))))) ))) 
                 else {
                       System.out.println("bar2")
                    }
    }
}

Did this work correctly in an earlier version?

No / Don't know

Operating System

macos

JDK

jdk24

Apache NetBeans packaging

Apache NetBeans platform

Anything else

No response

Are you willing to submit a pull request?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Java[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)kind:bugBug report or fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions