From jlahoda at openjdk.org Mon Sep 1 05:57:51 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Mon, 1 Sep 2025 05:57:51 GMT Subject: Integrated: 8177650: JShell tool: packages in classpath don't appear in completions In-Reply-To: References: Message-ID: <5adI4-XiRbIbljX36NB6Hl5rQ9u7LcFGAyxsZVxvJpo=.2ba4eb7c-a545-46e0-b06e-ad37c940e753@github.com> On Fri, 4 Jul 2025 17:32:38 GMT, Jan Lahoda wrote: > JShell provides the code completion feature, where it suggests possible follow ups for a given snippet prefix. To allow completion for packages, JShell uses a background task to go through known classes and create an index for them. > > There are two problems with this background task: > - the classpath is read from the JShell's FileManager, but the FileManager may not be configured with the compile options yet, so the classpath may not be filled yet, > - the module path is not included in the list of paths to paths to search > > This PR proposes to: > - use FileManager configured by passing the compile options through javac > - include the module path in the search path This pull request has now been integrated. Changeset: 28942406 Author: Jan Lahoda URL: https://git.openjdk.org/jdk/commit/28942406020881be79b7543105b9eb2a0dda429e Stats: 373 lines in 5 files changed: 340 ins; 23 del; 10 mod 8177650: JShell tool: packages in classpath don't appear in completions Reviewed-by: asotona ------------- PR: https://git.openjdk.org/jdk/pull/26137 From lkorinth at openjdk.org Mon Sep 1 08:07:48 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 08:07:48 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v8] In-Reply-To: References: Message-ID: <1SVkL88-a7Es6cosezvIjvZ63F4nv-2Kut2oKG27Eo8=.f2e2a083-b51d-4df9-ab6e-ec324467ebb9@github.com> > This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) > > In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). > > My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. > > These fixes have been created when I have ploughed through test cases: > JDK-8352719: Add an equals sign to the modules statement > JDK-8352709: Remove bad timing annotations from WhileOpTest.java > JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test > CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE > CODETOOLS-7903961: Make default timeout configurable > > After the review, I will update the copyrights. > > I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. > > I got 4 timing related faults: > 1) runtime/Thread/TestThreadDumpMonitorContention.java > This is probably: https://bugs.openjdk.org/browse/JDK-8361370 > 2) sun/tools/jhsdb/BasicLauncherTest.java > I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. > 3) gc/stress/TestReclaimStringsLeaksMemory.java > I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. > 4) sun/security/ssl/X509KeyManager/CertChecking.java > This is a new test that I got on last rebase. I have added a timeout of 480 to it. > > In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. > > From the review of the cancelled "8356171: Increase timeout for test cases as preparation for change of... Leo Korinth has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision: - new timeouts - Merge branch '_master_jdk' into _8260555 - update copyright - revert added timeout, it is not needed - feedback from Mark Sheppard - update testing.md, remove makefile link, fix bad text - after suggestion from Daniel - added extra timeout for: jdk/internal/vm/Continuation/BasicExt.java#COMP_WINDOW_LENGTH_{1-3}-GC_AFTER_YIELD - After suggestions from Erik and Andrey - 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26749/files - new: https://git.openjdk.org/jdk/pull/26749/files/4b33904a..7ca719c8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=07 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=06-07 Stats: 37788 lines in 1054 files changed: 23834 ins; 9562 del; 4392 mod Patch: https://git.openjdk.org/jdk/pull/26749.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26749/head:pull/26749 PR: https://git.openjdk.org/jdk/pull/26749 From lkorinth at openjdk.org Mon Sep 1 13:21:49 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 13:21:49 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v9] In-Reply-To: References: Message-ID: > This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) > > In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). > > My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. > > These fixes have been created when I have ploughed through test cases: > JDK-8352719: Add an equals sign to the modules statement > JDK-8352709: Remove bad timing annotations from WhileOpTest.java > JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test > CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE > CODETOOLS-7903961: Make default timeout configurable > > After the review, I will update the copyrights. > > I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. > > I got 4 timing related faults: > 1) runtime/Thread/TestThreadDumpMonitorContention.java > This is probably: https://bugs.openjdk.org/browse/JDK-8361370 > 2) sun/tools/jhsdb/BasicLauncherTest.java > I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. > 3) gc/stress/TestReclaimStringsLeaksMemory.java > I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. > 4) sun/security/ssl/X509KeyManager/CertChecking.java > This is a new test that I got on last rebase. I have added a timeout of 480 to it. > > In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. > > From the review of the cancelled "8356171: Increase timeout for test cases as preparation for change of... Leo Korinth has updated the pull request incrementally with one additional commit since the last revision: changed both test in GetStackTraceALotWhenBlocking to use timeout of 1200 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26749/files - new: https://git.openjdk.org/jdk/pull/26749/files/7ca719c8..5c0bcd19 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=08 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26749&range=07-08 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/26749.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26749/head:pull/26749 PR: https://git.openjdk.org/jdk/pull/26749 From alanb at openjdk.org Mon Sep 1 13:55:46 2025 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 1 Sep 2025 13:55:46 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v9] In-Reply-To: References: Message-ID: On Mon, 1 Sep 2025 13:21:49 GMT, Leo Korinth wrote: >> This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) >> >> In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). >> >> My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. >> >> These fixes have been created when I have ploughed through test cases: >> JDK-8352719: Add an equals sign to the modules statement >> JDK-8352709: Remove bad timing annotations from WhileOpTest.java >> JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test >> CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE >> CODETOOLS-7903961: Make default timeout configurable >> >> After the review, I will update the copyrights. >> >> I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. >> >> I got 4 timing related faults: >> 1) runtime/Thread/TestThreadDumpMonitorContention.java >> This is probably: https://bugs.openjdk.org/browse/JDK-8361370 >> 2) sun/tools/jhsdb/BasicLauncherTest.java >> I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. >> 3) gc/stress/TestReclaimStringsLeaksMemory.java >> I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. >> 4) sun/security/ssl/X509KeyManager/CertChecking.java >> This is a new test that I got on last rebase. I have added a timeout of 480 to it. >> >> In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. >> >> From the review of the cancelled "8356171: ... > > Leo Korinth has updated the pull request incrementally with one additional commit since the last revision: > > changed both test in GetStackTraceALotWhenBlocking to use timeout of 1200 Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/26749#pullrequestreview-3173774701 From lkorinth at openjdk.org Mon Sep 1 16:00:47 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 16:00:47 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v5] In-Reply-To: References: Message-ID: <9X-5PBm7G1Y8vJ8bw02E501aWdgleLyUWMk3nhSrF08=.bb490a54-e687-49cc-9ecc-df7c051eef18@github.com> On Fri, 22 Aug 2025 15:46:18 GMT, Albert Mingkun Yang wrote: >> Leo Korinth has updated the pull request incrementally with one additional commit since the last revision: >> >> update testing.md, remove makefile link, fix bad text > > test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/SuspendResume2.java line 31: > >> 29: * @compile SuspendResume2.java >> 30: * @run driver jdk.test.lib.FileInstaller . . >> 31: * @run main/othervm/native/timeout=700 > > Why `700` instead of `480` in this file? I think this is one of the earlier tests that failed with a timeout factor of `0.7` on 480. Later on I doubled it, but here I was a bit more conservative. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26749#discussion_r2314279387 From lkorinth at openjdk.org Mon Sep 1 16:09:44 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Mon, 1 Sep 2025 16:09:44 GMT Subject: RFR: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 [v5] In-Reply-To: References: Message-ID: On Mon, 25 Aug 2025 13:48:10 GMT, Albert Mingkun Yang wrote: >> It is a way to give a "4x" lowest value, while not multiplying a 10x factor with four resulting in a 40x factor. I think (but I am not sure) that it would sometime time out if I only used the given timeout factor and not "guarding" with the max(x, 4). > >> while not multiplying a 10x factor with four resulting in a 40x factor. > > Why is that undesirable? The base is `(HOLD_TARGET_TIME + 30000) * 4` and the timeout-factor changes that linearly. Using `max(..., 4)` here may come as a surprise to end users, IMO. Because 40x is a very large timeout factor. I think I might misunderstand you in some way. My change is conservative, and will give a timeout that is not smaller than before (but can be larger if an explicit (non-default) timeout factor less than 4 was used before). Does that make sense, or do I answer something different from what you are asking? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26749#discussion_r2314295263 From duke at openjdk.org Tue Sep 2 00:54:58 2025 From: duke at openjdk.org (duke) Date: Tue, 2 Sep 2025 00:54:58 GMT Subject: Withdrawn: 8347291: Exhaustive switch over a generic sealed abstract class In-Reply-To: References: Message-ID: On Fri, 24 Jan 2025 01:08:56 GMT, Liam Miller-Cushon wrote: > This change avoids javac incorrectly reporting switches like the example in [JDK-8347291](https://bugs.openjdk.org/browse/JDK-8347291) as exhaustive. > > As Jan noted in the bug it seems like the inference behaviour here may not be correct. If it was able to infer a type without crashing that would also avoid the bug. > > However with the current inference behaviour, it's safer to assume that if inference crashes the subtype may need to be handled by the switch, instead of assuming that it doesn't. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/23286 From lkorinth at openjdk.org Tue Sep 2 07:29:57 2025 From: lkorinth at openjdk.org (Leo Korinth) Date: Tue, 2 Sep 2025 07:29:57 GMT Subject: Integrated: 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 In-Reply-To: References: Message-ID: On Tue, 12 Aug 2025 17:01:41 GMT, Leo Korinth wrote: > This changes the timeout factor from 4 to 1. Most of the changes add timeouts to individual test cases so that I am able to run them with a timeout factor of 0.7 (some margin to the checked in factor of one) > > In addition to changing the timeout factor, I am also using a library call to parse the timeout factor from the Java properties (I cannot use the library function everywhere as jtreg does not allow me to add @library notations to non test case files). > > My approach has been to run all tests, and afterwards updating those that fail due to the timeout factor. The amount of updated test cases is huge, and my strategy has been to quadruple the timeout if I could not directly see that less was needed. In a few places, I have added a bit more timeout so that it will work with the 0.7 timeout factor. > > These fixes have been created when I have ploughed through test cases: > JDK-8352719: Add an equals sign to the modules statement > JDK-8352709: Remove bad timing annotations from WhileOpTest.java > JDK-8352074: Test MemoryLeak.java seems not to test what it is supposed to test > CODETOOLS-7903937: JTREG uses timeout factor on socket timeout but not on KEEPALIVE > CODETOOLS-7903961: Make default timeout configurable > > After the review, I will update the copyrights. > > I have run testing tier1-8. The last time with a timeout factor of 1 instead of 0.7. > > I got 4 timing related faults: > 1) runtime/Thread/TestThreadDumpMonitorContention.java > This is probably: https://bugs.openjdk.org/browse/JDK-8361370 > 2) sun/tools/jhsdb/BasicLauncherTest.java > I am unsure about this one, it has not failed on my runs before, even with a timeout factor of 0.7, maybe I was unlucky. > 3) gc/stress/TestReclaimStringsLeaksMemory.java > I updated this to 480 seconds, I finish this fairly fast (~14s) on my not very fast computer, but the Macs that fail are old x86-based ones. > 4) sun/security/ssl/X509KeyManager/CertChecking.java > This is a new test that I got on last rebase. I have added a timeout of 480 to it. > > In addition to these four tests, I have another one "java/lang/ThreadLocal/MemoryLeak.java" that earlier failed with a timeout factor of 0.7 but did not fail in the last run. I will *not* update that test case, because the extra time spent is strange and should be looked at. I have created JDK-8352074 on that test case, and I will probably create another bug describing the timeout I got. > > From the review of the cancelled "8356171: Increase timeout for test cases as preparation for change of... This pull request has now been integrated. Changeset: 55e7af05 Author: Leo Korinth URL: https://git.openjdk.org/jdk/commit/55e7af0560335ef69af072cee60956cf8e6d00a1 Stats: 901 lines in 342 files changed: 51 ins; 91 del; 759 mod 8260555: Change the default TIMEOUT_FACTOR from 4 to 1 Reviewed-by: alanb, sspitsyn, lmesnik, ihse ------------- PR: https://git.openjdk.org/jdk/pull/26749 From jlahoda at openjdk.org Wed Sep 3 05:54:31 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Wed, 3 Sep 2025 05:54:31 GMT Subject: RFR: 8351260: java.lang.AssertionError: Unexpected type tree: (ERROR) = (ERROR) Message-ID: Consider a very broken declaration like this: void test(List<@AlphaChars <@StringLength(int value = 5)String> s){ after seeing `@AlphaChars`, javac will try to parse `<@StringLength(int value = 5)String>` as a type, and assign the annotation to the type. But, the text does not parse as a type well (partly due to the `int value = 5`), and the parsing will proceed in an expression mode. Then a search for target type is performed to attach the annotation, and that fails, as the expression tree is not expected to be part of the type. The main proposal here is to wrap the badly parsed type in an `Erroneous` tree. The overall error recovery then seems to handle the situation well. The situation produces quite a few error reports, but it is not clear if this situation (esp. the nested `int value = 5`) is common enough to stretch the parsing error recovery capabilities to accommodate this code. ------------- Commit messages: - Adding more tests and a comment. - 8351260: java.lang.AssertionError: Unexpected type tree: (ERROR) = (ERROR) Changes: https://git.openjdk.org/jdk/pull/27065/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27065&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8351260 Stats: 92 lines in 3 files changed: 90 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27065.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27065/head:pull/27065 PR: https://git.openjdk.org/jdk/pull/27065 From syan at openjdk.org Wed Sep 3 07:28:20 2025 From: syan at openjdk.org (SendaoYan) Date: Wed, 3 Sep 2025 07:28:20 GMT Subject: RFR: 8366582: Problemlist jdk/jshell/ToolSimpleTest.java Message-ID: Hi all, Should we problemlist jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java on windows platform before the root cause been fixed. ------------- Commit messages: - 8366582: Problemlist jdk/jshell/ToolSimpleTest.java Changes: https://git.openjdk.org/jdk/pull/27066/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27066&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366582 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27066.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27066/head:pull/27066 PR: https://git.openjdk.org/jdk/pull/27066 From jlahoda at openjdk.org Wed Sep 3 09:00:42 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Wed, 3 Sep 2025 09:00:42 GMT Subject: RFR: 8366768: Problemlist jdk/jshell/ToolSimpleTest.java In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 07:23:01 GMT, SendaoYan wrote: > Hi all, > > Should we problemlist jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java on windows platform before the root cause been fixed. Looks good to me - thanks! ------------- Marked as reviewed by jlahoda (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27066#pullrequestreview-3179661866 From mcimadamore at openjdk.org Wed Sep 3 09:49:47 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 3 Sep 2025 09:49:47 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable In-Reply-To: References: Message-ID: <55UyC_qFFghp_fxg7oVtMk6_R6zMICrikszIO0HtIJ0=.40ab454b-e658-4356-b06f-ab548af2a946@github.com> On Sat, 30 Aug 2025 00:37:44 GMT, Chen Liang wrote: > The interface static methods added in Java 8 are never inherited in method resolution. However, javac incorrectly allowed them to be resolved against type variables with an interface as its only upper bound, which violates JLS 4.9: > >> The members of an intersection type are the members of the class or interface it induces. > > Combined with JLS 4.4: > >> The members of a type variable X with bound T & I1 & ... & In are the members of the intersection type ([?4.9](https://docs.oracle.com/javase/specs/jls/se24/html/jls-4.html#jls-4.9)) T & I1 & ... & In appearing at the point where the type variable is declared > > Last time this piece of code in Attr was updated was around Java 7, so this was probably missed in Java 8. > > The test cases added showcases wrong ways to refer to interface static methods: `Collator`, a subtype of `Comparator`, cannot use `reverseOrder`, so shouldn't type variable `T` bounded by `Comparator` be able to do so. > > In addition, the error for private member access on type variables should probably have been symbol not found instead of access errors - we might revisit that later. I made the new error symbol not found for parity with interface static reference on classes, as showcased in the compiler output in this new test. src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4577: > 4575: // 1. Private members > 4576: // 2. Interface static methods > 4577: Symbol sym2 = sym.isPrivate() Code is good, but please break up the big conditional ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27015#discussion_r2318416548 From mcimadamore at openjdk.org Wed Sep 3 09:56:42 2025 From: mcimadamore at openjdk.org (Maurizio Cimadamore) Date: Wed, 3 Sep 2025 09:56:42 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable In-Reply-To: References: Message-ID: On Sat, 30 Aug 2025 00:37:44 GMT, Chen Liang wrote: > The interface static methods added in Java 8 are never inherited in method resolution. However, javac incorrectly allowed them to be resolved against type variables with an interface as its only upper bound, which violates JLS 4.9: > >> The members of an intersection type are the members of the class or interface it induces. > > Combined with JLS 4.4: > >> The members of a type variable X with bound T & I1 & ... & In are the members of the intersection type ([?4.9](https://docs.oracle.com/javase/specs/jls/se24/html/jls-4.html#jls-4.9)) T & I1 & ... & In appearing at the point where the type variable is declared > > Last time this piece of code in Attr was updated was around Java 7, so this was probably missed in Java 8. > > The test cases added showcases wrong ways to refer to interface static methods: `Collator`, a subtype of `Comparator`, cannot use `reverseOrder`, so shouldn't type variable `T` bounded by `Comparator` be able to do so. > > In addition, the error for private member access on type variables should probably have been symbol not found instead of access errors - we might revisit that later. I made the new error symbol not found for parity with interface static reference on classes, as showcased in the compiler output in this new test. The fix is correct, and mimics a fix that I made several years ago :-) https://hg.openjdk.org/jdk9/jdk9/langtools/rev/4d2d8b6459e1 I'd suggest to add a test with a type variable with intersection type bound, just for good measure, ------------- PR Review: https://git.openjdk.org/jdk/pull/27015#pullrequestreview-3179877224 From liach at openjdk.org Wed Sep 3 12:53:48 2025 From: liach at openjdk.org (Chen Liang) Date: Wed, 3 Sep 2025 12:53:48 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 09:53:40 GMT, Maurizio Cimadamore wrote: > I'd suggest to add a test with a type variable with intersection type bound, just for good measure Sure. One with bound `T extends Object & Comparator` would definitely better showcase the JLS rules without the fix, as this is already correct. Do you think I need a CSR? ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3249124415 From cstein at openjdk.org Wed Sep 3 13:12:37 2025 From: cstein at openjdk.org (Christian Stein) Date: Wed, 3 Sep 2025 13:12:37 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac Message-ID: Please review this change to use JUnit in tests of `test/langtools/tools/javac`. ### Assess Status Quo A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 Framework-based tests: 3043 = 2762 TestNG + 281 JUnit ### Perform Automatic Conversion - [junit-convert]( https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) ### Perform Manual Adjustments Some of the following adjustments will be integrated into the `junit-convert` tool. #### Make argument source factory method `static` Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' must be static: local factory methods must be static unless the PER_CLASS @testinstance lifecycle mode is used; external factory methods must always be static. #### Make `@AfterAll`-annotated method `static` [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' must be static unless the test class is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. #### Remove `static` modifier from `@Test`-annotated methods This configuration error should have been detected by JUnit Jupiter and reported via the Discovery Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues #### Rename test property to `JUnit.dirs` package org.junit.jupiter.api does not exist #### Add custom test instance factory Class [FDTests] must declare a single constructor Class [MethodReferenceTestKinds] must declare a single constructor ### Results Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 Framework-based tests: 3043 = 0 TestNG + 3043 JUnit ------------- Commit messages: - Remove `static` modifier from `@Test`-annotated methods - Manual adjustments - Initial automatic conversion Changes: https://git.openjdk.org/jdk/pull/27046/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366678 Stats: 628 lines in 39 files changed: 211 ins; 92 del; 325 mod Patch: https://git.openjdk.org/jdk/pull/27046.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27046/head:pull/27046 PR: https://git.openjdk.org/jdk/pull/27046 From liach at openjdk.org Wed Sep 3 13:41:42 2025 From: liach at openjdk.org (Chen Liang) Date: Wed, 3 Sep 2025 13:41:42 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac In-Reply-To: References: Message-ID: On Tue, 2 Sep 2025 12:30:08 GMT, Christian Stein wrote: > Please review this change to use JUnit in tests of `test/langtools/tools/javac`. > > ### Assess Status Quo > A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: > > Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 2762 TestNG + 281 JUnit > > > ### Perform Automatic Conversion > - [junit-convert]( > https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) > > ### Perform Manual Adjustments > > Some of the following adjustments will be integrated into the `junit-convert` tool. > > #### Make argument source factory method `static` > > Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' > must be static: local factory methods must be static > unless the PER_CLASS @testinstance lifecycle mode is used; > external factory methods must always be static. > > > #### Make `@AfterAll`-annotated method `static` > > [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' > must be static unless the test class > is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. > > > #### Remove `static` modifier from `@Test`-annotated methods > This configuration error should have been detected by JUnit Jupiter and reported via the Discovery > Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues > > #### Rename test property to `JUnit.dirs` > > package org.junit.jupiter.api does not exist > > > #### Add custom test instance factory > > Class [FDTests] must declare a single constructor > Class [MethodReferenceTestKinds] must declare a single constructor > > > ### Results > Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: > > Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 0 TestNG + 3043 JUnit Please run `bash make/scripts/update_copyright_year.sh -b 31847149c1956b23c19a99309982660b4bbdd2d6` to update your copyright years. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27046#issuecomment-3249303386 From cstein at openjdk.org Wed Sep 3 13:52:33 2025 From: cstein at openjdk.org (Christian Stein) Date: Wed, 3 Sep 2025 13:52:33 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: > Please review this change to use JUnit in tests of `test/langtools/tools/javac`. > > ### Assess Status Quo > A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: > > Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 2762 TestNG + 281 JUnit > > > ### Perform Automatic Conversion > - [junit-convert]( > https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) > > ### Perform Manual Adjustments > > Some of the following adjustments will be integrated into the `junit-convert` tool. > > #### Make argument source factory method `static` > > Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' > must be static: local factory methods must be static > unless the PER_CLASS @testinstance lifecycle mode is used; > external factory methods must always be static. > > > #### Make `@AfterAll`-annotated method `static` > > [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' > must be static unless the test class > is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. > > > #### Remove `static` modifier from `@Test`-annotated methods > This configuration error should have been detected by JUnit Jupiter and reported via the Discovery > Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues > > #### Rename test property to `JUnit.dirs` > > package org.junit.jupiter.api does not exist > > > #### Add custom test instance factory > > Class [FDTests] must declare a single constructor > Class [MethodReferenceTestKinds] must declare a single constructor > > > ### Results > Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: > > Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 0 TestNG + 3043 JUnit Christian Stein has updated the pull request incrementally with one additional commit since the last revision: Update copyright year ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27046/files - new: https://git.openjdk.org/jdk/pull/27046/files/5c3baed1..4fa84ef8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=00-01 Stats: 37 lines in 37 files changed: 0 ins; 0 del; 37 mod Patch: https://git.openjdk.org/jdk/pull/27046.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27046/head:pull/27046 PR: https://git.openjdk.org/jdk/pull/27046 From syan at openjdk.org Wed Sep 3 14:10:41 2025 From: syan at openjdk.org (SendaoYan) Date: Wed, 3 Sep 2025 14:10:41 GMT Subject: RFR: 8366768: Problemlist jdk/jshell/ToolSimpleTest.java In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 08:57:40 GMT, Jan Lahoda wrote: >> Hi all, >> >> Should we problemlist jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java on windows platform before the root cause been fixed. > > Looks good to me - thanks! Thanks for your review @lahodaj I think we should merge this PR quickly to avoid test noisy, because this is tier1 test ------------- PR Comment: https://git.openjdk.org/jdk/pull/27066#issuecomment-3249417277 From jlahoda at openjdk.org Wed Sep 3 14:20:51 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Wed, 3 Sep 2025 14:20:51 GMT Subject: RFR: 8366768: Problemlist jdk/jshell/ToolSimpleTest.java In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 08:57:40 GMT, Jan Lahoda wrote: >> Hi all, >> >> Should we problemlist jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java on windows platform before the root cause been fixed. > > Looks good to me - thanks! > Thanks for your review @lahodaj > > I think we should merge this PR quickly to avoid test noisy, because this is tier1 test Nothing against that - but that's up to you, you must issue the `/integrate` command. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27066#issuecomment-3249460894 From liach at openjdk.org Wed Sep 3 14:32:45 2025 From: liach at openjdk.org (Chen Liang) Date: Wed, 3 Sep 2025 14:32:45 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 13:52:33 GMT, Christian Stein wrote: >> Please review this change to use JUnit in tests of `test/langtools/tools/javac`. >> >> ### Assess Status Quo >> A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: >> >> Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 2762 TestNG + 281 JUnit >> >> >> ### Perform Automatic Conversion >> - [junit-convert]( >> https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) >> >> ### Perform Manual Adjustments >> >> Some of the following adjustments will be integrated into the `junit-convert` tool. >> >> #### Make argument source factory method `static` >> >> Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' >> must be static: local factory methods must be static >> unless the PER_CLASS @testinstance lifecycle mode is used; >> external factory methods must always be static. >> >> >> #### Make `@AfterAll`-annotated method `static` >> >> [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' >> must be static unless the test class >> is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. >> >> >> #### Remove `static` modifier from `@Test`-annotated methods >> This configuration error should have been detected by JUnit Jupiter and reported via the Discovery >> Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues >> >> #### Rename test property to `JUnit.dirs` >> >> package org.junit.jupiter.api does not exist >> >> >> #### Add custom test instance factory >> >> Class [FDTests] must declare a single constructor >> Class [MethodReferenceTestKinds] must declare a single constructor >> >> >> ### Results >> Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: >> >> Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 0 TestNG + 3043 JUnit > > Christian Stein has updated the pull request incrementally with one additional commit since the last revision: > > Update copyright year test/langtools/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java line 215: > 213: } > 214: > 215: public Object[][] createModes() { This one technically can be removed in favor of `@EnumSource` but since you are using a script and we can be more lenient. 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: test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java line 210: > 208: } > 209: > 210: class LocalTestInstanceFactory implements TestInstanceFactory { Since we have this again, can we just make a no-arg-constructor calling test instance factory and leave it in like /test/lib? test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java line 25: > 23: > 24: // this test has been disabled because of timeout issues. > 25: // see JDK-8006746 Should we convert this to a full jtreg header and use problem lists or `@ignore` directive instead? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2319026920 PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2319141375 PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2319162108 PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2319166549 From syan at openjdk.org Wed Sep 3 14:42:53 2025 From: syan at openjdk.org (SendaoYan) Date: Wed, 3 Sep 2025 14:42:53 GMT Subject: Integrated: 8366768: Problemlist jdk/jshell/ToolSimpleTest.java In-Reply-To: References: Message-ID: <-cLI1JmEaYL3suG7X0Lj3SCDohxYM8OxWuZLAzF8IaE=.021f55fe-35db-447a-8ed9-219db6d32ff4@github.com> On Wed, 3 Sep 2025 07:23:01 GMT, SendaoYan wrote: > Hi all, > > Should we problemlist jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java on windows platform before the root cause been fixed. This pull request has now been integrated. Changeset: d5935af2 Author: SendaoYan URL: https://git.openjdk.org/jdk/commit/d5935af228d7129d75d6987767de50b019ec30c7 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod 8366768: Problemlist jdk/jshell/ToolSimpleTest.java Reviewed-by: jlahoda ------------- PR: https://git.openjdk.org/jdk/pull/27066 From liach at openjdk.org Wed Sep 3 16:53:48 2025 From: liach at openjdk.org (Chen Liang) Date: Wed, 3 Sep 2025 16:53:48 GMT Subject: RFR: 8366768: Problemlist jdk/jshell/ToolSimpleTest.java In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 07:23:01 GMT, SendaoYan wrote: > Hi all, > > Should we problemlist jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java on windows platform before the root cause been fixed. This failure happened once on linux-aarch64 too. So probably not platform-specific. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27066#issuecomment-3250014488 From liach at openjdk.org Wed Sep 3 21:07:48 2025 From: liach at openjdk.org (Chen Liang) Date: Wed, 3 Sep 2025 21:07:48 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: > The interface static methods added in Java 8 are never inherited in method resolution. However, javac incorrectly allowed them to be resolved against type variables with an interface as its only upper bound, which violates JLS 4.9: > >> The members of an intersection type are the members of the class or interface it induces. > > Combined with JLS 4.4: > >> The members of a type variable X with bound T & I1 & ... & In are the members of the intersection type ([?4.9](https://docs.oracle.com/javase/specs/jls/se24/html/jls-4.html#jls-4.9)) T & I1 & ... & In appearing at the point where the type variable is declared > > Last time this piece of code in Attr was updated was around Java 7, so this was probably missed in Java 8. > > The test cases added showcases wrong ways to refer to interface static methods: `Collator`, a subtype of `Comparator`, cannot use `reverseOrder`, so shouldn't type variable `T` bounded by `Comparator` be able to do so. > > In addition, the error for private member access on type variables should probably have been symbol not found instead of access errors - we might revisit that later. I made the new error symbol not found for parity with interface static reference on classes, as showcased in the compiler output in this new test. Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - Break up long conditional, add intersection bounded test case - Merge branch 'master' of https://github.com/openjdk/jdk into fix/typevar-inherit-interface-static - 8365676: javac incorrectly allows calling interface static method via type variable ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27015/files - new: https://git.openjdk.org/jdk/pull/27015/files/266dc4c3..c3abc487 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27015&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27015&range=00-01 Stats: 7304 lines in 671 files changed: 4112 ins; 1396 del; 1796 mod Patch: https://git.openjdk.org/jdk/pull/27015.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27015/head:pull/27015 PR: https://git.openjdk.org/jdk/pull/27015 From liach at openjdk.org Wed Sep 3 21:11:43 2025 From: liach at openjdk.org (Chen Liang) Date: Wed, 3 Sep 2025 21:11:43 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 21:07:48 GMT, Chen Liang wrote: >> The interface static methods added in Java 8 are never inherited in method resolution. However, javac incorrectly allowed them to be resolved against type variables with an interface as its only upper bound, which violates JLS 4.9: >> >>> The members of an intersection type are the members of the class or interface it induces. >> >> Combined with JLS 4.4: >> >>> The members of a type variable X with bound T & I1 & ... & In are the members of the intersection type ([?4.9](https://docs.oracle.com/javase/specs/jls/se24/html/jls-4.html#jls-4.9)) T & I1 & ... & In appearing at the point where the type variable is declared >> >> Last time this piece of code in Attr was updated was around Java 7, so this was probably missed in Java 8. >> >> The test cases added showcases wrong ways to refer to interface static methods: `Collator`, a subtype of `Comparator`, cannot use `reverseOrder`, so shouldn't type variable `T` bounded by `Comparator` be able to do so. >> >> In addition, the error for private member access on type variables should probably have been symbol not found instead of access errors - we might revisit that later. I made the new error symbol not found for parity with interface static reference on classes, as showcased in the compiler output in this new test. > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Break up long conditional, add intersection bounded test case > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/typevar-inherit-interface-static > - 8365676: javac incorrectly allows calling interface static method via type variable Interesting thing surfaces - the one with `extends Object & Comparator` bound reports the location to be `java.lang.Object&java.util.Comparator` while the new failure reports the location of `T`. Should we seek to unify this somehow? ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3250814112 From acobbs at openjdk.org Wed Sep 3 23:36:02 2025 From: acobbs at openjdk.org (Archie Cobbs) Date: Wed, 3 Sep 2025 23:36:02 GMT Subject: RFR: 8155591: Misleading warning when not overriding close method in interface extending AutoCloseable Message-ID: The compiler generates a warning if you declare a `close()` method that throws any supertype of `InterruptedException` in a class or interface extending `AutoCloseable`. This is because suppressed `InterruptedException`'s are likely to lead to misbehavior at runtime. However, this feature also generates a warning due to `AutoCloseable.close()` itself, if you simply inherit it. For example: $ cat MyClass.java public interface MyClass extends AutoCloseable { } $ javac -Xlint:try MyClass.java MyClass.java:1: warning: [try] auto-closeable resource MyClass has a member method close() that could throw InterruptedException public interface MyClass extends AutoCloseable { ^ 1 warning The warning is not useful because `AutoCloseable.close()` is abstract and so it's going to be some other class' job to deal with the throws clause. This change prevents `AutoCloseable.close()` itself from triggering the warning in a class declaration. We preserve the existing behavior in which a warning is generated at the use site (i.e., at the try-with-resources statement). ------------- Commit messages: - Don't warn about AutoCloseable.close() itself throwing InterruptedException. Changes: https://git.openjdk.org/jdk/pull/27062/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27062&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8155591 Stats: 89 lines in 3 files changed: 86 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/27062.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27062/head:pull/27062 PR: https://git.openjdk.org/jdk/pull/27062 From vromero at openjdk.org Thu Sep 4 01:55:41 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 01:55:41 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 12:51:26 GMT, Chen Liang wrote: > > I'd suggest to add a test with a type variable with intersection type bound, just for good measure > > Sure. One with bound `T extends Object & Comparator` would definitely better showcase the JLS rules without the fix, as this is already correct. Do you think I need a CSR? IMO yes, I think this deserves a CSR and probably release notes ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3251413207 From vromero at openjdk.org Thu Sep 4 02:28:43 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 02:28:43 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 21:07:48 GMT, Chen Liang wrote: >> The interface static methods added in Java 8 are never inherited in method resolution. However, javac incorrectly allowed them to be resolved against type variables with an interface as its only upper bound, which violates JLS 4.9: >> >>> The members of an intersection type are the members of the class or interface it induces. >> >> Combined with JLS 4.4: >> >>> The members of a type variable X with bound T & I1 & ... & In are the members of the intersection type ([?4.9](https://docs.oracle.com/javase/specs/jls/se24/html/jls-4.html#jls-4.9)) T & I1 & ... & In appearing at the point where the type variable is declared >> >> Last time this piece of code in Attr was updated was around Java 7, so this was probably missed in Java 8. >> >> The test cases added showcases wrong ways to refer to interface static methods: `Collator`, a subtype of `Comparator`, cannot use `reverseOrder`, so shouldn't type variable `T` bounded by `Comparator` be able to do so. >> >> In addition, the error for private member access on type variables should probably have been symbol not found instead of access errors - we might revisit that later. I made the new error symbol not found for parity with interface static reference on classes, as showcased in the compiler output in this new test. > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Break up long conditional, add intersection bounded test case > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/typevar-inherit-interface-static > - 8365676: javac incorrectly allows calling interface static method via type variable lgtm ------------- Marked as reviewed by vromero (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27015#pullrequestreview-3183193092 From syan at openjdk.org Thu Sep 4 03:03:20 2025 From: syan at openjdk.org (SendaoYan) Date: Thu, 4 Sep 2025 03:03:20 GMT Subject: RFR: 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all Message-ID: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> Hi all, Sorry for the interrupt. At first we found that jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java fails on windows-x64 several times, but we found the tests also fails on linux-aarch64 and macos-aarch64 intermittently later. So should we problemlist these two tests as generic-all. ------------- Commit messages: - 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all Changes: https://git.openjdk.org/jdk/pull/27082/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27082&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8366849 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/27082.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27082/head:pull/27082 PR: https://git.openjdk.org/jdk/pull/27082 From liach at openjdk.org Thu Sep 4 03:05:41 2025 From: liach at openjdk.org (Chen Liang) Date: Thu, 4 Sep 2025 03:05:41 GMT Subject: RFR: 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all In-Reply-To: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> References: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> Message-ID: On Thu, 4 Sep 2025 02:57:34 GMT, SendaoYan wrote: > Hi all, > > Sorry for the interrupt. > At first we found that jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java fails on windows-x64 several times, but we found the tests also fails on linux-aarch64 and macos-aarch64 intermittently later. So should we problemlist these two tests as generic-all. Sure, we can go ahead with this for now. ------------- Marked as reviewed by liach (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27082#pullrequestreview-3183238917 From syan at openjdk.org Thu Sep 4 03:20:41 2025 From: syan at openjdk.org (SendaoYan) Date: Thu, 4 Sep 2025 03:20:41 GMT Subject: RFR: 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all In-Reply-To: References: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> Message-ID: On Thu, 4 Sep 2025 03:03:16 GMT, Chen Liang wrote: >> Hi all, >> >> Sorry for the interrupt. >> At first we found that jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java fails on windows-x64 several times, but we found the tests also fails on linux-aarch64 and macos-aarch64 intermittently later. So should we problemlist these two tests as generic-all. > > Sure, we can go ahead with this for now. @liach Thanks for the review. I will integrate this PR after the GHA test finish and no other suggestions. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27082#issuecomment-3251638027 From liach at openjdk.org Thu Sep 4 04:11:43 2025 From: liach at openjdk.org (Chen Liang) Date: Thu, 4 Sep 2025 04:11:43 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 21:07:48 GMT, Chen Liang wrote: >> The interface static methods added in Java 8 are never inherited in method resolution. However, javac incorrectly allowed them to be resolved against type variables with an interface as its only upper bound, which violates JLS 4.9: >> >>> The members of an intersection type are the members of the class or interface it induces. >> >> Combined with JLS 4.4: >> >>> The members of a type variable X with bound T & I1 & ... & In are the members of the intersection type ([?4.9](https://docs.oracle.com/javase/specs/jls/se24/html/jls-4.html#jls-4.9)) T & I1 & ... & In appearing at the point where the type variable is declared >> >> Last time this piece of code in Attr was updated was around Java 7, so this was probably missed in Java 8. >> >> The test cases added showcases wrong ways to refer to interface static methods: `Collator`, a subtype of `Comparator`, cannot use `reverseOrder`, so shouldn't type variable `T` bounded by `Comparator` be able to do so. >> >> In addition, the error for private member access on type variables should probably have been symbol not found instead of access errors - we might revisit that later. I made the new error symbol not found for parity with interface static reference on classes, as showcased in the compiler output in this new test. > > Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Break up long conditional, add intersection bounded test case > - Merge branch 'master' of https://github.com/openjdk/jdk into fix/typevar-inherit-interface-static > - 8365676: javac incorrectly allows calling interface static method via type variable I have created the CSR https://bugs.openjdk.org/browse/JDK-8366848. Please help review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3251755049 From cstein at openjdk.org Thu Sep 4 05:49:43 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 05:49:43 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 13:42:25 GMT, Chen Liang wrote: >> Christian Stein has updated the pull request incrementally with one additional commit since the last revision: >> >> Update copyright year > > test/langtools/tools/javac/file/MultiReleaseJar/MultiReleaseJarTest.java line 215: > >> 213: } >> 214: >> 215: public Object[][] createModes() { > > This one technically can be removed in favor of `@EnumSource` but since you are using a script and we can be more lenient. Yes; but cleaning up the overall test setup and logic isn't part of this change. The goal is to keep the change set as minimal as possible. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2320900792 From cstein at openjdk.org Thu Sep 4 05:55:43 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 05:55:43 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 14:19:10 GMT, Chen Liang 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 From cstein at openjdk.org Thu Sep 4 06:03:45 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 06:03:45 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 14:26:10 GMT, Chen Liang wrote: >> Christian Stein has updated the pull request incrementally with one additional commit since the last revision: >> >> Update copyright year > > test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java line 210: > >> 208: } >> 209: >> 210: class LocalTestInstanceFactory implements TestInstanceFactory { > > Since we have this again, can we just make a no-arg-constructor calling test instance factory and leave it in like /test/lib? We either help Jupiter to select the right constructor or rewrite the test class to have a single one. An alternative implemented in a future Jupiter version could be to ignore `private` constructors. On the other hand, having the need and ability to create "detached" test instances, not managed by Jupiter, is very uncommon. As those detached instances won't take part in Jupiter's test instance lifecycle: https://docs.junit.org/current/user-guide/#writing-tests-test-instance-lifecycle > test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java line 25: > >> 23: >> 24: // this test has been disabled because of timeout issues. >> 25: // see JDK-8006746 > > Should we convert this to a full jtreg header and use problem lists or `@ignore` directive instead? I didn't find `JDK-8006746` nor `8006746` in no other file ? that's why I decided to dispose (against the goal of this PR to not clean up...) that comment. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2320918103 PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2320921571 From jlahoda at openjdk.org Thu Sep 4 06:23:42 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Thu, 4 Sep 2025 06:23:42 GMT Subject: RFR: 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all In-Reply-To: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> References: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> Message-ID: On Thu, 4 Sep 2025 02:57:34 GMT, SendaoYan wrote: > Hi all, > > Sorry for the interrupt. > At first we found that jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java fails on windows-x64 several times, but we found the tests also fails on linux-aarch64 and macos-aarch64 intermittently later. So should we problemlist these two tests as generic-all. Marked as reviewed by jlahoda (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/27082#pullrequestreview-3183617765 From syan at openjdk.org Thu Sep 4 07:17:47 2025 From: syan at openjdk.org (SendaoYan) Date: Thu, 4 Sep 2025 07:17:47 GMT Subject: RFR: 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all In-Reply-To: References: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> Message-ID: On Thu, 4 Sep 2025 03:03:16 GMT, Chen Liang wrote: >> Hi all, >> >> Sorry for the interrupt. >> At first we found that jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java fails on windows-x64 several times, but we found the tests also fails on linux-aarch64 and macos-aarch64 intermittently later. So should we problemlist these two tests as generic-all. > > Sure, we can go ahead with this for now. Thanks for the reviews @liach @lahodaj ------------- PR Comment: https://git.openjdk.org/jdk/pull/27082#issuecomment-3252247859 From syan at openjdk.org Thu Sep 4 07:17:48 2025 From: syan at openjdk.org (SendaoYan) Date: Thu, 4 Sep 2025 07:17:48 GMT Subject: Integrated: 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all In-Reply-To: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> References: <4II_7xlmLiSTyblPDCPe48ey-PQCt-mm44UQjNmwT5c=.1b3ccca5-f0be-4b06-987d-87591d37532c@github.com> Message-ID: <_oJ1DQ0Cgc5Om6lpZ4Me8ec8oyzdM-TFCY0Nu5ayrfQ=.599ba3b5-8ef9-4d83-8907-8e4c1c34527f@github.com> On Thu, 4 Sep 2025 02:57:34 GMT, SendaoYan wrote: > Hi all, > > Sorry for the interrupt. > At first we found that jdk/jshell/ToolSimpleTest.java and jdk/jshell/ToolLocalSimpleTest.java fails on windows-x64 several times, but we found the tests also fails on linux-aarch64 and macos-aarch64 intermittently later. So should we problemlist these two tests as generic-all. This pull request has now been integrated. Changeset: 986ecff5 Author: SendaoYan URL: https://git.openjdk.org/jdk/commit/986ecff5f9b16f1b41ff15ad94774d65f3a4631d Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod 8366849: Problemlist jdk/jshell/ToolSimpleTest.java as generic-all Reviewed-by: liach, jlahoda ------------- PR: https://git.openjdk.org/jdk/pull/27082 From vromero at openjdk.org Thu Sep 4 12:32:43 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 12:32:43 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 04:09:07 GMT, Chen Liang wrote: > I have created the CSR https://bugs.openjdk.org/browse/JDK-8366848. Please help review. suggestion: in the Specification section of the CSR consider including the related texts from the spec ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3253471561 From liach at openjdk.org Thu Sep 4 14:22:46 2025 From: liach at openjdk.org (Chen Liang) Date: Thu, 4 Sep 2025 14:22:46 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 12:29:50 GMT, Vicente Romero wrote: >> I have created the CSR https://bugs.openjdk.org/browse/JDK-8366848. Please help review. > >> I have created the CSR https://bugs.openjdk.org/browse/JDK-8366848. Please help review. > > suggestion: in the Specification section of the CSR consider including the related texts from the spec > question regarding the wording in the CSR: with your patch, won't the invocation of static methods belonging to interfaces be rejected even if the interface is not the only upper bound of the type variable? @vicente-romero-oracle I have updated the CSR to include relevant specs and give more examples. Please review again. ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3253970641 From liach at openjdk.org Thu Sep 4 14:26:47 2025 From: liach at openjdk.org (Chen Liang) Date: Thu, 4 Sep 2025 14:26:47 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 05:58:55 GMT, Christian Stein wrote: >> test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/javac/FDTest.java line 210: >> >>> 208: } >>> 209: >>> 210: class LocalTestInstanceFactory implements TestInstanceFactory { >> >> Since we have this again, can we just make a no-arg-constructor calling test instance factory and leave it in like /test/lib? > > We either help Jupiter to select the right constructor or rewrite the test class to have a single one. > > An alternative implemented in a future Jupiter version could be to ignore `private` constructors. On the other hand, having the need and ability to create "detached" test instances, not managed by Jupiter, is very uncommon. As those detached instances won't take part in Jupiter's test instance lifecycle: https://docs.junit.org/current/user-guide/#writing-tests-test-instance-lifecycle Well, uncommon as it is claimed to be, it already appeared twice in the set of tests in javac ? >> test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java line 25: >> >>> 23: >>> 24: // this test has been disabled because of timeout issues. >>> 25: // see JDK-8006746 >> >> Should we convert this to a full jtreg header and use problem lists or `@ignore` directive instead? > > I didn't find `JDK-8006746` nor `8006746` in no other file ? that's why I decided to dispose (against the goal of this PR to not clean up...) that comment. @vicente-romero-oracle Since you originally handled this test, can you decide what we should do with this? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2322379163 PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2322371905 From cstein at openjdk.org Thu Sep 4 15:42:42 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 15:42:42 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 14:23:58 GMT, Chen Liang wrote: >> We either help Jupiter to select the right constructor or rewrite the test class to have a single one. >> >> An alternative implemented in a future Jupiter version could be to ignore `private` constructors. On the other hand, having the need and ability to create "detached" test instances, not managed by Jupiter, is very uncommon. As those detached instances won't take part in Jupiter's test instance lifecycle: https://docs.junit.org/current/user-guide/#writing-tests-test-instance-lifecycle > > Well, uncommon as it is claimed to be, it already appeared twice in the set of tests in javac ? I think, these two classes started out as normal programs; using `main` methods as their entry-points. In such programs, you can and need to create instances to your liking, even of the static program-defining class. Using a framework, shifts the instantion duty to (most of the time) reflection, under the framework's control. That way, `@Before[After]All|Each` and other lifecycle callbacks are realized. Usually, you then never write `new MyObjectTest()` with your test code. That would be "detached" test instances; not par-taking in the test lifecycle. When those two test classes were migrated to use TestNG, they ended up with framework-managed instances (where @Test-annotated methods serve as entry-points) asserting stuff against "detached" instances created by the test logic. Therefore, I suggest to "just" help JUnit here to select the correct constructor - which TestNG does by default. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2322594772 From cstein at openjdk.org Thu Sep 4 16:34:26 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 16:34:26 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v3] In-Reply-To: References: Message-ID: <41uyd48pDiO7CqIKx3f9oVaiFPqVr2Vv0ZSZobUUlFE=.6ed9a790-5d7e-4988-a3dc-0d16be7f7d9c@github.com> > Please review this change to use JUnit in tests of `test/langtools/tools/javac`. > > ### Assess Status Quo > A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: > > Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 2762 TestNG + 281 JUnit > > > ### Perform Automatic Conversion > - [junit-convert]( > https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) > > ### Perform Manual Adjustments > > Some of the following adjustments will be integrated into the `junit-convert` tool. > > #### Make argument source factory method `static` > > Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' > must be static: local factory methods must be static > unless the PER_CLASS @testinstance lifecycle mode is used; > external factory methods must always be static. > > > #### Make `@AfterAll`-annotated method `static` > > [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' > must be static unless the test class > is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. > > > #### Remove `static` modifier from `@Test`-annotated methods > This configuration error should have been detected by JUnit Jupiter and reported via the Discovery > Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues > > #### Rename test property to `JUnit.dirs` > > package org.junit.jupiter.api does not exist > > > #### Add custom test instance factory > > Class [FDTests] must declare a single constructor > Class [MethodReferenceTestKinds] must declare a single constructor > > > ### Results > Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: > > Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 0 TestNG + 3043 JUnit Christian Stein has updated the pull request incrementally with one additional commit since the last revision: Refactor test classes to have a unique constructor That way, Jupiter doesn't need the help of a custom test instance factory ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27046/files - new: https://git.openjdk.org/jdk/pull/27046/files/4fa84ef8..839b9312 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=01-02 Stats: 36 lines in 2 files changed: 3 ins; 27 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/27046.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27046/head:pull/27046 PR: https://git.openjdk.org/jdk/pull/27046 From acobbs at openjdk.org Thu Sep 4 20:29:37 2025 From: acobbs at openjdk.org (Archie Cobbs) Date: Thu, 4 Sep 2025 20:29:37 GMT Subject: RFR: 8349847: Support configuring individual lint categories as errors [v10] In-Reply-To: References: Message-ID: > This PR enhances the `-Werror` flag to support lint categories just like `-Xlint` does. For example `-Werror:all,-preview` would cause an error if any warning not in the `preview` lint category occurred. > > The existing `-Xlint` flag has a particular behavior when conflicting flags are combined (e.g., `-Xlint:all -Xlint:none -Xlint:foo -Xlint:-foo` is equivalent to `-Xlint:all`). This behavior has been factored out and Javadocumented so that both `-Xlint` and `-Werror` can have this same "parsing" logic. > > See the CSR [JDK-8350044](https://bugs.openjdk.org/browse/JDK-8350044) for details on how the new flag behaves in certain corner cases. Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits: - Merge branch 'master' into JDK-8349847 to fix conflicts. - Improve documentation per CSR review comments. - Address review comments. - Merge branch 'master' into JDK-8349847 - Merge branch 'master' into JDK-8349847 to fix cross-compiling build problem. - Merge branch 'master' into JDK-8349847 to fix conflicts. - Merge branch 'master' into JDK-8349847 to fix conflicts. - Merge branch 'JDK-8359596' into JDK-8349847 to add "-Xlint:none" fix. - Ensure that "-Xlint:none" still works for the affected warnings. The extra checks for "-Xlint:none" are needed now because of JDK-8352612, which changed the behavior of "-Xlint:none" to no longer imply "-nowarn", which allowed the affected warnings to get away with skipping that check. - Minor naming and Javadoc tweaks. - ... and 8 more: https://git.openjdk.org/jdk/compare/945aaf89...f629438e ------------- Changes: https://git.openjdk.org/jdk/pull/23622/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=09 Stats: 269 lines in 13 files changed: 192 ins; 35 del; 42 mod Patch: https://git.openjdk.org/jdk/pull/23622.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23622/head:pull/23622 PR: https://git.openjdk.org/jdk/pull/23622 From vromero at openjdk.org Thu Sep 4 20:44:47 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 20:44:47 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v3] In-Reply-To: <41uyd48pDiO7CqIKx3f9oVaiFPqVr2Vv0ZSZobUUlFE=.6ed9a790-5d7e-4988-a3dc-0d16be7f7d9c@github.com> References: <41uyd48pDiO7CqIKx3f9oVaiFPqVr2Vv0ZSZobUUlFE=.6ed9a790-5d7e-4988-a3dc-0d16be7f7d9c@github.com> Message-ID: On Thu, 4 Sep 2025 16:34:26 GMT, Christian Stein wrote: >> Please review this change to use JUnit in tests of `test/langtools/tools/javac`. >> >> ### Assess Status Quo >> A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: >> >> Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 2762 TestNG + 281 JUnit >> >> >> ### Perform Automatic Conversion >> - [junit-convert]( >> https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) >> >> ### Perform Manual Adjustments >> >> Some of the following adjustments will be integrated into the `junit-convert` tool. >> >> #### Make argument source factory method `static` >> >> Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' >> must be static: local factory methods must be static >> unless the PER_CLASS @testinstance lifecycle mode is used; >> external factory methods must always be static. >> >> >> #### Make `@AfterAll`-annotated method `static` >> >> [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' >> must be static unless the test class >> is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. >> >> >> #### Remove `static` modifier from `@Test`-annotated methods >> This configuration error should have been detected by JUnit Jupiter and reported via the Discovery >> Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues >> >> #### Rename test property to `JUnit.dirs` >> >> package org.junit.jupiter.api does not exist >> >> >> #### Add custom test instance factory >> >> Class [FDTests] must declare a single constructor >> Class [MethodReferenceTestKinds] must declare a single constructor >> >> >> ### Results >> Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: >> >> Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 0 TestNG + 3043 JUnit > > Christian Stein has updated the pull request incrementally with one additional commit since the last revision: > > Refactor test classes to have a unique constructor > > That way, Jupiter doesn't need the help of a custom test instance factory test/langtools/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerDefault.java line 81: > 79: > 80: q = MethodReferenceTestInnerDefault.this::xs_B_; > 81: assertEquals("_B_xsB:*", q.m("*")); why changing the order of the arguments? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323507582 From cstein at openjdk.org Thu Sep 4 20:48:44 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 20:48:44 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v3] In-Reply-To: References: <41uyd48pDiO7CqIKx3f9oVaiFPqVr2Vv0ZSZobUUlFE=.6ed9a790-5d7e-4988-a3dc-0d16be7f7d9c@github.com> Message-ID: On Thu, 4 Sep 2025 20:42:08 GMT, Vicente Romero wrote: >> Christian Stein has updated the pull request incrementally with one additional commit since the last revision: >> >> Refactor test classes to have a unique constructor >> >> That way, Jupiter doesn't need the help of a custom test instance factory > > test/langtools/tools/javac/lambda/methodReferenceExecution/MethodReferenceTestInnerDefault.java line 81: > >> 79: >> 80: q = MethodReferenceTestInnerDefault.this::xs_B_; >> 81: assertEquals("_B_xsB:*", q.m("*")); > > why changing the order of the arguments? > The order of the expected and actual arguments to assertion methods such as `assertEquals(...)` needs to be swapped so that the expected result precedes the actual result. https://github.com/junit-team/junit-framework/wiki/Migrating-from-TestNG-to-JUnit-Jupiter ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323514057 From cstein at openjdk.org Thu Sep 4 21:20:43 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 21:20:43 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v3] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 21:11:31 GMT, Vicente Romero wrote: >> @vicente-romero-oracle Since you originally handled this test, can you decide what we should do with this? > > I didn't create the test, I'm not even sure that it is relevant anymore. Could probably be removed but not as part of this PR Alright, will restore the two lines. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323559930 From vromero at openjdk.org Thu Sep 4 21:20:36 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 21:20:36 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v3] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 14:22:13 GMT, Chen Liang wrote: >> I didn't find `JDK-8006746` nor `8006746` in no other file ? that's why I decided to dispose (against the goal of this PR to not clean up...) that comment. > > @vicente-romero-oracle Since you originally handled this test, can you decide what we should do with this? I didn't create the test, I'm not even sure that it is relevant anymore. Could probably be removed but not as part of this PR ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323557747 From vromero at openjdk.org Thu Sep 4 21:59:20 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 21:59:20 GMT Subject: RFR: 8365676: javac incorrectly allows calling interface static method via type variable [v2] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 12:29:50 GMT, Vicente Romero wrote: >> I have created the CSR https://bugs.openjdk.org/browse/JDK-8366848. Please help review. > >> I have created the CSR https://bugs.openjdk.org/browse/JDK-8366848. Please help review. > > suggestion: in the Specification section of the CSR consider including the related texts from the spec > question regarding the wording in the CSR: with your patch, won't the invocation of static methods belonging to interfaces be rejected even if the interface is not the only upper bound of the type variable? > @vicente-romero-oracle I have updated the CSR to include relevant specs and give more examples. Please review again. yep what @jddarcy said, I agree with him, the new behavior should affect only new releases ------------- PR Comment: https://git.openjdk.org/jdk/pull/27015#issuecomment-3255862775 From cstein at openjdk.org Thu Sep 4 22:01:57 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 22:01:57 GMT Subject: RFR: 8361950: Update to use jtreg 8 [v4] In-Reply-To: References: Message-ID: <6p7ncBylItu9HEeCINmqu_JFoL6zNXwJuSQaZoQ0J2I=.451526e1-d918-4fee-b1a7-e8193da61545@github.com> > Please review the change to update to using jtreg 8. > > The primary change is to the `jib-profiles.js` file, which specifies the version of jtreg to use, for those systems that rely on this file. In addition, the requiredVersion has been updated in the various `TEST.ROOT` files. Christian Stein has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: - Merge branch 'openjdk:master' into JDK-8361950-jtreg-8 - Merge branch 'openjdk:master' into JDK-8361950-jtreg-8 - Update to use correct library directories See also: https://openjdk.org/jtreg/faq.html#how-do-i-find-the-path-for-the-testng-or-junit-jar-files - 8361950: Set required version to 8+2 - 8361950: Update to use jtreg 8 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/26261/files - new: https://git.openjdk.org/jdk/pull/26261/files/56006240..12b0d0f5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=26261&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=26261&range=02-03 Stats: 20940 lines in 1016 files changed: 14715 ins; 2669 del; 3556 mod Patch: https://git.openjdk.org/jdk/pull/26261.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26261/head:pull/26261 PR: https://git.openjdk.org/jdk/pull/26261 From cstein at openjdk.org Thu Sep 4 22:03:14 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 22:03:14 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v4] In-Reply-To: References: Message-ID: > Please review this change to use JUnit in tests of `test/langtools/tools/javac`. > > ### Assess Status Quo > A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: > > Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 2762 TestNG + 281 JUnit > > > ### Perform Automatic Conversion > - [junit-convert]( > https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) > > ### Perform Manual Adjustments > > Some of the following adjustments will be integrated into the `junit-convert` tool. > > #### Make argument source factory method `static` > > Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' > must be static: local factory methods must be static > unless the PER_CLASS @testinstance lifecycle mode is used; > external factory methods must always be static. > > > #### Make `@AfterAll`-annotated method `static` > > [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' > must be static unless the test class > is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. > > > #### Remove `static` modifier from `@Test`-annotated methods > This configuration error should have been detected by JUnit Jupiter and reported via the Discovery > Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues > > #### Rename test property to `JUnit.dirs` > > package org.junit.jupiter.api does not exist > > > #### Add custom test instance factory > > Class [FDTests] must declare a single constructor > Class [MethodReferenceTestKinds] must declare a single constructor > > > ### Results > Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: > > Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 > Framework-based tests: 3043 = 0 TestNG + 3043 JUnit Christian Stein has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: - Restore comment - it is unrelated to the JUnit conversion - Update to use correct library directories See also: https://openjdk.org/jtreg/faq.html#how-do-i-find-the-path-for-the-testng-or-junit-jar-files - 8361950: Set required version to 8+2 - 8361950: Update to use jtreg 8 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27046/files - new: https://git.openjdk.org/jdk/pull/27046/files/839b9312..431eb75a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27046&range=02-03 Stats: 44 lines in 12 files changed: 11 ins; 19 del; 14 mod Patch: https://git.openjdk.org/jdk/pull/27046.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27046/head:pull/27046 PR: https://git.openjdk.org/jdk/pull/27046 From cstein at openjdk.org Thu Sep 4 22:03:16 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 22:03:16 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: <0vHEHTVIA7vl_zf407kREtL7n7R7piqpWTUQPRaGRXc=.4e13e317-b871-4809-a9c0-233cfeacb5bd@github.com> On Wed, 3 Sep 2025 13:52:33 GMT, Christian Stein wrote: >> Please review this change to use JUnit in tests of `test/langtools/tools/javac`. >> >> ### Assess Status Quo >> A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: >> >> Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 2762 TestNG + 281 JUnit >> >> >> ### Perform Automatic Conversion >> - [junit-convert]( >> https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) >> >> ### Perform Manual Adjustments >> >> Some of the following adjustments will be integrated into the `junit-convert` tool. >> >> #### Make argument source factory method `static` >> >> Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' >> must be static: local factory methods must be static >> unless the PER_CLASS @testinstance lifecycle mode is used; >> external factory methods must always be static. >> >> >> #### Make `@AfterAll`-annotated method `static` >> >> [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' >> must be static unless the test class >> is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. >> >> >> #### Remove `static` modifier from `@Test`-annotated methods >> This configuration error should have been detected by JUnit Jupiter and reported via the Discovery >> Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues >> >> #### Rename test property to `JUnit.dirs` >> >> package org.junit.jupiter.api does not exist >> >> >> #### Add custom test instance factory >> >> Class [FDTests] must declare a single constructor >> Class [MethodReferenceTestKinds] must declare a single constructor >> >> >> ### Results >> Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: >> >> Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 0 TestNG + 3043 JUnit > > Christian Stein has updated the pull request incrementally with one additional commit since the last revision: > > Update copyright year test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java line 23: > 21: * questions. > 22: */ > 23: Suggestion: */ // this test has been disabled because of timeout issues. // see JDK-8006746 Restore comment lines as their removal is not the task of this change. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323585887 From cstein at openjdk.org Thu Sep 4 22:03:17 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 22:03:17 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: <0vHEHTVIA7vl_zf407kREtL7n7R7piqpWTUQPRaGRXc=.4e13e317-b871-4809-a9c0-233cfeacb5bd@github.com> References: <0vHEHTVIA7vl_zf407kREtL7n7R7piqpWTUQPRaGRXc=.4e13e317-b871-4809-a9c0-233cfeacb5bd@github.com> Message-ID: On Thu, 4 Sep 2025 21:25:48 GMT, Christian Stein wrote: >> Christian Stein has updated the pull request incrementally with one additional commit since the last revision: >> >> Update copyright year > > test/langtools/tools/javac/lambdaShapes/org/openjdk/tests/vm/FDSeparateCompilationTest.java line 23: > >> 21: * questions. >> 22: */ >> 23: > > Suggestion: > > */ > > // this test has been disabled because of timeout issues. > // see JDK-8006746 > > > > Restore comment lines as their removal is not the task of this change. image ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323589286 From acobbs at openjdk.org Thu Sep 4 22:17:35 2025 From: acobbs at openjdk.org (Archie Cobbs) Date: Thu, 4 Sep 2025 22:17:35 GMT Subject: RFR: 8349847: Support configuring individual lint categories as errors [v11] In-Reply-To: References: Message-ID: > This PR enhances the `-Werror` flag to support lint categories just like `-Xlint` does. For example `-Werror:all,-preview` would cause an error if any warning not in the `preview` lint category occurred. > > The existing `-Xlint` flag has a particular behavior when conflicting flags are combined (e.g., `-Xlint:all -Xlint:none -Xlint:foo -Xlint:-foo` is equivalent to `-Xlint:all`). This behavior has been factored out and Javadocumented so that both `-Xlint` and `-Werror` can have this same "parsing" logic. > > See the CSR [JDK-8350044](https://bugs.openjdk.org/browse/JDK-8350044) for details on how the new flag behaves in certain corner cases. Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision: Add trailing "--help-lint" blurb to clarify how category aliases are handled. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/23622/files - new: https://git.openjdk.org/jdk/pull/23622/files/f629438e..002c78ff Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=10 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=09-10 Stats: 5 lines in 2 files changed: 5 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/23622.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23622/head:pull/23622 PR: https://git.openjdk.org/jdk/pull/23622 From vromero at openjdk.org Thu Sep 4 22:28:34 2025 From: vromero at openjdk.org (Vicente Romero) Date: Thu, 4 Sep 2025 22:28:34 GMT Subject: RFR: 8351260: java.lang.AssertionError: Unexpected type tree: (ERROR) = (ERROR) In-Reply-To: References: Message-ID: On Wed, 3 Sep 2025 05:48:51 GMT, Jan Lahoda wrote: > Consider a very broken declaration like this: > > void test(List<@AlphaChars <@StringLength(int value = 5)String> s){ > > > after seeing `@AlphaChars`, javac will try to parse `<@StringLength(int value = 5)String>` as a type, and assign the annotation to the type. But, the text does not parse as a type well (partly due to the `int value = 5`), and the parsing will proceed in an expression mode. Then a search for target type is performed to attach the annotation, and that fails, as the expression tree is not expected to be part of the type. > > The main proposal here is to wrap the badly parsed type in an `Erroneous` tree. The overall error recovery then seems to handle the situation well. > > The situation produces quite a few error reports, but it is not clear if this situation (esp. the nested `int value = 5`) is common enough to stretch the parsing error recovery capabilities to accommodate this code. lgtm ------------- Marked as reviewed by vromero (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27065#pullrequestreview-3187407459 From cstein at openjdk.org Thu Sep 4 22:28:43 2025 From: cstein at openjdk.org (Christian Stein) Date: Thu, 4 Sep 2025 22:28:43 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v2] In-Reply-To: References: Message-ID: <6WKM7lzN9YChvsYQDddGNRaGoCUpSnCzxfYYgA767HM=.0e9a567b-e1a6-494f-b239-11072d9f6091@github.com> On Thu, 4 Sep 2025 15:39:58 GMT, Christian Stein wrote: >> Well, uncommon as it is claimed to be, it already appeared twice in the set of tests in javac ? > > I think, these two classes started out as normal programs; using `main` methods as their entry-points. In such programs, you can and need to create instances to your liking, even of the static program-defining class. > Using a framework, shifts the instantion duty to (most of the time) reflection, under the framework's control. That way, `@Before[After]All|Each` and other lifecycle callbacks are realized. Usually, you then never write `new MyObjectTest()` with your test code. That would be "detached" test instances; not par-taking in the test lifecycle. > > When those two test classes were migrated to use TestNG, they ended up with framework-managed instances (where @Test-annotated methods serve as entry-points) asserting stuff against "detached" instances created by the test logic. > > Therefore, I suggest to "just" help JUnit here to select the correct constructor - which TestNG does by default. Turns out that we can delete the extra constructor from the test classes and leave only a sole one to use for JUnit and local test needs. See https://github.com/openjdk/jdk/pull/27046/commits/839b93129bb3318ac659be031b3e296eeaf0ead2 for details. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27046#discussion_r2323647315 From liach at openjdk.org Thu Sep 4 22:55:21 2025 From: liach at openjdk.org (Chen Liang) Date: Thu, 4 Sep 2025 22:55:21 GMT Subject: RFR: 8366678: Use JUnit in test/langtools/tools/javac [v4] In-Reply-To: References: Message-ID: On Thu, 4 Sep 2025 22:03:14 GMT, Christian Stein wrote: >> Please review this change to use JUnit in tests of `test/langtools/tools/javac`. >> >> ### Assess Status Quo >> A local `make test TEST=test/langtools/tools/javac` run before the conversion yields: >> >> Test results: passed: 3,938; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 2762 TestNG + 281 JUnit >> >> >> ### Perform Automatic Conversion >> - [junit-convert]( >> https://github.com/lahodaj/netbeans/tree/openjdk-testng-junit-fixes-and-hacks/java/java.openjdk.project/junit-convert) >> >> ### Perform Manual Adjustments >> >> Some of the following adjustments will be integrated into the `junit-convert` tool. >> >> #### Make argument source factory method `static` >> >> Method 'public java.lang.Object[][] org.openjdk.tests.javac.FDTest.caseGenerator()' >> must be static: local factory methods must be static >> unless the PER_CLASS @testinstance lifecycle mode is used; >> external factory methods must always be static. >> >> >> #### Make `@AfterAll`-annotated method `static` >> >> [ERROR] @afterall method 'public void org.openjdk.tests.vm.FDSeparateCompilationTest.cleanupCompilerCache()' >> must be static unless the test class >> is annotated with `@TestInstance(Lifecycle.PER_CLASS)`. >> >> >> #### Remove `static` modifier from `@Test`-annotated methods >> This configuration error should have been detected by JUnit Jupiter and reported via the Discovery >> Issues API: https://docs.junit.org/current/user-guide/#running-tests-discovery-issues >> >> #### Rename test property to `JUnit.dirs` >> >> package org.junit.jupiter.api does not exist >> >> >> #### Add custom test instance factory >> >> Class [FDTests] must declare a single constructor >> Class [MethodReferenceTestKinds] must declare a single constructor >> >> >> ### Results >> Re-run tests via `make test TEST=test/langtools/tools/javac` after the conversion; yielding: >> >> Test results: passed: 3,939; excluded: 4; did not match keywords: 2; did not meet platform requirements: 2 >> Framework-based tests: 3043 = 0 TestNG + 3043 JUnit > > Christian Stein has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: > > - Restore comment - it is unrelated to the JUnit conversion > - Update to use correct library directories > > See also: https://openjdk.org/jtreg/faq.html#how-do-i-find-the-path-for-the-testng-or-junit-jar-files > - 8361950: Set required version to 8+2 > - 8361950: Update to use jtreg 8 The actual changes look good - unfortunately github does not show the correct ... diff. ------------- Marked as reviewed by liach (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/27046#pullrequestreview-3187465466 From vromero at openjdk.org Fri Sep 5 02:06:21 2025 From: vromero at openjdk.org (Vicente Romero) Date: Fri, 5 Sep 2025 02:06:21 GMT Subject: RFR: 8359383: Incorrect starting positions for implicitly typed variables [v2] In-Reply-To: References: Message-ID: On Mon, 11 Aug 2025 18:17:35 GMT, Archie Cobbs wrote: >> This fixes starting position bugs relating to implicitly typed variables; see the linked issue for details. >> >> This also makes it possible to recover the declaration type (explicit, implicit, or `var`) from a `JCVariableDecl` and, in the case of `var` declarations, the starting position of the `var`; previously this wasn't possible. >> >> Finally, as a minor drive-by improvement, we can now pretty print `var` as `var` instead of `/*missing*/`. > > Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Add back regression test case that got removed somehow. > - Merge branch 'master' into JDK-8359383 > - Fix various starting position bugs relating to implicitly typed variables. lgtm ------------- Marked as reviewed by vromero (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/25786#pullrequestreview-3187785504 From vromero at openjdk.org Fri Sep 5 02:14:19 2025 From: vromero at openjdk.org (Vicente Romero) Date: Fri, 5 Sep 2025 02:14:19 GMT Subject: RFR: 8365689: Elements.getFileObjectOf fails with a NullPointerException when an erroneous Element is passed in In-Reply-To: References: Message-ID: <3wsrIbAFWwzeWekgHQMsep85Az1OzNsUlu3fIn3B5UQ=.769f1d53-4736-419f-9fb2-6ac7257bda01@github.com> On Tue, 19 Aug 2025 07:35:05 GMT, Jan Lahoda wrote: > If an erroneous/unresolvable `Element` is passed to `Elements.getFileObjectOf`, it fails with an NPE like: > > Caused by: java.lang.NullPointerException: Cannot read field "classfile" because the return value of "com.sun.tools.javac.code.Symbol.enclClass()" is null > at jdk.compiler/com.sun.tools.javac.model.JavacElements.getFileObjectOf(JavacElements.java:803) > at TestFileObjectOf$PrintFiles.handleDeclaration(TestFileObjectOf.java:329) > at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2718) > > > The reason is the `Symbol.enclClass()` will return `null` for the erroneous `Element`. The proposed solution herein is to return `null` for erroneous/unresolvable `Element`s. lgtm ------------- Marked as reviewed by vromero (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26836#pullrequestreview-3187794108 From acobbs at openjdk.org Fri Sep 5 03:22:11 2025 From: acobbs at openjdk.org (Archie Cobbs) Date: Fri, 5 Sep 2025 03:22:11 GMT Subject: RFR: 8359383: Incorrect starting positions for implicitly typed variables [v2] In-Reply-To: References: Message-ID: On Mon, 11 Aug 2025 18:17:35 GMT, Archie Cobbs wrote: >> This fixes starting position bugs relating to implicitly typed variables; see the linked issue for details. >> >> This also makes it possible to recover the declaration type (explicit, implicit, or `var`) from a `JCVariableDecl` and, in the case of `var` declarations, the starting position of the `var`; previously this wasn't possible. >> >> Finally, as a minor drive-by improvement, we can now pretty print `var` as `var` instead of `/*missing*/`. > > Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: > > - Add back regression test case that got removed somehow. > - Merge branch 'master' into JDK-8359383 > - Fix various starting position bugs relating to implicitly typed variables. Thanks for the review! ------------- PR Comment: https://git.openjdk.org/jdk/pull/25786#issuecomment-3256945278 From jlahoda at openjdk.org Fri Sep 5 10:03:33 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Fri, 5 Sep 2025 10:03:33 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG Message-ID: This is a conversion of JShell tests from TestNG to JUnit 5. To make the changes more transparent, there are 4 commit in this PR: - https://github.com/openjdk/jdk/pull/26841/commits/c6b5d8441ad532551e626b3542431aa3f479ffc0: this one changes a name of a custom interface representing test cases, so that subsequent commits can use a simple name for `org.junit.jupiter.api.Test` (otherwise `Test` would resolve to the custom interface is subclasses of `UITesting`, and FQN would need to be used to refer to the annotation). - https://github.com/openjdk/jdk/pull/26841/commits/2afee7d258f646f822d0b1bc3465d5595058e3df: the bulk of changes, done automatically by: The bulk of the changes is done automatically, using this tool/script: https://github.com/lahodaj/netbeans/tree/19515c3e2dbc07d977ca227d933197f856121ae5/java/java.openjdk.project/junit-convert - https://github.com/openjdk/jdk/pull/26841/commits/8ca03af1b4d06e479cdfe7cc66186222feeaaa76: manual adjustments for things the tool does not handle (at least currently): - one indent problem - two uses of injected `java.lang.reflect.Method`, which needs to be replaced with `TestInfo` - a different way to skip a test (normally, the tool detects and converts uses of `SkipException`, but that exception was not used on this place). - https://github.com/openjdk/jdk/pull/26841/commits/639da0171a593031dae6a73830bb1665b7097e73: scripted update to copyright headers, done using: bash ./make/scripts/update_copyright_year.sh -b `git merge-base master jshell-upgrade-testng-to-junit` As part of validation of this change, this script: [CompareTestResults.java](https://github.com/user-attachments/files/22169483/CompareTestResults.java) was used to compare the results in `junit.txt` and `testng.txt` in test results before and after the change, and it didn't find a difference in test counts. ------------- Commit messages: - Update copyright years. - Manual adjustments. - Automatic changes. - Renaming UITesting.Test to UITesting.UITest to avoid clashes with the JUnit @Test annotation. Changes: https://git.openjdk.org/jdk/pull/26841/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26841&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8365776 Stats: 1771 lines in 123 files changed: 740 ins; 216 del; 815 mod Patch: https://git.openjdk.org/jdk/pull/26841.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26841/head:pull/26841 PR: https://git.openjdk.org/jdk/pull/26841 From duke at openjdk.org Fri Sep 5 10:03:33 2025 From: duke at openjdk.org (David Beaumont) Date: Fri, 5 Sep 2025 10:03:33 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 10:26:14 GMT, Jan Lahoda wrote: > This is a conversion of JShell tests from TestNG to JUnit 5. > > To make the changes more transparent, there are 4 commit in this PR: > - https://github.com/openjdk/jdk/pull/26841/commits/c6b5d8441ad532551e626b3542431aa3f479ffc0: this one changes a name of a custom interface representing test cases, so that subsequent commits can use a simple name for `org.junit.jupiter.api.Test` (otherwise `Test` would resolve to the custom interface is subclasses of `UITesting`, and FQN would need to be used to refer to the annotation). > - https://github.com/openjdk/jdk/pull/26841/commits/2afee7d258f646f822d0b1bc3465d5595058e3df: the bulk of changes, done automatically by: > The bulk of the changes is done automatically, using this tool/script: > https://github.com/lahodaj/netbeans/tree/19515c3e2dbc07d977ca227d933197f856121ae5/java/java.openjdk.project/junit-convert > - https://github.com/openjdk/jdk/pull/26841/commits/8ca03af1b4d06e479cdfe7cc66186222feeaaa76: manual adjustments for things the tool does not handle (at least currently): > - one indent problem > - two uses of injected `java.lang.reflect.Method`, which needs to be replaced with `TestInfo` > - a different way to skip a test (normally, the tool detects and converts uses of `SkipException`, but that exception was not used on this place). > - https://github.com/openjdk/jdk/pull/26841/commits/639da0171a593031dae6a73830bb1665b7097e73: scripted update to copyright headers, done using: > > bash ./make/scripts/update_copyright_year.sh -b `git merge-base master jshell-upgrade-testng-to-junit` > > > As part of validation of this change, this script: > [CompareTestResults.java](https://github.com/user-attachments/files/22169483/CompareTestResults.java) > was used to compare the results in `junit.txt` and `testng.txt` in test results before and after the change, and it didn't find a difference in test counts. Just leaving some thoughts in passing - not a review in any meaningful sense. No signs of any issues so far either (about 50 files examined). test/langtools/jdk/jshell/AnalyzeSnippetTest.java line 87: > 85: ImportSnippet sn = (ImportSnippet) assertSnippet("import java.util.List;", > 86: SubKind.SINGLE_TYPE_IMPORT_SUBKIND); > 87: assertEquals("List", sn.name()); Nice that this is handling the order of expected/actual properly. test/langtools/jdk/jshell/ClassesTest.java line 70: > 68: assertTypeDeclSnippet(c1, "A", RECOVERABLE_NOT_DEFINED, CLASS_SUBKIND, 1, 0); > 69: TypeDeclSnippet c2 = classKey(assertEval("@interface A { Class f() default B.class; }", > 70: ste(MAIN_SNIPPET, RECOVERABLE_NOT_DEFINED, RECOVERABLE_NOT_DEFINED, false, null), Might be worth making sure that any helper asserts are also refactored to be conceptually "(, )" just to be consistent. Obviously asserts shared with other tests not being converted (yet) could wait until everything is done, but ideally it would happen eventually. test/langtools/jdk/jshell/CommandCompletionTest.java line 94: > 92: } > 93: > 94: public void assertCompletion(String code, boolean isSmart, String... expected) { Of course this is where , hits the snag of varargs being better for a list/set of expected things. It's one of the reasons I personally prefer (, ), but this code needs consistency more than personal preference :) test/langtools/jdk/jshell/CompletionSuggestionTest.java line 759: > 757: } > 758: > 759: @Test(enabled = false) //TODO 8171829 Sadly the TODO got lost here. Maybe worth looking through diffs with grep as a 2nd pass for inline comments like this to see what was removed. test/langtools/jdk/jshell/ComputeFQNsTest.java line 132: > 130: QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length()); > 131: > 132: assertEquals(Arrays.asList(), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames()); This is where my itch for test readability wants to see `List.of()` etc, I know it's not much, but every little helps. Of course, in Truth this is even nicer as: assertThat(candidates.getNames()).withMessage("Input: " + code).isEmpty(); ------------- PR Review: https://git.openjdk.org/jdk/pull/26841#pullrequestreview-3132392319 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285296296 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285305488 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285310088 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285313918 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285321182 From jlahoda at openjdk.org Fri Sep 5 10:03:33 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Fri, 5 Sep 2025 10:03:33 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 10:26:14 GMT, Jan Lahoda wrote: > This is a conversion of JShell tests from TestNG to JUnit 5. > > To make the changes more transparent, there are 4 commit in this PR: > - https://github.com/openjdk/jdk/pull/26841/commits/c6b5d8441ad532551e626b3542431aa3f479ffc0: this one changes a name of a custom interface representing test cases, so that subsequent commits can use a simple name for `org.junit.jupiter.api.Test` (otherwise `Test` would resolve to the custom interface is subclasses of `UITesting`, and FQN would need to be used to refer to the annotation). > - https://github.com/openjdk/jdk/pull/26841/commits/2afee7d258f646f822d0b1bc3465d5595058e3df: the bulk of changes, done automatically by: > The bulk of the changes is done automatically, using this tool/script: > https://github.com/lahodaj/netbeans/tree/19515c3e2dbc07d977ca227d933197f856121ae5/java/java.openjdk.project/junit-convert > - https://github.com/openjdk/jdk/pull/26841/commits/8ca03af1b4d06e479cdfe7cc66186222feeaaa76: manual adjustments for things the tool does not handle (at least currently): > - one indent problem > - two uses of injected `java.lang.reflect.Method`, which needs to be replaced with `TestInfo` > - a different way to skip a test (normally, the tool detects and converts uses of `SkipException`, but that exception was not used on this place). > - https://github.com/openjdk/jdk/pull/26841/commits/639da0171a593031dae6a73830bb1665b7097e73: scripted update to copyright headers, done using: > > bash ./make/scripts/update_copyright_year.sh -b `git merge-base master jshell-upgrade-testng-to-junit` > > > As part of validation of this change, this script: > [CompareTestResults.java](https://github.com/user-attachments/files/22169483/CompareTestResults.java) > was used to compare the results in `junit.txt` and `testng.txt` in test results before and after the change, and it didn't find a difference in test counts. I've updated the script and the patches here: - the comments around the `@Test` annotation should now be preserved. (I tried to move the TODO comments to the `@Disabled` annotation, but it would probably take too much time.) - the script no longer makes the data providers `static`, and adds the per-class lifecycle automatically if it detects the need. Or at least tries to. To keep things sensible, I force pushed here. The original commits are available under branch `jshell-upgrade-testng-to-junit.bak1`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26841#issuecomment-3201142106 From jlahoda at openjdk.org Fri Sep 5 10:03:33 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Fri, 5 Sep 2025 10:03:33 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 13:39:14 GMT, David Beaumont wrote: >> This is a conversion of JShell tests from TestNG to JUnit 5. >> >> To make the changes more transparent, there are 4 commit in this PR: >> - https://github.com/openjdk/jdk/pull/26841/commits/c6b5d8441ad532551e626b3542431aa3f479ffc0: this one changes a name of a custom interface representing test cases, so that subsequent commits can use a simple name for `org.junit.jupiter.api.Test` (otherwise `Test` would resolve to the custom interface is subclasses of `UITesting`, and FQN would need to be used to refer to the annotation). >> - https://github.com/openjdk/jdk/pull/26841/commits/2afee7d258f646f822d0b1bc3465d5595058e3df: the bulk of changes, done automatically by: >> The bulk of the changes is done automatically, using this tool/script: >> https://github.com/lahodaj/netbeans/tree/19515c3e2dbc07d977ca227d933197f856121ae5/java/java.openjdk.project/junit-convert >> - https://github.com/openjdk/jdk/pull/26841/commits/8ca03af1b4d06e479cdfe7cc66186222feeaaa76: manual adjustments for things the tool does not handle (at least currently): >> - one indent problem >> - two uses of injected `java.lang.reflect.Method`, which needs to be replaced with `TestInfo` >> - a different way to skip a test (normally, the tool detects and converts uses of `SkipException`, but that exception was not used on this place). >> - https://github.com/openjdk/jdk/pull/26841/commits/639da0171a593031dae6a73830bb1665b7097e73: scripted update to copyright headers, done using: >> >> bash ./make/scripts/update_copyright_year.sh -b `git merge-base master jshell-upgrade-testng-to-junit` >> >> >> As part of validation of this change, this script: >> [CompareTestResults.java](https://github.com/user-attachments/files/22169483/CompareTestResults.java) >> was used to compare the results in `junit.txt` and `testng.txt` in test results before and after the change, and it didn't find a difference in test counts. > > test/langtools/jdk/jshell/CommandCompletionTest.java line 94: > >> 92: } >> 93: >> 94: public void assertCompletion(String code, boolean isSmart, String... expected) { > > Of course this is where , hits the snag of varargs being better for a list/set of expected things. It's one of the reasons I personally prefer (, ), but this code needs consistency more than personal preference :) Here it is input and then expected values, not really actual value and the expected value. So the inconsistency is not that big. I am afraid that if we move expected to front here, there will be a lot of readability lost. For me, at least. Currently (with TestNG), the code is consistent and readable. If, in order to convert to JUnit, I would have to sacrifice readability to keep consistency, then I guess I would start to question if the conversion has a point. I.e. the conversion would need to bring a benefit big enough to compensate for the loss of readability here. > test/langtools/jdk/jshell/ComputeFQNsTest.java line 132: > >> 130: QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length()); >> 131: >> 132: assertEquals(Arrays.asList(), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames()); > > This is where my itch for test readability wants to see `List.of()` etc, I know it's not much, but every little helps. > Of course, in Truth this is even nicer as: > > assertThat(candidates.getNames()).withMessage("Input: " + code).isEmpty(); I think I am relatively opposed to mix different types of changes, esp. if there are biggish. Also, automatic `Arrays.asList()` -> `List.of()` is somewhat troublesome, as the semantics is different. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285600560 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285569963 From cstein at openjdk.org Fri Sep 5 10:03:34 2025 From: cstein at openjdk.org (Christian Stein) Date: Fri, 5 Sep 2025 10:03:34 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 15:19:25 GMT, Jan Lahoda wrote: >> test/langtools/jdk/jshell/CommandCompletionTest.java line 94: >> >>> 92: } >>> 93: >>> 94: public void assertCompletion(String code, boolean isSmart, String... expected) { >> >> Of course this is where , hits the snag of varargs being better for a list/set of expected things. It's one of the reasons I personally prefer (, ), but this code needs consistency more than personal preference :) > > Here it is input and then expected values, not really actual value and the expected value. So the inconsistency is not that big. > > I am afraid that if we move expected to front here, there will be a lot of readability lost. For me, at least. Currently (with TestNG), the code is consistent and readable. If, in order to convert to JUnit, I would have to sacrifice readability to keep consistency, then I guess I would start to question if the conversion has a point. I.e. the conversion would need to bring a benefit big enough to compensate for the loss of readability here. In conversions like this we should not touch test-local code unrelated to the framework migration. Just keep those helpers "as-is" in order to keep the touched surface of PR small(er) and on-topic. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2285637847 From duke at openjdk.org Fri Sep 5 10:03:34 2025 From: duke at openjdk.org (David Beaumont) Date: Fri, 5 Sep 2025 10:03:34 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 15:32:55 GMT, Christian Stein wrote: >> Here it is input and then expected values, not really actual value and the expected value. So the inconsistency is not that big. >> >> I am afraid that if we move expected to front here, there will be a lot of readability lost. For me, at least. Currently (with TestNG), the code is consistent and readable. If, in order to convert to JUnit, I would have to sacrifice readability to keep consistency, then I guess I would start to question if the conversion has a point. I.e. the conversion would need to bring a benefit big enough to compensate for the loss of readability here. > > In conversions like this we should not touch test-local code unrelated to the framework migration. Just keep those helpers "as-is" in order to keep the touched surface of PR small(er) and on-topic. I think people are thinking I was suggesting a change in this PR, I was not. I was simply pointing out the consistency issue which now arises. If I had to say what I'd like to see in tests, it would be to switch to using the Truth API everywhere (which is, realistically, not going to happen) because it is both more readable in the code *and* gives much much better error messages (and it's compatible with JUnit). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2288549459 From duke at openjdk.org Fri Sep 5 10:03:34 2025 From: duke at openjdk.org (Francesco Andreuzzi) Date: Fri, 5 Sep 2025 10:03:34 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 10:26:14 GMT, Jan Lahoda wrote: > This is a conversion of JShell tests from TestNG to JUnit 5. > > To make the changes more transparent, there are 4 commit in this PR: > - https://github.com/openjdk/jdk/pull/26841/commits/c6b5d8441ad532551e626b3542431aa3f479ffc0: this one changes a name of a custom interface representing test cases, so that subsequent commits can use a simple name for `org.junit.jupiter.api.Test` (otherwise `Test` would resolve to the custom interface is subclasses of `UITesting`, and FQN would need to be used to refer to the annotation). > - https://github.com/openjdk/jdk/pull/26841/commits/2afee7d258f646f822d0b1bc3465d5595058e3df: the bulk of changes, done automatically by: > The bulk of the changes is done automatically, using this tool/script: > https://github.com/lahodaj/netbeans/tree/19515c3e2dbc07d977ca227d933197f856121ae5/java/java.openjdk.project/junit-convert > - https://github.com/openjdk/jdk/pull/26841/commits/8ca03af1b4d06e479cdfe7cc66186222feeaaa76: manual adjustments for things the tool does not handle (at least currently): > - one indent problem > - two uses of injected `java.lang.reflect.Method`, which needs to be replaced with `TestInfo` > - a different way to skip a test (normally, the tool detects and converts uses of `SkipException`, but that exception was not used on this place). > - https://github.com/openjdk/jdk/pull/26841/commits/639da0171a593031dae6a73830bb1665b7097e73: scripted update to copyright headers, done using: > > bash ./make/scripts/update_copyright_year.sh -b `git merge-base master jshell-upgrade-testng-to-junit` > > > As part of validation of this change, this script: > [CompareTestResults.java](https://github.com/user-attachments/files/22169483/CompareTestResults.java) > was used to compare the results in `junit.txt` and `testng.txt` in test results before and after the change, and it didn't find a difference in test counts. test/langtools/jdk/jshell/ComputeFQNsTest.java line 80: > 78: } > 79: > 80: @Test(enabled = false) //TODO 8161165 Should the `// TODO` comment stay? test/langtools/jdk/jshell/EditorTestBase.java line 266: > 264: } > 265: > 266: @Test(enabled = false) // TODO JDK-8191875 Should the `// TODO` comment stay? test/langtools/jdk/jshell/ErrorTranslationTest.java line 76: > 74: } > 75: > 76: @Test(enabled = false) // TODO 8132147 Should the `// TODO` comment stay? test/langtools/jdk/jshell/ExceptionsTest.java line 295: > 293: } > 294: > 295: @Test(enabled = false) // TODO 8129427 Should the `// TODO` comment stay? test/langtools/jdk/jshell/ExternalEditorTest.java line 253: > 251: } > 252: > 253: @Test(enabled = false) // TODO 8159229 Should the `// TODO` comment stay? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2284885174 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2284888622 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2284889638 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2284890329 PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2284891071 From duke at openjdk.org Fri Sep 5 10:03:34 2025 From: duke at openjdk.org (David Beaumont) Date: Fri, 5 Sep 2025 10:03:34 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 15:07:53 GMT, Jan Lahoda wrote: >> test/langtools/jdk/jshell/ComputeFQNsTest.java line 132: >> >>> 130: QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length()); >>> 131: >>> 132: assertEquals(Arrays.asList(), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames()); >> >> This is where my itch for test readability wants to see `List.of()` etc, I know it's not much, but every little helps. >> Of course, in Truth this is even nicer as: >> >> assertThat(candidates.getNames()).withMessage("Input: " + code).isEmpty(); > > I think I am relatively opposed to mix different types of changes, esp. if there are biggish. Also, automatic `Arrays.asList()` -> `List.of()` is somewhat troublesome, as the semantics is different. I was in no way suggesting that this sort of thing be changed in this PR, simply making a comment. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26841#discussion_r2288539425 From acobbs at openjdk.org Fri Sep 5 14:33:22 2025 From: acobbs at openjdk.org (Archie Cobbs) Date: Fri, 5 Sep 2025 14:33:22 GMT Subject: Integrated: 8359383: Incorrect starting positions for implicitly typed variables In-Reply-To: References: Message-ID: On Thu, 12 Jun 2025 19:07:38 GMT, Archie Cobbs wrote: > This fixes starting position bugs relating to implicitly typed variables; see the linked issue for details. > > This also makes it possible to recover the declaration type (explicit, implicit, or `var`) from a `JCVariableDecl` and, in the case of `var` declarations, the starting position of the `var`; previously this wasn't possible. > > Finally, as a minor drive-by improvement, we can now pretty print `var` as `var` instead of `/*missing*/`. This pull request has now been integrated. Changeset: 1e90af08 Author: Archie Cobbs URL: https://git.openjdk.org/jdk/commit/1e90af08abb74df9ec4ab94b67deeae5c1c9fee1 Stats: 153 lines in 12 files changed: 94 ins; 10 del; 49 mod 8359383: Incorrect starting positions for implicitly typed variables Reviewed-by: vromero ------------- PR: https://git.openjdk.org/jdk/pull/25786 From acobbs at openjdk.org Fri Sep 5 16:15:48 2025 From: acobbs at openjdk.org (Archie Cobbs) Date: Fri, 5 Sep 2025 16:15:48 GMT Subject: RFR: 8349847: Support configuring individual lint categories as errors [v12] In-Reply-To: References: Message-ID: > This PR enhances the `-Werror` flag to support lint categories just like `-Xlint` does. For example `-Werror:all,-preview` would cause an error if any warning not in the `preview` lint category occurred. > > The existing `-Xlint` flag has a particular behavior when conflicting flags are combined (e.g., `-Xlint:all -Xlint:none -Xlint:foo -Xlint:-foo` is equivalent to `-Xlint:all`). This behavior has been factored out and Javadocumented so that both `-Xlint` and `-Werror` can have this same "parsing" logic. > > See the CSR [JDK-8350044](https://bugs.openjdk.org/browse/JDK-8350044) for details on how the new flag behaves in certain corner cases. Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision: Reword the "--help-lint" trailing blurb to make it sound more friendly. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/23622/files - new: https://git.openjdk.org/jdk/pull/23622/files/002c78ff..66dc9a1e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=11 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=10-11 Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/23622.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/23622/head:pull/23622 PR: https://git.openjdk.org/jdk/pull/23622 From vromero at openjdk.org Fri Sep 5 17:26:14 2025 From: vromero at openjdk.org (Vicente Romero) Date: Fri, 5 Sep 2025 17:26:14 GMT Subject: RFR: 8365776: Convert JShell tests to use JUnit instead of TestNG In-Reply-To: References: Message-ID: On Tue, 19 Aug 2025 10:26:14 GMT, Jan Lahoda wrote: > This is a conversion of JShell tests from TestNG to JUnit 5. > > To make the changes more transparent, there are 4 commit in this PR: > - https://github.com/openjdk/jdk/pull/26841/commits/c6b5d8441ad532551e626b3542431aa3f479ffc0: this one changes a name of a custom interface representing test cases, so that subsequent commits can use a simple name for `org.junit.jupiter.api.Test` (otherwise `Test` would resolve to the custom interface is subclasses of `UITesting`, and FQN would need to be used to refer to the annotation). > - https://github.com/openjdk/jdk/pull/26841/commits/2afee7d258f646f822d0b1bc3465d5595058e3df: the bulk of changes, done automatically by: > The bulk of the changes is done automatically, using this tool/script: > https://github.com/lahodaj/netbeans/tree/19515c3e2dbc07d977ca227d933197f856121ae5/java/java.openjdk.project/junit-convert > - https://github.com/openjdk/jdk/pull/26841/commits/8ca03af1b4d06e479cdfe7cc66186222feeaaa76: manual adjustments for things the tool does not handle (at least currently): > - one indent problem > - two uses of injected `java.lang.reflect.Method`, which needs to be replaced with `TestInfo` > - a different way to skip a test (normally, the tool detects and converts uses of `SkipException`, but that exception was not used on this place). > - https://github.com/openjdk/jdk/pull/26841/commits/639da0171a593031dae6a73830bb1665b7097e73: scripted update to copyright headers, done using: > > bash ./make/scripts/update_copyright_year.sh -b `git merge-base master jshell-upgrade-testng-to-junit` > > > As part of validation of this change, this script: > https://gist.github.com/lahodaj/a6535272ec275ffa394232657492218b > was used to compare the results in `junit.txt` and `testng.txt` in test results before and after the change, and it didn't find a difference in test counts. lgtm ------------- Marked as reviewed by vromero (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26841#pullrequestreview-3190244602 From archie.cobbs at gmail.com Fri Sep 5 18:39:04 2025 From: archie.cobbs at gmail.com (Archie Cobbs) Date: Fri, 5 Sep 2025 13:39:04 -0500 Subject: Proposal: Warnings for unnecessary warning suppression In-Reply-To: References: <4a5cce73-3b39-416b-8308-2edbef4dfa15@oracle.com> Message-ID: PIcking back up this discussion regarding adding a new compiler warning for unnecessary @SuppressWarnings annotations... The CSR has been updated (hopefully for the better) based on the conversation in this thread and is ready for another review by anyone who is interested. Otherwise I'll plan to finalize it in a few days. Thanks, -Archie On Fri, May 9, 2025 at 10:23?AM Archie Cobbs wrote: > Hi Maurizio, > > Thanks for your input. > > On Fri, May 9, 2025 at 9:31?AM Maurizio Cimadamore < > maurizio.cimadamore at oracle.com> wrote: > >> IMHO, this is a problem present with the addition of every new lint >> warning. It's not specific to this one. Of course, some new lint warning >> operate on brand new language features, so the potential to compromise >> existing compilaton units is low. But I'd expect that warnings such as >> "serial" would have ran into similar corner cases (e.g. previously ok code >> started to report new warnings, and to fail with Werror). >> >> So I think this seems ok, and not enough to cause a tweak to the >> treatment of lint:all. >> > That sounds good to me, but Joe Darcy had some reservations (see CSR). So > we would need to decide how to proceed. > > Maybe the thing to do is just to ensure that it gets introduced early in > the cycle so we can get some experience with it...? > >> I'll add here that a more robust fix for Werror issues is to enable >> developers to be more specific in the warnings they'd like to promote to >> errors (as discussed in the past). I'll CC Kevin who has always been a fan >> of this feature ;-) >> > Good news: that PR is already in place :) > https://github.com/openjdk/jdk/pull/23622 > >> Also complicating things, there are two different ways to suppress >> warnings, @SuppressWarnings("foo") and -Xlint:-foo and for similar >> "corner case" reasons they need to be configurable separately. >> >> IMHO, the main value of this new lint warning is to detect the use of >> `@SuppressWarnings` that are redundant. Sure there's the command-line >> flavor as well, but that renders any source code analysis dependent on the >> flags passed to javac. In other words, detecting redundant >> `@SuppressWarnings` has a more "timeless" nature that does not apply to >> detecting redundant command-line suppressions. The former tells you >> something about _your code_, in a way that is independent from which flags >> you use to compile it. Which is why I think we should only worry about that. >> > I think that's a reasonable way to start - that is, we just add the > category for "suppression" now and worry later about possibly adding > "supression-option". > > Joe - any thoughts? > > -Archie > > -- > Archie L. Cobbs > -- Archie L. Cobbs -------------- next part -------------- An HTML attachment was scrubbed... URL: From liach at openjdk.org Sat Sep 6 01:07:12 2025 From: liach at openjdk.org (Chen Liang) Date: Sat, 6 Sep 2025 01:07:12 GMT Subject: RFR: 8361950: Update to use jtreg 8 [v4] In-Reply-To: <6p7ncBylItu9HEeCINmqu_JFoL6zNXwJuSQaZoQ0J2I=.451526e1-d918-4fee-b1a7-e8193da61545@github.com> References: <6p7ncBylItu9HEeCINmqu_JFoL6zNXwJuSQaZoQ0J2I=.451526e1-d918-4fee-b1a7-e8193da61545@github.com> Message-ID: On Thu, 4 Sep 2025 22:01:57 GMT, Christian Stein wrote: >> Please review the change to update to using jtreg 8. >> >> The primary change is to the `jib-profiles.js` file, which specifies the version of jtreg to use, for those systems that rely on this file. In addition, the requiredVersion has been updated in the various `TEST.ROOT` files. > > Christian Stein has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: > > - Merge branch 'openjdk:master' into JDK-8361950-jtreg-8 > - Merge branch 'openjdk:master' into JDK-8361950-jtreg-8 > - Update to use correct library directories > > See also: https://openjdk.org/jtreg/faq.html#how-do-i-find-the-path-for-the-testng-or-junit-jar-files > - 8361950: Set required version to 8+2 > - 8361950: Update to use jtreg 8 #26749 was merged 4 days ago. Can we integrate this one now? ------------- PR Comment: https://git.openjdk.org/jdk/pull/26261#issuecomment-3260152639 From alanb at openjdk.org Sat Sep 6 07:04:14 2025 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 6 Sep 2025 07:04:14 GMT Subject: RFR: 8361950: Update to use jtreg 8 [v4] In-Reply-To: References: <6p7ncBylItu9HEeCINmqu_JFoL6zNXwJuSQaZoQ0J2I=.451526e1-d918-4fee-b1a7-e8193da61545@github.com> Message-ID: On Sat, 6 Sep 2025 01:04:56 GMT, Chen Liang wrote: > #26749 was merged 4 days ago. Can we integrate this one now? I think it would be useful to get input from @dholmes-ora and @lkorinth before doing this. There seems to be several timeout issues in the last few days, a few follow-on changes to adjust the timeout of a few tests, and a spate of tests being reported as timed out after passing. Updating jtreg adds another change to the picture. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26261#issuecomment-3261436239