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

Side by Side Diff: base/android/jni_generator/SampleForTests.java

Issue 10830035: Ignore block comments in JNI generator. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.example.jni_generator; 5 package org.chromium.example.jni_generator;
6 6
7 // This class serves as a reference test for the bindings generator, and as exam ple documentation 7 // This class serves as a reference test for the bindings generator, and as exam ple documentation
8 // for how to use the jni generator. 8 // for how to use the jni generator.
9 // The C++ counter-part is sample_for_tests.cc. 9 // The C++ counter-part is sample_for_tests.cc.
10 // jni_generator.gyp has a jni_generator_tests target that will: 10 // jni_generator.gyp has a jni_generator_tests target that will:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 @CalledByNative 71 @CalledByNative
72 void packagePrivateJavaMethod() {} 72 void packagePrivateJavaMethod() {}
73 73
74 // Note the "Unchecked" suffix. By default, @CalledByNative will always genera te bindings that 74 // Note the "Unchecked" suffix. By default, @CalledByNative will always genera te bindings that
75 // call CheckException(). With "@CalledByNativeUnchecked", the client C++ code is responsible to 75 // call CheckException(). With "@CalledByNativeUnchecked", the client C++ code is responsible to
76 // call ClearException() and act as appropriate. 76 // call ClearException() and act as appropriate.
77 // See more details at the "@CalledByNativeUnchecked" annotation. 77 // See more details at the "@CalledByNativeUnchecked" annotation.
78 @CalledByNativeUnchecked 78 @CalledByNativeUnchecked
79 void methodThatThrowsException() throws Exception {} 79 void methodThatThrowsException() throws Exception {}
80 80
81 // The generator is not confused by inline comments:
82 // @CalledByNative void thisShouldNotAppearInTheOutput();
83 // @CalledByNativeUnchecked public static void neitherShouldThis(int foo);
84
85 /**
86 * The generator is not confused by block comments:
87 * @CalledByNative void thisShouldNotAppearInTheOutputEither();
88 * @CalledByNativeUnchecked public static void andDefinitelyNotThis(int foo);
89 */
90
91 // String constants that look like comments don't confuse the generator:
92 private String arrgh = "*/*";
93
81 //---------------------------------------------------------------------------- -------------------- 94 //---------------------------------------------------------------------------- --------------------
82 // Java fields which are accessed from C++ code only must be annotated with @A ccessedByNative to 95 // Java fields which are accessed from C++ code only must be annotated with @A ccessedByNative to
83 // prevent them being eliminated when unreferenced code is stripped. 96 // prevent them being eliminated when unreferenced code is stripped.
84 @AccessedByNative 97 @AccessedByNative
85 private int javaField; 98 private int javaField;
86 99
87 //---------------------------------------------------------------------------- -------------------- 100 //---------------------------------------------------------------------------- --------------------
88 // The following methods demonstrate declaring methods to call into C++ from J ava. 101 // The following methods demonstrate declaring methods to call into C++ from J ava.
89 // The generator detects the "native" and "static" keywords, the type and name of the first 102 // The generator detects the "native" and "static" keywords, the type and name of the first
90 // parameter, and the "native" prefix to the function name to determine the C+ + function 103 // parameter, and the "native" prefix to the function name to determine the C+ + function
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 160 }
148 161
149 @NativeCall("InnerClass") 162 @NativeCall("InnerClass")
150 private static native int nativeInnerFunction(); 163 private static native int nativeInnerFunction();
151 164
152 @NativeCall("InnerClass") 165 @NativeCall("InnerClass")
153 private static native String nativeInnerMethod(int nativeCPPClass); 166 private static native String nativeInnerMethod(int nativeCPPClass);
154 167
155 } 168 }
156 } 169 }
OLDNEW
« no previous file with comments | « no previous file | base/android/jni_generator/jni_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698