Skip to content

CCDA produces strange refactorings #162

Open

Description

@Ivan-Veselov
package com.example;

public class B {
    private int field1;

    private int field2;

    private int field3;

    public int getField1() {
        return field1;
    }

    public int getField2() {
        return field2;
    }

    public int getField3() {
        return field3;
    }
}
package com.example;

public class A {
    void method1() {
        B b = new B();

        b.getField1();
        b.getField2();
    }

    void method2() {
        B b = new B();

        b.getField1();
        b.getField3();
    }

    void method3() {
        B b = new B();

        b.getField2();
        b.getField3();
    }
}


CCDA output:

com.example.A.method3() -> com.example.B [0.83]
com.example.B.getField1() -> com.example.A [0.60]

Problem 1: From logical point of view the first suggestion is correct. But where are the two others which are symmetrical?
Problem 2: The second refactoring is very strange. It suggests to move getter. And such suggestions arise very often. For example there are many of them in spellchecker module of community IDEA project.

Activity

  1. Ivan-Veselov commented on Aug 20, 2018

    @Ivan-Veselov
    CollaboratorAuthor

    Possible reason for problem 1 is that CCDA logically applies each found refactoring and continues its execution. Am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions