Index: base/android/jni_generator/jni_generator.py |
diff --git a/base/android/jni_generator/jni_generator.py b/base/android/jni_generator/jni_generator.py |
index 8616240aeabbcb157917e0ee2e3b2c482a7f0093..e4410673dddef3a8d4be946b153666c1de144fd4 100755 |
--- a/base/android/jni_generator/jni_generator.py |
+++ b/base/android/jni_generator/jni_generator.py |
@@ -168,13 +168,34 @@ class JniParams(object): |
# Coming from javap, use the fully qualified param directly. |
return 'L' + param + ';' |
for qualified_name in (object_param_list + |
- JniParams._imports + |
[JniParams._fully_qualified_class] + |
JniParams._inner_classes): |
if (qualified_name.endswith('/' + param) or |
qualified_name.endswith('$' + param.replace('.', '$')) or |
qualified_name == 'L' + param): |
return prefix + qualified_name + ';' |
+ |
+ # Is it Bar from import zoo.foo.Bar ? |
joth
2012/11/12 21:22:07
nit: Is it from an inner class import? (e.g. impor
bulach
2012/11/12 22:10:19
Done.
|
+ for qualified_name in JniParams._imports: |
+ if qualified_name.endswith('/' + param): |
+ # Ensure it's not an inner class. |
+ components = qualified_name.split('/') |
+ if len(components) > 2 and components[-2][0].isupper(): |
+ raise SyntaxError('Inner class (%s) can not be imported ' |
+ 'and used by JNI (%s). Please import the outer ' |
+ 'class and use Outer.Inner instead.' % |
+ (qualified_name, param)) |
+ return prefix + qualified_name + ';' |
+ |
+ # Is it an inner class zoo.Foo.Bar from import zoo.Foo? |
joth
2012/11/12 21:22:07
Is it an inner class from an outer class import? (
bulach
2012/11/12 22:10:19
Done.
|
+ if '.' in param: |
+ components = param.split('.') |
+ outer = '/'.join(components[:-1]) |
+ inner = components[-1] |
+ for qualified_name in JniParams._imports: |
+ if qualified_name.endswith('/' + outer): |
+ return prefix + qualified_name + '$' + inner |
+ |
# Type not found, falling back to same package as this class. |
return prefix + 'L' + JniParams._package + '/' + param + ';' |