I also share the former opinion from two opinions provided by Nick. And I also 
thought that Nick and Sean were of the same opinion that @VisibleForTesting is 
only intended for our project and should not be treated as public API by 
downstreamers. 

After Bharath's reply, I again went through the thread and now I feel I was 
incorrect. Sean and Nick are of the opinion that @VisibleForTesting with wider 
scope (although intended for our unit tests) should be treated as public API 
and we should follow deprecation cycle for minor release for them. Is that 
correct?

IMHO these methods should be strictly used by tests only and downstreamers 
should treat them as upstream's private APIs and should never use them directly.


On 2020/06/23 00:15:39, Bharath Vissapragada <[email protected]> wrote: 
> Sorry, I should've been clearer. It's the former. My point is, any method
> tagged with @VisibleForTesting is only intended for testing purposes and
> should _not_ be considered public, its visibility scope is wider than
> necessary only because it was needed by some test method. That's how I'd
> interpret it (Actually, that's what I thought you meant, now I'm confused
> :-)).
> 
> On Mon, Jun 22, 2020 at 4:02 PM Nick Dimiduk <[email protected]> wrote:
> 
> > On Mon, Jun 22, 2020 at 3:45 PM Bharath Vissapragada <[email protected]>
> > wrote:
> >
> > > I share the same opinion. Infact hadoop (from which our annotations are
> > > derived I believe), talks about this, "Also, certain APIs are annotated
> > as
> > > @VisibleForTesting (from com.google.common
> > .annotations.VisibleForTesting)
> > > - these are meant to be used strictly for unit tests and should be
> > treated
> > > as “Private” APIs."
> > >
> > >
> > >
> > https://hadoop.apache.org/docs/r3.1.2/hadoop-project-dist/hadoop-common/InterfaceClassification.html
> > >
> >
> > Sorry Bharath, I don't follow. Are you saying "I share the opinion that the
> > VisibleForTesting annotation should be considered as defining a method as
> > IA.Private," and this is an omission from our community guidelines
> > document? Or are you saying "no, it does not count as an interface audience
> > marker," and we are obliged to treat methods such as in this example as
> > public API?
> >
> > Thanks,
> > Nick
> >
> > On Mon, Jun 22, 2020 at 10:15 AM Sean Busbey <[email protected]> wrote:
> > >
> > > > Yeah I would say no as well. We should make clear on our dev guide that
> > > you
> > > > also should be marking those things with an Interface Audience marking
> > if
> > > > you don't intend them to be at the downstream API visibility of the
> > > parent
> > > > class.
> > > >
> > > > (IIRC we also use VisibleForTesting in IA.Private classes to
> > proactively
> > > > explain why some internal looking member is at a wider Java access
> > > scope.)
> > > >
> > > > On Mon, Jun 22, 2020, 11:39 Nick Dimiduk <[email protected]> wrote:
> > > >
> > > > > Hello,
> > > > >
> > > > > This came up over on the 2.3.0RC0 thread, so let's open it for proper
> > > > > discussion. In that context, we observe method signature changes to a
> > > > > method marked with the Guava VisibleForTesting annotation. The method
> > > is
> > > > a
> > > > > protected method on a IA.Public class. There is no method-level IA
> > > > > annotation.
> > > > >
> > > > > Do we consider the VisibleForTesting annotation as a specifier for
> > our
> > > > > compatibility guidelines?
> > > > >
> > > > > I am of the opinion that no, it is not an InterfaceAudience
> > annotation,
> > > > and
> > > > > so it is not applicable for defining our public API.
> > > > >
> > > > > What do you think?
> > > > >
> > > > > Thanks,
> > > > > Nick
> > > > >
> > > >
> > >
> >
> 

Reply via email to