From 5795c1d9e0076e1732df1b9673e69e2ec39dec47 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 4 Mar 2016 15:32:42 +0100 Subject: [PATCH] [tests] test cases added --- .../java/decompiler/SingleClassesTest.java | 1 + .../classes/pkg/TestMemberAnnotations$A.class | Bin 0 -> 438 bytes .../classes/pkg/TestMemberAnnotations.class | Bin 0 -> 619 bytes testData/results/TestMemberAnnotations.dec | 34 ++++++++++++++++++ testData/src/pkg/TestMemberAnnotations.java | 13 +++++++ 5 files changed, 48 insertions(+) create mode 100644 testData/classes/pkg/TestMemberAnnotations$A.class create mode 100644 testData/classes/pkg/TestMemberAnnotations.class create mode 100644 testData/results/TestMemberAnnotations.dec create mode 100644 testData/src/pkg/TestMemberAnnotations.java diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index e3a6f56..5647ab8 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -81,6 +81,7 @@ public class SingleClassesTest { @Test public void testJava9StringConcat() { doTest("java9/TestJava9StringConcat"); } @Test public void testMethodReferenceSameName() { doTest("pkg/TestMethodReferenceSameName"); } @Test public void testMethodReferenceLetterClass() { doTest("pkg/TestMethodReferenceLetterClass"); } + @Test public void testMemberAnnotations() { doTest("pkg/TestMemberAnnotations"); } protected void doTest(String testFile, String... companionFiles) { ConsoleDecompiler decompiler = fixture.getDecompiler(); diff --git a/testData/classes/pkg/TestMemberAnnotations$A.class b/testData/classes/pkg/TestMemberAnnotations$A.class new file mode 100644 index 0000000000000000000000000000000000000000..f7fa7905d1df87219b377e5d8ec65948f42139ea GIT binary patch literal 438 zcmah_yG{c!5S+~eha*4&p#Taf&xN}~SB zNd_EPYBDGJ@jsTw%$muY7}enEe$?yVD0B#i^Vc-_wX2gZfdtK-bDUpU?LB)!s~r7d zJmrZ@c~nX(y_NmTXn&@}%NfDRRjuGk+Hh3+B(!7U)78mSZOtx0;T5TL$BIWp*>UmjtYK( zyR{>V51kNW*9p_)j`^Kd{;fdjSQ~9m1mgSUwm_mjxFvJ8sf{|1oLEcJj=+AS%-&Lg zvQc0JcEf|D8x6@5ohO znqKvybFaFbsQ52^w}vgQKfx`=P(TJ*#@wiyg2y-oZk%T(#4I7YvzP$p2*7nmXpvco zQ7|SeuMp2n1eSQGz8^;_%QSV=9aiphu2^|N>?U8id79vRlWr?mCB<_VKaCYAvBtL; Oiby*#LP;8=_A*}twS2Px literal 0 HcmV?d00001 diff --git a/testData/results/TestMemberAnnotations.dec b/testData/results/TestMemberAnnotations.dec new file mode 100644 index 0000000..1e3a41c --- /dev/null +++ b/testData/results/TestMemberAnnotations.dec @@ -0,0 +1,34 @@ +package pkg; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +class TestMemberAnnotations { + @TestMemberAnnotations.A("const") + public static final int CONST = 42; + @TestMemberAnnotations.A("field") + private int f; + + @TestMemberAnnotations.A("return") + private int f(@TestMemberAnnotations.A("arg") int var1) { + return var1 + this.f + 42;// 12 + } + + @Retention(RetentionPolicy.RUNTIME) + @interface A { + String value() default ""; + } +} + +class 'pkg/TestMemberAnnotations' { + method 'f (I)I' { + 2 13 + 5 13 + 6 13 + 8 13 + 9 13 + } +} + +Lines mapping: +12 <-> 14 diff --git a/testData/src/pkg/TestMemberAnnotations.java b/testData/src/pkg/TestMemberAnnotations.java new file mode 100644 index 0000000..b7c7da9 --- /dev/null +++ b/testData/src/pkg/TestMemberAnnotations.java @@ -0,0 +1,13 @@ +package pkg; + +import java.lang.annotation.*; + +class TestMemberAnnotations { + @Retention(RetentionPolicy.RUNTIME) + @interface A { String value() default ""; } + + @A("const") public static final int CONST = 42; + @A("field") private int f; + + @A("return") private int f(@A("arg") int i) { return i + f + CONST; } +} \ No newline at end of file