您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Ajc170Tests.java 4.2KB

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