Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MalformedParametersException on JDK 8 for synthetic bridge methods in Jupiter classes (5.11.0-M1) #3797

Closed
kaipe opened this issue Apr 26, 2024 · 5 comments · Fixed by #3798

Comments

@kaipe
Copy link

kaipe commented Apr 26, 2024

When using JDK 8 and junit-jupiter-engine-5.11.0-M1:
MalformedParametersException is thrown when calling java.lang.reflect.Method#getParameters() on some synthetic bridge methods.

Concerns version 5.11.0-M1 only: doesn't occur with 5.10.2 and older releases of "junit-jupiter-engine".

Also it only happens when using JDK-8:

  • Java : 1.8
  • JVM vendor name : Private Build
  • JVM vendor version : 25.402-b06
  • JVM name : OpenJDK 64-Bit Server VM
  • JVM version : 1.8.0_402-8u402-ga-2ubuntu1~22.04-b06
  • JVM info : mixed mode
  • OS name : Linux
  • OS version : 6.5.0-28-generic

This only concerns JDK 8. Everything seems to work just fine with later JDKs (e.g. 11, 17, 21).

There is something about how junit-jupiter-engine-5.11.0-M1 was compiled that makes it not fully compatible with JDK 8.

Steps to reproduce

Output from this program pinpoints the root problem:

import java.lang.reflect.MalformedParametersException;
import java.lang.reflect.Method;
import java.util.*;
import org.junit.jupiter.engine.descriptor.*;
import org.junit.platform.engine.support.hierarchical.EngineExecutionContext;

class MalformedParametersException_forJupiterSyntheticNodeMethodImplementations_onlyOnJdk8 {
    public static void main(String[] ___) {
        System.out.println("\nRunning on " + System.getProperty("java.version") + " ...");

        java.util.stream.Stream.of(
                JupiterTestDescriptor.class, ClassBasedTestDescriptor.class,
                ClassTestDescriptor.class, MethodBasedTestDescriptor.class,
                TestMethodTestDescriptor.class, TestTemplateTestDescriptor.class,
                TestTemplateInvocationTestDescriptor.class,
                TestFactoryTestDescriptor.class, NestedClassTestDescriptor.class)

                .forEach(descriptorClass -> {

            Set<String> reasonsForMalformedParameters = new HashSet<>();
            StringBuilder methodsWithMalformedParameters = new StringBuilder();
            for (Method m : descriptorClass.getDeclaredMethods()) {
                try {
                    m.getParameters();

                } catch (MalformedParametersException badParameters) {
                    assert m.isSynthetic();
                    assert m.getParameterTypes()[0] == EngineExecutionContext.class;
                    reasonsForMalformedParameters.add(badParameters.getMessage());
                    methodsWithMalformedParameters.append("\n ->").append(m
                            .toString().substring("public".length())
                            .replaceAll("(?<=[ ,(])[a-zA-Z\\.]*\\.", " ")
                            .replaceFirst(" throws .++", ""));
                }
            }
            if (false == reasonsForMalformedParameters.isEmpty()) {
                System.out.println("\n" + reasonsForMalformedParameters
                        + " was thrown for synthetic bridge methods on "
                        + descriptorClass.getSimpleName() + ":" + methodsWithMalformedParameters);
            }
        });
    }
}

Running the above program on my laptop, using JDK 8 and junit-jupiter-engine-5.11.0-M1, results in this output:

Running on 1.8.0_402 ...

[Invalid parameter name ""] was thrown for synthetic bridge methods on JupiterTestDescriptor:
 ->  Node$SkipResult  shouldBeSkipped( EngineExecutionContext)
 -> void  cleanUp( EngineExecutionContext)
 ->  EngineExecutionContext  prepare( EngineExecutionContext)

[Invalid parameter name ""] was thrown for synthetic bridge methods on ClassBasedTestDescriptor:
 ->  EngineExecutionContext  prepare( EngineExecutionContext)
 ->  EngineExecutionContext  before( EngineExecutionContext)
 -> void  after( EngineExecutionContext)

[Invalid parameter name ""] was thrown for synthetic bridge methods on MethodBasedTestDescriptor:
 -> void  nodeSkipped( EngineExecutionContext, TestDescriptor, Node$SkipResult)

[Invalid parameter name ""] was thrown for synthetic bridge methods on TestMethodTestDescriptor:
 -> void  cleanUp( EngineExecutionContext)
 -> void  nodeFinished( EngineExecutionContext, TestDescriptor, TestExecutionResult)
 ->  EngineExecutionContext  execute( EngineExecutionContext, Node$DynamicTestExecutor)
 ->  EngineExecutionContext  prepare( EngineExecutionContext)

[Invalid parameter name ""] was thrown for synthetic bridge methods on TestTemplateTestDescriptor:
 ->  EngineExecutionContext  execute( EngineExecutionContext, Node$DynamicTestExecutor)
 ->  EngineExecutionContext  prepare( EngineExecutionContext)

[Invalid parameter name ""] was thrown for synthetic bridge methods on TestTemplateInvocationTestDescriptor:
 -> void  after( EngineExecutionContext)

[Invalid parameter name ""] was thrown for synthetic bridge methods on TestFactoryTestDescriptor:
 -> void  nodeSkipped( EngineExecutionContext, TestDescriptor, Node$SkipResult)
 -> void  nodeFinished( EngineExecutionContext, TestDescriptor, TestExecutionResult)

The above pinpoints a root problem that is far away from regular developer concerns, but it causes other indirect problems further down the road. E.g. using Mockito 4.11's inline-mockmaker to mock the above classes (on JDK 8) is problematic: "Mockito cannot mock this class: ...".

But test descriptor classes that don't have these synthetic bridge methods (e.g. ClassTestDescriptor and NestedClassTestDescriptor) are perfectly mockable.

Context

Above program was run with these jars on classpath:

  • junit-jupiter-engine-5.11.0-M1.jar
  • unit-platform-engine-1.11.0-M1.jar
  • junit-platform-commons-1.11.0-M1.jar
  • junit-jupiter-api-5.11.0-M1.jar

JDK details:

  • Java : 1.8
  • JVM vendor name : Private Build
  • JVM vendor version : 25.402-b06
  • JVM name : OpenJDK 64-Bit Server VM
  • JVM version : 1.8.0_402-8u402-ga-2ubuntu1~22.04-b06
  • JVM info : mixed mode
  • OS name : Linux
  • OS version : 6.5.0-28-generic

This issue report only concerns classes of junit-jupiter-engine-5.11.0-M1.jar, but there is reason to suspect similar situation with other 5.11.0-M1 artifacts wherever there are synthetic bridge methods.

@sormuras sormuras added this to the 5.11 M2 milestone Apr 26, 2024
kaipe referenced this issue Apr 26, 2024
To improve consistency and avoid confusion regarding primitive types
and their wrapper types, this commit ensures that we always use class
literals for primitive types.

For example, instead of using the `Void.TYPE` constant, we now
consistently use `void.class`.
@sbrannen sbrannen changed the title Regression: MalformedParametersException on JDK-8 for synthetic bridge methods on Jupiter classes (version 5.11.0-M1 only) MalformedParametersException on JDK 8 for synthetic bridge methods in Jupiter classes (5.11.0-M1) Apr 28, 2024
@marcphilipp marcphilipp self-assigned this Apr 28, 2024
@marcphilipp
Copy link
Member

Thanks for the detailed report! Based on your reproducer I created a test (see marc/3797-bridge-method-reproducer branch) and used it find the initial commit introducing the issue: 8930313. In that commit, the build was switched to use JDK 21 instead of 17 for compilation.

The 5.11.0-M1 binaries where created using

Created-By: 21.0.2 (Eclipse Adoptium 21.0.2+13-LTS)

I've verified locally that the problem persists with Temurin 21.0.3+9.

@marcphilipp
Copy link
Member

marcphilipp commented Apr 28, 2024

Here's a gist with the output of javap -v for JupiterTestDescriptor.class when compiled with Java 17 (on commit 6687a76) and 21 (on commit 8930313): https://gist.github.com/marcphilipp/8bb33c88a6af8067288c731680181598

Diff

1,3c1,3
< Classfile 17-JupiterTestDescriptor.class
<   Last modified Apr 28, 2024; size 16084 bytes
<   SHA-256 checksum 464709a464e64cce32149ca46bd5870c09179d47c818c98981621369216f0ad1
---
> Classfile 21-JupiterTestDescriptor.class
>   Last modified Apr 28, 2024; size 16136 bytes
>   SHA-256 checksum c019ac7ee7b3a2a1aaaca153965d5b123cec4a79e162fdae8d4ab097fbc553c6
440,531c440,532
<   #428 = Utf8               (Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;)V
<   #429 = Utf8               (Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;
<   #430 = Utf8               lambda$getExclusiveResourcesFromAnnotation$2
<   #431 = Utf8               (Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<   #432 = Utf8               resource
<   #433 = Utf8               Lorg/junit/jupiter/api/parallel/ResourceLock;
<   #434 = Utf8               lambda$getTags$1
<   #435 = Utf8               (Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
<   #436 = Utf8               tag
<   #437 = Utf8               Z
<   #438 = Utf8               lambda$getTags$0
<   #439 = Utf8               (Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
<   #440 = Utf8               <clinit>
<   #441 = Utf8               Lorg/junit/platform/engine/support/descriptor/AbstractTestDescriptor;Lorg/junit/platform/engine/support/hierarchical/Node<Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;>;
<   #442 = Utf8               SourceFile
<   #443 = Utf8               JupiterTestDescriptor.java
<   #444 = Utf8               RuntimeVisibleAnnotations
<   #445 = Utf8               Lorg/apiguardian/api/API;
<   #446 = Utf8               status
<   #447 = Utf8               Lorg/apiguardian/api/API$Status;
<   #448 = Utf8               INTERNAL
<   #449 = Utf8               since
<   #450 = Utf8               5.0
<   #451 = Utf8               BootstrapMethods
<   #452 = MethodHandle       6:#453        // REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
<   #453 = Methodref          #454.#455     // java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
<   #454 = Class              #456          // java/lang/invoke/LambdaMetafactory
<   #455 = NameAndType        #457:#458     // metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
<   #456 = Utf8               java/lang/invoke/LambdaMetafactory
<   #457 = Utf8               metafactory
<   #458 = Utf8               (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
<   #459 = MethodType         #282          //  (Ljava/lang/Object;)Ljava/lang/Object;
<   #460 = MethodHandle       9:#461        // REF_invokeInterface org/junit/jupiter/api/Tag.value:()Ljava/lang/String;
<   #461 = InterfaceMethodref #22.#313      // org/junit/jupiter/api/Tag.value:()Ljava/lang/String;
<   #462 = MethodType         #463          //  (Lorg/junit/jupiter/api/Tag;)Ljava/lang/String;
<   #463 = Utf8               (Lorg/junit/jupiter/api/Tag;)Ljava/lang/String;
<   #464 = MethodType         #465          //  (Ljava/lang/Object;)Z
<   #465 = Utf8               (Ljava/lang/Object;)Z
<   #466 = MethodHandle       6:#467        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
<   #467 = Methodref          #8.#468       // org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
<   #468 = NameAndType        #434:#435     // lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
<   #469 = MethodType         #331          //  (Ljava/lang/String;)Z
<   #470 = MethodHandle       6:#471        // REF_invokeStatic org/junit/platform/engine/TestTag.create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<   #471 = Methodref          #327.#472     // org/junit/platform/engine/TestTag.create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<   #472 = NameAndType        #473:#474     // create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<   #473 = Utf8               create
<   #474 = Utf8               (Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<   #475 = MethodType         #474          //  (Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<   #476 = MethodType         #133          //  ()Ljava/lang/Object;
<   #477 = MethodHandle       8:#478        // REF_newInvokeSpecial java/util/LinkedHashSet."<init>":()V
<   #478 = Methodref          #479.#190     // java/util/LinkedHashSet."<init>":()V
<   #479 = Class              #480          // java/util/LinkedHashSet
<   #480 = Utf8               java/util/LinkedHashSet
<   #481 = MethodType         #482          //  ()Ljava/util/LinkedHashSet;
<   #482 = Utf8               ()Ljava/util/LinkedHashSet;
<   #483 = MethodHandle       6:#484        // REF_invokeStatic java/util/Collections.unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
<   #484 = Methodref          #83.#485      // java/util/Collections.unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
<   #485 = NameAndType        #486:#487     // unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
<   #486 = Utf8               unmodifiableSet
<   #487 = Utf8               (Ljava/util/Set;)Ljava/util/Set;
<   #488 = MethodType         #489          //  (Ljava/util/LinkedHashSet;)Ljava/util/Set;
<   #489 = Utf8               (Ljava/util/LinkedHashSet;)Ljava/util/Set;
<   #490 = MethodHandle       9:#491        // REF_invokeInterface org/junit/jupiter/api/parallel/Execution.value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
<   #491 = InterfaceMethodref #155.#492     // org/junit/jupiter/api/parallel/Execution.value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
<   #492 = NameAndType        #314:#147     // value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
<   #493 = MethodType         #494          //  (Lorg/junit/jupiter/api/parallel/Execution;)Lorg/junit/jupiter/api/parallel/ExecutionMode;
<   #494 = Utf8               (Lorg/junit/jupiter/api/parallel/Execution;)Lorg/junit/jupiter/api/parallel/ExecutionMode;
<   #495 = MethodHandle       6:#148        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.toExecutionMode:(Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
<   #496 = MethodType         #151          //  (Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
<   #497 = MethodHandle       6:#498        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<   #498 = Methodref          #8.#499       // org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<   #499 = NameAndType        #430:#431     // lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<   #500 = MethodType         #431          //  (Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<   #501 = MethodHandle       6:#502        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
<   #502 = Methodref          #8.#503       // org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
<   #503 = NameAndType        #438:#439     // lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
<   #504 = MethodType         #204          //  ()Ljava/lang/String;
<   #505 = Utf8               InnerClasses
<   #506 = Utf8               ExceptionHandlerInvoker
<   #507 = Utf8               ExecutionMode
<   #508 = Utf8               LockMode
<   #509 = Utf8               SkipResult
<   #510 = Class              #511          // org/apiguardian/api/API$Status
<   #511 = Utf8               org/apiguardian/api/API$Status
<   #512 = Class              #513          // org/apiguardian/api/API
<   #513 = Utf8               org/apiguardian/api/API
<   #514 = Utf8               Status
<   #515 = Class              #516          // java/lang/invoke/MethodHandles$Lookup
<   #516 = Utf8               java/lang/invoke/MethodHandles$Lookup
<   #517 = Class              #518          // java/lang/invoke/MethodHandles
<   #518 = Utf8               java/lang/invoke/MethodHandles
<   #519 = Utf8               Lookup
---
>   #428 = Utf8               MethodParameters
>   #429 = Utf8               (Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;)V
>   #430 = Utf8               (Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;
>   #431 = Utf8               lambda$getExclusiveResourcesFromAnnotation$2
>   #432 = Utf8               (Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>   #433 = Utf8               resource
>   #434 = Utf8               Lorg/junit/jupiter/api/parallel/ResourceLock;
>   #435 = Utf8               lambda$getTags$1
>   #436 = Utf8               (Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
>   #437 = Utf8               tag
>   #438 = Utf8               Z
>   #439 = Utf8               lambda$getTags$0
>   #440 = Utf8               (Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
>   #441 = Utf8               <clinit>
>   #442 = Utf8               Lorg/junit/platform/engine/support/descriptor/AbstractTestDescriptor;Lorg/junit/platform/engine/support/hierarchical/Node<Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;>;
>   #443 = Utf8               SourceFile
>   #444 = Utf8               JupiterTestDescriptor.java
>   #445 = Utf8               RuntimeVisibleAnnotations
>   #446 = Utf8               Lorg/apiguardian/api/API;
>   #447 = Utf8               status
>   #448 = Utf8               Lorg/apiguardian/api/API$Status;
>   #449 = Utf8               INTERNAL
>   #450 = Utf8               since
>   #451 = Utf8               5.0
>   #452 = Utf8               BootstrapMethods
>   #453 = MethodType         #282          //  (Ljava/lang/Object;)Ljava/lang/Object;
>   #454 = MethodHandle       9:#455        // REF_invokeInterface org/junit/jupiter/api/Tag.value:()Ljava/lang/String;
>   #455 = InterfaceMethodref #22.#313      // org/junit/jupiter/api/Tag.value:()Ljava/lang/String;
>   #456 = MethodType         #457          //  (Lorg/junit/jupiter/api/Tag;)Ljava/lang/String;
>   #457 = Utf8               (Lorg/junit/jupiter/api/Tag;)Ljava/lang/String;
>   #458 = MethodType         #459          //  (Ljava/lang/Object;)Z
>   #459 = Utf8               (Ljava/lang/Object;)Z
>   #460 = MethodHandle       6:#461        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
>   #461 = Methodref          #8.#462       // org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
>   #462 = NameAndType        #435:#436     // lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
>   #463 = MethodType         #331          //  (Ljava/lang/String;)Z
>   #464 = MethodHandle       6:#465        // REF_invokeStatic org/junit/platform/engine/TestTag.create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>   #465 = Methodref          #327.#466     // org/junit/platform/engine/TestTag.create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>   #466 = NameAndType        #467:#468     // create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>   #467 = Utf8               create
>   #468 = Utf8               (Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>   #469 = MethodType         #468          //  (Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>   #470 = MethodType         #133          //  ()Ljava/lang/Object;
>   #471 = MethodHandle       8:#472        // REF_newInvokeSpecial java/util/LinkedHashSet."<init>":()V
>   #472 = Methodref          #473.#190     // java/util/LinkedHashSet."<init>":()V
>   #473 = Class              #474          // java/util/LinkedHashSet
>   #474 = Utf8               java/util/LinkedHashSet
>   #475 = MethodType         #476          //  ()Ljava/util/LinkedHashSet;
>   #476 = Utf8               ()Ljava/util/LinkedHashSet;
>   #477 = MethodHandle       6:#478        // REF_invokeStatic java/util/Collections.unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
>   #478 = Methodref          #83.#479      // java/util/Collections.unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
>   #479 = NameAndType        #480:#481     // unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
>   #480 = Utf8               unmodifiableSet
>   #481 = Utf8               (Ljava/util/Set;)Ljava/util/Set;
>   #482 = MethodType         #483          //  (Ljava/util/LinkedHashSet;)Ljava/util/Set;
>   #483 = Utf8               (Ljava/util/LinkedHashSet;)Ljava/util/Set;
>   #484 = MethodHandle       9:#485        // REF_invokeInterface org/junit/jupiter/api/parallel/Execution.value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
>   #485 = InterfaceMethodref #155.#486     // org/junit/jupiter/api/parallel/Execution.value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
>   #486 = NameAndType        #314:#147     // value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
>   #487 = MethodType         #488          //  (Lorg/junit/jupiter/api/parallel/Execution;)Lorg/junit/jupiter/api/parallel/ExecutionMode;
>   #488 = Utf8               (Lorg/junit/jupiter/api/parallel/Execution;)Lorg/junit/jupiter/api/parallel/ExecutionMode;
>   #489 = MethodHandle       6:#148        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.toExecutionMode:(Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
>   #490 = MethodType         #151          //  (Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
>   #491 = MethodHandle       6:#492        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>   #492 = Methodref          #8.#493       // org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>   #493 = NameAndType        #431:#432     // lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>   #494 = MethodType         #432          //  (Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>   #495 = MethodHandle       6:#496        // REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
>   #496 = Methodref          #8.#497       // org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
>   #497 = NameAndType        #439:#440     // lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
>   #498 = MethodType         #204          //  ()Ljava/lang/String;
>   #499 = MethodHandle       6:#500        // REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
>   #500 = Methodref          #501.#502     // java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
>   #501 = Class              #503          // java/lang/invoke/LambdaMetafactory
>   #502 = NameAndType        #504:#505     // metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
>   #503 = Utf8               java/lang/invoke/LambdaMetafactory
>   #504 = Utf8               metafactory
>   #505 = Utf8               (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
>   #506 = Utf8               InnerClasses
>   #507 = Utf8               ExceptionHandlerInvoker
>   #508 = Utf8               ExecutionMode
>   #509 = Utf8               LockMode
>   #510 = Utf8               SkipResult
>   #511 = Class              #512          // org/apiguardian/api/API$Status
>   #512 = Utf8               org/apiguardian/api/API$Status
>   #513 = Class              #514          // org/apiguardian/api/API
>   #514 = Utf8               org/apiguardian/api/API
>   #515 = Utf8               Status
>   #516 = Class              #517          // java/lang/invoke/MethodHandles$Lookup
>   #517 = Utf8               java/lang/invoke/MethodHandles$Lookup
>   #518 = Class              #519          // java/lang/invoke/MethodHandles
>   #519 = Utf8               java/lang/invoke/MethodHandles
>   #520 = Utf8               Lookup
959a961,963
>     MethodParameters:
>       Name                           Flags
>       <no name>                      synthetic
977a982,984
>     MethodParameters:
>       Name                           Flags
>       <no name>                      synthetic
995a1003,1005
>     MethodParameters:
>       Name                           Flags
>       <no name>                      synthetic
1014c1024
< Signature: #441                         // Lorg/junit/platform/engine/support/descriptor/AbstractTestDescriptor;Lorg/junit/platform/engine/support/hierarchical/Node<Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;>;
---
> Signature: #442                         // Lorg/junit/platform/engine/support/descriptor/AbstractTestDescriptor;Lorg/junit/platform/engine/support/hierarchical/Node<Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;>;
1017c1027
<   0: #445(#446=e#447.#448,#449=s#450)
---
>   0: #446(#447=e#448.#449,#450=s#451)
1023c1033
<   0: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>   0: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1025,1028c1035,1038
<       #459 (Ljava/lang/Object;)Ljava/lang/Object;
<       #460 REF_invokeInterface org/junit/jupiter/api/Tag.value:()Ljava/lang/String;
<       #462 (Lorg/junit/jupiter/api/Tag;)Ljava/lang/String;
<   1: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #453 (Ljava/lang/Object;)Ljava/lang/Object;
>       #454 REF_invokeInterface org/junit/jupiter/api/Tag.value:()Ljava/lang/String;
>       #456 (Lorg/junit/jupiter/api/Tag;)Ljava/lang/String;
>   1: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1030,1033c1040,1043
<       #464 (Ljava/lang/Object;)Z
<       #466 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
<       #469 (Ljava/lang/String;)Z
<   2: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #458 (Ljava/lang/Object;)Z
>       #460 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$1:(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;)Z
>       #463 (Ljava/lang/String;)Z
>   2: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1035,1038c1045,1048
<       #459 (Ljava/lang/Object;)Ljava/lang/Object;
<       #470 REF_invokeStatic org/junit/platform/engine/TestTag.create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<       #475 (Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
<   3: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #453 (Ljava/lang/Object;)Ljava/lang/Object;
>       #464 REF_invokeStatic org/junit/platform/engine/TestTag.create:(Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>       #469 (Ljava/lang/String;)Lorg/junit/platform/engine/TestTag;
>   3: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1040,1043c1050,1053
<       #476 ()Ljava/lang/Object;
<       #477 REF_newInvokeSpecial java/util/LinkedHashSet."<init>":()V
<       #481 ()Ljava/util/LinkedHashSet;
<   4: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #470 ()Ljava/lang/Object;
>       #471 REF_newInvokeSpecial java/util/LinkedHashSet."<init>":()V
>       #475 ()Ljava/util/LinkedHashSet;
>   4: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1045,1048c1055,1058
<       #459 (Ljava/lang/Object;)Ljava/lang/Object;
<       #483 REF_invokeStatic java/util/Collections.unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
<       #488 (Ljava/util/LinkedHashSet;)Ljava/util/Set;
<   5: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #453 (Ljava/lang/Object;)Ljava/lang/Object;
>       #477 REF_invokeStatic java/util/Collections.unmodifiableSet:(Ljava/util/Set;)Ljava/util/Set;
>       #482 (Ljava/util/LinkedHashSet;)Ljava/util/Set;
>   5: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1050,1053c1060,1063
<       #459 (Ljava/lang/Object;)Ljava/lang/Object;
<       #490 REF_invokeInterface org/junit/jupiter/api/parallel/Execution.value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
<       #493 (Lorg/junit/jupiter/api/parallel/Execution;)Lorg/junit/jupiter/api/parallel/ExecutionMode;
<   6: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #453 (Ljava/lang/Object;)Ljava/lang/Object;
>       #484 REF_invokeInterface org/junit/jupiter/api/parallel/Execution.value:()Lorg/junit/jupiter/api/parallel/ExecutionMode;
>       #487 (Lorg/junit/jupiter/api/parallel/Execution;)Lorg/junit/jupiter/api/parallel/ExecutionMode;
>   6: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1055,1058c1065,1068
<       #459 (Ljava/lang/Object;)Ljava/lang/Object;
<       #495 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.toExecutionMode:(Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
<       #496 (Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
<   7: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #453 (Ljava/lang/Object;)Ljava/lang/Object;
>       #489 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.toExecutionMode:(Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
>       #490 (Lorg/junit/jupiter/api/parallel/ExecutionMode;)Lorg/junit/platform/engine/support/hierarchical/Node$ExecutionMode;
>   7: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1060,1063c1070,1073
<       #459 (Ljava/lang/Object;)Ljava/lang/Object;
<       #497 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<       #500 (Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
<   8: #452 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
---
>       #453 (Ljava/lang/Object;)Ljava/lang/Object;
>       #491 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getExclusiveResourcesFromAnnotation$2:(Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>       #494 (Lorg/junit/jupiter/api/parallel/ResourceLock;)Lorg/junit/platform/engine/support/hierarchical/ExclusiveResource;
>   8: #499 REF_invokeStatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
1065,1067c1075,1077
<       #476 ()Ljava/lang/Object;
<       #501 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
<       #504 ()Ljava/lang/String;
---
>       #470 ()Ljava/lang/Object;
>       #495 REF_invokeStatic org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.lambda$getTags$0:(Ljava/lang/String;Ljava/lang/reflect/AnnotatedElement;)Ljava/lang/String;
>       #498 ()Ljava/lang/String;
1069,1070c1079,1080
<   static #506= #109 of #8;                // ExceptionHandlerInvoker=class org/junit/jupiter/engine/descriptor/JupiterTestDescriptor$ExceptionHandlerInvoker of class org/junit/jupiter/engine/descriptor/JupiterTestDescriptor
<   public static final #507= #134 of #360; // ExecutionMode=class org/junit/platform/engine/support/hierarchical/Node$ExecutionMode of class org/junit/platform/engine/support/hierarchical/Node
---
>   static #507= #109 of #8;                // ExceptionHandlerInvoker=class org/junit/jupiter/engine/descriptor/JupiterTestDescriptor$ExceptionHandlerInvoker of class org/junit/jupiter/engine/descriptor/JupiterTestDescriptor
>   public static final #508= #134 of #360; // ExecutionMode=class org/junit/platform/engine/support/hierarchical/Node$ExecutionMode of class org/junit/platform/engine/support/hierarchical/Node
1072,1075c1082,1085
<   public static final #508= #222 of #310; // LockMode=class org/junit/platform/engine/support/hierarchical/ExclusiveResource$LockMode of class org/junit/platform/engine/support/hierarchical/ExclusiveResource
<   public static #509= #286 of #360;       // SkipResult=class org/junit/platform/engine/support/hierarchical/Node$SkipResult of class org/junit/platform/engine/support/hierarchical/Node
<   public static final #514= #510 of #512; // Status=class org/apiguardian/api/API$Status of class org/apiguardian/api/API
<   public static final #519= #515 of #517; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
---
>   public static final #509= #222 of #310; // LockMode=class org/junit/platform/engine/support/hierarchical/ExclusiveResource$LockMode of class org/junit/platform/engine/support/hierarchical/ExclusiveResource
>   public static #510= #286 of #360;       // SkipResult=class org/junit/platform/engine/support/hierarchical/Node$SkipResult of class org/junit/platform/engine/support/hierarchical/Node
>   public static final #515= #511 of #513; // Status=class org/apiguardian/api/API$Status of class org/apiguardian/api/API
>   public static final #520= #516 of #518; // Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles

I think the most interesting part is this:

959a961,963
>     MethodParameters:
>       Name                           Flags
>       <no name>                      synthetic
977a982,984
>     MethodParameters:
>       Name                           Flags
>       <no name>                      synthetic
995a1003,1005
>     MethodParameters:
>       Name                           Flags
>       <no name>                      synthetic

which is on all three synthetic methods.

@sormuras
Copy link
Member

This is the underlying change, introduced in Java 21: https://bugs.openjdk.org/browse/JDK-8292275

@marcphilipp
Copy link
Member

Adding -parameters seems to fix the issue: #3798

@sormuras
Copy link
Member

FYI: https://bugs.openjdk.org/browse/JDK-8058322 fixed the underlying issue some time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment