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.

Ajc150TestsNoHarness.java 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*******************************************************************************
  2. * Copyright (c) 2005 IBM
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Common Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/cpl-v10.html
  7. *
  8. * Contributors:
  9. * Andy Clement - initial API and implementation
  10. *******************************************************************************/
  11. package org.aspectj.systemtest.ajc150;
  12. import java.io.File;
  13. import org.aspectj.apache.bcel.classfile.JavaClass;
  14. import org.aspectj.apache.bcel.classfile.Method;
  15. import org.aspectj.tools.ajc.CompilationResult;
  16. /**
  17. * These are tests that run on Java 1.4 and use the new ajctestcase format.
  18. * If you have a test that *needs* to run on Java 1.5 then look in Ajc150TestsRequireJava15.java
  19. */
  20. public class Ajc150TestsNoHarness extends TestUtils {
  21. protected void setUp() throws Exception {
  22. super.setUp();
  23. baseDir = new File("../tests/bugs150");
  24. }
  25. public void testIncorrectExceptionTableWhenBreakInMethod_pr78021() {
  26. CompilationResult cR=ajc(baseDir,new String[]{"PR78021.java"});
  27. if (verbose) { System.err.println(cR); System.err.println(cR.getStandardError());}
  28. RunResult rR = run("PR78021");
  29. if (verbose) {System.err.println(rR.getStdErr());}
  30. }
  31. public void testIncorrectExceptionTableWhenReturnInMethod_pr79554() {
  32. CompilationResult cR=ajc(baseDir,new String[]{"PR79554.java"});
  33. if (verbose) { System.err.println(cR); System.err.println(cR.getStandardError());}
  34. RunResult rR = run("PR79554");
  35. if (verbose) {System.err.println(rR.getStdErr());}
  36. }
  37. public void testMissingDebugInfoForGeneratedMethods_pr82570() throws ClassNotFoundException {
  38. boolean f = false;
  39. CompilationResult cR = ajc(baseDir,new String[]{"PR82570_1.java"});
  40. System.err.println(cR.getStandardError());
  41. assertTrue("Expected no compile problem:"+cR,!cR.hasErrorMessages());
  42. JavaClass jc = getClassFrom(ajc.getSandboxDirectory(),"PR82570_1");
  43. Method[] meths = jc.getMethods();
  44. for (int i = 0; i < meths.length; i++) {
  45. Method method = meths[i];
  46. if (f) System.err.println("Line number table for "+method.getName()+method.getSignature()+" = "+method.getLineNumberTable());
  47. assertTrue("Didn't find a line number table for method "+method.getName()+method.getSignature(),
  48. method.getLineNumberTable()!=null);
  49. }
  50. // This test would determine the info isn't there if you pass -g:none ...
  51. // cR = ajc(baseDir,new String[]{"PR82570_1.java","-g:none"});
  52. // assertTrue("Expected no compile problem:"+cR,!cR.hasErrorMessages());
  53. // System.err.println(cR.getStandardError());
  54. // jc = getClassFrom(ajc.getSandboxDirectory(),"PR82570_1");
  55. // meths = jc.getMethods();
  56. // for (int i = 0; i < meths.length; i++) {
  57. // Method method = meths[i];
  58. // assertTrue("Found a line number table for method "+method.getName(),
  59. // method.getLineNumberTable()==null);
  60. // }
  61. }
  62. public void testCanOverrideProtectedMethodsViaITDandDecp_pr83303() {
  63. CompilationResult cR = ajc(baseDir,new String[]{"PR83303.java"});
  64. assertTrue("Should be no errors:"+cR,!cR.hasErrorMessages());
  65. }
  66. public void testPerTypeWithinMissesNamedInnerTypes() {
  67. CompilationResult cR = ajc(baseDir,new String[]{"PR83563_1.java"});
  68. assertMessages(cR,new EmptyMessageSpec());
  69. RunResult rR = run("PR83563_1");
  70. }
  71. public void testPerTypeWithinMissesAnonymousInnerTypes() {
  72. CompilationResult cR = ajc(baseDir,new String[]{"PR83563_2.java"});
  73. assertMessages(cR,new EmptyMessageSpec());
  74. RunResult rR = run("PR83563_2");
  75. }
  76. public void testPerTypeWithinIncorrectlyMatchingInterfaces() {
  77. CompilationResult cR = ajc(baseDir,new String[]{"PR83645.java"});
  78. assertMessages(cR,new EmptyMessageSpec());
  79. RunResult rR = run("PR83645");
  80. }
  81. }