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.

XMLBasedAjcTestCaseForJava19Only.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* *******************************************************************
  2. * Copyright (c) 2022 Contributors
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v 2.0
  6. * which accompanies this distribution and is available at
  7. * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  8. * ******************************************************************/
  9. package org.aspectj.testing;
  10. import org.aspectj.util.LangUtil;
  11. /**
  12. * Makes sure tests are running on the right level of JDK.
  13. *
  14. * @author Alexander Kriegisch
  15. */
  16. public abstract class XMLBasedAjcTestCaseForJava19Only extends XMLBasedAjcTestCase {
  17. @Override
  18. public void setUp() throws Exception {
  19. // Activate this block after upgrading to JDT Core Java 20
  20. /*
  21. throw new IllegalStateException(
  22. "These tests need a Java 19 level AspectJ compiler " +
  23. "(e.g. because they use version-specific preview features). " +
  24. "This compiler does not support preview features of a previous version anymore."
  25. );
  26. */
  27. // Activate this block before upgrading to JDT Core Java 20
  28. if (!LangUtil.is19VMOrGreater() || LangUtil.is20VMOrGreater()) {
  29. throw new IllegalStateException(
  30. "These tests should be run on Java 19 only " +
  31. "(e.g. because they use version-specific preview features)"
  32. );
  33. }
  34. super.setUp();
  35. }
  36. }