You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

newarray_joinpoint.xml 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
  2. <!-- AspectJ v1.5.1 Tests -->
  3. <suite>
  4. <ajc-test dir="features151/newarrayjoinpoint" title="basics">
  5. <compile files="One.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction">
  6. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'One' (One.java:4) advised by before advice from 'X' (One.java:9)"/>
  7. </compile>
  8. <run class="One">
  9. <stderr>
  10. <line text="advice running"/>
  11. </stderr>
  12. </run>
  13. </ajc-test>
  14. <ajc-test dir="features151/newarrayjoinpoint" title="basics - 2">
  15. <compile files="Two.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction">
  16. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'Two' (Two.java:4) advised by before advice from 'X' (Two.java:9)"/>
  17. </compile>
  18. <run class="Two">
  19. <stderr>
  20. <line text="advice running"/>
  21. </stderr>
  22. </run>
  23. </ajc-test>
  24. <ajc-test dir="features151/newarrayjoinpoint" title="shouldnt match">
  25. <compile files="Three.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction">
  26. <message kind="warning" line="9" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  27. <message kind="warning" line="10" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  28. <message kind="warning" line="11" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  29. <message kind="warning" line="12" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  30. </compile>
  31. </ajc-test>
  32. <ajc-test dir="features151/newarrayjoinpoint" title="thisjoinpoint">
  33. <compile files="Four.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction">
  34. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'Four' (Four.java:4) advised by before advice from 'X' (Four.java:10)"/>
  35. <message kind="weave" text="Join point 'constructor-call(void Foo.&lt;init&gt;(int))' in Type 'Four' (Four.java:5) advised by before advice from 'X' (Four.java:13)"/>
  36. </compile>
  37. <run class="Four">
  38. <stderr>
  39. <line text="tjp1=>call(java.lang.Integer[](int))"/>
  40. <line text="tjp2=>call(Foo(int))"/>
  41. </stderr>
  42. </run>
  43. </ajc-test>
  44. <ajc-test dir="features151/newarrayjoinpoint" title="different advice kinds">
  45. <compile files="Five.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction">
  46. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'Five' (Five.java:4) advised by around advice from 'Z' (Five.java:16)"/>
  47. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'Five' (Five.java:4) advised by after advice from 'Y' (Five.java:12)"/>
  48. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'Five' (Five.java:4) advised by afterReturning advice from 'Y' (Five.java:13)"/>
  49. <message kind="weave" text="Join point 'constructor-call(void java.lang.Integer[].&lt;init&gt;(int))' in Type 'Five' (Five.java:4) advised by before advice from 'X' (Five.java:9)"/>
  50. </compile>
  51. <run class="Five">
  52. <stderr>
  53. <line text="before"/>
  54. <line text="around!"/>
  55. <line text="after"/>
  56. <line text="after returning"/>
  57. </stderr>
  58. </run>
  59. </ajc-test>
  60. <ajc-test dir="features151/newarrayjoinpoint" title="args">
  61. <compile files="Six.java" options="-1.5 -Xjoinpoints:arrayconstruction"/>
  62. <run class="Six">
  63. <stderr>
  64. <line text="Array size = 5"/>
  65. </stderr>
  66. </run>
  67. </ajc-test>
  68. <ajc-test dir="features151/newarrayjoinpoint" title="basic primitive array creation">
  69. <compile files="Seven.java" options="-1.5 -Xjoinpoints:arrayconstruction"/>
  70. <run class="Seven">
  71. <stderr>
  72. <line text="advice running"/>
  73. </stderr>
  74. </run>
  75. </ajc-test>
  76. <ajc-test dir="features151/newarrayjoinpoint" title="multi dimensional array creation">
  77. <compile files="Eight.java" options="-1.5 -Xjoinpoints:arrayconstruction"/>
  78. <run class="Eight">
  79. <stderr>
  80. <line text="advice running 2"/>
  81. <line text="advice running 1"/>
  82. </stderr>
  83. </run>
  84. </ajc-test>
  85. <ajc-test dir="features151/newarrayjoinpoint" title="multi dimensional array args">
  86. <compile files="Nine.java" options="-1.5 -Xjoinpoints:arrayconstruction"/>
  87. <run class="Nine">
  88. <stderr>
  89. <line text="advice running 2 (5,6)"/>
  90. <line text="advice running 1 (2,4)"/>
  91. </stderr>
  92. </run>
  93. </ajc-test>
  94. <ajc-test dir="features151/newarrayjoinpoint" title="using target and after returning">
  95. <compile files="Ten.java" options="-1.5 -showWeaveInfo -Xjoinpoints:arrayconstruction">
  96. <message kind="warning" line="13" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  97. <message kind="warning" line="17" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  98. <message kind="weave" text="Join point 'constructor-call(void Ten.&lt;init&gt;())' in Type 'Ten' (Ten.java:4) advised by afterReturning advice from 'X' (Ten.java:21)"/>
  99. <message kind="weave" text="Join point 'constructor-call(void int[].&lt;init&gt;(int))' in Type 'Ten' (Ten.java:5) advised by afterReturning advice from 'X' (Ten.java:21)"/>
  100. </compile>
  101. <run class="Ten">
  102. <stderr>
  103. <line text="afterReturning class Ten"/>
  104. <line text="afterReturning class [I"/>
  105. </stderr>
  106. </run>
  107. </ajc-test>
  108. <ajc-test dir="features151/newarrayjoinpoint" title="using it for real">
  109. <compile files="Eleven.java" options="-1.5 -Xjoinpoints:arrayconstruction">
  110. <!--message kind="weave" text="Join point 'constructor-call(void Ten.&lt;init&gt;())' in Type 'Ten' (Ten.java:4) advised by afterReturning advice from 'X' (Ten.java:21)"/>
  111. <message kind="weave" text="Join point 'constructor-call(void int[].&lt;init&gt;(int))' in Type 'Ten' (Ten.java:5) advised by afterReturning advice from 'X' (Ten.java:21)"/-->
  112. </compile>
  113. <run class="Eleven">
  114. <stderr>
  115. <line text="Found the interesting array"/>
  116. </stderr>
  117. </run>
  118. </ajc-test>
  119. <ajc-test dir="features151/newarrayjoinpoint" title="differentiating array types">
  120. <compile files="Twelve.java" options="-1.5 -Xjoinpoints:arrayconstruction"/>
  121. <run class="Twelve">
  122. <stderr>
  123. <line text="It is class [I"/>
  124. <line text="Is it an array? true"/>
  125. <line text="Component type is int"/>
  126. <line text="--"/>
  127. <line text="It is class [Ljava.lang.Integer;"/>
  128. <line text="Is it an array? true"/>
  129. <line text="Component type is class java.lang.Integer"/>
  130. <line text="--"/>
  131. <line text="It is class [[Ljava.lang.String;"/>
  132. <line text="Is it an array? true"/>
  133. <line text="Component type is class [Ljava.lang.String;"/>
  134. <line text="--"/>
  135. </stderr>
  136. </run>
  137. </ajc-test>
  138. <ajc-test dir="features151/newarrayjoinpoint" title="structure model">
  139. <compile files="Five.java" options="-1.5 -emacssym -Xjoinpoints:arrayconstruction"/>
  140. </ajc-test>
  141. <ajc-test dir="features151/newarrayjoinpoint" title="option deactivated - no match expected">
  142. <compile files="One.java" options="-1.5 -showWeaveInfo">
  143. <message kind="warning" line="9" text="advice defined in X has not been applied [Xlint:adviceDidNotMatch]"/>
  144. <message kind="warning" line="9" text="There are no join points for array construction unless -Xjoinpoints:arrayconstruction is specified"/>
  145. </compile>
  146. </ajc-test>
  147. </suite>