diff options
author | Eric Bruneton <ebruneton@free.fr> | 2022-06-12 15:03:34 +0000 |
---|---|---|
committer | Eric Bruneton <ebruneton@free.fr> | 2022-06-12 15:03:34 +0000 |
commit | 1a7f1696e442d44650aaaf2928c95a3156b4ced8 (patch) | |
tree | ee6f3593d5ae465cd10eee5489222622e715f138 /asm | |
parent | 211f4eba2e76e361506f8856d11cae0cd0898ecd (diff) | |
download | ow2-asm-1a7f1696e442d44650aaaf2928c95a3156b4ced8.tar.gz |
Make sure that CheckClassAdapter leaves classes unchanged. Also fix a bug in...
Diffstat (limited to 'asm')
-rw-r--r-- | asm/src/test/java/org/objectweb/asm/ClassWriterTest.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java b/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java index 22afbd4b..0871e90c 100644 --- a/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java +++ b/asm/src/test/java/org/objectweb/asm/ClassWriterTest.java @@ -556,11 +556,13 @@ class ClassWriterTest extends AsmTest { /** * Tests that a ClassReader -> ClassWriter transform with the COMPUTE_MAXS option leaves classes * unchanged. This is not true in general (the valid max stack and max locals for a given method - * are not unique), but this should be the case with our precompiled classes. + * are not unique), but this should be the case with our precompiled classes (except + * jdk3.SubOptimalMaxStackAndLocals, which has non optimal max values on purpose). */ @ParameterizedTest @MethodSource(ALL_CLASSES_AND_ALL_APIS) void testReadAndWrite_computeMaxs(final PrecompiledClass classParameter, final Api apiParameter) { + assumeTrue(classParameter != PrecompiledClass.JDK3_SUB_OPTIMAL_MAX_STACK_AND_LOCALS); byte[] classFile = classParameter.getBytes(); ClassReader classReader = new ClassReader(classFile); ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS); @@ -614,8 +616,10 @@ class ClassWriterTest extends AsmTest { assertTrue(classWriter.hasFlags(ClassWriter.COMPUTE_FRAMES)); // The computed stack map frames should be equal to the original ones, if any (classes before // JDK8 don't have ones). This is not true in general (the valid frames for a given method are - // not unique), but this should be the case with our precompiled classes. - if (classParameter.isMoreRecentThan(Api.ASM4)) { + // not unique), but this should be the case with our precompiled classes (except + // jdk3.SubOptimalMaxStackAndLocals, which has non optimal max values on purpose). + if (classParameter.isMoreRecentThan(Api.ASM4) + && classParameter != PrecompiledClass.JDK3_SUB_OPTIMAL_MAX_STACK_AND_LOCALS) { assertEquals(new ClassFile(classFile), new ClassFile(newClassFile)); } Executable newInstance = () -> new ClassFile(newClassFile).newInstance(); @@ -663,8 +667,10 @@ class ClassWriterTest extends AsmTest { // The computed stack map frames should be equal to the original ones, if any (classes before // JDK8 don't have ones). This is not true in general (the valid frames for a given method are - // not unique), but this should be the case with our precompiled classes. - if (classParameter.isMoreRecentThan(Api.ASM4)) { + // not unique), but this should be the case with our precompiled classes (except + // jdk3.SubOptimalMaxStackAndLocals, which has non optimal max values on purpose). + if (classParameter.isMoreRecentThan(Api.ASM4) + && classParameter != PrecompiledClass.JDK3_SUB_OPTIMAL_MAX_STACK_AND_LOCALS) { assertEquals(new ClassFile(classFile), new ClassFile(newClassFile)); } Executable newInstance = () -> new ClassFile(newClassFile).newInstance(); |