Skip to content

Commit

Permalink
Fix jni prefix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
davidliu committed Jun 13, 2024
1 parent 6902cb3 commit eef3e08
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions build/patches/jni_prefix.patch
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,28 @@ index be0ee6ca43b..8f90d4f6c33 100644
sb = []
sb.append(f"""\
// This file was generated by
diff --git a/third_party/jni_zero/java_types.py b/third_party/jni_zero/java_types.py
index 06708f70ab3..65c1b29ee8d 100644
--- a/third_party/jni_zero/java_types.py
+++ b/third_party/jni_zero/java_types.py
@@ -129,7 +129,7 @@ class JavaClass:
return JavaClass(f'{prefix}/{self._fqn}', self)
diff --git a/jni_zero/java_types.py b/jni_zero/java_types.py
index 06708f70ab3..a4df349a492 100644
--- a/jni_zero/java_types.py
+++ b/jni_zero/java_types.py
@@ -62,6 +62,7 @@ class JavaClass:
_fqn: str
# This is only meaningful if make_prefix have been called on the original class.
_class_without_prefix: 'JavaClass' = None
+ _prefix: str = None

def __post_init__(self):
assert '.' not in self._fqn, f'{self._fqn} should have / and $, but not .'
@@ -126,10 +127,10 @@ class JavaClass:
if not prefix:
return self
prefix = prefix.replace('.', '/')
- return JavaClass(f'{prefix}/{self._fqn}', self)
+ return JavaClass(f'{prefix}/{self._fqn}', self, prefix)

def make_nested(self, name):
- return JavaClass(f'{self._fqn}${name}')
+ return JavaClass(f'{self.class_without_prefix._fqn}${name}')
+ return JavaClass(f'{self.class_without_prefix._fqn}${name}').make_prefixed(self._prefix)


@dataclasses.dataclass(frozen=True)
Expand Down

0 comments on commit eef3e08

Please sign in to comment.