Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5476)

Unified Diff: base/android/jni_generator/jni_generator.py

Issue 214543002: Android: improves error message for Outer.Inner usage in JNI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/jni_generator/jni_generator_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f5aab86c07f0e38da68ca7083e069a23835f859c..27335834953a3e006647d27d98b301deb5b1fbf2 100755
--- a/base/android/jni_generator/jni_generator.py
+++ b/base/android/jni_generator/jni_generator.py
@@ -206,6 +206,7 @@ class JniParams(object):
if '/' in param:
# Coming from javap, use the fully qualified param directly.
return prefix + 'L' + JniParams.RemapClassName(param) + ';'
+
for qualified_name in (object_param_list +
[JniParams._fully_qualified_class] +
JniParams._inner_classes):
@@ -238,6 +239,12 @@ class JniParams(object):
if qualified_name.endswith('/' + outer):
return (prefix + JniParams.RemapClassName(qualified_name) +
'$' + inner + ';')
+ raise SyntaxError('Inner class (%s) can not be '
+ 'used directly by JNI. Please import the outer '
+ 'class, probably:\n'
+ 'import %s.%s;' %
+ (param, JniParams._package.replace('/', '.'),
+ outer.replace('/', '.')))
# Type not found, falling back to same package as this class.
return (prefix + 'L' +
« no previous file with comments | « no previous file | base/android/jni_generator/jni_generator_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698