• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.jni_zero.samples;
6 
7 import org.jni_zero.samples.Boolean;
8 
9 class SampleBidirectionalNonProxy {
10     /** The pointer to the native Test. */
11     public long nativeTest;
nativeStaticMethod(long nativeTest, int arg1)12     private static native int nativeStaticMethod(long nativeTest, int arg1);
nativeMethod(long nativeTest, int arg1)13     private native int nativeMethod(long nativeTest, int arg1);
14     @CalledByNative
testMethodWithParam(int iParam)15     private void testMethodWithParam(int iParam) {}
16     @CalledByNative
testMethodWithParamAndReturn(int iParam)17     private String testMethodWithParamAndReturn(int iParam) {
18         return null;
19     }
20     @CalledByNative
testStaticMethodWithParam(int iParam)21     private static int testStaticMethodWithParam(int iParam) {
22         return 0;
23     }
24     @CalledByNative
testMethodWithNoParam()25     private static double testMethodWithNoParam() {
26         return 0;
27     }
28     @CalledByNative
testStaticMethodWithNoParam()29     private static String testStaticMethodWithNoParam() {}
30 
31     // Tests passing a nested class from another class in the same package.
32     @CalledByNative
addStructB(SampleForTests caller, SampleForTests.InnerStructB b)33     void addStructB(SampleForTests caller, SampleForTests.InnerStructB b) {}
34 
35     // Tests a java.lang class.
36     @CalledByNative
setStringBuilder(StringBuilder sb)37     void setStringBuilder(StringBuilder sb) {}
38 
39     // Tests name collisions with java.lang classes.
40     @CalledByNative
setBool(Boolean b, Integer i)41     void setBool(Boolean b, Integer i) {}
42 
43     class MyInnerClass {
44         @NativeCall("MyInnerClass")
nativeInit()45         private native int nativeInit();
46     }
47     class MyOtherInnerClass {
48         @NativeCall("MyOtherInnerClass")
nativeInit()49         private native int nativeInit();
50     }
51 }
52