From 9b30f9f9d9e55ff51dc6c05ee88e00c1d84c8abf Mon Sep 17 00:00:00 2001 From: wisberg Date: Mon, 28 Apr 2003 20:08:56 +0000 Subject: [PATCH] test cases for binary warnings (bugs 37020, 37021, 37023) --- tests/ajcTestsFailing.xml | 112 ++++++++++++++++++ .../new/binaryWarnings/injars/app-ajc-1.1.jar | Bin 0 -> 1143 bytes .../binaryWarnings/injars/app-javac-1.4.jar | Bin 0 -> 1208 bytes tests/new/binaryWarnings/readme.txt | 43 +++++++ tests/new/binaryWarnings/src/app/Main.java | 55 +++++++++ .../src/aspects/MainWarnings.java | 56 +++++++++ 6 files changed, 266 insertions(+) create mode 100644 tests/new/binaryWarnings/injars/app-ajc-1.1.jar create mode 100644 tests/new/binaryWarnings/injars/app-javac-1.4.jar create mode 100644 tests/new/binaryWarnings/readme.txt create mode 100644 tests/new/binaryWarnings/src/app/Main.java create mode 100644 tests/new/binaryWarnings/src/aspects/MainWarnings.java diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 41665da25..711108e0a 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -4,7 +4,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/new/binaryWarnings/injars/app-ajc-1.1.jar b/tests/new/binaryWarnings/injars/app-ajc-1.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..c05b4224703bd87906bc275112d32ddceb7fc2ed GIT binary patch literal 1143 zcmWIWW@Zs#-~d9K*g1L(NPrK>PAn+U_f5>q(@V}tEH2Isj`bII6tTT5Ru(<2iIrnFu6-V3`FG(<%gb$U*8;c5G^Wy(^Wn`N^%x!$k&=>FrC@cAEsJt}_~{`b9qHS?~M zsFm;Yw0C!^&)I%I_wUc&$2^Wc$)OIWT2tT5N}MXn(fF?R@r4t&+;+~0y?@V~dtK9l zhO!4z>q2i7tPb0$A#mD!an1cn4HgPv>k^_^2fW}nfv+~7x6tcUNJteR$HK4+m&ws6Ptdoig~MLwRsH}%%L zb&;VLKF^o>@8>wbp(x{qX>o0Mg3{FeYsxiir@A@Yvnh2v-sMoePH}_&)m3u5<^{%0 zaVjS!*SrpSJ6BNj@R{VAq8z*n- zC}@fG<7VmVYtxJjW{@nqyh6-!#XPaIPnKp+(_)(V=jY@J$yE4)}E>L%v9r_ zfOyKOd9HgL)K)%X>}OvWd~w3(m-1XZW|?u@vber5YOr6%fs z*HP10uX83U`hlOO=+91UxkCUGwumqvuP7ivw5_Hzs_;a zw`E85=l`7;mHNL}eAlx~)m?|=HXogSe3`N0=YF}RjM^WLbjSSU4)A8@@Ly%4x`T;< z;Q$K*LjcY+&karU&X5GJ>wA{(V1mG$+|^6FjtN^RE#%BQ;`%5=rsMbZUx(DMdQJUa zG|8fZfnRl-uldcnH}}tc|Nd`dA7hM@Ys~t4hnNKKY_8zY7y5YdHcPr>npjDbW$?yR z&sg@}zAfD2S~P)A%OF=`g;3PKuBX51I8$~BJF0Nz+H<;Y5np-gcTq-)dZ}_m-9vNL z8@Hd#Yb#p$DK}R&#OBQ3i;c$)RSKy8Hi$ZNtmo*G|4wgDx-_4?n#SVx$H;N+%;0^N z86rYwA8q=|4)V8cl&8dgpszjyaey}?lL!MMw7_chz9^E-rZ>c literal 0 HcmV?d00001 diff --git a/tests/new/binaryWarnings/injars/app-javac-1.4.jar b/tests/new/binaryWarnings/injars/app-javac-1.4.jar new file mode 100644 index 0000000000000000000000000000000000000000..c163258972380a3cd1ac74aa04c6a9dbae8cfea0 GIT binary patch literal 1208 zcmWIWW@h1H00Ga~IeK6Qlwe_CVMr_}(EoRefgu2>N`!#}2+>t>166}mIqN0oBo-Iz z_8sIq=pf?y{&LvLMITwGMPxL|Zk!k)%6;kY7PX!b?a+Uxy^*G#Eso_=O``8(U0 zXI}rUV0v-5IAKBF;>5+C8vY@xx-<{IC~C=-{KKFJA`9(R3b*qT% zy!5?3L#(<~?M9=;+&?#GJXo{YTkiDEOSz?rA-C*1Ru?25Qi_Q0dGPX#zss)A;TIi` zvEI`7xcrNNd|Tw{H*IUIHdd8i==J3^%WoHzFtBiHo%_2v;HjH^;O|NA*aN)TIsUTu zW*q=}>oXAJ_BbEZXo!JSjS6PyHFjAWx&MW>u*b`zc) zCTuA2_;Ns-(UP|&sjKQ5_4pct$sa+&xz%B$@_VG%de%*|NQv+ z_h1IgHR=l#S06MJIJk$$Qnqqte&&wc4VLdVFEl)0*Aeloa?_l0uKK=Hy9@i=Q{+cGCZa`yX?C5!o~A z_m;@JWzza{-gapV{+$$jvq);5P5aRqmoC&X`U^j^9x z%G*ZAM!j0+I<}B^4ouAwO$QA8|TLa`Rbf4$G);_aHG-}(@r+RHUx6L^DE=F#NdSU7E z#be>p&P%dIeM;wMJTg+Baz?Yxct@vBnx4eg|DSGW{jA|K(bM%_EcHD72mhz3Ew83I zE$%FMsee9KD(lK3&)-c)T|5>}{>PINQ`%6mY5H|_!4{{E)w_C%xvu_V2Bm9NR-dJF zm>3u)v4GMwBNG<`?u-vi+(-aX3@|c@Fdzy7}{I0RU25(H;N* literal 0 HcmV?d00001 diff --git a/tests/new/binaryWarnings/readme.txt b/tests/new/binaryWarnings/readme.txt new file mode 100644 index 000000000..6b6eb486e --- /dev/null +++ b/tests/new/binaryWarnings/readme.txt @@ -0,0 +1,43 @@ + +Warning: brittle test! Change carefully and rebuild binaries! + +Bugs: 37020, 37021, 37023 + +- there are 3+ associated test specifications: + - source-only + - binary (javac) application, source aspect + - binary (ajc) application, source aspect + - binary (javac) application, binary aspect (todo) + - binary (ajc) application, binary aspect (todo) + +- the lines in Main.java correspond with + warning line values in the test specifications + +- the message text in MainWarnings.java correspond with + warning text values in the test specifications + +- all the warnings in MainWarnings.java + should resolve to unique lines + (until we verify based on more than line) + +- all test specifications should have exactly the same warnings + as each other as as specified in MainWarnings.java + +To build the injar sources from the src directory: + +Using javac: + mkdir classes + javac -d classes app/Main.java + jar cfM ../injars/app-javac-1.4.jar -C classes . + rm -rf classes + +Using ajc: + ajc -classpath ../../../lib/test/aspectjrt.jar \ + -outjar ../injars/app-ajc-1.1.jar app/Main.java + +Using ajc in eclipse, from a module directory: + + {ajc} -classpath ../lib/test/aspectjrt.jar + -outjar ../tests/new/binaryWarnings/injars/app-ajc-1.1.jar + ../test/new/binnaryWarnings/src/app/Main.java + diff --git a/tests/new/binaryWarnings/src/app/Main.java b/tests/new/binaryWarnings/src/app/Main.java new file mode 100644 index 000000000..a2daee1d9 --- /dev/null +++ b/tests/new/binaryWarnings/src/app/Main.java @@ -0,0 +1,55 @@ + +package app; +// WARNING: do not change lineation without changing test specification!! +public class Main { + + static String staticString = "hello"; + + String s = "me"; + + public static void main(String[] args) { + + String temp = staticString; // 12 + + staticString = temp + " world!"; // 14 + + Main main = new Main(); // 16 + + for (int i = 0; i < args.length; i++) { + main.go(args[i]); // 19 + } + } + + Main() { // 23 + } + + void go(String s) { // 26 + try { + + String temp = this.s; // 29 + + this.s = temp + ", " + s; // 31 + + } catch (RuntimeException e) { // 33 + + stop(); // 35 + + } + } + + void stop() { // 40 + + new Main(); // 42 + + } +} + + +class C { + + C() { // 50 + + } + +} + diff --git a/tests/new/binaryWarnings/src/aspects/MainWarnings.java b/tests/new/binaryWarnings/src/aspects/MainWarnings.java new file mode 100644 index 000000000..4debf1f3b --- /dev/null +++ b/tests/new/binaryWarnings/src/aspects/MainWarnings.java @@ -0,0 +1,56 @@ + +package aspects; + +import app.Main; + +// WARNING: do not change message text without changing test specification +public privileged aspect MainWarnings { + + declare warning : staticinitialization(Main) + : "staticinitializtion(Main)"; + + declare warning : initialization(Main.new()) + : "initialization(Main.new())"; + + declare warning : execution(Main.new()) + : "execution(Main.new())"; + + declare warning : execution(void Main.go(String)) + : "execution(void Main.go(String))"; + + declare warning : call(Main.new()) + : "call(Main.new())"; + + declare warning : call(void Main.go(String)) + : "call(void Main.go(String))"; + + declare warning : call(Main.new()) + && withincode(void Main.stop()) + : "call(Main.new()) && withincode(void Main.stop())"; + + declare warning : call(void Main.stop()) + && withincode(void Main.go(String)) + : "call(void Main.stop()) && withincode(void Main.go(String))"; + + declare warning : get(String Main.s) + : "get(String Main.s)"; + + declare warning : set(String Main.s) + : "set(String Main.s)"; + + declare warning : get(String Main.staticString) + : "get(String Main.staticString)"; + + declare warning : set(String Main.staticString) + : "set(String Main.staticString)"; + + declare warning : handler(RuntimeException) + && within(Main) + : "handler(RuntimeException) && within(Main)"; + + declare warning : preinitialization(app.C.new()) + : "preinitialization(app.C.new())"; + +// declare warning : adviceexecution() && within(app.AdvisingAspect) +// : "adviceexecution() && within(app.AdvisingAspect)"; +} \ No newline at end of file -- 2.39.5