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

Side by Side Diff: base/android/jni_generator/jni_generator.py

Issue 12094008: Bugfix: to add missing prefix for return type from javap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removing spaces. Created 7 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/android/jni_generator/jni_generator_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Extracts native methods from a Java file and generates the JNI bindings. 6 """Extracts native methods from a Java file and generates the JNI bindings.
7 If you change this, please run and update the tests.""" 7 If you change this, please run and update the tests."""
8 8
9 import collections 9 import collections
10 import optparse 10 import optparse
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 while param[-2:] == '[]': 165 while param[-2:] == '[]':
166 prefix += '[' 166 prefix += '['
167 param = param[:-2] 167 param = param[:-2]
168 # Generic? 168 # Generic?
169 if '<' in param: 169 if '<' in param:
170 param = param[:param.index('<')] 170 param = param[:param.index('<')]
171 if param in pod_param_map: 171 if param in pod_param_map:
172 return prefix + pod_param_map[param] 172 return prefix + pod_param_map[param]
173 if '/' in param: 173 if '/' in param:
174 # Coming from javap, use the fully qualified param directly. 174 # Coming from javap, use the fully qualified param directly.
175 return 'L' + param + ';' 175 return prefix + 'L' + param + ';'
176 for qualified_name in (object_param_list + 176 for qualified_name in (object_param_list +
177 [JniParams._fully_qualified_class] + 177 [JniParams._fully_qualified_class] +
178 JniParams._inner_classes): 178 JniParams._inner_classes):
179 if (qualified_name.endswith('/' + param) or 179 if (qualified_name.endswith('/' + param) or
180 qualified_name.endswith('$' + param.replace('.', '$')) or 180 qualified_name.endswith('$' + param.replace('.', '$')) or
181 qualified_name == 'L' + param): 181 qualified_name == 'L' + param):
182 return prefix + qualified_name + ';' 182 return prefix + qualified_name + ';'
183 183
184 # Is it from an import? (e.g. referecing Class from import pkg.Class; 184 # Is it from an import? (e.g. referecing Class from import pkg.Class;
185 # note that referencing an inner class Inner from import pkg.Class.Inner 185 # note that referencing an inner class Inner from import pkg.Class.Inner
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 input_file = options.input_file 1008 input_file = options.input_file
1009 output_file = None 1009 output_file = None
1010 if options.output_dir: 1010 if options.output_dir:
1011 root_name = os.path.splitext(os.path.basename(input_file))[0] 1011 root_name = os.path.splitext(os.path.basename(input_file))[0]
1012 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' 1012 output_file = os.path.join(options.output_dir, root_name) + '_jni.h'
1013 GenerateJNIHeader(input_file, output_file, options.namespace) 1013 GenerateJNIHeader(input_file, output_file, options.namespace)
1014 1014
1015 1015
1016 if __name__ == '__main__': 1016 if __name__ == '__main__':
1017 sys.exit(main(sys.argv)) 1017 sys.exit(main(sys.argv))
OLDNEW
« 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