Prevent Netbeans from replacing assignments with getters

0

Sometimes I have in Java something like the following:

public class MiClase {
    Objeto objeto;

    Objeto objeto2;

    public void foo() {
        objeto = new Objet();
        objeto2 = objeto;
    }

    public Objeto getObjeto2() {
        return objeto2;
    }

    public void setObjeto2(Objeto objeto2) {
        this.objeto2 = objeto2;
    }
}

But when I use alt+shif+f to sort the code it replaces the assignments to the following:

public class MiClase {
    Objeto objeto;

    Objeto objeto2;

    public void foo() {
        objeto = new Objet();
        setObjeto2(objeto);
    }

    public Objeto getObjeto2() {
        return objeto2;
    }

    public void setObjeto2(Objeto objeto2) {
        this.objeto2 = objeto2;
    }
}

Which is quite uncomfortable for me, is there a way to avoid that in Netbeans?

I've already looked at options but I did not find anything related.

    
asked by gibran alexis moreno zuñiga 03.06.2017 в 01:02
source

0 answers