dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.59k forks source link

`public_member_api_docs` ignores constructors in abstract interface classes #59488

Open Pante opened 3 months ago

Pante commented 3 months ago

Describe the issue public_member_api_docs does not flag constructors in abstract interface classes that are undocumented.

To Reproduce

abstract interface class Foo {
  factory Foo.a() = Bar;

  factory Foo.b() => Bar();

  Foo();
}

class Bar extends Foo {}

Expected behavior The constructors should be flagged as undocumented, similar to how they are flagged in abstract & interface classes.

pq commented 3 months ago

This is related to https://github.com/dart-lang/sdk/issues/59210 but maybe we over-stepped in treating abstract interface classes as "effectively" private?

/cc @lrhn

lrhn commented 3 months ago

I think the dart-lang/sdk#59210 discussion was correct in saying that generative constructors of abstract non-extensible classes can be treated as private, because they have no valid public uses. That doesn't extend to factory constructors, which can be called and torn off just like any static method. (Yet another difference between factory and generative constructors which make it breaking to change one to the other.)