Menu

#1322 [patch] False-positive for IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD

3.0.1
closed-fixed
patch (11)
5
2014-11-08
2014-11-07
No

Current implementation of ConfusionBetweenInheritedAndOuterMethod doesn't take into account which object the method was executed on, thus the false-positive is possible in the following case:

public class Outer {
    public void test() {}

    public static class Super {
        public void test() {}
    }

    public class Inner extends Super {
        @NoWarning("IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD")
        public void fp() {
            Inner inner = new Inner();
            inner.test();
        }
    }
}

We actually encountered such false-positive in the clone method in our project. I wrote a simple fix for this case.

Discussion

  • Andrey Loskutov

    Andrey Loskutov - 2014-11-08
    • status: open --> closed-fixed
    • assigned_to: Andrey Loskutov
    • Group: 3.x --> 3.0.1
     
  • Andrey Loskutov

    Andrey Loskutov - 2014-11-08

    Thanks Tagir!

     

Log in to post a comment.