Skip to content

EffectivelyPrivate false positives? #5182

@facboy

Description

@facboy

A couple of scenarios:

public methods on inner private classes

class Outside {

  private class Inside {
    public void doSomething() {
      // ...
    }
  }
}

I'm prepared to be told that it's worthwhile warning on doSomething(), but at the moment it seems a bit like noise. It appears to me it's not just 'effectively private', it is private because it's defined in a private inner class?

It will also warn on public (and protected) constructors of private inner classes.

public methods on private inner classes that are extended by public inner classes

class Outside {

  private abstract class InsideParent {
    public void doSomething() {
      // ...
    }
  }

  public OutsideChild extends InsideParent {
    // ... other stuff
  }
}

doSomething() is supposed to be visible and accessible on OutsideChild. This is a fairly common pattern, isn't it?

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