File tree Expand file tree Collapse file tree
androidTest/java/com/readdle/swiftjava/sample
java/com/readdle/swiftjava/sample
swift/Sources/SampleAppCore Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,5 +249,16 @@ public void testNullPointerAfterRelease() {
249249 Assert .assertTrue (error .getMessage ().equals ("java.lang.NullPointerException: 1" ));
250250 }
251251 }
252+
253+ // Run on Android 7.0 to fail
254+ @ Test
255+ public void testLocalTableOverflow3 () {
256+ sampleReference .oneMoreReferenceTableOverflow (new SampleDelegateAndroid () {
257+ @ Override
258+ void onSetSampleValue (SampleValue value ) {
259+ // empty
260+ }
261+ });
262+ }
252263
253264}
Original file line number Diff line number Diff line change 77import android .support .annotation .Nullable ;
88import android .util .Log ;
99
10+ import java .nio .ByteBuffer ;
11+
1012@ SwiftDelegate (protocols = {"SampleDelegate" })
1113public abstract class SampleDelegateAndroid {
1214
@@ -72,7 +74,11 @@ public String throwableFuncWithReturnType(@NonNull Boolean flag) throws Exceptio
7274 }
7375 }
7476
75-
77+ @ SwiftCallbackFunc @ NonNull
78+ public ByteBuffer funcWithData () {
79+ byte [] tenBytes = new byte [10 ];
80+ return ByteBuffer .wrap (tenBytes );
81+ }
7682
7783 abstract void onSetSampleValue (SampleValue value );
7884
Original file line number Diff line number Diff line change @@ -147,4 +147,6 @@ public interface CompletionBlock {
147147
148148 public native void saveCustomSampleValue (@ NonNull CustomSampleValue value );
149149
150+ public native void oneMoreReferenceTableOverflow (@ NonNull SampleDelegateAndroid delegate );
151+
150152}
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ public protocol SampleDelegate: class {
1515 func throwableFunc( _ flag: Bool ) throws
1616
1717 func throwableFuncWithReturnType( _ flag: Bool ) throws -> String
18+
19+ func funcWithData( ) -> Data
1820}
1921
2022public protocol SampleBlockDelegate {
@@ -147,4 +149,14 @@ public class SampleReference {
147149 NSLog ( " save SampleValue: \( value. string) " )
148150 }
149151
152+ public func oneMoreReferenceTableOverflow( _ delegate: SampleDelegate ) {
153+ // For table overflow test
154+ for i in 0 ..< 512 {
155+ let data = delegate. funcWithData ( )
156+ if data. count != 10 {
157+ fatalError ( " Wrong data count \( data. count) != 10 " )
158+ }
159+ }
160+ }
161+
150162}
You can’t perform that action at this time.
0 commit comments