Commit e91fd99a authored by Jacob Potter's avatar Jacob Potter

Small cleanups to Java / JNI generators

parent 268b0201
......@@ -131,7 +131,7 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
w.wl(s"const auto& data = ::djinni::JniClass<$jniHelper>::get();")
val call = "auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject("
w.w(call + "data.clazz.get(), data.jconstructor")
if(!r.fields.isEmpty) {
if(r.fields.nonEmpty) {
w.wl(",")
writeAlignedCall(w, " " * call.length(), r.fields, ")}", f => {
val name = idCpp.field(f.ident)
......@@ -167,11 +167,11 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
override def generateInterface(origin: String, ident: Ident, doc: Doc, typeParams: Seq[TypeParam], i: Interface) {
val refs = new JNIRefs(ident.name)
i.methods.map(m => {
m.params.map(p => refs.find(p.ty))
i.methods.foreach(m => {
m.params.foreach(p => refs.find(p.ty))
m.ret.foreach(refs.find)
})
i.consts.map(c => {
i.consts.foreach(c => {
refs.find(c.ty)
})
......@@ -258,7 +258,7 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
w.w(call)
val javaMethodName = idJava.method(m.ident)
w.w(s"getGlobalRef(), data.method_$javaMethodName")
if(!m.params.isEmpty){
if(m.params.nonEmpty){
w.wl(",")
writeAlignedCall(w, " " * call.length(), m.params, ")", p => {
val param = jniMarshal.fromCpp(p.ty, "c_" + idCpp.local(p.ident))
......
......@@ -187,7 +187,7 @@ class JavaGenerator(spec: Spec) extends Generator(spec) {
w.wl("super.finalize();")
}
for (m <- i.methods if !m.static) { // Static methods not in CppProxy
val ret = marshal.returnType(m.ret)
val ret = marshal.returnType(m.ret)
val returnStmt = m.ret.fold("")(_ => "return ")
val params = m.params.map(p => marshal.paramType(p.ty) + " " + idJava.local(p.ident)).mkString(", ")
val args = m.params.map(p => idJava.local(p.ident)).mkString(", ")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment