RFR: 8163229: test test/tools/javac/CaptureInSubtype.java has a main method that is never executed Export [v3]

Archie L. Cobbs duke at openjdk.org
Thu Jan 5 18:31:52 UTC 2023


On Thu, 5 Jan 2023 18:13:15 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Archie L. Cobbs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>> 
>>  - Merge branch 'master' into JDK-8163229
>>  - Merge branch 'master' into JDK-8163229
>>  - Rename or remove "main()" methods in tests that never actually run.
>
> test/langtools/tools/javac/4980495/static/Test.java line 14:
> 
>> 12: public class Test {
>> 13: 
>> 14:     public static void meth() {
> 
> not sure about this case, but if a method doesn't need to be `static` we should remove the modifier, consider removing `public` too if not needed

Yes - in fact, at first I started doing that as well, but it turns out that doing this wholesale generates a bunch of test failures, and therefore requires a good bit more analysis to figure out which tests can handle it and which can't. The primary goal here is to remove misleading `public static void main(String[])` methods, not minimize in general. Perhaps more a general test minimization effort could be relegated to "phase 2", i.e., another bug?

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

PR: https://git.openjdk.org/jdk/pull/10992


More information about the compiler-dev mailing list