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 import java.util.Map; 10 11 @SomeAnnotation("that contains class Foo ") 12 class SampleProxyEdgeCases { 13 enum Integer {} 14 @interface ShouldBeIgnored {} 15 static class OtherInnerClass {} 16 17 public @interface ShouldBeIgnored {} 18 19 @NativeMethods 20 interface Natives { foo__weirdly__escaped_name1()21 void foo__weirdly__escaped_name1(); arrayTypes1(int[] a, Object[][] b)22 String[][] arrayTypes1(int[] a, Object[][] b); arrayTypes2(int[] a, Throwable[][] b)23 int[] arrayTypes2(int[] a, Throwable[][] b); fooForTest()24 void fooForTest(); fooForTests()25 void fooForTests(); fooForTesting()26 void fooForTesting(); genericsWithNestedClassArray( Map<OtherInnerClass, OtherInnerClass[]>[] arg)27 Map<OtherInnerClass, OtherInnerClass[]>[] genericsWithNestedClassArray( 28 Map<OtherInnerClass, OtherInnerClass[]>[] arg); 29 30 // Tests passing a nested class from another class in the same package. addStructB(SampleForTests caller, SampleForTests.InnerStructB b)31 int addStructB(SampleForTests caller, SampleForTests.InnerStructB b); 32 33 // Tests a java.lang class. setStringBuilder(StringBuilder sb)34 public boolean setStringBuilder(StringBuilder sb); 35 36 // Tests name collisions with java.lang classes. setBool(Boolean b, Integer i)37 public void setBool(Boolean b, Integer i); 38 39 // Test IntDef setStringBuilder(@yThing int sb)40 public @SomeClass.EnumType int setStringBuilder(@MyThing int sb); 41 } 42 43 // Non-proxy natives in same file. nativeInstanceMethod(long nativeInstance)44 native void nativeInstanceMethod(long nativeInstance); nativeStaticMethod()45 static native void nativeStaticMethod(); 46 } 47