@@ -22,12 +22,13 @@ void _runJavaGC() {
22
22
);
23
23
final bean = managementFactory
24
24
.staticMethodId (
25
- 'getRuntimeMXBean' ,
26
- '()Ljava/lang/management/RuntimeMXBean;' ,
27
- )
25
+ 'getRuntimeMXBean' ,
26
+ '()Ljava/lang/management/RuntimeMXBean;' ,
27
+ )
28
28
.call (managementFactory, JObject .type, []);
29
- final pid =
30
- bean.jClass.instanceMethodId ('getPid' , '()J' ).call (bean, jlong.type, []);
29
+ final pid = bean.jClass
30
+ .instanceMethodId ('getPid' , '()J' )
31
+ .call (bean, jlong.type, []);
31
32
ProcessResult result;
32
33
do {
33
34
result = Process .runSync ('jcmd' , [pid.toString (), 'GC.run' ]);
@@ -135,8 +136,9 @@ void registerTests(String groupName, TestRunnerCallback test) {
135
136
final rand = e.getRandom ();
136
137
expect (rand, isNotNull);
137
138
final _ = e.getRandomLong ();
138
- final id =
139
- e.getRandomNumericString (rand)! .toDartString (releaseOriginal: true );
139
+ final id = e
140
+ .getRandomNumericString (rand)!
141
+ .toDartString (releaseOriginal: true );
140
142
expect (int .parse (id), lessThan (10000 ));
141
143
e.setNumber (145 );
142
144
expect (
@@ -339,15 +341,15 @@ void registerTests(String groupName, TestRunnerCallback test) {
339
341
map.put ('Hello' .toJString ()..releasedBy (arena), helloExample);
340
342
map.put ('World' .toJString ()..releasedBy (arena), worldExample);
341
343
expect (
342
- (map.get ('Hello' . toJString ().. releasedBy (arena)) !
343
- .. releasedBy (arena))
344
- .getNumber (),
344
+ (map.get (
345
+ 'Hello' . toJString ().. releasedBy (arena),
346
+ ) ! .. releasedBy (arena)) .getNumber (),
345
347
1 ,
346
348
);
347
349
expect (
348
- (map.get ('World' . toJString ().. releasedBy (arena)) !
349
- .. releasedBy (arena))
350
- .getNumber (),
350
+ (map.get (
351
+ 'World' . toJString ().. releasedBy (arena),
352
+ ) ! .. releasedBy (arena)) .getNumber (),
351
353
2 ,
352
354
);
353
355
expect (
@@ -376,9 +378,9 @@ void registerTests(String groupName, TestRunnerCallback test) {
376
378
final example = Example ()..releasedBy (arena);
377
379
map.put ('Hello' .toJString ()..releasedBy (arena), example);
378
380
expect (
379
- (map.get ('Hello' . toJString ().. releasedBy (arena)) !
380
- .. releasedBy (arena))
381
- .getNumber (),
381
+ (map.get (
382
+ 'Hello' . toJString ().. releasedBy (arena),
383
+ ) ! .. releasedBy (arena)) .getNumber (),
382
384
0 ,
383
385
);
384
386
});
@@ -440,8 +442,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
440
442
final exampleStaticParent = GrandParent .varStaticParent (
441
443
S : Example .type,
442
444
Example ()..releasedBy (arena),
443
- )!
444
- ..releasedBy (arena);
445
+ )! ..releasedBy (arena);
445
446
expect (
446
447
(exampleStaticParent.value! ..releasedBy (arena)).getNumber (),
447
448
0 ,
@@ -459,8 +460,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
459
460
final exampleParent = grandParent.varParent (
460
461
S : Example .type,
461
462
Example ()..releasedBy (arena),
462
- )!
463
- ..releasedBy (arena);
463
+ )! ..releasedBy (arena);
464
464
expect (
465
465
exampleParent.parentValue!
466
466
.as (JString .type, releaseOriginal: true )
@@ -504,8 +504,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
504
504
final stack = MyStack .of$1 (
505
505
'Hello' .toJString ()..releasedBy (arena),
506
506
T : JString .type,
507
- )!
508
- ..releasedBy (arena);
507
+ )! ..releasedBy (arena);
509
508
expect (stack, isA <MyStack <JString ?>>());
510
509
expect (stack.$type, isA <$MyStack$Type $<JString ?>>());
511
510
expect (stack.pop ()! .toDartString (releaseOriginal: true ), 'Hello' );
@@ -517,8 +516,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
517
516
'Hello' .toJString ()..releasedBy (arena),
518
517
'World' .toJString ()..releasedBy (arena),
519
518
T : JString .type,
520
- )!
521
- ..releasedBy (arena);
519
+ )! ..releasedBy (arena);
522
520
expect (stack, isA <MyStack <JString ?>>());
523
521
expect (stack.$type, isA <$MyStack$Type $<JString ?>>());
524
522
expect (stack.pop ()! .toDartString (releaseOriginal: true ), 'World' );
@@ -533,8 +531,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
533
531
T : JObject .type,
534
532
'Hello' .toJString ()..releasedBy (arena),
535
533
array,
536
- )!
537
- ..releasedBy (arena);
534
+ )! ..releasedBy (arena);
538
535
expect (stack, isA <MyStack <JObject ?>>());
539
536
expect (stack.$type, isA <$MyStack$Type $<JObject ?>>());
540
537
expect (
@@ -576,8 +573,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
576
573
final stack = MyStack .fromArrayOfArrayOfGrandParents (
577
574
S : JString .type,
578
575
twoDimentionalArray,
579
- )!
580
- ..releasedBy (arena);
576
+ )! ..releasedBy (arena);
581
577
expect (stack, isA <MyStack <JString ?>>());
582
578
expect (stack.$type, isA <$MyStack$Type $<JString ?>>());
583
579
expect (stack.pop ()! .toDartString (releaseOriginal: true ), 'Hello' );
@@ -605,8 +601,8 @@ void registerTests(String groupName, TestRunnerCallback test) {
605
601
return (s! .toDartString (releaseOriginal: true ) * 2 ).toJString ();
606
602
},
607
603
varCallback: (JInteger ? t) {
608
- final result =
609
- (t ! . intValue (releaseOriginal : true ) * 2 ) .toJInteger ();
604
+ final result = (t ! . intValue (releaseOriginal : true ) * 2 )
605
+ .toJInteger ();
610
606
varCallbackResult.complete (result);
611
607
return result;
612
608
},
@@ -780,8 +776,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
780
776
group ('Dart exceptions are handled' , () {
781
777
for (final exception in [UnimplementedError (), 'Hello!' ]) {
782
778
for (final sameThread in [true , false ]) {
783
- test (
784
- 'on ${sameThread ? 'the same thread' : 'another thread' }'
779
+ test ('on ${sameThread ? 'the same thread' : 'another thread' }'
785
780
' throwing $exception ' , () async {
786
781
await using ((arena) async {
787
782
final runnable = MyRunnable .implement (
@@ -857,7 +852,6 @@ void registerTests(String groupName, TestRunnerCallback test) {
857
852
// TODO(#1213): remove this once we support Java futures.
858
853
Future <$T > toDartFuture <$T extends JObject >(
859
854
JObject future,
860
- // ignore: invalid_use_of_internal_member
861
855
JType <$T > T ,
862
856
) async {
863
857
final receivePort = ReceivePort ();
@@ -877,17 +871,18 @@ void registerTests(String groupName, TestRunnerCallback test) {
877
871
return (await receivePort.first) as $T ;
878
872
}
879
873
880
- final sevenHundredBoxed =
881
- consume (stringConverter, '700' .toJString ())! ;
874
+ final sevenHundredBoxed = consume (
875
+ stringConverter,
876
+ '700' .toJString (),
877
+ )! ;
882
878
final int sevenHundred;
883
879
if (sevenHundredBoxed is JInteger ) {
884
880
sevenHundred = sevenHundredBoxed.intValue ();
885
881
} else {
886
882
sevenHundred = (await toDartFuture (
887
883
sevenHundredBoxed,
888
884
JInteger .type,
889
- ))
890
- .intValue ();
885
+ )).intValue ();
891
886
}
892
887
expect (sevenHundred, 700 );
893
888
@@ -921,9 +916,9 @@ void registerTests(String groupName, TestRunnerCallback test) {
921
916
JMap .hash (JString .type, JObject .type)..[key! ] = value,
922
917
),
923
918
)..releasedBy (arena);
924
- final stringArray = genericInterface
925
- . arrayOf ( 'hello' .toJString ()..releasedBy (arena)) !
926
- ..releasedBy (arena);
919
+ final stringArray = genericInterface. arrayOf (
920
+ 'hello' .toJString ()..releasedBy (arena),
921
+ ) ! ..releasedBy (arena);
927
922
expect (stringArray, hasLength (1 ));
928
923
expect (stringArray[0 ]! .toDartString (releaseOriginal: true ), 'hello' );
929
924
expect (
@@ -936,8 +931,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
936
931
final intArray = genericInterface.genericArrayOf (
937
932
U : JInteger .type,
938
933
42. toJInteger ()..releasedBy (arena),
939
- )!
940
- ..releasedBy (arena);
934
+ )! ..releasedBy (arena);
941
935
expect (
942
936
genericInterface
943
937
.firstOfGenericArray (U : JInteger .type, intArray)!
@@ -949,8 +943,7 @@ void registerTests(String groupName, TestRunnerCallback test) {
949
943
U : JInteger .type,
950
944
'hello' .toJString ()..releasedBy (arena),
951
945
42. toJInteger ()..releasedBy (arena),
952
- )!
953
- ..releasedBy (arena);
946
+ )! ..releasedBy (arena);
954
947
expect (
955
948
jmap['hello' .toJString ()..releasedBy (arena)]! .intValue (
956
949
releaseOriginal: true ,
@@ -976,17 +969,21 @@ void registerTests(String groupName, TestRunnerCallback test) {
976
969
expect (
977
970
$R2250 .new ,
978
971
isA<
979
- $R2250 <$T > Function <$T extends JObject ?>(
980
- // ignore: invalid_use_of_internal_member
981
- {required JType <$T > T ,
982
- required void Function ($T ? ) foo,
983
- bool foo$async})> (),
972
+ $R2250 <$T > Function <$T extends JObject ?>({
973
+ required JType <$T > T ,
974
+ required void Function ($T ? ) foo,
975
+ bool foo$async,
976
+ })
977
+ > (),
984
978
);
985
979
expect (
986
980
$R2250$Child .new ,
987
981
isA<
988
- $R2250$Child Function (
989
- {required void Function (JObject ? ) foo, bool foo$async})> (),
982
+ $R2250$Child Function ({
983
+ required void Function (JObject ? ) foo,
984
+ bool foo$async,
985
+ })
986
+ > (),
990
987
);
991
988
});
992
989
});
@@ -1063,9 +1060,9 @@ void registerTests(String groupName, TestRunnerCallback test) {
1063
1060
expect ((annotated.arrayOfNullable ()..releasedBy (arena))[0 ], isNull);
1064
1061
expect (annotated.nullableArray (true ), isNull);
1065
1062
expect (
1066
- (annotated.nullableArray (false ) ! .. releasedBy (arena))[ 0 ]. toDartString (
1067
- releaseOriginal : true ,
1068
- ),
1063
+ (annotated.nullableArray (
1064
+ false ,
1065
+ )! .. releasedBy (arena))[ 0 ]. toDartString (releaseOriginal : true ) ,
1069
1066
'hello' ,
1070
1067
);
1071
1068
expect (annotated.nullableArrayOfNullable (true ), isNull);
@@ -1088,9 +1085,9 @@ void registerTests(String groupName, TestRunnerCallback test) {
1088
1085
expect ((annotated.listOfNullable ()..releasedBy (arena))[0 ], isNull);
1089
1086
expect (annotated.nullableList (true ), isNull);
1090
1087
expect (
1091
- (annotated.nullableList (false ) ! .. releasedBy (arena))[ 0 ]. toDartString (
1092
- releaseOriginal : true ,
1093
- ),
1088
+ (annotated.nullableList (
1089
+ false ,
1090
+ )! .. releasedBy (arena))[ 0 ]. toDartString (releaseOriginal : true ) ,
1094
1091
'hello' ,
1095
1092
);
1096
1093
expect (annotated.nullableListOfNullable (true ), isNull);
@@ -1191,8 +1188,8 @@ void registerTests(String groupName, TestRunnerCallback test) {
1191
1188
);
1192
1189
expect (
1193
1190
annotated
1194
- // Requires `V`.
1195
- .nullableReturnMethodGenericEcho (object, true , V : JString .type),
1191
+ // Requires `V`.
1192
+ .nullableReturnMethodGenericEcho (object, true , V : JString .type),
1196
1193
isNull,
1197
1194
);
1198
1195
expect (
@@ -1205,8 +1202,8 @@ void registerTests(String groupName, TestRunnerCallback test) {
1205
1202
);
1206
1203
expect (
1207
1204
annotated
1208
- // `V` is optional.
1209
- .nullableReturnMethodGenericEcho2 (object, true ),
1205
+ // `V` is optional.
1206
+ .nullableReturnMethodGenericEcho2 (object, true ),
1210
1207
isNull,
1211
1208
);
1212
1209
expect (
@@ -1273,8 +1270,8 @@ void registerTests(String groupName, TestRunnerCallback test) {
1273
1270
final annotated = newNonNullTestObject (arena);
1274
1271
expect (
1275
1272
(annotated.classGenericList ()..releasedBy (arena)).first.toDartString (
1276
- releaseOriginal: true ,
1277
- ),
1273
+ releaseOriginal: true ,
1274
+ ),
1278
1275
'hello' ,
1279
1276
);
1280
1277
expect (
@@ -1283,16 +1280,16 @@ void registerTests(String groupName, TestRunnerCallback test) {
1283
1280
);
1284
1281
expect (annotated.nullableClassGenericList (true ), isNull);
1285
1282
expect (
1286
- (annotated.nullableClassGenericList (false ) ! .. releasedBy (arena))
1287
- .first
1288
- .toDartString (releaseOriginal: true ),
1283
+ (annotated.nullableClassGenericList (
1284
+ false ,
1285
+ ) ! .. releasedBy (arena)).first .toDartString (releaseOriginal: true ),
1289
1286
'hello' ,
1290
1287
);
1291
1288
expect (annotated.nullableClassGenericListOfNullable (true ), isNull);
1292
1289
expect (
1293
- (annotated.nullableClassGenericListOfNullable (false ) !
1294
- .. releasedBy (arena))
1295
- .first,
1290
+ (annotated.nullableClassGenericListOfNullable (
1291
+ false ,
1292
+ ) ! .. releasedBy (arena)) .first,
1296
1293
isNull,
1297
1294
);
1298
1295
});
@@ -1308,12 +1305,18 @@ void registerTests(String groupName, TestRunnerCallback test) {
1308
1305
expect (red.code, 0xFF0000 );
1309
1306
expect (green.code, 0x00FF00 );
1310
1307
expect (blue.code, 0x0000FF );
1311
- expect (red.toRGB ()! ..releasedBy (arena),
1312
- Colors$RGB (255 , 0 , 0 )..releasedBy (arena));
1313
- expect (green.toRGB ()! ..releasedBy (arena),
1314
- Colors$RGB (0 , 255 , 0 )..releasedBy (arena));
1315
- expect (blue.toRGB ()! ..releasedBy (arena),
1316
- Colors$RGB (0 , 0 , 255 )..releasedBy (arena));
1308
+ expect (
1309
+ red.toRGB ()! ..releasedBy (arena),
1310
+ Colors$RGB (255 , 0 , 0 )..releasedBy (arena),
1311
+ );
1312
+ expect (
1313
+ green.toRGB ()! ..releasedBy (arena),
1314
+ Colors$RGB (0 , 255 , 0 )..releasedBy (arena),
1315
+ );
1316
+ expect (
1317
+ blue.toRGB ()! ..releasedBy (arena),
1318
+ Colors$RGB (0 , 0 , 255 )..releasedBy (arena),
1319
+ );
1317
1320
});
1318
1321
});
1319
1322
});
0 commit comments