Commit dc538afe authored by Aiden Benner's avatar Aiden Benner Committed by Commit Bot

Fix presubmit warnings for javadocs in the JNI processor

Can't use @JniStaticNatives in comments because it's not a
valid javadoc tag. Use {@link JniStaticNatives} instead.

Also renames instances of JNINatives -> JniStaticNatives
in comments.

Bug: 898261
Change-Id: I62d0dda735559af92473052f4856466308cd14a4
Reviewed-on: https://chromium-review.googlesource.com/c/1345231
Commit-Queue: Aiden Benner <abenner@google.com>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610167}
parent 113cfb65
...@@ -7,7 +7,7 @@ package org.chromium.base; ...@@ -7,7 +7,7 @@ package org.chromium.base;
/** /**
* Implemented by the TEST_HOOKS field in JNI wrapper classes that are generated * Implemented by the TEST_HOOKS field in JNI wrapper classes that are generated
* by the JNI annotation processor. Used in tests for setting the mock * by the JNI annotation processor. Used in tests for setting the mock
* implementation of a @JniStaticNatives interface. * implementation of a {@link org.chromium.base.annotations.JniStaticNatives} interface.
* @param <T> The @JniStaticNatives annotated interface * @param <T> The interface annotated with {@link org.chromium.base.annotations.JniStaticNatives}
*/ */
public interface JniStaticTestMocker<T> { void setInstanceForTesting(T instance); } public interface JniStaticTestMocker<T> { void setInstanceForTesting(T instance); }
...@@ -49,7 +49,7 @@ import javax.tools.Diagnostic; ...@@ -49,7 +49,7 @@ import javax.tools.Diagnostic;
/** /**
* Annotation processor that finds inner interfaces annotated with * Annotation processor that finds inner interfaces annotated with
* @JniStaticNatives and generates a class with native bindings * {@link JniStaticNatives} and generates a class with native bindings
* (GEN_JNI) and a class specific wrapper class with name (classnameJni) * (GEN_JNI) and a class specific wrapper class with name (classnameJni)
* *
* NativeClass - refers to the class that contains all native declarations. * NativeClass - refers to the class that contains all native declarations.
...@@ -183,7 +183,7 @@ public class JniProcessor extends AbstractProcessor { ...@@ -183,7 +183,7 @@ public class JniProcessor extends AbstractProcessor {
// Queue this file for writing. // Queue this file for writing.
// Can't write right now because the wrapper class depends on NativeClass // Can't write right now because the wrapper class depends on NativeClass
// to be written and we can't write NativeClass until all @JNINatives // to be written and we can't write NativeClass until all @JniStaticNatives
// interfaces are processed because each will add new native methods. // interfaces are processed because each will add new native methods.
JavaFile file = JavaFile.builder(packageName, nativeWrapperClassSpec).build(); JavaFile file = JavaFile.builder(packageName, nativeWrapperClassSpec).build();
writeQueue.add(file); writeQueue.add(file);
...@@ -249,8 +249,9 @@ public class JniProcessor extends AbstractProcessor { ...@@ -249,8 +249,9 @@ public class JniProcessor extends AbstractProcessor {
/** /**
* Creates method specs for the native methods of NativeClass given * Creates method specs for the native methods of NativeClass given
* the method declarations from a JNINative annotated interface * the method declarations from a {@link JniStaticNatives} annotated interface
* @param interfaceMethods method declarations from a JNINative annotated interface * @param interfaceMethods method declarations from a {@link JniStaticNatives} annotated
* interface
* @param outerType ClassName of class that contains the annotated interface * @param outerType ClassName of class that contains the annotated interface
* @return map from old method name to new native method specification * @return map from old method name to new native method specification
*/ */
...@@ -296,20 +297,21 @@ public class JniProcessor extends AbstractProcessor { ...@@ -296,20 +297,21 @@ public class JniProcessor extends AbstractProcessor {
} }
/** /**
* Creates a class spec for an implementation of an @JNINatives annotated interface that will * Creates a class spec for an implementation of an {@link JniStaticNatives} annotated interface
* wrap calls to the NativesClass which contains the actual native method declarations. * that will wrap calls to the NativesClass which contains the actual native method
* declarations.
* *
* This class should contain: * This class should contain:
* 1. Wrappers for all GEN_JNI static native methods * 1. Wrappers for all GEN_JNI static native methods
* 2. A getter that when testing is disabled, will return the native implementation and * 2. A getter that when testing is disabled, will return the native implementation and
* when testing is enabled, will call the mock of the native implementation. * when testing is enabled, will call the mock of the native implementation.
* 3. A field that holds the testNatives instance for when testing is enabled * 3. A field that holds the testNatives instance for when testing is enabled
* 4. A TEST_HOOKS field that implements an anonymous instance of JniStaticTestMocker * 4. A TEST_HOOKS field that implements an anonymous instance of {@link JniStaticTestMocker}
* which will set the testNatives implementation when called in tests * which will set the testNatives implementation when called in tests
* *
* @param name name of the wrapper class. * @param name name of the wrapper class.
* @param isPublic if true, a public modifier will be added to this native wrapper. * @param isPublic if true, a public modifier will be added to this native wrapper.
* @param nativeInterface the @JNINatives annotated type that this native wrapper * @param nativeInterface the {@link JniStaticNatives} annotated type that this native wrapper
* will implement. * will implement.
* @param methodMap a map from the old method name to the new method spec in NativeClass. * @param methodMap a map from the old method name to the new method spec in NativeClass.
* */ * */
...@@ -329,8 +331,8 @@ public class JniProcessor extends AbstractProcessor { ...@@ -329,8 +331,8 @@ public class JniProcessor extends AbstractProcessor {
// Start by adding all the native method wrappers. // Start by adding all the native method wrappers.
for (Element enclosed : nativeInterface.getEnclosedElements()) { for (Element enclosed : nativeInterface.getEnclosedElements()) {
if (enclosed.getKind() != ElementKind.METHOD) { if (enclosed.getKind() != ElementKind.METHOD) {
printError( printError("Cannot have a non-method in a @JniStaticNatives annotated interface",
"Cannot have a non-method in a @JNINatives annotated interface", enclosed); enclosed);
} }
// ElementKind.Method is ExecutableElement so this cast is safe. // ElementKind.Method is ExecutableElement so this cast is safe.
...@@ -401,7 +403,8 @@ public class JniProcessor extends AbstractProcessor { ...@@ -401,7 +403,8 @@ public class JniProcessor extends AbstractProcessor {
/** /**
* Creates a wrapper method that overrides interfaceMethod and calls staticNativeMethod. * Creates a wrapper method that overrides interfaceMethod and calls staticNativeMethod.
* @param interfaceMethod method that will be overridden in a @JNINatives annotated interface. * @param interfaceMethod method that will be overridden in a {@link JniStaticNatives} annotated
* interface.
* @param staticNativeMethod method that will be called in NativeClass. * @param staticNativeMethod method that will be called in NativeClass.
*/ */
MethodSpec createNativeWrapperMethod( MethodSpec createNativeWrapperMethod(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment