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.

Ajc170Tests.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*******************************************************************************
  2. * Copyright (c) 2008 Contributors
  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.ajc170;
  12. import java.io.File;
  13. import java.util.List;
  14. import junit.framework.Test;
  15. import org.aspectj.apache.bcel.util.ClassPath;
  16. import org.aspectj.testing.XMLBasedAjcTestCase;
  17. import org.aspectj.weaver.CrosscuttingMembers;
  18. import org.aspectj.weaver.ReferenceType;
  19. import org.aspectj.weaver.ResolvedMember;
  20. import org.aspectj.weaver.ResolvedType;
  21. import org.aspectj.weaver.TypeFactory;
  22. import org.aspectj.weaver.TypeVariable;
  23. import org.aspectj.weaver.UnresolvedType;
  24. import org.aspectj.weaver.World;
  25. import org.aspectj.weaver.bcel.BcelWorld;
  26. /**
  27. * @author Andy Clement
  28. */
  29. public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
  30. public void testGenericsWithTwoTypeParamsOneWildcard() {
  31. UnresolvedType ut;
  32. ut = TypeFactory.createTypeFromSignature("LFoo<**>;");
  33. assertEquals(2,ut.getTypeParameters().length);
  34. ut = TypeFactory.createTypeFromSignature("LFoo<***>;");
  35. assertEquals(3,ut.getTypeParameters().length);
  36. ut = TypeFactory.createTypeFromSignature("LFoo<TP;*+Ljava/lang/String;>;");
  37. assertEquals(2,ut.getTypeParameters().length);
  38. ut = TypeFactory.createTypeFromSignature("LFoo<*+Ljava/lang/String;TP;>;");
  39. assertEquals(2,ut.getTypeParameters().length);
  40. ut = TypeFactory.createTypeFromSignature("LFoo<*+Ljava/lang/String;TP;>;");
  41. assertEquals(2,ut.getTypeParameters().length);
  42. ut = TypeFactory.createTypeFromSignature("LFoo<*TT;>;");
  43. assertEquals(2,ut.getTypeParameters().length);
  44. ut = TypeFactory.createTypeFromSignature("LFoo<[I>;");
  45. assertEquals(1,ut.getTypeParameters().length);
  46. ut = TypeFactory.createTypeFromSignature("LFoo<[I[Z>;");
  47. assertEquals(2,ut.getTypeParameters().length);
  48. }
  49. public void testPerThis() {
  50. runTest("perthis");
  51. }
  52. public void testPerTarget() {
  53. runTest("pertarget");
  54. }
  55. public void testPerCflow() {
  56. runTest("percflow");
  57. }
  58. public void testPerTypeWithin() {
  59. runTest("pertypewithin");
  60. }
  61. // not specifying -1.7
  62. public void testDiamond1() {
  63. runTest("diamond 1");
  64. }
  65. public void testDiamond2() {
  66. runTest("diamond 2");
  67. }
  68. public void testDiamondItd1() {
  69. runTest("diamond itd 1");
  70. }
  71. public void testLiterals1() {
  72. runTest("literals 1");
  73. }
  74. public void testLiterals2() {
  75. runTest("literals 2");
  76. }
  77. public void testLiteralsItd1() {
  78. runTest("literals itd 1");
  79. }
  80. public void testStringSwitch1() {
  81. runTest("string switch 1");
  82. }
  83. public void testStringSwitch2() {
  84. runTest("string switch 2");
  85. }
  86. public void testMultiCatch1() {
  87. runTest("multi catch 1");
  88. }
  89. public void testMultiCatch2() {
  90. runTest("multi catch 2");
  91. }
  92. public void testMultiCatchWithHandler1() {
  93. runTest("multi catch with handler 1");
  94. }
  95. public void testMultiCatchAspect1() {
  96. runTest("multi catch aspect 1");
  97. }
  98. // public void testMultiCatchWithHandler2() {
  99. // runTest("multi catch with handler 2");
  100. // }
  101. public void testSanity1() {
  102. runTest("sanity 1");
  103. }
  104. public void testMissingImpl_363979() {
  105. runTest("missing impl");
  106. }
  107. public void testMissingImpl_363979_2() {
  108. runTest("missing impl 2");
  109. }
  110. public void testStackOverflow_364380() {
  111. runTest("stackoverflow");
  112. }
  113. // public void testTryResources1() {
  114. // runTest("try resources 1");
  115. // }
  116. //
  117. // public void testTryResources2() {
  118. // runTest("try resources 2");
  119. // }
  120. // ---
  121. public static Test suite() {
  122. return XMLBasedAjcTestCase.loadSuite(Ajc170Tests.class);
  123. }
  124. @Override
  125. protected File getSpecFile() {
  126. return new File("../tests/src/org/aspectj/systemtest/ajc170/ajc170.xml");
  127. }
  128. }