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 9.4KB

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