RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2]

Christian Stein cstein at openjdk.org
Thu Sep 4 05:55:43 UTC 2025


On Wed, 3 Sep 2025 14:19:10 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update copyright year
>
> test/langtools/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestKinds.java line 185:
> 
>> 183: }
>> 184: 
>> 185: class LocalTestInstanceFactory implements TestInstanceFactory {
> 
> Can't junit call the no-arg constructor naturally :thinking:

It does; but iff it is the sole constructor. As Jupiter supports parameter injection by default, it's impossible to select the right constructor.

> If no `TestInstanceFactory` is registered, the framework will invoke the _sole_ constructor for the test class to instantiate it, potentially resolving constructor arguments via registered `ParameterResolver` extensions.

Find details at: https://docs.junit.org/current/user-guide/#writing-tests-dependency-injection
and: https://docs.junit.org/current/user-guide/#extensions-test-instance-factories

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2320909559


More information about the compiler-dev mailing list