Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8e225e4dc2102eae29f3793792cf6d547b75d0f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
/**********************************************************************
 * This file is part of "Object Teams Development Tooling"-Software
 * 
 * Copyright 2004, 2010 IT Service Omikron GmbH and others.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * $Id$
 * 
 * Please visit http://www.eclipse.org/objectteams for updates and contact.
 * 
 * Contributors:
 * 	  Thomas Dudziak - Initial API and implementation
 * 	  Stephan Herrmann - Initial API and implementation
 **********************************************************************/
package org.eclipse.objectteams.otdt.tests.otjld.liftlower;

import java.util.Map;

import junit.framework.Test;

import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.objectteams.otdt.tests.otjld.AbstractOTJLDTest;

@SuppressWarnings("unchecked")
public class DeclaredLifting extends AbstractOTJLDTest {
	
	public DeclaredLifting(String name) {
		super(name);
	}
	
	// Static initializer to specify tests subset using TESTS_* static variables
	// All specified tests which does not belong to the class are skipped...
	static {
//		TESTS_NAMES = new String[] { "test6112_declaredLiftingInConstructor4"};
//		TESTS_NUMBERS = new int[] { 1459 };
//		TESTS_RANGE = new int[] { 1097, -1 };
	}
	
	public static Test suite() {
		return buildComparableTestSuite(testClass());
	}

	public static Class testClass() {
		return DeclaredLifting.class;
	}

    // access to a feature of a role object that has been created using declared lifting
    // 6.1.1-otjld-lifted-role-feature-access-1
    public void test611_liftedRoleFeatureAccess1() {
       
       runConformTest(
            new String[] {
		"T611lrfa1Main.java",
			    "\n" +
			    "public class T611lrfa1Main {\n" +
			    "    @SuppressWarnings(\"roletypesyntax\")\n" +
			    "    public static void main(String[] args) {\n" +
			    "        final Team611lrfa1 t = new Team611lrfa1();\n" +
			    "        t.Role611lrfa1_2   r = t.new Role611lrfa1_2(\"NOTOK\");\n" +
			    "\n" +
			    "        // should lower the role object as the external signature of the method is\n" +
			    "        //   Team611lrfa1.getValue(T611lrfa1 obj)\n" +
			    "        System.out.print(t.getValue(r));\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T611lrfa1.java",
			    "\n" +
			    "public class T611lrfa1 {}\n" +
			    "    \n",
		"Team611lrfa1.java",
			    "\n" +
			    "public team class Team611lrfa1 {\n" +
			    "    public class Role611lrfa1_1 playedBy T611lrfa1 {\n" +
			    "        protected String getValue() {\n" +
			    "            return \"OK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "\n" +
			    "    public class Role611lrfa1_2 playedBy T611lrfa1 {\n" +
			    "        @SuppressWarnings(\"unused\")\n" +
			    "        private String value;\n" +
			    "\n" +
			    "        public Role611lrfa1_2(String value) {\n" +
			    "            base();\n" +
			    "            this.value = value;\n" +
			    "        }\n" +
			    "    }\n" +
			    "\n" +
			    "    public String getValue(T611lrfa1 as Role611lrfa1_1 obj) {\n" +
			    "        return obj.getValue();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }

    // access to a feature of a role object that has been created using declared lifting
    // 6.1.1-otjld-lifted-role-feature-access-2
    public void test611_liftedRoleFeatureAccess2() {
        runConformTest(
            new String[] {
		"Team611lrfa2_1.java",
			    "\n" +
			    "public team class Team611lrfa2_1 {\n" +
			    "    public class Role611lrfa2 playedBy I611lrfa2 {}\n" +
			    "}\n" +
			    "    \n",
		"I611lrfa2.java",
			    "\n" +
			    "public interface I611lrfa2 {}\n" +
			    "    \n",
		"T611lrfa2.java",
			    "\n" +
			    "public class T611lrfa2 implements I611lrfa2 {}\n" +
			    "    \n"
            },
            ""); // warning re binding-to-interface cannot be suppressed but does not harm
    }

    // access to a feature of a role object that has been created using declared lifting
    // 6.1.1-otjld-lifted-role-feature-access-3
    public void test611_liftedRoleFeatureAccess3() {
       
       runConformTest(
            new String[] {
		"T611lrfa3Main.java",
			    "\n" +
			    "public class T611lrfa3Main {\n" +
			    "    public static void main(String[] args) {\n" +
			    "        Team611lrfa3 t = new Team611lrfa3();\n" +
			    "        T611lrfa3_2  o = new T611lrfa3_2();\n" +
			    "\n" +
			    "        System.out.print(t.getValue(o));\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T611lrfa3_1.java",
			    "\n" +
			    "public abstract class T611lrfa3_1 {}\n" +
			    "    \n",
		"T611lrfa3_2.java",
			    "\n" +
			    "public class T611lrfa3_2 extends T611lrfa3_1 {}\n" +
			    "    \n",
		"Team611lrfa3.java",
			    "\n" +
			    "public team class Team611lrfa3 {\n" +
			    "    protected class Role611lrfa3_1 playedBy T611lrfa3_1 {\n" +
			    "        protected String getValue() {\n" +
			    "            return \"OK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "\n" +
			    "    protected class Role611lrfa3_2 extends Role611lrfa3_1 {}\n" +
			    "\n" +
			    "    public String getValue(T611lrfa3_1 as Role611lrfa3_2 obj) {\n" +
			    "        return obj.getValue();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }

    // access to a feature of a role object that has been created using declared lifting
    // 6.1.1-otjld-lifted-role-feature-access-4
    public void test611_liftedRoleFeatureAccess4() {
       Map customOptions = getCompilerOptions();
       customOptions.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.WARNING);
       
       runConformTest(
            new String[] {
		"T611lrfa4Main.java",
			    "\n" +
			    "public class T611lrfa4Main {\n" +
			    "    public static void main(String[] args) {\n" +
			    "        Team611lrfa4_2 t = new Team611lrfa4_2();\n" +
			    "        T611lrfa4      o = new T611lrfa4();\n" +
			    "\n" +
			    "        System.out.print(t.getValue(o));\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T611lrfa4.java",
			    "\n" +
			    "public class T611lrfa4 {}\n" +
			    "    \n",
		"Team611lrfa4_1.java",
			    "\n" +
			    "public abstract team class Team611lrfa4_1 {\n" +
			    "    public abstract class Role611lrfa4_1 playedBy T611lrfa4 {\n" +
			    "        public String value = \"OK\";\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"Team611lrfa4_2.java",
			    "\n" +
			    "public team class Team611lrfa4_2 extends Team611lrfa4_1 {\n" +
			    "    public class Role611lrfa4_2 extends Role611lrfa4_1 {}\n" +
			    "\n" +
			    "    /**\n" +
			    "     * Intentionally omitted return tag, to trigger one warning so we can detect\n" +
			    "     * that _no_ warning is reported against obj (see Trac #205).\n" +
			    "     * @param obj\n" +
			    "     */\n" +
			    "    public String getValue(T611lrfa4 as Role611lrfa4_2 obj) {\n" +
			    "        return obj.value;\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK",
            null/*classLibraries*/,
            true/*shouldFlushOutputDirectory*/,
            null/*vmArguments*/,
            customOptions,
            null/*no custom requestor*/);
    }

    // access to a feature of an externalized role object that has been created using declared lifting
    // 6.1.2-otjld-lifted-externalized-role-feature-access-1
    public void test612_liftedExternalizedRoleFeatureAccess1() {
        runNegativeTestMatching(
            new String[] {
		"Team612lerfa1.java",
			    "\n" +
			    "public team class Team612lerfa1 {\n" +
			    "    public class Role612lerfa1 playedBy T612lerfa1 {\n" +
			    "        protected String getValue() {\n" +
			    "            return \"OK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "\n" +
			    "    public static String getValue(final Team612lerfa1 t, T612lerfa1 as t.Role612lerfa1_1 obj) {\n" +
			    "        return obj.getValue();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T612lerfa1.java",
			    "\n" +
			    "public class T612lerfa1 {}\n" +
			    "    \n"
            },
            "2.3.2(a)");
    }

    // access to a feature of an externalized role object that has been created using declared lifting
    // 6.1.2-otjld-lifted-externalized-role-feature-access-2
    public void test612_liftedExternalizedRoleFeatureAccess2() {
        runNegativeTestMatching(
            new String[] {
		"Team612lerfa2_2.java",
			    "\n" +
			    "public team class Team612lerfa2_2 {\n" +
			    "    public String getValue(final Team612lerfa2_1 t, T612lerfa2 as t.Role612lerfa2 obj) {\n" +
			    "        return obj.value;\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T612lerfa2.java",
			    "\n" +
			    "public class T612lerfa2 {}\n" +
			    "    \n",
		"Team612lerfa2_1.java",
			    "\n" +
			    "public team class Team612lerfa2_1 {\n" +
			    "    protected class Role612lerfa2 playedBy T612lerfa2 {\n" +
			    "        String value = \"OK\";\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "2.3.2(a)");
    }

    // a team implements a method of an interface using declared lifting for the parameter
    // 6.1.3-otjld-interface-implementation-with-declared-lifting
    public void test613_interfaceImplementationWithDeclaredLifting() {
       
       runConformTest(
            new String[] {
		"T613iiwdlMain.java",
			    "\n" +
			    "public class T613iiwdlMain {\n" +
			    "    public static void main(String[] args) {\n" +
			    "        I613iiwdl i = new Team613iiwdl();\n" +
			    "        T613iiwdl o = new T613iiwdl();\n" +
			    "\n" +
			    "        System.out.print(i.getValue(o));\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T613iiwdl.java",
			    "\n" +
			    "public class T613iiwdl {\n" +
			    "    public String toString() {\n" +
			    "        return \"NOTOK\";\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"I613iiwdl.java",
			    "\n" +
			    "public interface I613iiwdl {\n" +
			    "    String getValue(T613iiwdl obj);\n" +
			    "}\n" +
			    "    \n",
		"Team613iiwdl.java",
			    "\n" +
			    "public team class Team613iiwdl implements I613iiwdl {\n" +
			    "    public class Role613iiwdl playedBy T613iiwdl {\n" +
			    "        public String toString() {\n" +
			    "            return \"OK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "\n" +
			    "    public String getValue(T613iiwdl as Role613iiwdl obj) {\n" +
			    "        return obj.toString();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-1
    public void test614_illegalUseOfAsConstruct1() {
        runNegativeTest(
            new String[] {
		"T614iuoac1.java",
			    "\n" +
			    "public class T614iuoac1 {}\n" +
			    "    \n",
		"Team614iuoac1.java",
			    "\n" +
			    "public team class Team614iuoac1 {\n" +
			    "    public class Role614iuoac1 playedBy T614iuoac1 {}\n" +
			    "\n" +
			    "    public T614iuoac1 as Role614iuoac1 obj;\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-2
    public void test614_illegalUseOfAsConstruct2() {
        runNegativeTest(
            new String[] {
		"T614iuoac2.java",
			    "\n" +
			    "public class T614iuoac2 {}\n" +
			    "    \n",
		"Team614iuoac2.java",
			    "\n" +
			    "public team class Team614iuoac2 {\n" +
			    "    public class Role614iuoac2 playedBy T614iuoac2 {}\n" +
			    "\n" +
			    "    public void test() {\n" +
			    "        T614iuoac2 as Role614iuoac2 obj;\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-3
    public void test614_illegalUseOfAsConstruct3() {
        runNegativeTest(
            new String[] {
		"T614iuoac3.java",
			    "\n" +
			    "public class T614iuoac3 {}\n" +
			    "    \n",
		"Team614iuoac3.java",
			    "\n" +
			    "public team class Team614iuoac3 {\n" +
			    "    public class Role614iuoac3 playedBy T614iuoac3 {}\n" +
			    "\n" +
			    "    public T614iuoac3 as Role614iuoac3 test() {\n" +
			    "         return null;\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-4
    public void test614_illegalUseOfAsConstruct4() {
        runNegativeTest(
            new String[] {
		"T614iuoac4.java",
			    "\n" +
			    "public class T614iuoac4 {}\n" +
			    "    \n",
		"Team614iuoac4.java",
			    "\n" +
			    "public team class Team614iuoac4 {\n" +
			    "    public class Role614iuoac4 playedBy T614iuoac4 {}\n" +
			    "\n" +
			    "    public void test(T614iuoac4 obj) {\n" +
			    "        ((T614iuoac4 as Role614iuoac4)obj).toString();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-5
    public void test614_illegalUseOfAsConstruct5() {
        runNegativeTest(
            new String[] {
		"T614iuoac5.java",
			    "\n" +
			    "public class T614iuoac5 {}\n" +
			    "    \n",
		"Team614iuoac5.java",
			    "\n" +
			    "public team class Team614iuoac5 {\n" +
			    "    public class Role614iuoac5 playedBy T614iuoac5 {}\n" +
			    "\n" +
			    "    public void test(T614iuoac5 obj) {\n" +
			    "        if (obj instanceof T614iuoac5 as Role614iuoac5) {\n" +
			    "        }\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-6
    public void test614_illegalUseOfAsConstruct6() {
        runNegativeTest(
            new String[] {
		"T614iuoac6.java",
			    "\n" +
			    "public class T614iuoac6 {}\n" +
			    "    \n",
		"Team614iuoac6.java",
			    "\n" +
			    "public team class Team614iuoac6 {\n" +
			    "    public class Role614iuoac6 playedBy T614iuoac6 {}\n" +
			    "\n" +
			    "    public void test() {\n" +
			    "        T614iuoac6 obj = new T614iuoac6 as Role614iuoac6();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-7
    public void test614_illegalUseOfAsConstruct7() {
        runNegativeTest(
            new String[] {
		"T614iuoac7.java",
			    "\n" +
			    "public class T614iuoac7 {}\n" +
			    "    \n",
		"Team614iuoac7.java",
			    "\n" +
			    "public team class Team614iuoac7 {\n" +
			    "    public class Role614iuoac7_1 playedBy T614iuoac7 {}\n" +
			    "\n" +
			    "    public class Role614iuoac7_2 {\n" +
			    "        public void test(T614iuoac7 as Role614iuoac7_1 obj) {\n" +
			    "        }\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the as construct is used outside of the parameter list of a team method
    // 6.1.4-otjld-illegal-use-of-as-construct-8
    public void test614_illegalUseOfAsConstruct8() {
        runNegativeTest(
            new String[] {
		"T614iuoac8.java",
			    "\n" +
			    "public class T614iuoac8 {}\n" +
			    "    \n",
		"Team614iuoac8.java",
			    "\n" +
			    "public class Team614iuoac8 {\n" +
			    "    public class Role614iuoac8_1 {}\n" +
			    "\n" +
			    "    public void test(T614iuoac8 as Role614iuoac8_1 obj) {\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the right side of an as construct does not specify a valid role class
    // 6.1.5-otjld-invalid-role-class-for-lifting-1
    public void test615_invalidRoleClassForLifting1() {
        runNegativeTest(
            new String[] {
		"T615ircfl1.java",
			    "\n" +
			    "public class T615ircfl1 {}\n" +
			    "    \n",
		"Team615ircfl1.java",
			    "\n" +
			    "public team class Team615ircfl1 {\n" +
			    "    public class Role615ircfl1_1 playedBy T615ircfl1 {}\n" +
			    "\n" +
			    "    public class Role615ircfl1_2 {}\n" +
			    "\n" +
			    "    public void test(T615ircfl1 as Role615ircfl1_2 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the right side of an as construct does not specify a valid role class
    // 6.1.5-otjld-invalid-role-class-for-lifting-2
    public void test615_invalidRoleClassForLifting2() {
        runNegativeTest(
            new String[] {
		"T615ircfl2_1.java",
			    "\n" +
			    "public class T615ircfl2_1 {}\n" +
			    "    \n",
		"T615ircfl2_2.java",
			    "\n" +
			    "public class T615ircfl2_2 extends T615ircfl2_1 {}\n" +
			    "    \n",
		"Team615ircfl2.java",
			    "\n" +
			    "public team class Team615ircfl2 {\n" +
			    "    public class Role615ircfl2 playedBy T615ircfl2_1 {}\n" +
			    "\n" +
			    "    public void test(T615ircfl2_1 as T615ircfl2_2 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the right side of an as construct does not specify a valid role class
    // 6.1.5-otjld-invalid-role-class-for-lifting-3
    public void test615_invalidRoleClassForLifting3() {
        runNegativeTest(
            new String[] {
		"T615ircfl3.java",
			    "\n" +
			    "public class T615ircfl3 {}\n" +
			    "    \n",
		"Team615ircfl3_1.java",
			    "\n" +
			    "public team class Team615ircfl3_1 {\n" +
			    "    public class Role615ircfl3 playedBy T615ircfl3 {}\n" +
			    "}\n" +
			    "    \n",
		"Team615ircfl3_2.java",
			    "\n" +
			    "public team class Team615ircfl3_2 extends Team615ircfl3_1 {\n" +
			    "    public void test(T615ircfl3 as Team615ircfl3_1 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the left side of an as construct does not specify a base class valid for this role class
    // 6.1.6-otjld-invalid-base-class-for-lifting-1
    public void test616_invalidBaseClassForLifting1() {
        runNegativeTest(
            new String[] {
		"T616ibcfl1_1.java",
			    "\n" +
			    "public class T616ibcfl1_1 {}\n" +
			    "    \n",
		"T616ibcfl1_2.java",
			    "\n" +
			    "public class T616ibcfl1_2 extends T616ibcfl1_1 {}\n" +
			    "    \n",
		"Team616ibcfl1.java",
			    "\n" +
			    "public team class Team616ibcfl1 {\n" +
			    "    public class Role616ibcfl1 playedBy T616ibcfl1_2 {}\n" +
			    "\n" +
			    "    public void test(T616ibcfl1_1 as Role616ibcfl1 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the left side of an as construct does not specify a base class valid for this role class
    // 6.1.6-otjld-invalid-base-class-for-lifting-2
    public void test616_invalidBaseClassForLifting2() {
        runNegativeTest(
            new String[] {
		"T616ibcfl2.java",
			    "\n" +
			    "public class T616ibcfl2 {}\n" +
			    "    \n",
		"Team616ibcfl2.java",
			    "\n" +
			    "public team class Team616ibcfl2 {\n" +
			    "    public class Role616ibcfl2_1 playedBy T616ibcfl2 {}\n" +
			    "    public class Role616ibcfl2_2 playedBy T616ibcfl2 {}\n" +
			    "\n" +
			    "    public void test(Role616ibcfl2_1 as Role616ibcfl2_2 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the left side of an as construct does not specify a base class valid for this role class
    // 6.1.6-otjld-invalid-base-class-for-lifting-3
    public void test616_invalidBaseClassForLifting3() {
        runNegativeTest(
            new String[] {
		"T616ibcfl3.java",
			    "\n" +
			    "public class T616ibcfl3 {}\n" +
			    "    \n",
		"Team616ibcfl3.java",
			    "\n" +
			    "public team class Team616ibcfl3 {\n" +
			    "    public class Role616ibcfl3_1 playedBy T616ibcfl3 {}\n" +
			    "    public class Role616ibcfl3_2 extends Role616ibcfl3_1 {}\n" +
			    "\n" +
			    "    public void test(Role616ibcfl3_1 as Role616ibcfl3_2 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // the left side of an as construct does not specify a base class valid for this role class
    // 6.1.6-otjld-invalid-base-class-for-lifting-4
    public void test616_invalidBaseClassForLifting4() {
        runNegativeTest(
            new String[] {
		"T616ibcfl4.java",
			    "\n" +
			    "public class T616ibcfl4 {}\n" +
			    "    \n",
		"Team616ibcfl4_1.java",
			    "\n" +
			    "public team class Team616ibcfl4_1 {\n" +
			    "    public class Role616ibcfl4 playedBy T616ibcfl4 {}\n" +
			    "}\n" +
			    "    \n",
		"Team616ibcfl4_2.java",
			    "\n" +
			    "public team class Team616ibcfl4_2 extends Team616ibcfl4_1 {\n" +
			    "    public void test(Team616ibcfl4_1 as Role616ibcfl4 obj) {}\n" +
			    "}\n" +
			    "    \n"
            },
            null);
    }

    // a nested team has a method with declared lifting
    // 6.1.7-otjld-declared-lifting-in-nested-team-1
    public void test617_declaredLiftingInNestedTeam1() {
       
       runConformTest(
            new String[] {
		"Team617dlint1.java",
			    "\n" +
			    "public team class Team617dlint1 {\n" +
			    "    public team class InnerTeam {\n" +
			    "        protected class InnerRole playedBy T617dlint1 {\n" +
			    "            protected void foo() {\n" +
			    "                System.out.print(\"K\");\n" +
			    "            }\n" +
			    "        }\n" +
			    "        public void test(T617dlint1 as InnerRole o) {\n" +
			    "            o.foo();\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public InnerTeam getTeam() {\n" +
			    "        return new InnerTeam();\n" +
			    "    }\n" +
			    "    public static void main(String[] args) {\n" +
			    "        T617dlint1 b = new T617dlint1();\n" +
			    "        b.test();\n" +
			    "        final Team617dlint1 t = new Team617dlint1();\n" +
			    "        InnerTeam<@t> it = t.getTeam();\n" +
			    "        it.test(b);\n" +
			    "    }\n" +
			    "}    \n" +
			    "    \n",
		"T617dlint1.java",
			    "\n" +
			    "public class T617dlint1 {\n" +
			    "    void test() {\n" +
			    "        System.out.print(\"O\");\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }

    // a nested team has a method with declared lifting -- base type anchored to "base"
    // 6.1.7-otjld-declared-lifting-in-nested-team-2
    public void test617_declaredLiftingInNestedTeam2() {
       
       runConformTest(
            new String[] {
		"Team617dlint2_2.java",
			    "\n" +
			    "public team class Team617dlint2_2 {\n" +
			    "    public team class InnerTeam playedBy Team617dlint2_1 {\n" +
			    "        protected class InnerRole playedBy R<@base> {\n" +
			    "            protected void foo() {\n" +
			    "                System.out.print(\"K\");\n" +
			    "            }\n" +
			    "        }\n" +
			    "        public abstract R<@base> getBaseR();\n" +
			    "        getBaseR -> getR;\n" +
			    "        public void test(R<@base> r, R<@base> as InnerRole o) {\n" +
			    "            r.bar();\n" +
			    "            o.foo();\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public void test(Team617dlint2_1 as InnerTeam it) {\n" +
			    "        it.test(it.getBaseR(), it.getBaseR());\n" +
			    "    }\n" +
			    "    public static void main(String[] args) {\n" +
			    "        final Team617dlint2_2 t = new Team617dlint2_2();\n" +
			    "        Team617dlint2_1 bt = new Team617dlint2_1();\n" +
			    "        t.test(bt);\n" +
			    "    }\n" +
			    "}    \n" +
			    "    \n",
		"Team617dlint2_1.java",
			    "\n" +
			    "public team class Team617dlint2_1 {\n" +
			    "    public class R {\n" +
			    "        public void bar() {\n" +
			    "            System.out.print(\"I\");\n" +
			    "        }\n" +
			    "    }\n" +
			    "    R getR() {\n" +
			    "        System.out.print(\"O\");\n" +
			    "        return new R();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OOIK");
    }

    // A catch clause uses declared lifting
    // 6.1.8-otjld-exception-lifting-1
    public void test618_exceptionLifting1() {
       
       runConformTest(
            new String[] {
		"Team618el1.java",
			    "\n" +
			    "public team class Team618el1 {\n" +
			    "    protected class R playedBy T618el1 {\n" +
			    "        protected void test() -> void test();\n" +
			    "    }\n" +
			    "    protected class E playedBy E618el1 {\n" +
			    "        public String toString() {\n" +
			    "            return \"OK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public Team618el1() {\n" +
			    "        R r = new R(new T618el1());\n" +
			    "        try {\n" +
			    "            r.test();\n" +
			    "        } catch (E618el1 as E ex) {\n" +
			    "            System.out.print(\"CAUGHT:\"+ex);\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public static void main(String[] args) {\n" +
			    "        new Team618el1();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"E618el1.java",
			    "\n" +
			    "@SuppressWarnings(\"serial\")\n" +
			    "public class E618el1 extends Exception {\n" +
			    "    public E618el1(String msg) {\n" +
			    "        super(msg);\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T618el1.java",
			    "\n" +
			    "public class T618el1 {\n" +
			    "    void test () throws E618el1 {\n" +
			    "        throw new E618el1(\"NOK\");\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "CAUGHT:OK");
    }

    // A catch clause uses declared lifting, rethrowing
    // 6.1.8-otjld-exception-lifting-2
    public void test618_exceptionLifting2() {
       
       runConformTest(
            new String[] {
		"Team618el2.java",
			    "\n" +
			    "public team class Team618el2 {\n" +
			    "    protected class R playedBy T618el2 {\n" +
			    "        protected abstract void test() throws E618el2;\n" +
			    "        test -> test;\n" +
			    "    }\n" +
			    "    protected class E playedBy E618el2 {\n" +
			    "        public String toString() {\n" +
			    "            return \"NOK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public void test() throws E618el2\n" +
			    "    {\n" +
			    "        R r = new R(new T618el2());\n" +
			    "        try {\n" +
			    "            r.test();\n" +
			    "        } catch (E618el2 as E ex) {\n" +
			    "            System.out.print(\"CAUGHT(1)\");\n" +
			    "            throw ex;\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public static void main(String[] args) {\n" +
			    "        try {\n" +
			    "            new Team618el2().test();\n" +
			    "        } catch (E618el2 ex) {\n" +
			    "            System.out.print(\"CAUGHT(2)\"+ex);\n" +
			    "        }\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"E618el2.java",
			    "\n" +
			    "@SuppressWarnings(\"serial\")\n" +
			    "public class E618el2 extends Exception {\n" +
			    "    public E618el2(String msg) {\n" +
			    "        super(msg);\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T618el2.java",
			    "\n" +
			    "public class T618el2 {\n" +
			    "    void test () throws E618el2 {\n" +
			    "        throw new E618el2(\"OK\");\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "CAUGHT(1)CAUGHT(2)E618el2: OK");
    }

    // A catch clause within a role uses declared lifting
    // 6.1.8-otjld-exception-lifting-3
    public void test618_exceptionLifting3() {
       
       runConformTest(
            new String[] {
		"Team618el3.java",
			    "\n" +
			    "public team class Team618el3 {\n" +
			    "    protected class R playedBy T618el3 {\n" +
			    "        protected void doit() {\n" +
			    "            try {\n" +
			    "                test();\n" +
			    "            } catch (E618el3 as E ex) {\n" +
			    "                System.out.print(\"CAUGHT:\"+ex);\n" +
			    "            }\n" +
			    "        }\n" +
			    "        protected abstract void test() throws E618el3;\n" +
			    "        void test() -> void test();\n" +
			    "    }\n" +
			    "    protected class E playedBy E618el3 {\n" +
			    "        public String toString() {\n" +
			    "            return \"OK\";\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public Team618el3() {\n" +
			    "        R r = new R(new T618el3());\n" +
			    "        r.doit();\n" +
			    "    }\n" +
			    "    public static void main(String[] args) {\n" +
			    "        new Team618el3();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"E618el3.java",
			    "\n" +
			    "@SuppressWarnings(\"serial\")\n" +
			    "public class E618el3 extends Exception {\n" +
			    "    public E618el3(String msg) {\n" +
			    "        super(msg);\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T618el3.java",
			    "\n" +
			    "public class T618el3 {\n" +
			    "    void test () throws E618el3 {\n" +
			    "        throw new E618el3(\"NOK\");\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "CAUGHT:OK");
    }

    // a catch clause outside a team tries to lift its argument
    // 6.1.8-otjld-exception-lifting-4
    public void test618_exceptionLifting4() {
        runNegativeTestMatching(
            new String[] {
		"T618el4.java",
			    "\n" +
			    "public class T618el4 {\n" +
			    "    void foo() {\n" +
			    "        try {\n" +
			    "            System.out.println(\"nothing\");\n" +
			    "        } catch (Object as String o) {\n" +
			    "            // nop\n" +
			    "        }\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "A.0.1");
    }

    // a team ctor used both declared lifting and a role anchored to another argument
    // 6.1.9-otjld-declared-lifting-and-externalized-role-1
    public void test619_declaredLiftingAndExternalizedRole1() {
       
       runConformTest(
            new String[] {
		"Team619dlaer1_2.java",
			    "\n" +
			    "public team class Team619dlaer1_2 extends Team619dlaer1_1 {\n" +
			    "    public class R playedBy T619dlaer1 {\n" +
			    "        test -> test;\n" +
			    "        // FIXME(SH): absence of this ctor is only complained at runtime!\n" +
			    "        public R() {\n" +
			    "            base();\n" +
			    "        }\n" +
			    "    }\n" +
			    "    public Team619dlaer1_2(T619dlaer1 as R r1, final Team619dlaer1_1 tother, R<@tother> rother) {\n" +
			    "        super(tother, rother, r1);\n" +
			    "    }\n" +
			    "    public Team619dlaer1_2() {}\n" +
			    "    public static void main(String[] args) {\n" +
			    "        final Team619dlaer1_2 tother = new Team619dlaer1_2();\n" +
			    "        new Team619dlaer1_2(new T619dlaer1(), tother, tother.new R());\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T619dlaer1.java",
			    "\n" +
			    "public class T619dlaer1 {\n" +
			    "    double test() { return 42.0; }\n" +
			    "}\n" +
			    "    \n",
		"Team619dlaer1_1.java",
			    "\n" +
			    "public team class Team619dlaer1_1 {\n" +
			    "    public abstract class R {\n" +
			    "        public abstract double test();\n" +
			    "    }\n" +
			    "    public Team619dlaer1_1(final Team619dlaer1_1 tother, R<@tother> rother, R r1) {\n" +
			    "        System.out.print(r1.test());\n" +
			    "        System.out.print(r1.test() == rother.test());\n" +
			    "    }\n" +
			    "    public Team619dlaer1_1() {}\n" +
			    "}\n" +
			    "    \n"
            },
            "42.0true");
    }

    // bogus source positions if these coincide: role file, declared lifting, method requires bridge for visibility
    // 6.1.10-otjld-declared-lifting-in-nested-1
    public void test6110_declaredLiftingInNested1() {
       
       runConformTest(
            new String[] {
		"Team6110dlin1.java",
			    "\n" +
			    "public team class Team6110dlin1 {\n" +
			    "    void test() {\n" +
			    "        new Mid().runTest();\n" +
			    "    }\n" +
			    "    public static void main(String[] args) {\n" +
			    "        new Team6110dlin1().test();\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T6110dlin1.java",
			    "\n" +
			    "public class T6110dlin1 {\n" +
			    "}\n" +
			    "    \n",
		"Team6110dlin1/Mid.java",
			    "\n" +
			    "team package Team6110dlin1;    \n" +
			    "protected team class Mid {\n" +
			    "    protected class R playedBy T6110dlin1 {\n" +
			    "        String val;\n" +
			    "        protected R(String v) {\n" +
			    "            base();\n" +
			    "            this.val = v;\n" +
			    "            Mid.this.test(this); // lower before declared lifting\n" +
			    "        }\n" +
			    "        protected void beep() {\n" +
			    "            System.out.print(this.val);\n" +
			    "        }\n" +
			    "    }\n" +
			    "    private void test(T6110dlin1 as R r) {\n" +
			    "        r.beep();\n" +
			    "    }\n" +
			    "    public void runTest() {\n" +
			    "        new R(\"OK\");\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }
    
    // Lifting to an unbound super role
    // Bug 339801 - [compiler] declared lifting cannot resolve base imported base type
    public void test6111_declaredLiftingToSuper1() {
    	runConformTest(
    		new String[] {
    	"p1/T6111dlts1Main.java",
    			"package p1;" +
    			"import p2.Team6111dlts1;\n" +
    			"public class T6111dlts1Main {\n" +
    			"    public static void main(String... args) {\n" +
    			"        new Team6111dlts1().test(new T6111dlts1_1());\n" +
    			"    }\n" +
    			"}\n",
    	"p2/Team6111dlts1.java",
    			"package p2;\n" +
    			"import base p1.T6111dlts1_1;\n" +
    			"@SuppressWarnings(\"decapsulation\")\n" +
    			"public team class Team6111dlts1 {\n" +
    			"    protected abstract class R0 {\n" +
    			"        protected abstract void test();\n" +
    			"    }\n" +
    			"    protected class R1 extends R0 playedBy T6111dlts1_1 {\n" +
    			"        test -> test;" +
    			"    }\n" +
    			"    public void test(T6111dlts1_1 as R0 r) {\n" +
    			"        r.test();\n" +
    			"    }\n" +
    			"}\n",
    	"p1/T6111dlts1_1.java",
    			"package p1;\n" +
    			"class T6111dlts1_1 {\n" +
    			"    void test() { System.out.print(\"OK\"); }\n" +
    			"}\n",
    		},
    		"OK");
    }

    // Bug 355441 - illegal bytecode for team constructor with declared lifting and field access
    public void _test6112_declaredLiftingInConstructor1() {
       runConformTest(
            new String[] {
		"T6112dlic1Main.java",
			    "\n" +
			    "public class T6112dlic1Main {\n" +
			    "    public static void main(String[] args) {\n" +
			    "        T6112dlic1      o = new T6112dlic1();\n" +
			    "        Team6112dlic1_2 t = new Team6112dlic1_2(o);\n" +
			    "\n" +
			    "        System.out.print(t.getValue());\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T6112dlic1.java",
			    "\n" +
			    "public class T6112dlic1 {}\n" +
			    "    \n",
		"Team6112dlic1_1.java",
			    "\n" +
			    "public team class Team6112dlic1_1 {\n" +
			    "    Role6112dlic1_1 r;\n" +
			    "    public Team6112dlic1_1(Role6112dlic1_1 obj) {\n" +
			    "        this.r = obj;\n" +
			    "    }\n" +
			    "    public class Role6112dlic1_1 playedBy T6112dlic1 {\n" +
			    "        public String value = \"OK\";\n" +
			    "    }\n" +
			    "    public String getValue() {\n" +
			    "        return this.r.value;" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"Team6112dlic1_2.java",
			    "\n" +
			    "public team class Team6112dlic1_2 extends Team6112dlic1_1 {\n" +
			    "    public Team6112dlic1_2(T6112dlic1 as Role6112dlic1_1 obj) {\n" +
			    "        super(obj);\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }

    // Bug 355441 - illegal bytecode for team constructor with declared lifting and field access
    public void _test6112_declaredLiftingInConstructor2() {
       runConformTest(
            new String[] {
		"T6112dlic2Main.java",
			    "\n" +
			    "public class T6112dlic2Main {\n" +
			    "    public static void main(String[] args) {\n" +
			    "        T6112dlic2      o = new T6112dlic2();\n" +
			    "        Team6112dlic2_2 t = new Team6112dlic2_2(o);\n" +
			    "\n" +
			    "        System.out.print(t.getValue());\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"T6112dlic2.java",
			    "\n" +
			    "public class T6112dlic2 {}\n" +
			    "    \n",
		"Team6112dlic2_1.java",
			    "\n" +
			    "public team class Team6112dlic2_1 {\n" +
			    "    private Role6112dlic2_1 r;\n" +
			    "    public Team6112dlic2_1(Role6112dlic2_1 obj) {\n" +
			    "        this.r = obj;\n" +
			    "    }\n" +
			    "    public class Role6112dlic2_1 playedBy T6112dlic2 {\n" +
			    "        public String value = \"OK\";\n" +
			    "    }\n" +
			    "    public String getValue() {\n" +
			    "        return this.r.value;" +
			    "    }\n" +
			    "}\n" +
			    "    \n",
		"Team6112dlic2_2.java",
			    "\n" +
			    "public team class Team6112dlic2_2 extends Team6112dlic2_1 {\n" +
			    "    public Team6112dlic2_2(T6112dlic2 as Role6112dlic2_1 obj) {\n" +
			    "        super(obj);\n" +
			    "    }\n" +
			    "}\n" +
			    "    \n"
            },
            "OK");
    }

    // Bug 393072 - VerifyError caused by super call within team constructor using declared lifting
    // array lifting and super-call
    public void test6112_declaredLiftingInConstructor3() {
    	runConformTest(
    		new String[] {
    	"T6112dlic3.java",
    			"public class T6112dlic3 {}\n",
    	"Team6112dlic3_0.java",
    			"public team class Team6112dlic3_0 {\n" + 
    			"    R[] f;\n" + 
    			"    Team6112dlic3_0(R[] roles){ this.f = roles; }\n" + 
    			"    protected class R {}\n" + 
    			"}\n",
    	"Team6112dlic3_1.java",
    			"public team class Team6112dlic3_1 extends Team6112dlic3_0 {\n" + 
    			"    Team6112dlic3_1(T6112dlic3[] as R[] roles) { super(roles); }\n" + 
    			"    @Override\n" +
    			"    protected class R playedBy T6112dlic3 {}\n" + 
    			"}\n"
    		});
    }

    // Bug 393072 - VerifyError caused by super call within team constructor using declared lifting
    // array lifting and super-call - additional contructor provided
    public void test6112_declaredLiftingInConstructor4() {
    	runConformTest(
    		new String[] {
    	"Team6112dlic4_1.java",
    			"public team class Team6112dlic4_1 extends Team6112dlic4_0 {\n" + 
    			"    Team6112dlic4_1(T6112dlic4[] as R[] roles) { super(roles); }\n" + 
    			"    @Override\n" +
    			"    protected class R playedBy T6112dlic4 {\n" +
    			"        test -> OK;\n" +
    			"    }\n" +
    			"    public static void main(String[] args) {\n" +
    			"        T6112dlic4 b = new T6112dlic4();\n" +
    			"        new Team6112dlic4_1(new T6112dlic4[]{b});\n" +
    			"    }\n" + 
    			"}\n",
    	"T6112dlic4.java",
    			"public class T6112dlic4 {\n" +
    			"    void OK() { System.out.print(\"OK\"); }\n" +
    			"}\n",
    	"Team6112dlic4_0.java",
    			"public abstract team class Team6112dlic4_0 {\n" + 
    			"    R[] f;\n" + 
    			"    Team6112dlic4_0(){ System.out.print(\"wrong\"); }\n" + 
    			"    Team6112dlic4_0(R[] roles){\n" +
    			"        this.f = roles;\n" +
    			"        this.f[0].test();" +
    			"    }\n" + 
    			"    protected abstract class R { protected abstract void test(); }\n" + 
    			"}\n",
    		},
    		"OK");
    }

    // Bug 393072 - VerifyError caused by super call within team constructor using declared lifting
    // expected lifting does not happen
    public void test6112_declaredLiftingInConstructor5() {
    	runConformTest(
    		new String[] {
		"Team6112dlic5_1.java",
				"public team class Team6112dlic5_1 extends Team6112dlic5_0 {\n" + 
				"    Team6112dlic5_1() { super(new R[0]); }\n" +
				"    public void test() {\n" +
				"        new R().test(this.f.length);\n" +
				"    }\n" + 
				"    @Override\n" +
				"    protected class R playedBy T6112dlic5 {\n" +
				"        protected R() { base(); }\n" +
    			"        test -> OK;\n" +
				"    }\n" + 
    			"    public static void main(String[] args) {\n" +
    			"        new Team6112dlic5_1().test();\n" +
    			"    }\n" + 
				"}\n",
    	"T6112dlic5.java",
    			"public class T6112dlic5 {\n" +
    			"    void OK(int x) { System.out.print(\"OK\"+x); }\n" +
    			"}\n",
    	"Team6112dlic5_0.java",
    			"public abstract team class Team6112dlic5_0 {\n" + 
    			"    R[] f;\n" + 
    			"    Team6112dlic5_0(R[] roles){\n" +
    			"        this.f = roles;\n" +
    			"    }\n" +
    			"    protected abstract class R { protected abstract void test(int l); }\n" + 
    			"}\n",
    		},
    		"OK0");
    }

    // Bug 397712 - [compiler] illegal bytecode from chains of team constructors
    public void test6112_declaredLiftingInConstructor6() {
    	runConformTest(
    		new String[] {
		"Team6112dlic6_2.java",
				"public team class Team6112dlic6_2 extends Team6112dlic6_1 {\n" + 
				"    Team6112dlic6_2(T6112dlic6 as R r) { super(r); }\n" +
				"    @Override\n" +
				"    protected class R playedBy T6112dlic6 {\n" +
    			"        test -> OK;\n" +
				"    }\n" + 
    			"    public static void main(String[] args) {\n" +
    			"        new Team6112dlic6_2(new T6112dlic6()).test();\n" +
    			"    }\n" + 
				"}\n",
		"Team6112dlic6_1.java",
				"public team class Team6112dlic6_1 extends Team6112dlic6_0 {\n" +
				"    R r;" + 
				"    protected Team6112dlic6_1(R r) { this.r = r; }\n" +
				"    public void test() {\n" +
				"        this.r.test(2);\n" +
				"    }\n" + 
				"}\n",
    	"T6112dlic6.java",
    			"public class T6112dlic6 {\n" +
    			"    void OK(int x) { System.out.print(\"OK\"+x); }\n" +
    			"}\n",
    	"Team6112dlic6_0.java",
    			"public abstract team class Team6112dlic6_0 {\n" + 
    			"    Team6112dlic6_0(){}\n" +
    			"    protected abstract class R { protected abstract void test(int l); }\n" + 
    			"}\n",
    		},
    		"OK2");
    }
    
    public void test6113_declaredLiftingOfExternalizedRole1() {
    	runConformTest(new String[] {
    		"Team6113dloer1_2.java",
    			"public team class Team6113dloer1_2 {\n" +
    			"final static Team6113dloer1_1 other = new Team6113dloer1_1();\n" +
    			"    protected class R playedBy R<@other> {\n" +
    			"        void test() -> void test();\n" +
    			"    }\n" +
    			"    void test(R<@other> as R r) {\n" +
    			"        r.test();\n" +
    			"    }\n" +
    			"    public static void main(String[] args) {\n" +
    			"        other.val = \"OK\";\n" +
    			"        new Team6113dloer1_2().test(other.getR());\n" +
    			"    }\n" +
    			"}\n",
    		"Team6113dloer1_1.java",
    			"public team class Team6113dloer1_1 {\n" +
    			"public String val;\n" +
    			"public class R {\n" +
    			"    public void test() {\n" +
    			"        System.out.print(val);\n" +
    			"    }\n" +
    			"}\n" +
    			"public R getR() { return new R(); }\n" +
    			"}\n"
    	},
    	"OK");
    }

}

Back to the top