forked from lihongbin/Javac-Research
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path文档.java
1807 lines (1406 loc) · 44.2 KB
/
文档.java
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
**********************************************************
时间: 2007.05.29 23:00
用途: 说明javac不是一个优化编译器的例子
**********************************************************
package my.test;
public class Test {
Test() {
int v1=1;
while(v1<10000) {
int v2=5;
v1=v1+v2*2;
}
}
}
**********************************************************
时间: 2007.05.29 23:00
用途: ClassWriter测试例子
**********************************************************
package my.test;
import java.lang.annotation.*;
/*
interface InterfaceTest {
void interfaceMethod(int arg);
}
*/
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.FIELD, ElementType.METHOD})
@interface MyAnnotation {
String value();
//String value2() default "defaultValue";
}
class ExtendsTest{}
class TestA extends ExtendsTest{}
class TestB extends ExtendsTest{}
interface InterfaceA{}
interface InterfaceB{}
@interface AnnotationA{
String value();
}
@interface AnnotationB{
String value() default "str";
}
public class Test<T> extends ExtendsTest implements InterfaceA {
{
class LocalClassInInitBlock{}
}
protected abstract class C<T> { int this$0 ;abstract T id(T x); }
class D extends C<String> { String id(String x) { return x; } }
protected static int fieldStatic=10;
public int fieldA=10;
int fieldB=10;
@Deprecated
@MyAnnotation("test")
@SuppressWarnings("fallthrough")
private static final int fieldStaticFinal=10;
/*
public static void main(String args[]) {
Test t=new Test();
System.err.println(t.fieldStatic);
System.err.println(t.fieldA);
System.err.println(t.fieldB);
System.err.println(t.fieldStaticFinal);
}
*/
private T t;
class TestC{}
protected class TestD<V>{}
TestD<? extends TestC> testD;
/*Test(int i) {
//boolean myBoolean=false;
//if((i<0)?i<10:i>10) myBoolean=!myBoolean;
//if((i<0)?true:false) myBoolean=!myBoolean;
//for(int n=0;n<10;n++) i++;
//while(i<10) i++;
//do i++;while(i<10);
//myLable:i++;
myLable: {
i++;
while(true) {
if(i>0) continue;
else break myLable;
}
}
}*/
<T extends Exception & InterfaceA & InterfaceB,V extends InterfaceA & InterfaceB > int method(int i,int... is) throws T {
class LocalTest{}
T t;
//int[] n=(i<0) ? new int[5] : new int[10];
//int[] n=(i<0) ? new int[5] : new int[10];
//ExtendsTest[] n=(i<0) ? new TestA[5] : new TestB[10];
//ExtendsTest et=new TestA();
//int[] in=new int[]{2,3};
//i=10;
//i-=-10;
//i/=10;
//String s="str";
//s+=i+"str2";
String s[]=new String[]{"str","sss"};
s[0]+=i+"str2";
return 0;
}
//public class Test<T> implements InterfaceTest {
/*
static int fieldStatic=10;
static {
fieldStatic=20;
}
int field=10;
{
field=20;
}
static final int fieldStaticFinal=10;
Test() {
InterfaceTest interfaceTest=this;
interfaceTest.interfaceMethod(10);
myStaticMethod();
myPrivateMethod();
myMethod(12,"str",100,101,102);
}
private void myPrivateMethod(){}
private static void myStaticMethod(){}
public void interfaceMethod(int arg){}
*/
/*
public static void main(String args[]) {
Test t=new Test();
System.err.println(t.field);
System.err.println(t.fieldStatic);
}*/
//protected abstract class C<T> { int this$0 ;abstract T id(T x); }
//class D extends C<String> { String id(String x) { return x; } }
/*
enum MyEnum {
EXTENDS("? extends "),
SUPER("? super "),
UNBOUND("?");
private final String name;
MyEnum(String name) {
this.name = name;
}
public String toString() { return name; }
}*/
/*
class MyInnerClass{
MyInnerClass(){
this("str");
}
MyInnerClass(String str){}
}*/
/*
class MyInnerClass2 extends MyInnerClass{
MyInnerClass2(String SSSSS){
super("dfdfdf");
}
MyInnerClass2(){
this("dfdfdf");
}
}
*/
/*
public <V> int myMethod(int i,String s,double d,int... ii) {
//final @Deprecated class MyLocalClass{
// int fieldLocal=10;
// {
// fieldLocal=20;
// }
//}
{}
{final double myMethodDouble=1.3F;}
//C c = new D()
//c.id(new Object()); // fails with a ClassCastException
//Flow阶段用于错误测试的例子
//对于这样的if语句,编译器把整个if语句替换成--bbb
int bbb=10;
if(false) bbb++;
else bbb--;
//对于这样的if语句,编译器把整个if语句替换成++ccc
int ccc=10;
if(true) ccc++;
else ccc--;
//对于这样的if语句,编译器也不能优化,即使(iii=10)>5这一结果很明显
int iii=10;
if(iii>5) iii++;
//else iii--;
int array[][]=null;
//if(s==null) s=null;
boolean myBoolean=false;
if((i<0)?i<10:i>10) myBoolean=!myBoolean;
if(i+1/2*3-4>5) i++;
else i--;
//int ddd;
int ddd=10;
for(final int dd:ii) {
int eee=3*6*7;
if (dd>0) {
continue;
//;
//ddd++;
}
else ddd--;
//else myStaticMethod();
if (dd>10) {
break;
//;
//ddd++;
}
ddd--;
int fff;
}
//for(;7<10;) i++;
//ddd++;
for(;i<10;i++,i+=2);
for(int n=0,n2[]={10,20};n<10;n++);
while(i<10) return 100;
do i++;
while(i<10);
try {
i++;
}
catch(RuntimeException e) {}
catch(Exception e) {}
//catch(NoSuchFieldException e) {}
finally {
i=0;
}
switch(i) {
case 0:
i++;
int fff;
break;
default:
i--;
}
synchronized (s) {}
assert (i<10): "message";
//abstract class MyClass2{}
//strictfp class MyClass3{}
//枚举类型不能为本地类型
//enum MyEnum {}
myLable:{
int bb;// i++;
//break;
}
//报错:意外的类型
//++-10;
//++--myInt;
//注意ExtendsTestBound必须extends TestBound且同时implements MyInterfaceA
//因为Test类的第一个形式参数S extends TestBound & MyInterfaceA
//否则报错:类型参数 my.test.ExtendsTestBound 不在其限制范围之内
//Test<ExtendsTestBound,String> test=new Test<ExtendsTestBound,String>();
int myIntArray[]=new int[10];
myIntArray[1]=10;
int[] myIntArray2={1,2};
i++;
int myInt=0;
myInt<<=(int)2L;
//myInt<<=(int)2;//警告:[转换] 向 int 转换出现冗余
//return new int[0][0];
//对于condition ? trueExpression : falseExpression语句
//从这里可以看出falseExpression不能含有赋值运符符AssignmentOperator
//但是trueExpression可以
//myInt=(myInt>0) ? myInt=0:myInt=1;
return 1000;
}
*/
}
Enter测试例子:
package my.test;
import my.*;
public class Test<S,T extends ExtendsTest,E extends ExtendsTest&MyInterfaceA> {
public class MyInnerClass {}
public static class MyInnerClassStatic {}
public interface MyInnerInterface {}
public static interface MyInnerInterfaceStatic {}
public enum MyInnerEnum {}
public static enum MyInnerEnumStatic {}
@Deprecated
public <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
final @Deprecated class MyLocalClass1{}
abstract class MyLocalClass2 {}
strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
}
class MyTheSamePackageClass {}
public class Test{
/*
public class MyInnerClass {}
public interface MyInnerInterface {}
public enum MyInnerEnum {}
*/
public void myMethod() {
final @Deprecated class MyLocalClass{}
}
int field;
}
MenberEnter测试例子:
package my.test;
import static my.StaticImportTest.MyInnerClassStaticPublic;
import static my.StaticImportTest.*;
import my.StaticImportTest.MyInnerClass;
import my.*;
public class Test<S,T extends ExtendsTest,E extends ExtendsTest&MyInterfaceA> {
//public static class MyInnerClassStaticPublic {}
public class MyInnerClass {}
public static class MyInnerClassStatic {}
public interface MyInnerInterface {}
//public static interface MyInnerInterfaceStatic {}
public enum MyInnerEnum {}
//public static enum MyInnerEnumStatic {}
@Deprecated
public <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
final @Deprecated class MyLocalClass1{}
abstract class MyLocalClass2 {}
strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
int field;
}
class MyTheSamePackageClass {}
package my.test;
;
import static my.StaticImportTest.*;
import my.*;
import static my.StaticImportTest.MyInnerClassStaticPublic;
import my.ExtendsTest;
//public class Test<S,T extends ExtendsTest,E extends ExtendsTest&MyInterfaceA> extends ExtendsTest {
public class Test<S,T extends ExtendsTest,E extends ExtendsTest & MyInterfaceA> extends my.ExtendsTest.MyInnerClassStatic {
//public static class MyInnerClassStaticPublic {}
public class MyInnerClass {
//错误提示:
//bin\mysrc\my\test\Test.java:11: 只有在静态上下文中才允许使用枚举声明
// public enum MyInnerEnum2{}
// ^
//public enum MyInnerEnum2{}
}
public static class MyInnerClassStatic {}
public interface MyInnerInterface {}
//public static interface MyInnerInterfaceStatic {}
public enum MyInnerEnum {
;
MyInnerEnum() {}
}
//public static enum MyInnerEnumStatic {}
@Deprecated
public <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
field=Test.super.field;
final @Deprecated class MyLocalClass1{}
abstract class MyLocalClass2 {}
strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
int field;
//MyInterfaceA myInterfaceA=new MyInterfaceA() {};
/*
{
field=6;
}
*/
}
//class MyTheSamePackageClass {}
MenberEnter Attr测试例子:
package my.test;
import static my.StaticImportTest.*;
import my.*;
import static my.StaticImportTest.MyInnerClassStaticPublic;
import my.ExtendsTest;
public class Test<S,T extends ExtendsTest,E extends ExtendsTest&MyInterfaceA> extends ExtendsTest {
//public static class MyInnerClassStaticPublic {}
public class MyInnerClass {}
public static class MyInnerClassStatic {}
public interface MyInnerInterface {}
//public static interface MyInnerInterfaceStatic {}
public enum MyInnerEnum {}
//public static enum MyInnerEnumStatic {}
@Deprecated
public <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
final @Deprecated class MyLocalClass1{}
abstract class MyLocalClass2 {}
strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
int field;
/*
{
field=6;
}
*/
}
class MyTheSamePackageClass {}
MenberEnter Attr测试例子:
package my.test;
//import static my.StaticImportTest.*;
//import my.*;
//import static my.StaticImportTest.MyInnerClassStaticPublic;
import my.ExtendsTest;
//public class Test<S,T extends ExtendsTest,E extends ExtendsTest&MyInterfaceA> extends ExtendsTest {
public class Test<S,T extends ExtendsTest,E extends ExtendsTest & MyInterfaceA> extends my.ExtendsTest<Test,MyInterfaceA>.MyInnerClassStatic {
//public static class MyInnerClassStaticPublic {}
public class MyInnerClass {}
public static class MyInnerClassStatic {}
public interface MyInnerInterface {}
//public static interface MyInnerInterfaceStatic {}
public enum MyInnerEnum {}
//public static enum MyInnerEnumStatic {}
@Deprecated
public <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
final @Deprecated class MyLocalClass1{}
abstract class MyLocalClass2 {}
strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
int field;
/*
{
field=6;
}
*/
}
//class MyTheSamePackageClass {}
Attr 语言各类语句:
package my.test;
public class Test<T> {
//abstract void myMethod();
@Deprecated
public <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
//int field=Test.this.field;
;
if(i+1/2*3-4>5) i++;
else i--;
for(final int dd:ii);
for(;i<10;i++,i+=2);
for(int n=0,n2[]={10,20};n<10;n++);
while(i<10);
do i++;
while(i<10);
try {
i++;
}
catch(RuntimeException e) {}
catch(Exception e) {}
finally {
i=0;
}
switch(i) {
case 0:
i++;
break;
default:
i--;
}
synchronized (s) {}
assert (i<10): "message";
//枚举类型不能为本地类型
//enum MyEnum {}
myLable: i++;
//报错:意外的类型
//++-10;
//++--myInt;
//注意ExtendsTestBound必须extends TestBound且同时implements MyInterfaceA
//因为Test类的第一个形式参数S extends TestBound & MyInterfaceA
//否则报错:类型参数 my.test.ExtendsTestBound 不在其限制范围之内
//Test<String> test=new Test<String>();
int myIntArray[]=new int[10];
myIntArray[1]=10;
int[] myIntArray2={1,2};
i++;
field<<=2;
final @Deprecated class MyLocalClass1{}
abstract class MyLocalClass2 {}
strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
int field=10;
}
第一:
javac <选项>的处理:
<选项>类型分三种:
enum OptionKind {
NORMAL, //标准选项
EXTENDED,//非标准选项(也称扩展选项,用标准选项“-X”来查看所有扩展选项)
HIDDEN, //隐藏选项(内部使用,不会显示)
}
几个重要的Scope:
JCCompilationUnit
//packge.members_field是一个Scope,这个Scope里的每一个Entry
//代表了包名目录下的所有除成员类与本地类以外的类
//每个Entry是在Enter阶段加入的
public PackageSymbol packge;
Scope members_field
//在Env.topLevelEnv(JCCompilationUnit tree)中进行初始化
//与JCCompilationUnit对应的Env<AttrContext>.info.Scope相同。
//Scope包括在同一源文件中定义的所有最顶层的类(不包括成员类)
//以及非*号结尾的import语句导入的类
public Scope namedImportScope;
//java.lang包中的所有类及所有以*号结尾的import语句导入的类
public Scope starImportScope;
JCClassDecl
//sym.members_field是一个Scope,这个Scope里的每一个Entry
//代表一个成员类(或成员接口),但是不包括type parameter。
//type parameter在与JCClassDecl对应的Env<AttrContext>.info.Scope中。
//在Enter阶断把成员类、接口、枚举类加入members_field
//在MemberEnter阶断把字段、方法加入members_field
//在Attr阶断本地类加入members_field
public ClassSymbol sym;
Scope members_field
MemberEnter详细例子:
package my.test;
import static my.StaticImportTest.*;
import my.*;
import static my.StaticImportTest.MyInnerClassStaticPublic;
//import static my.ExtendsTest.MyInnerClassStaticPublic;
//import java.util.Date;
//import java.sql.Date;
import my.StaticImportTest.MyInnerClass;
//import my.StaticImportTest.*;
public class Test<S,V extends InterfaceTest,T extends ExtendsTest,E extends ExtendsTest&InterfaceTest> extends ExtendsTest implements InterfaceTest {
public int myInterfaceMethod(int i,char c) {
return field;
}
public class MyTestInnerClass {
MyTestInnerClass(int intInner) {
}
}
//abstract void myMethod();
@Deprecated
public <M extends T,S> int[] myMethod(final M t,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
//无法从静态上下文中引用非静态 类型变量的限制范围 T
//public static <M extends T,S> int[] myMethod(final M m,S[] s[],int i,String s2,int... ii)[] throws Exception,Error{
//int field=Test.this.field;
;
if(i+1/2*3-4>5) i++;
else i--;
for(final int dd:ii);
for(;i<10;i++,i+=2);
for(int n=0,n2[]={10,20};n<10;n++);
while(i<10);
do i++;
while(i<10);
try {
i++;
}
catch(RuntimeException e) {}
catch(Exception e) {}
finally {
i=0;
}
switch(i) {
case 0:
i++;
break;
default:
i--;
}
synchronized (s) {}
assert (i<10): "message";
//枚举类型不能为本地类型
//enum MyEnum {}
myLable: i++;
//报错:意外的类型
//++-10;
//++--myInt;
//注意ExtendsTestBound必须extends TestBound且同时implements MyInterfaceA
//因为Test类的第一个形式参数S extends TestBound & MyInterfaceA
//否则报错:类型参数 my.test.ExtendsTestBound 不在其限制范围之内
//Test<String> test=new Test<String>();
int myIntArray[]=new int[10];
myIntArray[1]=10;
int[] myIntArray2={1,2};
i++;
field<<=2;
final @Deprecated class MyLocalClass1{
//int field=Test.this.field;
MyLocalClass1() {
Test.this.field=10;
}
}
//abstract class MyLocalClass2 {}
//strictfp class MyLocalClass3 {}
//interface MyLocalInterface {}//不允许
return new int[0][0];
}
int field=10;
static int staticfield=10;
{
field=20;
}
static{
staticfield=20;
}
}
//Flow分析使用的测试例子:
package my.test;
@Deprecated
public class Test<S, T> {
/*
;
public class MyInnerClass {
MyInnerClass(){}
}
public static class MyInnerClassStatic {}
public interface MyInnerInterface {}
public static interface MyInnerInterfaceStatic {
//int myInt=1;
//String myMethod();
}
public enum MyInnerEnum{,}//只有一个逗号
public static enum MyInnerEnumStatic implements MyInterfaceA,MyInterfaceB{
@Deprecated EXTENDS("? extends ") {
String toString() {
return "extends";
}
},
SUPER("? super "),
UNBOUND("?");
private final String name;
MyInnerEnumStatic(String name) {
this.name = name;
}
public String toString() { return name; }
}
//{ case; }//错误提示:“单个 case”或“单个 default”
*/
{
int i=0;
}
static {
//myStaticInt2=10;
int i=2;
final int i2=2;
final int i3;
//final int i4=myStaticMethod();
}
public static int myStaticMethod() throws Exception{
return 10;
}
//Flow阶段用于错误测试的例子
//Test() {
// this(2);//super();
//}
Test() throws Error, Exception {
this(2);//super();
}
Test(int myInt) throws Error, NoSuchFieldException {
//this.myInt=myInt;
//myStaticInt1=1;
}
Test(float f) throws NoSuchFieldException, InterruptedException {
//myStaticInt1=1;
}
<N extends T,S> void myMethod2(final N n,S s) throws Exception{
int myMethodInt;
}
public <M extends T,S> int myMethod3(M m,S s)[] throws Exception,RuntimeException {
int myMethodInt=10;
return new int[0];
}
@Deprecated
//public void myMethod(int i,String s,int... ii) throws Exception{
public <M extends T,S> int[] myMethod(final M m,S[] s2[],int i,String s,int... ii)[] {//throws Exception,Error{
//Flow阶段用于错误测试的例子
/*
{}
int bbb;
if(false) bbb++;
else bbb--;
int ccc;
if(true) ccc++;
else ccc--;
int iii;
if(iii>5) iii++;
else iii--;
boolean myBoolean;
if(i<0) myBoolean=!myBoolean;
if(i+1/2*3-4>5) i++;
else i--;
*/
//int ddd;
int ddd=10;
for(final int dd:ii) {
int eee;
if (dd>0) {
continue;
//;
//ddd++;
}
else ddd--;
//else myStaticMethod();
if (dd>10) {
break;
//;
//ddd++;
}
ddd--;
int fff;
}
/*
for(;7<10;) i++;
ddd++;
*/
for(;i<10;i++,i+=2);
for(int n=0,n2[]={10,20};n<10;n++);
while(i<10);
do i++;
while(i<10);
try {
i++;
}
catch(RuntimeException e) {}
catch(Exception e) {}
//catch(NoSuchFieldException e) {}
finally {
i=0;
}
switch(i) {
case 0:
i++;
int fff;
break;
default:
i--;
}
synchronized (s) {}
assert (i<10): "message";
final @Deprecated class MyClass{}
final int myMethodInt;
abstract class MyClass2{}
strictfp class MyClass3{}
//枚举类型不能为本地类型
//enum MyEnum {}
myLable:{
int bb;// i++;
//break;
}
//报错:意外的类型
//++-10;
//++--myInt;
//注意ExtendsTestBound必须extends TestBound且同时implements MyInterfaceA
//因为Test类的第一个形式参数S extends TestBound & MyInterfaceA
//否则报错:类型参数 my.test.ExtendsTestBound 不在其限制范围之内
//Test<ExtendsTestBound,String> test=new Test<ExtendsTestBound,String>();
int myIntArray[]=new int[10];
myIntArray[1]=10;
int[] myIntArray2={1,2};
i++;
myInt<<=(int)2L;
//myInt<<=(int)2;//警告:[转换] 向 int 转换出现冗余
return new int[0][0];
//对于condition ? trueExpression : falseExpression语句
//从这里可以看出falseExpression不能含有赋值运符符AssignmentOperator
//但是trueExpression可以
//myInt=(myInt>0) ? myInt=0:myInt=1;
}
public int myInt='\uuuuu5df2';
public final int myInt2=10;
//public final int myInt3;//Flow阶段用于错误测试的例子
public float myFloat=0x.1p-1f;
//public float 我的变量=" ";
public static final int myStaticInt1='\377';
//Flow阶段用于错误测试的例子
/*public static final int myStaticInt2;
public static final int myStaticInt3;
public static final int myStaticInt4;
public static final int myStaticInt5;
public static final int myStaticInt21;
public static final int myStaticInt31;
public static final int myStaticInt41;
public static final int myStaticInt51;
public static final int myStaticInt211;
public static final int myStaticInt311;
public static final int myStaticInt411;
public static final int myStaticInt511;
public static final int myStaticInt2111;
public static final int myStaticInt3111;
public static final int myStaticInt4111;
public static final int myStaticInt5111;
public static final int myStaticInt21111;
public static final int myStaticInt31111;
public static final int myStaticInt41111;
public static final int myStaticInt51111;
public static final int myStaticInt211111;
public static final int myStaticInt311111;
public static final int myStaticInt411111;
public static final int myStaticInt511111;
public static final int myStaticInt2111111;
public static final int myStaticInt3111111;
public static final int myStaticInt4111111;
public static final int myStaticInt5111111;
public static final int myStaticInt21111111;
public static final int myStaticInt31111111;
public static final int myStaticInt41111111;
public static final int myStaticInt51111111;
public static final int myStaticInt211111111;
public static final int myStaticInt311111111;
public static final int myStaticInt411111111;
public static final int myStaticInt511111111;
public static final int myStaticInt2111111111;
public static final int myStaticInt3111111111;
public static final int myStaticInt4111111111;
public static final int myStaticInt5111111111;
*/
S myS;
T myT;
public void method(){}
public void method(int i){}
}