From e629738a46ca5e82ad93939f3de7c05c37512323 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 1 Sep 2014 18:54:33 +0400 Subject: [PATCH] java-decompiler: tests moved --- .../java/decompiler/SingleClassesTest.java | 30 ++++--- testData/classes/pkg/TestCodeConstructs.class | Bin 0 -> 661 bytes testData/classes/pkg/TestConstants$A.class | Bin 0 -> 293 bytes testData/classes/pkg/TestConstants.class | Bin 0 -> 1668 bytes .../classes/pkg/TestDeprecations$ByAnno.class | Bin 0 -> 367 bytes .../pkg/TestDeprecations$ByComment.class | Bin 0 -> 308 bytes testData/classes/pkg/TestDeprecations.class | Bin 0 -> 576 bytes testData/classes/pkg/TestEnum$1.class | Bin 0 -> 363 bytes testData/classes/pkg/TestEnum$2.class | Bin 0 -> 428 bytes testData/classes/pkg/TestEnum.class | Bin 0 -> 1491 bytes testData/classes/pkg/TestExtendsList.class | Bin 0 -> 522 bytes .../pkg/TestMethodParameters$1Local.class | Bin 0 -> 567 bytes .../classes/pkg/TestMethodParameters$C1.class | Bin 0 -> 519 bytes .../classes/pkg/TestMethodParameters$C2.class | Bin 0 -> 483 bytes .../classes/pkg/TestMethodParameters.class | Bin 0 -> 629 bytes testData/results/TestClassLambda.dec | 2 +- testData/results/TestCodeConstructs.dec | 17 ++++ testData/results/TestConstants.dec | 76 ++++++++++++++++++ testData/results/TestDeprecations.dec | 32 ++++++++ testData/results/TestEnum.dec | 30 +++++++ testData/results/TestExtendsList.dec | 13 +++ testData/results/TestMethodParameters.dec | 47 +++++++++++ testData/src/pkg/TestCodeConstructs.java | 28 +++++++ testData/src/pkg/TestConstants.java | 64 +++++++++++++++ testData/src/pkg/TestDeprecations.java | 36 +++++++++ testData/src/pkg/TestEnum.java | 36 +++++++++ testData/src/pkg/TestExtendsList.java | 26 ++++++ testData/src/pkg/TestMethodParameters.java | 40 +++++++++ 28 files changed, 467 insertions(+), 10 deletions(-) create mode 100644 testData/classes/pkg/TestCodeConstructs.class create mode 100644 testData/classes/pkg/TestConstants$A.class create mode 100644 testData/classes/pkg/TestConstants.class create mode 100644 testData/classes/pkg/TestDeprecations$ByAnno.class create mode 100644 testData/classes/pkg/TestDeprecations$ByComment.class create mode 100644 testData/classes/pkg/TestDeprecations.class create mode 100644 testData/classes/pkg/TestEnum$1.class create mode 100644 testData/classes/pkg/TestEnum$2.class create mode 100644 testData/classes/pkg/TestEnum.class create mode 100644 testData/classes/pkg/TestExtendsList.class create mode 100644 testData/classes/pkg/TestMethodParameters$1Local.class create mode 100644 testData/classes/pkg/TestMethodParameters$C1.class create mode 100644 testData/classes/pkg/TestMethodParameters$C2.class create mode 100644 testData/classes/pkg/TestMethodParameters.class create mode 100644 testData/results/TestCodeConstructs.dec create mode 100644 testData/results/TestConstants.dec create mode 100644 testData/results/TestDeprecations.dec create mode 100644 testData/results/TestEnum.dec create mode 100644 testData/results/TestExtendsList.dec create mode 100644 testData/results/TestMethodParameters.dec create mode 100644 testData/src/pkg/TestCodeConstructs.java create mode 100644 testData/src/pkg/TestConstants.java create mode 100644 testData/src/pkg/TestDeprecations.java create mode 100644 testData/src/pkg/TestEnum.java create mode 100644 testData/src/pkg/TestExtendsList.java create mode 100644 testData/src/pkg/TestMethodParameters.java diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index fc8b1c2..291c0e7 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -37,15 +37,11 @@ public class SingleClassesTest { assertTrue(tempDir.delete()); assertTrue(tempDir.mkdirs()); decompiler = new ConsoleDecompiler(new HashMap() {{ - boolean win = System.getProperty("os.name", "").startsWith("Windows"); put(IFernflowerPreferences.LOG_LEVEL, "warn"); - put(IFernflowerPreferences.RENAME_ENTITIES, "1"); - put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "1"); - put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "0"); - put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1"); - put(IFernflowerPreferences.LAMBDA_TO_ANONYMOUS_CLASS, "0"); - put(IFernflowerPreferences.USE_DEBUG_VAR_NAMES, "0"); - put(IFernflowerPreferences.NEW_LINE_SEPARATOR, (win ? "0" : "1")); + put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "1"); + put(IFernflowerPreferences.REMOVE_SYNTHETIC, "1"); + put(IFernflowerPreferences.REMOVE_BRIDGE, "1"); + put(IFernflowerPreferences.LITERALS_AS_IS, "1"); }}); } @@ -62,8 +58,14 @@ public class SingleClassesTest { @Test public void testClassSwitch() { doTest("TestClassSwitch"); } @Test public void testClassTypes() { doTest("TestClassTypes"); } @Test public void testClassVar() { doTest("TestClassVar"); } + @Test public void testDeprecations() { doTest("TestDeprecations"); } + @Test public void testExtendsList() { doTest("TestExtendsList"); } + @Test public void testMethodParameters() { doTest("TestMethodParameters"); } + @Test public void testCodeConstructs() { doTest("TestCodeConstructs"); } + @Test public void testConstants() { doTest("TestConstants"); } + //@Test public void testEnum() { doTest("TestEnum"); } - private void doTest(String testName) { + private void doTest(final String testName) { try { File testDataDir = new File("testData"); if (!isTestDataDir(testDataDir)) testDataDir = new File("community/plugins/java-decompiler/engine/testData"); @@ -73,6 +75,16 @@ public class SingleClassesTest { File classFile = new File(testDataDir, "/classes/pkg/" + testName + ".class"); assertTrue(classFile.isFile()); decompiler.addSpace(classFile, true); + File[] innerClasses = classFile.getParentFile().listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.matches(testName + "\\$.+\\.class"); + } + }); + for (File inner : innerClasses) { + decompiler.addSpace(inner, true); + } + decompiler.decompileContext(tempDir); File decompiledFile = new File(tempDir, testName + ".java"); diff --git a/testData/classes/pkg/TestCodeConstructs.class b/testData/classes/pkg/TestCodeConstructs.class new file mode 100644 index 0000000000000000000000000000000000000000..3a2777015a716c6a929fa7b43f0bad16f998952a GIT binary patch literal 661 zcmaJ<%TB^T6g@+M)=~vgQGDXNkSH5hN?d4SLSl5G(df$3jxdNV>BIP0nkXca_yK;D z@lGU0A#u@rr)TDzd(WNu_K~Fu=tp)K zY)g)T48{$NAa@<2a#ww+^4>Uvuj`jn=+UNipVkK+IRKxaJfJFr?n=x zsdcSk1&wdpGy^#jtKH_V!?0xzdm6Uc?}XgWo7Mlewb1(>3<`8RwOI@&%@`~6q{V_~PjP~UDI5f(WKOD2qF?vw0x`=m>xEy39kfL`0Od;2= vR3ROyS14V*Aa)(Up<0z5lBA$!wGKw+I?y{vJ<*xp^>uQPB4nEI7-qfzhjoVV literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestConstants$A.class b/testData/classes/pkg/TestConstants$A.class new file mode 100644 index 0000000000000000000000000000000000000000..1d81f91d6fde70abcd11c6bd01c637496a3f03cd GIT binary patch literal 293 zcmZWk%ZdU)46OKSbzPs})r-jL!MS)-1Q7&5@Sr~sr5Q$tj7<0VaeLSg*pCvk9#+Id zkyKJtQopzF9{>}y3_c9%1`R^-%5i21ov-2M#8(btmM~bx?A(-4*+rqS&r(%%-xagb zTt(GglBGwxiego@_tyDkBF?jTH~zCUXsZ9^90o7D{(?Y?+FHb>kBin3n$It`hm$>e zLhm_Zk;Jo)5(yUnEur=1J^%PB;*HYnc#9Op>% literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestConstants.class b/testData/classes/pkg/TestConstants.class new file mode 100644 index 0000000000000000000000000000000000000000..00c924aae6f81581b4aca3f100c67cd0ced44a88 GIT binary patch literal 1668 zcmai!+f&m(6vofCX^I8pCUR2|t#YT7n=mjqrL|ft1!+Y^eONHV1l!ahDZ^X%mwa-@ z2ghgs8GZE0`khqD8Xl6FoSff&=R4WW?&QaxuiuDhf!@a`OmCvJAEmcZdM8Mv1hwTX z%Q#7wrEMEFhDx~i1+}NEmhDK(*^}j(5r$tt$Z|r0Lg`shnkmMV0N3-do;L$8=A6;p-%z=Lvz6@4-TmoJ2lLU_Ov`lE1%=1P_s}j~{a^^{$eWf?s8tS(laf3rVkH+e-qrNa6fo}2Ald2_?E)A!FOo5sow>UD0~lmpW;pZ0eDp5G4KRd zaIv0A@RY*S;2DJz;8}%};5mio!3(t5?6(A7R(J)xs_+_kUE#;zl)@WcZ)_hrX7R;G z@DzAPCccpPj6~2=#2B`Mut6FYOY{uoA+LPEt3cIdsqXnlDF=zyy@~tzAwD@#KG-+r z_g#l?E7&*g_btL#2=-0*eXa0q2m2=dzG3)wf_+ndUmU&{!M{=!Gn4*7jKH76+tKpT6*84L)n^cN_HdovpfkN`~m(b zaZ)J-ahLgcZ)V;s`}O_t3E&KIhz8aIbOLM={0nWgyCgJ@j)#P1uNX0*)7OUYt7*#R zK&81b;ZsqS8QD`N`x+fCT% z*8@qe%s5%joJVM)6<~|7H+vo@f43Z7zt$@9=tUCU8N+2SSJtv6beF0R>4Y;!i2oD9 z0X+GH`jA{%D&7~gKgU4pO@M literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestDeprecations$ByComment.class b/testData/classes/pkg/TestDeprecations$ByComment.class new file mode 100644 index 0000000000000000000000000000000000000000..e5576181f2d44e85869cb1df1e00576f82400932 GIT binary patch literal 308 zcmZus%Syvg5IvK&iAkevr7jf;U9>LD#$|EQh#(YQSlr*FL%D5oQ*u+GpXEw$(GT#W zij#sM;tcaRXI{+L;d2k*7UuyPXnQ#I&?UGNZFF@iTi<*lg7smqG_Tt`{K%meyMunZJj3O1es0-xU zi%#JC%EZjQBo|$Q{DYc>YA9nhqK3E9sK3ljtbH}mk@lv_3db_mfr$iay@`C6t*JEQ zRx*6U>051dd?%1P=&N4m45*Ov^k5~|e&eG=a?2d(y2a&g02 W4xQ{bDqIxY!J)T<482|A4sw4nA8e@r literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestEnum$1.class b/testData/classes/pkg/TestEnum$1.class new file mode 100644 index 0000000000000000000000000000000000000000..163965a6acf0baea56fc331c52149931a010c3a7 GIT binary patch literal 363 zcmZvX!AiqG5QhIrV-sWAss};v;GsyXU@Um6NTF0HL@zD9Z`&oVCL75nzL%#$4?cho zCC*lbA};LCzcb(byYun6eg|-k!vHljJTyJ*6Y4igtMZm`)QO+OtB6velW0;FN+lh`SP4Zzi7Kh2*+B>VwehJq~Ys!opAQw_u_4)-RpN}gDW^Zo?Q-a7dzk? zS)H=BdH?+4gjS$8)&!5wI!A0cAG<&F@uteeU(92ZfQt_H5OVxBZLtct)jo-V{{^X_ BMQs28 literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestEnum$2.class b/testData/classes/pkg/TestEnum$2.class new file mode 100644 index 0000000000000000000000000000000000000000..25c051bd894374ba049f75c558128881093e8220 GIT binary patch literal 428 zcma)2!AiqG5Pg%bO&ilzs~5qG&_h%-Ry+t5DU=F@=%vMb+AcAgY)UrqzdQ*Z`~W{n zoUIB~FD~r7nKy6tE%WyN@(SP#+YTyd*l60=AXG166&IHT&kOFu$Iwqg75U>Lk5$wg z{iXJA31X1VC7~6>O5T*|ROXX#nlM8tq2d{dGtSCcHzraSLsh27#(@WiYL;Z0 z9j;|@m(5)Wv;Bc&={w3d8c3JUT=JM+fH!ZBgWfV)d P7H4hdj3@dvY<}Vg!;x5) literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestEnum.class b/testData/classes/pkg/TestEnum.class new file mode 100644 index 0000000000000000000000000000000000000000..397ff04ee01e9507ef1b0fb31fc75b882fd6cd7d GIT binary patch literal 1491 zcmZuxTXWK25IrA(B*gTVQtbUgQK7ZP-n12LsV!9$TSsa~#;24_Em{x&sQut^)^EQ=b=zHIu zLp;}uHC|#M676t$cgiOQMP*FO*sqn2jmn{ZTqKL+L>+u!2t_(8M%#<95`z$l9x;ds z(=zQ%hG3VtG)MTeX2H_!T7}9)x`DdXqp+baP@XRIre@h@$v85rCQ*N_SM-u$8^ z;NzRbNXeFKmAtWM@-_7QKZZqKNyUA{xL8mT;wL$);w3V4Os#jLB7#?REL$q3F{5G( z<8)fBi13n%32tSSXtL8yN5|$>OgWzG7CB)CU%ptjh*}^LZE5D<_|(YTM1QSyPR@D9 zTVU?RwnjRqo}8fyepu8l#hU(W%v=s9ndc6DMXt8 zlsbfO@Lt0AnVuN#krW-DK==rvS9p(ORWxz#JETj9op^>h%)5Bbkyl_}+S2wBF=3!ydUeYRsH7R)EE0p#^0XOmimIx`)s<2Gs z0Hs-RNlv+GBqxohJ%iwYS6%QlRrFCNnZOHOm(R zoYw1YqOXB|$1~v5G)mUM-~|FXZAjFDP26r^So%qULLF*0=dGhZoAcE%n9YfG3}+h< ruDJ%CN?!V=`Y=j6i$cLVH7299o1nWgmYGLTE&G8`8!jh;(DY?2?(#(> zk|2!cj3|pfp=oE*GmXDWZy$mQ*Dl^buY4gGZ1pv$Vvl#7 iQw!=zNmb}&i>JY4M8Q6@8#wrvUoZKGT(P;%Y<&YJ7I0qx literal 0 HcmV?d00001 diff --git a/testData/classes/pkg/TestMethodParameters$1Local.class b/testData/classes/pkg/TestMethodParameters$1Local.class new file mode 100644 index 0000000000000000000000000000000000000000..6ba8aed255a34fc0bd50c72b7ab9b1f95635a010 GIT binary patch literal 567 zcmZ{hT}uK%6o%i?)y-{7`_R^B}nsIP<` z_`O>ma8GCvgvV5MB9+vq4BOTDWvyC=!D#wD!H{lCC9cO_R|F5d>(WX2ZmhKQL`Q~_ z4!-ecO8J^=>8p?-*B)sy+j<}Q&weX+e{Rl!H zE|lZ?p;Z0pL?((hHc_&XK+=YZ62s2Cp(}@N-{CGpVy1RWDG@YX9)^OPW`2y`bce#x z4EcF1g1A#yyjtsEmp;Lu|6rL+L*CDUih? sMU$QdHYLCkmS@cc+C@0_wxQ)k6e5^aJ`) z(X2#Kj-2TQJ)0zEv4yt8g?me%kG$eDtA+DR7f3_DE|1C zKi4`k(x^x$0)^H{KFa!7>OuX2CNcG-p*|ZBAxj6d3GRI~jeB&dQq|Ibh7VE^4-3e8 za8Ptm64;)%UA1u}V5PxpYE5xtER%%Ti~nQgraPjZ5wL@F#o|0E?DBatd}-nP>2%I4 zehwBHbDUKeZAQ1Y{|r%kf%U|dfXgw<2xcvDba-KSoB+#M`D!k4mCA{~J?`%w3;7w- OM}g60B^&G51U>CC03?PSVK>i=>jxbO$~ zqr{soDy5pmIroN~FE{!6{`drNj=F~eYAym7n*!xarIoo7C^p+iJ+@XFlYrk*n(n7b zpR%s(k9p_dX{wD%sHbwp8;>%R2^q?+wN8yRD%H6_y)%@rG8{`i2ybYTQ6vq;7XnUl zYUND8drqfWM7PR98(qrH9hsLjo&)m}%c!D=Ef?DYyOYr%{OjCdi*b&XYFlf{T4R~# z#8U*nLp=0{6d8d+(>`wJKNR-i@UPfqwTKe;Wv=$XSFo3k-yz<(5O7(`>_80_R#$Md p!Uf>Xa}DlnZYkq0W-3@+$XM)BCRofksLtqX*kJc&6Z%+3{pdS^T zDKJEB;M~u5zBA|Z>-_`3DQaoNvCUE9D05U8VyzQ~Y+Gv?wmcC3BpeF>5b zvJ|h9R|EZ%taJ1R_DT-J8tEii+nOWI83lQAfb}V^Op(RSVVqe^3L7&RJ9Z9}oW%f} lC=jRJ&+;t9l!$(diZK*vTcASUOHkw>1x_|axfPN$@C~6+b%p={ literal 0 HcmV?d00001 diff --git a/testData/results/TestClassLambda.dec b/testData/results/TestClassLambda.dec index baf2cd7..6124268 100644 --- a/testData/results/TestClassLambda.dec +++ b/testData/results/TestClassLambda.dec @@ -65,7 +65,7 @@ public class TestClassLambda { return null; } - public static String function(Supplier var0) { + public static String function(Supplier var0) { return (String)var0.get(); } diff --git a/testData/results/TestCodeConstructs.dec b/testData/results/TestCodeConstructs.dec new file mode 100644 index 0000000..da9b30c --- /dev/null +++ b/testData/results/TestCodeConstructs.dec @@ -0,0 +1,17 @@ +package pkg; + + +class TestCodeConstructs { + + private int count = 0; + + + void expressions() { + (new String()).hashCode(); + } + + String fieldIncrement() { + int var1 = this.count++; + return "id:" + var1; + } +} diff --git a/testData/results/TestConstants.dec b/testData/results/TestConstants.dec new file mode 100644 index 0000000..275c1e4 --- /dev/null +++ b/testData/results/TestConstants.dec @@ -0,0 +1,76 @@ +package pkg; + +import java.util.Date; + +public class TestConstants { + + static final boolean T = true; + static final boolean F = false; + static final char C0 = '\n'; + static final char C1 = 'a'; + static final char C2 = 'Ȁ'; + static final byte BMin = -128; + static final byte BMax = 127; + static final short SMin = -32768; + static final short SMax = 32767; + static final int IMin = -2147483648; + static final int IMax = 2147483647; + static final long LMin = -9223372036854775808L; + static final long LMax = 9223372036854775807L; + static final float FNan = 0.0F / 0.0; + static final float FNeg = -1.0F / 0.0; + static final float FPos = 1.0F / 0.0; + static final float FMin = 1.4E-45F; + static final float FMax = 3.4028235E38F; + static final double DNan = 0.0D / 0.0; + static final double DNeg = -1.0D / 0.0; + static final double DPos = 1.0D / 0.0; + static final double DMin = 4.9E-324D; + static final double DMax = 1.7976931348623157E308D; + + + @TestConstants.A(byte.class) + void m1() { + } + + @TestConstants.A(char.class) + void m2() { + } + + @TestConstants.A(double.class) + void m3() { + } + + @TestConstants.A(float.class) + void m4() { + } + + @TestConstants.A(int.class) + void m5() { + } + + @TestConstants.A(long.class) + void m6() { + } + + @TestConstants.A(short.class) + void m7() { + } + + @TestConstants.A(boolean.class) + void m8() { + } + + @TestConstants.A(void.class) + void m9() { + } + + @TestConstants.A(Date.class) + void m10() { + } + + @interface A { + + Class value(); + } +} diff --git a/testData/results/TestDeprecations.dec b/testData/results/TestDeprecations.dec new file mode 100644 index 0000000..9dd5737 --- /dev/null +++ b/testData/results/TestDeprecations.dec @@ -0,0 +1,32 @@ +package pkg; + + +public class TestDeprecations { + + /** @deprecated */ + public int byComment; + /** @deprecated */ + @Deprecated + public int byAnno; + + + /** @deprecated */ + public void byComment() { + } + + /** @deprecated */ + @Deprecated + public void byAnno() { + } + + /** @deprecated */ + @Deprecated + public static class ByAnno { + + } + + /** @deprecated */ + public static class ByComment { + + } +} diff --git a/testData/results/TestEnum.dec b/testData/results/TestEnum.dec new file mode 100644 index 0000000..6aa64c7 --- /dev/null +++ b/testData/results/TestEnum.dec @@ -0,0 +1,30 @@ +package pkg; + + +public enum TestEnum { + + E1, + E2 { + public void m() { + } + }, + E3("-"), + E4("+") { + public void m() { + } + }; + private String s; + + + public void m() { + } + + private TestEnum() { + this((String)"?"); + } + + private TestEnum(@Deprecated String var3) { + this.s = var3; + } + +} diff --git a/testData/results/TestExtendsList.dec b/testData/results/TestExtendsList.dec new file mode 100644 index 0000000..133281e --- /dev/null +++ b/testData/results/TestExtendsList.dec @@ -0,0 +1,13 @@ +package pkg; + + +public class TestExtendsList { + + static > T m1(T var0) { + return null; + } + + static > T m2(T var0) { + return null; + } +} diff --git a/testData/results/TestMethodParameters.dec b/testData/results/TestMethodParameters.dec new file mode 100644 index 0000000..ff23e1c --- /dev/null +++ b/testData/results/TestMethodParameters.dec @@ -0,0 +1,47 @@ +package pkg; + + +public class TestMethodParameters { + + TestMethodParameters(@Deprecated int var1) { + } + + void m1(@Deprecated int var1) { + } + + static void m2(@Deprecated int var0) { + } + + void local() { + class Local { + + Local(@Deprecated int var2) { + } + + void m(@Deprecated int var1) { + } + } + + } + + static class C2 { + + C2(@Deprecated int var1) { + } + + void m1(@Deprecated int var1) { + } + + static void m2(@Deprecated int var0) { + } + } + + class C1 { + + C1(@Deprecated int var2) { + } + + void m(@Deprecated int var1) { + } + } +} diff --git a/testData/src/pkg/TestCodeConstructs.java b/testData/src/pkg/TestCodeConstructs.java new file mode 100644 index 0000000..3c0ad53 --- /dev/null +++ b/testData/src/pkg/TestCodeConstructs.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +class TestCodeConstructs { + void expressions() { + new String().hashCode(); + } + + private int count = 0; + String fieldIncrement() { + int id = count++; + return "id:" + id; + } +} \ No newline at end of file diff --git a/testData/src/pkg/TestConstants.java b/testData/src/pkg/TestConstants.java new file mode 100644 index 0000000..09b5419 --- /dev/null +++ b/testData/src/pkg/TestConstants.java @@ -0,0 +1,64 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestConstants { + static final boolean T = true; + static final boolean F = false; + + static final char C0 = '\n'; + static final char C1 = 'a'; + static final char C2 = 512; + + static final byte BMin = Byte.MIN_VALUE; + static final byte BMax = Byte.MAX_VALUE; + + static final short SMin = Short.MIN_VALUE; + static final short SMax = Short.MAX_VALUE; + + static final int IMin = Integer.MIN_VALUE; + static final int IMax = Integer.MAX_VALUE; + + static final long LMin = Long.MIN_VALUE; + static final long LMax = Long.MAX_VALUE; + + static final float FNan = Float.NaN; + static final float FNeg = Float.NEGATIVE_INFINITY; + static final float FPos = Float.POSITIVE_INFINITY; + static final float FMin = Float.MIN_VALUE; + static final float FMax = Float.MAX_VALUE; + + static final double DNan = Double.NaN; + static final double DNeg = Double.NEGATIVE_INFINITY; + static final double DPos = Double.POSITIVE_INFINITY; + static final double DMin = Double.MIN_VALUE; + static final double DMax = Double.MAX_VALUE; + + static @interface A { + Class value(); + } + + @A(byte.class) void m1() { } + @A(char.class) void m2() { } + @A(double.class) void m3() { } + @A(float.class) void m4() { } + @A(int.class) void m5() { } + @A(long.class) void m6() { } + @A(short.class) void m7() { } + @A(boolean.class) void m8() { } + @A(void.class) void m9() { } + @A(java.util.Date.class) void m10() { } +} \ No newline at end of file diff --git a/testData/src/pkg/TestDeprecations.java b/testData/src/pkg/TestDeprecations.java new file mode 100644 index 0000000..18ba0b5 --- /dev/null +++ b/testData/src/pkg/TestDeprecations.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestDeprecations { + /** @deprecated */ + public int byComment; + + @Deprecated + public int byAnno; + + /** @deprecated */ + public void byComment() { } + + @Deprecated + public void byAnno() { } + + /** @deprecated */ + public static class ByComment { } + + @Deprecated + public static class ByAnno { } +} \ No newline at end of file diff --git a/testData/src/pkg/TestEnum.java b/testData/src/pkg/TestEnum.java new file mode 100644 index 0000000..43fab48 --- /dev/null +++ b/testData/src/pkg/TestEnum.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public enum TestEnum { + E1, + E2() { + @Override + public void m() { } + }, + E3("-"), + E4("+") { + @Override + public void m() { } + }; + + public void m() { } + + private String s; + + private TestEnum() { this("?"); } + private TestEnum(@Deprecated String s) { this.s = s; } +} diff --git a/testData/src/pkg/TestExtendsList.java b/testData/src/pkg/TestExtendsList.java new file mode 100644 index 0000000..812f836 --- /dev/null +++ b/testData/src/pkg/TestExtendsList.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestExtendsList { + static > T m1(T t) { + return null; + } + + static > T m2(T t) { + return null; + } +} \ No newline at end of file diff --git a/testData/src/pkg/TestMethodParameters.java b/testData/src/pkg/TestMethodParameters.java new file mode 100644 index 0000000..b9739e9 --- /dev/null +++ b/testData/src/pkg/TestMethodParameters.java @@ -0,0 +1,40 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package pkg; + +public class TestMethodParameters { + TestMethodParameters(@Deprecated int p01) { } + void m1(@Deprecated int p02) { } + static void m2(@Deprecated int p03) { } + + class C1 { + C1(@Deprecated int p11) { } + void m(@Deprecated int p12) { } + } + + static class C2 { + C2(@Deprecated int p21) { } + void m1(@Deprecated int p22) { } + static void m2(@Deprecated int p23) { } + } + + void local() { + class Local { + Local(@Deprecated int p31) { } + void m(@Deprecated int p32) { } + } + } +} \ No newline at end of file