generate a "prelude" from `java_package`
nikomatsakis opened this issue · comments
It's annoying to import all the FooExt
traits manually. Let's create a "prelude", I .. guess for each java package?
Then you can do something like
duchess::java_package! {
package foo.bar;
}
use foo::bar::prelude::*;
If we include the subpackages too, then you can do
use duchess::java::prelude::*;
use foo::prelude::*;
which would be nice.
Mentoring tips
Tokens for a package are created here:
Lines 51 to 56 in a23cf56
You will need to modify that to generate a pub mod prelude
with pub use
statements for the Ext
traits. But you'll also need to modify the code that generates a class declaration to return back a list of Ext
traits and collect them here.
To include subpackages, you'd need to return the Ext
traits from SpannedPackageInfo::to_tokens
and collect them here.
This is no longer relevant as we are using inherent method dispatch.