native
native copied to clipboard
Constructing non-static nested classes
public class A {
public class B {
// ...
}
}
We should be able to construct B from an instance of A. Something like:
final a = A(...);
final b = a.B(...);
a.B here has to be a field where its call method invokes the default constructor of B. B's constructors themselves have to all be private (except for fromRef) because we cannot construct B without having an instance of A.
Other constructors:
final b = a.B.ctor2(...);
How widespread is a nested public class which is not also static?
final b = a.B.ctor2(...);
What functional (not API) difference does it make over, A_B just taking an extra parameter of type A?
How widespread is a nested
public classwhich is not alsostatic?
Map.Entry is an example. – Here's the code for MyMap.Entry to get an idea. Almost all of inner classes for Map are non-static. So I'd say it's pretty widespread.
What functional (not API) difference does it make over,
A_Bjust taking an extra parameter of typeA?
It just takes an extra parameter A. This issue has been opened before we even correctly supported such classes. This got solved in https://github.com/dart-lang/jnigen/commit/f1c9fc49f895cc089919510bc759eb353eb90a64 by simply passing the extra parameter in the constructors of A_B (APISummarizer didn't include this).
This issue is mostly about the aesthetics of it, and it's not a top priority (even if we want to do it).