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.

XMLBasedAjcTestCaseForJava21Only.java 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* *******************************************************************
  2. * Copyright (c) 2023 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 XMLBasedAjcTestCaseForJava21Only extends XMLBasedAjcTestCase {
  17. @Override
  18. public void setUp() throws Exception {
  19. // AspectJ_JDK_Update
  20. // Activate this block after upgrading to JDT Core Java 22
  21. /*
  22. throw new IllegalStateException(
  23. "These tests need a Java 21 level AspectJ compiler " +
  24. "(e.g. because they use version-specific preview features). " +
  25. "This compiler does not support preview features of a previous version anymore."
  26. );
  27. */
  28. // AspectJ_JDK_Update
  29. // Activate this block before upgrading to JDT Core Java 22
  30. if (!LangUtil.isVMGreaterOrEqual(21) || LangUtil.isVMGreaterOrEqual(22)) {
  31. throw new IllegalStateException(
  32. "These tests should be run on Java 21 only " +
  33. "(e.g. because they use version-specific preview features)"
  34. );
  35. }
  36. super.setUp();
  37. }
  38. }