@Test public void shouldReturnEmptyForExplicitPackagePrivate() { assertThat(selector.accessModifierFor("com.spotify.pkgpriv"), is(Optional.empty())); }
public Optional<Modifier> accessModifierFor(String packageName) { switch (accessFor(packageName)) { case PACKAGE_PRIVATE: return Optional.empty(); case PRIVATE: return Optional.of(Modifier.PRIVATE); case PROTECTED: return Optional.of(Modifier.PROTECTED); case PUBLIC: return Optional.of(Modifier.PUBLIC); } throw new AssertionError("cannot get here"); }
AccessSelector { public Optional<Modifier> accessModifierFor(String packageName) { switch (accessFor(packageName)) { case PACKAGE_PRIVATE: return Optional.empty(); case PRIVATE: return Optional.of(Modifier.PRIVATE); case PROTECTED: return Optional.of(Modifier.PROTECTED); case PUBLIC: return Optional.of(Modifier.PUBLIC); } throw new AssertionError("cannot get here"); } }
AccessSelector { public Optional<Modifier> accessModifierFor(String packageName) { switch (accessFor(packageName)) { case PACKAGE_PRIVATE: return Optional.empty(); case PRIVATE: return Optional.of(Modifier.PRIVATE); case PROTECTED: return Optional.of(Modifier.PROTECTED); case PUBLIC: return Optional.of(Modifier.PUBLIC); } throw new AssertionError("cannot get here"); } AccessSelector(Set<? extends Element> visibilityAnnotatedPackages); }
AccessSelector { public Optional<Modifier> accessModifierFor(String packageName) { switch (accessFor(packageName)) { case PACKAGE_PRIVATE: return Optional.empty(); case PRIVATE: return Optional.of(Modifier.PRIVATE); case PROTECTED: return Optional.of(Modifier.PROTECTED); case PUBLIC: return Optional.of(Modifier.PUBLIC); } throw new AssertionError("cannot get here"); } AccessSelector(Set<? extends Element> visibilityAnnotatedPackages); Optional<Modifier> accessModifierFor(String packageName); }
AccessSelector { public Optional<Modifier> accessModifierFor(String packageName) { switch (accessFor(packageName)) { case PACKAGE_PRIVATE: return Optional.empty(); case PRIVATE: return Optional.of(Modifier.PRIVATE); case PROTECTED: return Optional.of(Modifier.PROTECTED); case PUBLIC: return Optional.of(Modifier.PUBLIC); } throw new AssertionError("cannot get here"); } AccessSelector(Set<? extends Element> visibilityAnnotatedPackages); Optional<Modifier> accessModifierFor(String packageName);  }