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.

Ajc152Tests.java 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. /*******************************************************************************
  2. * Copyright (c) 2006 IBM
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *
  8. * Contributors:
  9. * Andy Clement - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc152;
  12. import java.net.URL;
  13. import java.util.List;
  14. import org.aspectj.asm.AsmManager;
  15. import org.aspectj.asm.IHierarchy;
  16. import org.aspectj.asm.IProgramElement;
  17. import org.aspectj.asm.internal.CharOperation;
  18. import org.aspectj.testing.XMLBasedAjcTestCase;
  19. import junit.framework.Test;
  20. public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
  21. // public void testCovarianceAndDecp_pr128443_1() { runTest("covariance and decp - 1"); }
  22. // public void testSuperITDExplosion_pr134425() { runTest("super ITDs");}
  23. // public void testMisbehavingDeclareAnnotation_pr135865() { runTest("misbehaving declare annotation");}
  24. // public void testMisbehavingDeclareAnnotation_pr135865_2() { runTest("misbehaving declare annotation - 2");}
  25. // public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");}
  26. // tests added post 152rc1 and before final
  27. public void testSeparateCallAspectOf_pr148727() {
  28. runTest("separate compilation calling aspectOf and hasAspect");
  29. }
  30. public void testIntegratedCallAspectOf_pr148727() {
  31. runTest("integrated compilation calling aspectOf and hasAspect");
  32. }
  33. public void testFreakyNewArrayJoinpoint_pr148786() {
  34. runTest("freaky new array joinpoint");
  35. }
  36. // tests adding during 152 development
  37. public void testPrivilegeGeneric_pr148545() {
  38. runTest("nosuchmethoderror for privileged aspect");
  39. }
  40. public void testPrivilegeGeneric_pr148545_2() {
  41. runTest("nosuchmethoderror for privileged aspect - 2");
  42. }
  43. public void testUnknownAnnotationNPE() {
  44. runTest("NPE for unknown annotation");
  45. }
  46. public void testDuplicateBridgeMethods_pr147801_1() {
  47. runTest("duplicate bridge methods");
  48. }
  49. public void testPackageIgnoredForException_pr147701_1() {
  50. runTest("package for exception ignored");
  51. }
  52. public void testPackageIgnoredForException_pr147701_2() {
  53. runTest("package for exception ignored - 2");
  54. }
  55. public void testPackageIgnoredForException_pr147701_3() {
  56. runTest("package for exception ignored - 3");
  57. }
  58. public void testBrokenAddSerialVersionUID_pr145950() {
  59. runTest("fails to discover Serializable");
  60. }
  61. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_1() {
  62. runTest("no unnecessary declaration of thrown exception warning - 1");
  63. }
  64. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_2() {
  65. runTest("no unnecessary declaration of thrown exception warning - 2");
  66. }
  67. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_3() {
  68. runTest("no unnecessary declaration of thrown exception warning - 3");
  69. }
  70. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_4() {
  71. runTest("no unnecessary declaration of thrown exception warning - 4");
  72. }
  73. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_5() {
  74. runTest("no unnecessary declaration of thrown exception warning - 5");
  75. }
  76. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_6() {
  77. runTest("no unnecessary declaration of thrown exception warning - 6");
  78. }
  79. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_7() {
  80. runTest("no unnecessary declaration of thrown exception warning - 7");
  81. }
  82. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_8() {
  83. runTest("no unnecessary declaration of thrown exception warning - 8");
  84. }
  85. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_9() {
  86. runTest("no unnecessary declaration of thrown exception warning - 9");
  87. }
  88. public void testNoUnnecessaryDeclarationOfThrownExcp_pr129282_10() {
  89. runTest("no unnecessary declaration of thrown exception warning - 10");
  90. }
  91. public void testAtAJVerificationError_pr144602() {
  92. runTest("atAJ perthis aspect verification error");
  93. }
  94. public void testLTWAndGeneratingSUID_pr144465() {
  95. runTest("ltw with serialversionUID creation");
  96. }
  97. public void testAspects14PerSingleton_pr122253() {
  98. runTest("aspects14 - persingleton");
  99. }
  100. public void testAspects14PerCflow_pr122253() {
  101. runTest("aspects14 - percflow");
  102. }
  103. public void testAspects14PerThis_pr122253() {
  104. runTest("aspects14 - perthis");
  105. }
  106. public void testAspects14PerTypeWithin_pr122253() {
  107. runTest("aspects14 - pertypewithin");
  108. }
  109. public void testFunkyGenericErrorWithITDs_pr126355() {
  110. runTest("bizarre generic error with itds");
  111. }
  112. public void testConcretizingAbstractMethods_pr142466() {
  113. runTest("aop.xml aspect inheriting but not concretizing abstract method");
  114. }
  115. public void testConcretizingAbstractMethods_pr142466_2() {
  116. runTest("aop.xml aspect inheriting but not concretizing abstract method - 2");
  117. }
  118. public void testComplexGenericDecl_pr137568() {
  119. runTest("complicated generics declaration");
  120. }
  121. public void testItdOnInnerTypeOfGenericType_pr132349() {
  122. runTest("ITD on inner type of generic type");
  123. }
  124. public void testItdOnInnerTypeOfGenericType_pr132349_2() {
  125. runTest("ITD on inner type of generic type - 2");
  126. }
  127. public void testItdOnInnerTypeOfGenericType_pr132349_3() {
  128. runTest("ITD on inner type of generic type - 3");
  129. }
  130. public void testLTWGeneratedAspectAbstractMethod_pr125480() {
  131. runTest("aop.xml aspect inheriting abstract method");
  132. }
  133. public void testLTWGeneratedAspectAbstractMethod_pr125480_2() {
  134. runTest("aop.xml aspect inheriting abstract method - code style");
  135. }
  136. public void testCompletelyBrokenAopConcretization_pr142165_1() {
  137. runTest("broken concretization");
  138. }
  139. public void testCompletelyBrokenAopConcretization_pr142165_2() {
  140. runTest("broken concretization - 2");
  141. }
  142. public void testCompletelyBrokenAopConcretization_pr142165_3() {
  143. runTest("broken concretization - 3");
  144. }
  145. // public void testVerifyErrorLTW_pr135068() { runTest("ltw verifyerror");}
  146. // public void testVerifyErrorLTW_pr135068_2() { runTest("ltw verifyerror - 2");}
  147. // public void testVerifyErrorLTW_pr135068_3() { runTest("ltw verifyerror - 3");}
  148. public void testVerifyErrorLTW_pr135068_4() {
  149. runTest("ltw verifyerror - 4");
  150. }
  151. public void testVerifyErrorForComplexCflow_pr136026() {
  152. runTest("verifyerror");
  153. }
  154. public void testVerifyErrorForComplexCflow_pr136026_2() {
  155. runTest("verifyerror - 2");
  156. }
  157. public void testAnnotationsAndGenericsBCException_pr129704() {
  158. runTest("annotations and generics leading to BCException");
  159. }
  160. public void testMethodTooBigAfterWeaving_pr138384() {
  161. runTest("method too big");
  162. }
  163. public void testNotAtWithincode_pr138158_1() {
  164. runTest("not at withincode - 1");
  165. }
  166. public void testNotAtWithincode_pr138158_2() {
  167. runTest("not at withincode - 2");
  168. }
  169. public void testNotAtWithincode_pr138158_3() {
  170. runTest("not at within - 3");
  171. }
  172. public void testNpeOnDup_pr138143() {
  173. runTest("npe on duplicate method with ataj");
  174. }
  175. public void testPointcutsAndGenerics_pr137496_1() {
  176. runTest("pointcuts and generics - B");
  177. }
  178. public void testPointcutsAndGenerics_pr137496_2() {
  179. runTest("pointcuts and generics - D");
  180. }
  181. public void testPointcutsAndGenerics_pr137496_3() {
  182. runTest("pointcuts and generics - E");
  183. }
  184. public void testPointcutsAndGenerics_pr137496_4() {
  185. runTest("pointcuts and generics - F");
  186. }
  187. public void testPointcutsAndGenerics_pr137496_5() {
  188. runTest("pointcuts and generics - G");
  189. }
  190. public void testPointcutsAndGenerics_pr137496_6() {
  191. runTest("pointcuts and generics - H");
  192. }
  193. public void testAspectLibrariesAndASM_pr135001() {
  194. runTest("aspect libraries and asm");
  195. }
  196. public void testStackOverflow_pr136258() {
  197. runTest("stack overflow");
  198. }
  199. public void testIncorrectOverridesEvaluation13() {
  200. runTest("incorrect overrides evaluation - 1.3");
  201. }
  202. public void testIncorrectOverridesEvaluation15() {
  203. runTest("incorrect overrides evaluation - 1.5");
  204. }
  205. public void testAtWithinCodeBug_pr138798() {
  206. runTest("atWithinCodeBug");
  207. }
  208. public void testReferencePCutInDeclareWarning_pr138215() {
  209. runTest("Reference pointcut fails inside @DeclareWarning");
  210. }
  211. public void testReferencePCutInPerClause_pr138219() {
  212. runTest("Can't use a FQ Reference pointcut in any pointcut expression referenced by a per-clause");
  213. }
  214. public void testReferencePCutInPerClause_pr130722() {
  215. runTest("FQ Reference pointcut from perclause ref pc");
  216. }
  217. public void testDoubleAnnotationMatching_pr138223() {
  218. runTest("Double at annotation matching (no binding)");
  219. }
  220. public void testSuperCallsInAtAspectJAdvice_pr139749() {
  221. runTest("Super calls in @AspectJ advice");
  222. }
  223. public void testNoClassCastExceptionWithPerThis_pr138286() {
  224. runTest("No ClassCastException with perThis");
  225. }
  226. public void testGenericAspectHierarchyWithBounds_pr147845() {
  227. runTest("Generic abstract aspect hierarchy with bounds");
  228. }
  229. public void testJRockitBooleanReturn_pr148007() {
  230. runTest("jrockit boolean fun");
  231. }
  232. public void testJRockitBooleanReturn2_pr148007() {
  233. runTest("jrockit boolean fun (no aspects)");
  234. }
  235. public void testSyntheticAjcMembers_pr147711() {
  236. runTest("synthetic ajc$ members");
  237. }
  238. // this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
  239. // public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}
  240. public void testJarChecking_pr137235_1() {
  241. runTest("directory with .jar extension: source and outjar");
  242. }
  243. public void testJarChecking_pr137235_2() {
  244. runTest("directory with .jar extension");
  245. }
  246. public void testMakePreMethodNPE_pr136393() {
  247. runTest("NPE in makePreMethod");
  248. }
  249. public void testGetParameterSignatures_pr141730() {
  250. runTest("new iprogramelement method getParameterSignatures");
  251. checkGetParamSigOfMethod("stringMethod(java.lang.String)", "Ljava/lang/String;");
  252. checkGetParamSigOfMethod("main(java.lang.String[])", "[Ljava/lang/String;");
  253. checkGetParamSigOfMethod("multiMethod(java.lang.String[][])", "[[Ljava/lang/String;");
  254. }
  255. public void testGetParameterSignaturesWithGenerics_pr141730() {
  256. runTest("new iprogramelement method getParameterSignatures with generics");
  257. checkGetParamSigOfMethod("genericMethod(java.util.List<java.lang.String>)", "Ljava/util/List<Ljava/lang/String;>;");
  258. checkGetParamSigOfMethod("genericMethod2(MyGenericClass<java.lang.String,MyClass>)",
  259. "LMyGenericClass<Ljava/lang/String;LMyClass;>;");
  260. }
  261. // public void testFunkyGenericErrorWithITDs_pr126355_2() {
  262. // runTest("bizarre generic error with itds - 2");
  263. // // public class Pair<F,S> affected by pertarget aspect
  264. // GenericsTests.verifyClassSignature(ajc,"Pair","<F:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;LIdempotentCache$ajcMightHaveAspect;;");
  265. // }
  266. public void testNoAspects() {
  267. // setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
  268. runTest("Ensure no weaving without included aspects");
  269. }
  270. public void testWeaveinfoMessages() {
  271. runTest("weaveinfo messages with include and exclude");
  272. }
  273. // tests that can't be included for some reason
  274. // Not valid whilst the ajc compiler forces debug on (ignores -g:none) - it will be green but is invalid, trust me
  275. // public void testLongWindedMessages_pr129408() { runTest("long winded ataj messages");}
  276. // ---------------- helper methods ---------------
  277. private void checkGetParamSigOfMethod(String ipeLabel, String expectedParm) {
  278. IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
  279. IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, ipeLabel);
  280. assertNotNull("Couldn't find '" + ipeLabel + "' element in the tree", ipe);
  281. List<char[]> l = ipe.getParameterSignatures();
  282. boolean eq = CharOperation.equals((l.get(0)), expectedParm.toCharArray());
  283. assertTrue("expected parameter to be '" + expectedParm + "' but found '" + new String((l.get(0))) + "'", eq);
  284. }
  285. // ///////////////////////////////////////
  286. public static Test suite() {
  287. return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
  288. }
  289. protected URL getSpecFile() {
  290. return getClassResource("ajc152.xml");
  291. }
  292. }