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.

Java16PreviewFeaturesTests.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*******************************************************************************
  2. * Copyright (c) 2021 Contributors
  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. package org.aspectj.systemtest.ajc197;
  9. import junit.framework.Test;
  10. import org.aspectj.apache.bcel.Constants;
  11. import org.aspectj.testing.JavaVersionSpecificXMLBasedAjcTestCase;
  12. import org.aspectj.testing.XMLBasedAjcTestCase;
  13. /**
  14. * @author Alexander Kriegisch
  15. */
  16. public class Java16PreviewFeaturesTests extends JavaVersionSpecificXMLBasedAjcTestCase {
  17. private static final Constants.ClassFileVersion classFileVersion = Constants.ClassFileVersion.of(16);
  18. public Java16PreviewFeaturesTests() {
  19. super(16, 16);
  20. }
  21. public void testSealedClassWithLegalSubclasses() {
  22. runTest("sealed class with legal subclasses");
  23. checkVersion("Employee", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  24. checkVersion("Manager", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  25. }
  26. public void testSealedClassWithIllegalSubclass() {
  27. runTest("sealed class with illegal subclass");
  28. checkVersion("Person", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  29. }
  30. public void testWeaveSealedClass() {
  31. runTest("weave sealed class");
  32. checkVersion("PersonAspect", classFileVersion.MAJOR, classFileVersion.PREVIEW_MINOR);
  33. }
  34. public static Test suite() {
  35. return XMLBasedAjcTestCase.loadSuite(Java16PreviewFeaturesTests.class);
  36. }
  37. @Override
  38. protected java.net.URL getSpecFile() {
  39. return getClassResource("ajc197.xml");
  40. }
  41. }