This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
The documentation for JavaInterface gives the following example code
interface IFoo : JavaInterface!("com.example", IFoo) {
string whatever();
}
final class Foo : IFoo, JavaClass!("com.example", Foo) {
// need to tell D that the implementation exists, just in Java.
// (This actually generates the D implementation that just forwards to the existing java method)
@Import string whatever();
}
however, this code does not compile (at least with DMD). It should instead be something like:
interface IFoo : JavaInterface!("com.example", IFoo) {
@Import string whatever();
}
final class Foo : JavaClass!("com.example", Foo), IFoo {
// need to tell D that the implementation exists, just in Java.
// (This actually generates the D implementation that just forwards to the existing java method)
@Import string whatever();
}
The documentation for
JavaInterface
gives the following example codehowever, this code does not compile (at least with DMD). It should instead be something like:
which seems to compile and work on the java side