選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

PartiallyExposedHierarchyTestCase.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*******************************************************************************
  2. * Copyright (c) 2004 IBM Corporation and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v 2.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  7. *
  8. * Contributors:
  9. * Matthew Webster - initial implementation
  10. *******************************************************************************/
  11. package org.aspectj.ajdt.internal.compiler.batch;
  12. import java.io.File;
  13. import org.aspectj.tools.ajc.AjcTestCase;
  14. import org.aspectj.tools.ajc.CompilationResult;
  15. /**
  16. * If you need to rebuild the components for this test, I'm afraid you will have
  17. * to run build.cmd in the testdata/partialHierarchy directory which calls ajc and
  18. * does some jar manipulation.
  19. */
  20. public class PartiallyExposedHierarchyTestCase extends AjcTestCase {
  21. public static final String PROJECT_DIR = "partialHierarchy";
  22. private File baseDir;
  23. protected void setUp() throws Exception {
  24. super.setUp();
  25. baseDir = new File("../org.aspectj.ajdt.core/testdata",PROJECT_DIR);
  26. }
  27. /**
  28. * This test verifies that AspectJ behaves correctly when parts of an object
  29. * hierarchy are exposed to it for weaving. See pr49657 for all the details.
  30. */
  31. public void testPartiallyExposedHierarchy () {
  32. Message warning = new Message(11,"no interface constructor-execution join point");
  33. // This error can't happen with the new logic to process types in hierarchical order
  34. // when applying declare parents (rather than just processing them in the order encountered
  35. // like we have been doing) - this kind of makes the test redundant ?!?
  36. // Message error = new Message(15, "type sample.Base must be accessible for weaving interface inter type declaration from aspect sample.Trace");
  37. CompilationResult result = ajc(baseDir,
  38. new String[]{"-classpath","fullBase.jar",
  39. "-injars","base.jar",
  40. "sample"+File.separator+"Trace.aj"});
  41. System.err.println(result.getWarningMessages());
  42. System.err.println(result.getErrorMessages());
  43. System.err.println(result.getStandardOutput());
  44. MessageSpec spec = new MessageSpec(null,newMessageList(warning),null);//newMessageList(error));
  45. assertMessages(result,spec);
  46. }
  47. }