mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
bind: initialize JNI library on any class load
With the introduction of constructors Java side, all types become entry points into the library. However the library was only initialized by the main class until now, resulting in all other constructors hitting linker errors until an interaction with the main library class. This CL fixes that by changing each generated type to touch the main library class, ensuring that the underlying native library is loaded. Change-Id: I640d1dc329e072f8d0753f74ccce87cd9e5aaea8 Reviewed-on: https://go-review.googlesource.com/29994 Reviewed-by: Elias Naur <elias.naur@gmail.com>
This commit is contained in:
committed by
Elias Naur
parent
9640137a86
commit
1663ffa95c
+1
-1
@@ -171,7 +171,7 @@ func (g *JavaGen) genStruct(s structInfo) {
|
||||
g.Printf(" {\n")
|
||||
g.Indent()
|
||||
|
||||
g.Printf("{ Seq.touch(); }\n\n")
|
||||
g.Printf("static { %s.touch(); }\n\n", g.className())
|
||||
if jinf != nil {
|
||||
g.Printf("private final Seq.Ref ref;\n\n")
|
||||
for _, f := range jinf.cons {
|
||||
|
||||
Vendored
+4
-4
@@ -7,7 +7,7 @@ package go.java;
|
||||
import go.Seq;
|
||||
|
||||
public final class Future implements Seq.GoObject, java.util.concurrent.Future {
|
||||
{ Seq.touch(); }
|
||||
static { Java.touch(); }
|
||||
|
||||
private final Seq.Ref ref;
|
||||
|
||||
@@ -39,7 +39,7 @@ package go.java;
|
||||
import go.Seq;
|
||||
|
||||
public final class InputStream extends java.io.InputStream implements Seq.GoObject {
|
||||
{ Seq.touch(); }
|
||||
static { Java.touch(); }
|
||||
|
||||
private final Seq.Ref ref;
|
||||
|
||||
@@ -71,7 +71,7 @@ package go.java;
|
||||
import go.Seq;
|
||||
|
||||
public final class Object extends java.lang.Object implements Seq.GoObject {
|
||||
{ Seq.touch(); }
|
||||
static { Java.touch(); }
|
||||
|
||||
private final Seq.Ref ref;
|
||||
|
||||
@@ -95,7 +95,7 @@ package go.java;
|
||||
import go.Seq;
|
||||
|
||||
public final class Runnable implements Seq.GoObject, java.lang.Runnable {
|
||||
{ Seq.touch(); }
|
||||
static { Java.touch(); }
|
||||
|
||||
private final Seq.Ref ref;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ package go.ignore;
|
||||
import go.Seq;
|
||||
|
||||
public final class S extends Seq.Proxy implements I {
|
||||
{ Seq.touch(); }
|
||||
static { Ignore.touch(); }
|
||||
|
||||
S(Seq.Ref ref) { super(ref); }
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ package go.issue10788;
|
||||
import go.Seq;
|
||||
|
||||
public final class TestStruct extends Seq.Proxy {
|
||||
{ Seq.touch(); }
|
||||
static { Issue10788.touch(); }
|
||||
|
||||
TestStruct(Seq.Ref ref) { super(ref); }
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ package go.issue12328;
|
||||
import go.Seq;
|
||||
|
||||
public final class T extends Seq.Proxy {
|
||||
{ Seq.touch(); }
|
||||
static { Issue12328.touch(); }
|
||||
|
||||
T(Seq.Ref ref) { super(ref); }
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -7,7 +7,7 @@ package go.structs;
|
||||
import go.Seq;
|
||||
|
||||
public final class S extends Seq.Proxy {
|
||||
{ Seq.touch(); }
|
||||
static { Structs.touch(); }
|
||||
|
||||
S(Seq.Ref ref) { super(ref); }
|
||||
|
||||
@@ -59,7 +59,7 @@ package go.structs;
|
||||
import go.Seq;
|
||||
|
||||
public final class S2 extends Seq.Proxy implements I {
|
||||
{ Seq.touch(); }
|
||||
static { Structs.touch(); }
|
||||
|
||||
S2(Seq.Ref ref) { super(ref); }
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ package go.vars;
|
||||
import go.Seq;
|
||||
|
||||
public final class S extends Seq.Proxy implements I {
|
||||
{ Seq.touch(); }
|
||||
static { Vars.touch(); }
|
||||
|
||||
S(Seq.Ref ref) { super(ref); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user