mirror of https://github.com/adamdruppe/arsd.git
improved
This commit is contained in:
parent
a0367f644c
commit
ee3b087f3e
9
jni.d
9
jni.d
|
@ -394,6 +394,7 @@ void rawClassBytesToD()(ubyte[] classBytes, string dPackagePrefix, string output
|
||||||
foreach(method; cf.methodsListing) {
|
foreach(method; cf.methodsListing) {
|
||||||
bool native = (method.flags & 0x0100) ? true : false;
|
bool native = (method.flags & 0x0100) ? true : false;
|
||||||
if(jtc.nativesAreImports) {
|
if(jtc.nativesAreImports) {
|
||||||
|
native = false; // kinda hacky but meh
|
||||||
if(!jtc.doImports)
|
if(!jtc.doImports)
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -411,7 +412,7 @@ void rawClassBytesToD()(ubyte[] classBytes, string dPackagePrefix, string output
|
||||||
auto name = method.name;
|
auto name = method.name;
|
||||||
|
|
||||||
// FIXME: maybe check name for other D keywords but since so many overlap with java I think we will be ok most the time for now
|
// FIXME: maybe check name for other D keywords but since so many overlap with java I think we will be ok most the time for now
|
||||||
if(name == "debug" || name == "delete" || name == "with" || name == "version" || name == "cast" || name == "union" || name == "align" || name == "alias" || name == "in" || name == "out" || name == "toString") {
|
if(name == "debug" || name == "delete" || name == "with" || name == "version" || name == "cast" || name == "union" || name == "align" || name == "alias" || name == "in" || name == "out" || name == "toString" || name == "init") {
|
||||||
// toString is special btw in order to avoid a dmd bug
|
// toString is special btw in order to avoid a dmd bug
|
||||||
port ~= " @JavaName(\""~name~"\")";
|
port ~= " @JavaName(\""~name~"\")";
|
||||||
name ~= "_";
|
name ~= "_";
|
||||||
|
@ -457,7 +458,9 @@ void rawClassBytesToD()(ubyte[] classBytes, string dPackagePrefix, string output
|
||||||
|
|
||||||
if(!isInterface)
|
if(!isInterface)
|
||||||
dco ~= "\tmixin IJavaObjectImplementation!(false);\n";
|
dco ~= "\tmixin IJavaObjectImplementation!(false);\n";
|
||||||
dco ~= "\tmixin JavaPackageId!(\""~originalJavaPackage.replace("/", ".")~"\", \""~originalClassName~"\");\n";
|
//dco ~= "\tmixin JavaPackageId!(\""~originalJavaPackage.replace("/", ".")~"\", \""~originalClassName~"\");\n";
|
||||||
|
// the following saves some compile time of the bindings; might as well do some calculations ahead of time
|
||||||
|
dco ~= "\tpublic static immutable string _javaParameterString = \"L" ~ cn ~ "\";\n";
|
||||||
|
|
||||||
dco ~= "}\n";
|
dco ~= "}\n";
|
||||||
|
|
||||||
|
@ -1605,7 +1608,7 @@ mixin template ImportExportImpl(Class) {
|
||||||
private static arsd.jni.JavaBridge!(Class) _javaDBridge;
|
private static arsd.jni.JavaBridge!(Class) _javaDBridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
class JavaBridge(Class) {
|
final class JavaBridge(Class) {
|
||||||
static foreach(memberName; __traits(derivedMembers, Class)) {
|
static foreach(memberName; __traits(derivedMembers, Class)) {
|
||||||
// validations
|
// validations
|
||||||
static if(is(typeof(__traits(getMember, Class, memberName).offsetof)))
|
static if(is(typeof(__traits(getMember, Class, memberName).offsetof)))
|
||||||
|
|
Loading…
Reference in New Issue