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.

Ajc153Tests.java 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * Andy Clement - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc153;
  12. import java.io.File;
  13. import junit.framework.Test;
  14. import org.aspectj.asm.AsmManager;
  15. import org.aspectj.asm.IHierarchy;
  16. import org.aspectj.asm.IProgramElement;
  17. import org.aspectj.testing.Utils;
  18. import org.aspectj.testing.XMLBasedAjcTestCase;
  19. import org.aspectj.weaver.bcel.Utility;
  20. public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
  21. //public void testGenericsProblem_pr151978() { runTest("generics problem");}
  22. // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");}
  23. // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); }
  24. // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
  25. // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");}
  26. public void testNoNPEDueToMissingType_pr149908() { runTest("ensure no npe due to missing type");}
  27. public void testNoNPEDueToMember_pr149908() { runTest("ensure no npe due to missing member");}
  28. public void testPTWgetWithinTypeName_pr123423_1() { runTest("basic usage of getWithinTypeName");}
  29. public void testPTWgetWithinTypeName_pr123423_2() { runTest("basic usage of getWithinTypeName - multiple types");}
  30. public void testPTWgetWithinTypeName_pr123423_3() { runTest("basic usage of getWithinTypeName - non matching types");}
  31. public void testPTWgetWithinTypeName_pr123423_4() { runTest("basic usage of getWithinTypeName - types in packages");}
  32. public void testPTWgetWithinTypeName_pr123423_5() { runTest("basic usage of getWithinTypeName - annotation style");}
  33. public void testTurningOffBcelCaching_pr160674() { runTest("turning off bcel caching");}
  34. public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); }
  35. public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058_2() { runTest("no IllegalStateException with generic inner aspect - 2"); }
  36. public void testDeclareMethodAnnotations_pr159143() { runTest("declare method annotations");}
  37. public void testVisibilityProblem_pr149071() { runTest("visibility problem");}
  38. public void testMissingLineNumbersInStacktraceAfter_pr145442() { runTest("missing line numbers in stacktrace after");}
  39. public void testMissingLineNumbersInStacktraceAround_pr145442() { runTest("missing line numbers in stacktrace around");}
  40. public void testGenericArrays_pr158624() { runTest("generics and arrays"); }
  41. public void testMissingLineNumbersInStacktraceBefore_pr145442() { runTest("missing line numbers in stacktrace before");}
  42. public void testMissingLineNumbersInStacktraceBefore_pr145442_Binary() { runTest("missing line numbers in stacktrace before - binary");}
  43. public void testAnnotationStylePointcutNPE_pr158412() { runTest("annotation style pointcut npe"); }
  44. public void testAnnotationStylePointcutNPE_pr158412_2() { runTest("annotation style pointcut npe - 2"); }
  45. public void testAnnotationsCallConstructors_pr158126() { runTest("annotations, call and constructors problem");}
  46. public void testIllegalStateExceptionGenerics_pr153845() { runTest("IllegalStateException at GenericSignatureParser.java"); }
  47. public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_1() { runTest("no illegal state exception from AsmDelegate - 1");}
  48. public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_2() { runTest("no illegal state exception from AsmDelegate - 2");}
  49. public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_3() { runTest("no illegal state exception from AsmDelegate - 3");}
  50. public void testAnnotMethod_pr156962() { runTest("Test Annot Method");}
  51. public void testAnnotMethodHasMember_pr156962() { runTest("Test Annot Method Has Member"); }
  52. public void testMixingGenerics_pr152848() { runTest("mixing generics"); }
  53. public void testIncorrectStaticinitializationWeaving_pr149560_1() { runTest("incorrect staticinitialization weaving - codestyle");}
  54. public void testIncorrectStaticinitializationWeaving_pr149560_2() { runTest("incorrect staticinitialization weaving - annstyle");}
  55. public void testIncorrectDeprecatedAnnotationProcessing_pr154332() { runTest("incorrect deprecated annotation processing");}
  56. public void testPipeliningProblemWithAnnotationsDecp_pr153380_1() { runTest("pipelining decps");}
  57. public void testUnwantedPointcutWarning_pr148219() { runTest("unwanted warning for pointcut");}
  58. public void testDecpAndCflowadderMungerClash_pr152631() { runTest("decp and cflowadder munger clash");}
  59. public void testGenericInheritanceDecp_pr150095() { runTest("generics, inheritance and decp");}
  60. public void testIllegalStateException_pr148737() { runTest("illegalstateexception for non generic type");}
  61. public void testAtajInheritance_pr149305_1() { runTest("ataj inheritance - 1");}
  62. public void testAtajInheritance_pr149305_2() { runTest("ataj inheritance - 2");}
  63. public void testAtajInheritance_pr149305_3() { runTest("ataj inheritance - 3");}
  64. public void testVerificationFailureForAspectOf_pr148693() {
  65. runTest("verification problem"); // build the code
  66. Utils.verifyClass(ajc,"mypackage.MyAspect"); // verify it <<< BRAND NEW VERIFY UTILITY FOR EVERYONE TO TRY ;)
  67. }
  68. public void testIncorrectAnnotationValue_pr148537() { runTest("incorrect annotation value");}
  69. public void testVerifyErrNoTypeCflowField_pr145693_1() { runTest("verifyErrNoTypeCflowField"); }
  70. public void testVerifyErrInpathNoTypeCflowField_pr145693_2() { runTest("verifyErrInpathNoTypeCflowField"); }
  71. public void testCpathNoTypeCflowField_pr145693_3() { runTest("cpathNoTypeCflowField"); }
  72. // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");}
  73. public void testGenericSignatures_pr148409() { runTest("generic signature problem"); }
  74. // public void testBrokenIfArgsCflowAtAj_pr145018() { runTest("ataj crashing with cflow, if and args");}
  75. public void testCantFindType_pr149322_01() {runTest("can't find type on interface call 1");}
  76. public void testCantFindType_pr149322_02() {runTest("can't find type on interface call 2");}
  77. public void testCantFindType_pr149322_03() {runTest("can't find type on interface call 3");}
  78. public void testParsingBytecodeLess_pr152871() {
  79. Utility.testingParseCounter=0;
  80. runTest("parsing bytecode less");
  81. assertTrue("Should have called parse 5 times, not "+Utility.testingParseCounter+" times",Utility.testingParseCounter==5);
  82. // 5 means:
  83. // (1)=registerAspect
  84. // (2,3)=checkingIfShouldWeave,AcceptingResult for class
  85. // (4,5)=checkingIfShouldWeave,AcceptingResult for aspect
  86. }
  87. public void testMatchVolatileField_pr150671() {runTest("match volatile field");};
  88. public void testDuplicateJVMTIAgents_pr151938() {runTest("Duplicate JVMTI agents");};
  89. public void testLTWWorldWithAnnotationMatching_pr153572() { runTest("LTWWorld with annotation matching");}
  90. public void testReweavableAspectNotRegistered_pr129525 () {
  91. runTest("reweavableAspectNotRegistered error");
  92. }
  93. public void testNPEinConstructorSignatureImpl_pr155972 () {
  94. runTest("NPE in ConstructorSignatureImpl");
  95. }
  96. public void testNPEinFieldSignatureImpl_pr155972 () {
  97. runTest("NPE in FieldSignatureImpl");
  98. }
  99. public void testNPEinInitializerSignatureImpl_pr155972 () {
  100. runTest("NPE in InitializerSignatureImpl");
  101. }
  102. public void testLineNumberTableCorrectWithGenericsForEachAndContinue_pr155763() {
  103. runTest("ensure LineNumberTable correct with generics, for each and continue");
  104. }
  105. public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772() {
  106. runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class");
  107. }
  108. public void testDeclareSoftDoesntAllowUndeclaredExInAnonInnerClass_pr151772_2() {
  109. runTest("ensure declare soft doesn't allow undeclared exception in anonymous inner class - 2");
  110. }
  111. public void testDeclareSoftAndInnerClasses_pr125981() {
  112. runTest("declare soft and inner classes");
  113. }
  114. public void testGetSourceSignature_pr148908() {
  115. runTest("ensure getSourceSignature correct with static field");
  116. IHierarchy top = AsmManager.getDefault().getHierarchy();
  117. IProgramElement ipe = top.findElementForLabel(top.getRoot(),
  118. IProgramElement.Kind.FIELD,"MY_COMPARATOR");
  119. String expected = "static final Comparator MY_COMPARATOR = new Comparator() {\n" +
  120. " public int compare(Object o1, Object o2) {\n" +
  121. " return 0;\n" +
  122. " }\n" +
  123. "};";
  124. assertEquals("expected source signature to be " + expected +
  125. " but found " + ipe.getSourceSignature(),
  126. expected, ipe.getSourceSignature());
  127. }
  128. public void testNPEWithCustomAgent_pr158005() {
  129. runTest("NPE with custom agent");
  130. }
  131. public void testWeaveConcreteSubaspectWithAdvice_pr132080() {
  132. runTest("Weave concrete sub-aspect with advice");
  133. }
  134. public void testWeaveConcreteSubaspectWithITD_pr132080() {
  135. runTest("Weave concrete sub-aspect with ITD");
  136. }
  137. public void testWeaveConcreteSubaspectWithAroundClosure_pr132080() {
  138. runTest("Weave concrete sub-aspect with around closure");
  139. }
  140. public void testWeaveConcreteSubaspectWithCflow_pr132080() {
  141. runTest("Weave concrete sub-aspect with cflow");
  142. }
  143. public void testNPEWithLTWPointcutLibraryAndMissingAspectDependency_pr158957 () {
  144. runTest("NPE with LTW, pointcut library and missing aspect dependency");
  145. }
  146. public void testNoInvalidAbsoluteTypeNameWarning_pr156904_1() {runTest("ensure no invalidAbsoluteTypeName when do match - 1");}
  147. public void testNoInvalidAbsoluteTypeNameWarning_pr156904_2() {runTest("ensure no invalidAbsoluteTypeName when do match - 2");}
  148. public void testNoInvalidAbsoluteTypeNameWarning_pr156904_3() {runTest("ensure no invalidAbsoluteTypeName when do match - 3");}
  149. public void testNoInvalidAbsoluteTypeNameWarning_pr156904_4() {runTest("ensure no invalidAbsoluteTypeName when do match - 4");}
  150. public void testNoNPEWithThrownExceptionWarningAndAtAspectj_pr161217() {runTest("NPE with thrown exception warning and at aspectj");}
  151. /////////////////////////////////////////
  152. public static Test suite() {
  153. return XMLBasedAjcTestCase.loadSuite(Ajc153Tests.class);
  154. }
  155. protected File getSpecFile() {
  156. return new File("../tests/src/org/aspectj/systemtest/ajc153/ajc153.xml");
  157. }
  158. }