diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-23 12:55:48 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-23 17:03:17 +0700 |
commit | 6be777e71708df5a62e41c6ef95da66bfd02f447 (patch) | |
tree | 54c9ea180c51742abdef2fc3ce2e94426fbbb2bb | |
parent | acdf4ffd9d4c6ee0b8d8595a112c5331974e08cb (diff) | |
download | aspectj-6be777e71708df5a62e41c6ef95da66bfd02f447.tar.gz aspectj-6be777e71708df5a62e41c6ef95da66bfd02f447.zip |
Fix AtAjLTWTests::testLTWDumpProxy for Java 16
Before Java 16, JDK proxies were given a virtual package name of
'com.sun.proxy'. Now the packages are numbered 'jdk.proxy[n]', i.e.
'jdk.proxy1', 'jdk.proxy2' etc. This makes the package-name-derived path
name here less predictable. In our simple runtime scenario, we can be
pretty sure than the counter starts at 1 because it is the first and
only proxy we create.
TODO: A better solution would be a recursive filtered search via
Files.walk, ideally added as a recursive search option for
CountingFilenameFilter.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
-rw-r--r-- | tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java index 16f7321a9..15f3f0796 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -19,6 +19,8 @@ import org.aspectj.util.FileUtil; import junit.framework.Test; +import static org.aspectj.util.LangUtil.is16VMOrGreater; + /** * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> */ @@ -133,11 +135,21 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase { // The working directory is different because this test must be forked File dir = new File("../tests/java5/ataspectj"); - File f = new File(dir, "_ajdump/_before/com/sun/proxy"); + + // Before Java 16, JDK proxies were given a virtual package name of 'com.sun.proxy'. Now the packages are numbered + // 'jdk.proxy[n]', i.e. 'jdk.proxy1', 'jdk.proxy2' etc. This makes the package-name-derived path name here less + // predictable. In our simple runtime scenario, we can be pretty sure than the counter starts at 1 because + // it is the first and only proxy we create. + // + // TODO: A better solution would be a recursive filtered search via Files.walk, ideally added as a recursive search + // option for CountingFilenameFilter. + String proxyDir = is16VMOrGreater() ? "jdk/proxy1" : "com/sun/proxy"; + + File f = new File(dir, "_ajdump/_before/" + proxyDir); CountingFilenameFilter cff = new CountingFilenameFilter(".class"); f.listFiles(cff); assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount()); - f = new File(dir, "_ajdump/com/sun/proxy"); + f = new File(dir, "_ajdump/" + proxyDir); cff = new CountingFilenameFilter(".class"); f.listFiles(cff); assertEquals(1, cff.getCount()); |