From abimpoudis at openjdk.org Mon May 1 22:29:27 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 1 May 2023 22:29:27 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v8]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Address comments around JavacParser (remove identOrFlagUnderscore)
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/e39dd6dd..47d738bb
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=07
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=06-07
Stats: 39 lines in 1 file changed: 12 ins; 20 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Mon May 1 22:29:30 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 1 May 2023 22:29:30 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 08:56:38 GMT, Maurizio Cimadamore wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 839:
>
>> 837: }
>> 838:
>> 839: private UnnamedDetails identOrFlagUnderscore(JCModifiers mods) {
>
> I'm not 100% sure this is required - the main use seems to be in `variableDeclarator` - but in that method you already have a token to look at, and a set of modifiers that you can augment - so why not just doing everything in that method (instead of preprocessing it?)
Good point. That was an artifact of code evolution. Everything is integrated in `variableDeclarator` now.
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3555:
>
>> 3553: */
>> 3554: JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc, boolean localDecl) {
>> 3555: UnnamedDetails result = identOrFlagUnderscore(mods);
>
> Why do we need to get the "unnamed details" here, instead of letting the code flow to `variableDeclaratorRest` and do it there?
Indeed. I removed it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1181937000
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1181937191
From abimpoudis at openjdk.org Mon May 1 22:32:31 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 1 May 2023 22:32:31 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 09:07:22 GMT, Maurizio Cimadamore wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1777:
>
>> 1775: log.error(guard.pos(), Errors.GuardHasConstantExpressionFalse);
>> 1776: }
>> 1777: } else if (guard != null) {
>
> I guess this is caused by something like:
>
> case _ when ...
>
> If now a guard can appear regardless of how many labels there are, should be refactor this code so that if `guard != null` it is always attributed? And then we do other stuff in case `labels.tail.isEmpty()` ? Note that the code for attributing the guard is slightly different in the two cases in this patch: the original code creates a nested scope - while the new code doesn't.
Actually this is for the case where we have `case A(_), B(C _) when ... `. In that case we are sure that the only scope we can use is the switch environment (since no bindings are introduced). Hm, I don't see another way of refactoring this without depending on `labels.tail.isEmpty()`
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 826:
>
>> 824: //type test pattern:
>> 825: UnnamedDetails result = identOrFlagUnderscore(mods);
>> 826: JCVariableDecl var = toP(F.at(result.varPos()).VarDef(mods, result.name(), e, null));
>
> Do you think we can delegate to `variableDeclarator` here?
The behavior I observe is that `variableDeclarator` does not behave well when we have a `var` instead of a type in a type pattern. `variableDeclarator` is well suited for variable declarations but not for type patterns. But I can investigate further.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1181938984
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1181938402
From duke at openjdk.org Tue May 2 00:02:26 2023
From: duke at openjdk.org (duke)
Date: Tue, 2 May 2023 00:02:26 GMT
Subject: Withdrawn: 8303625:
jdk/jshell/JdiFailingLaunchExecutionControlTest.java fail with -Xcomp
In-Reply-To:
References:
Message-ID:
On Mon, 6 Mar 2023 02:38:19 GMT, SUN Guoyun wrote:
> This tests failed with VM_OPTIONS=-Xcomp and CONF=fastdebug on the LOONGARCH64 architecture because JdiExecutionControlProvider`s timeout.
> jdk/jshell/JdiFailingLaunchExecutionControlTest.java
> jdk/jshell/JdiFailingListenExecutionControlTest.java
>
> This PR fix the issue, Please help review it.
>
> Thanks.
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.org/jdk/pull/12873
From abimpoudis at openjdk.org Tue May 2 08:20:19 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 2 May 2023 08:20:19 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 08:59:35 GMT, Maurizio Cimadamore wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3660:
>
>> 3658: int pos = token.pos;
>> 3659: Name name;
>> 3660: if (allowThisIdent ||
>
> I note that now the error re. underscore on lambda is no longer given even if preview features are disabled. But I guess that's ok. (instead you will probably get an error that unnamed parameters are a preview feature)
Yes, indeed.
~/dev/jdk unnamed !1 > javac Unnamed.java
Unnamed.java:61: error: unnamed variables are a preview feature and are disabled by default.
TwoParams p1 = (_, _) -> {};
^
(use --enable-preview to enable unnamed variables)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1182230562
From abimpoudis at openjdk.org Tue May 2 08:27:20 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 2 May 2023 08:27:20 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 09:20:12 GMT, Maurizio Cimadamore wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 746:
>
>> 744:
>> 745: sealed interface PatternDescription {
>> 746: public static PatternDescription from(Types types, Type selectorType, JCPattern pattern, Symtab syms) {
>
> Optional comment: the fact that this factory needs so much compiler state makes me think that perhaps a better place for it would be as an instance method of Flow, rather than a static method in PatternDescription.
@lahodaj WDYT? Looks like it can be easily refactored and it is used only in one place (apart from the recursive call). I can refactor it in this PR or u can do it in #13074.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1182237560
From abimpoudis at openjdk.org Tue May 2 09:49:38 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 2 May 2023 09:49:38 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v9]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with two additional commits since the last revision:
- Address comments around JavacParser (reuse variableDeclaratorRest in parsePattern)
- Add new lines and revise comment in Unnamed.java
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/47d738bb..3d83fa14
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=08
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=07-08
Stats: 49 lines in 4 files changed: 8 ins; 7 del; 34 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Tue May 2 09:49:42 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 2 May 2023 09:49:42 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Mon, 1 May 2023 22:28:00 GMT, Aggelos Biboudis wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 826:
>>
>>> 824: //type test pattern:
>>> 825: UnnamedDetails result = identOrFlagUnderscore(mods);
>>> 826: JCVariableDecl var = toP(F.at(result.varPos()).VarDef(mods, result.name(), e, null));
>>
>> Do you think we can delegate to `variableDeclarator` here?
>
> The behavior I observe is that `variableDeclarator` does not behave well when we have a `var` instead of a type in a type pattern. `variableDeclarator` is well suited for variable declarations but not for type patterns. But I can investigate further.
What about reusing `variableDeclaratorRest`?
https://github.com/openjdk/jdk/pull/13528/commits/3d83fa14ae26981d5b6fc75faa0d3ba9336952b1
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1182329080
From abimpoudis at openjdk.org Tue May 2 19:27:12 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 2 May 2023 19:27:12 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v10]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Remove flag
- Fixes unnamed errors
- Fixes missing test in TestUnnamedVariableElement
- Removes scope elements from erroneous source file tests in TestGetScopeResult (names.empty is used to signify error when we mix and match implicit and explicit parameters in lambdas)
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/3d83fa14..5c9314d3
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=09
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=08-09
Stats: 29 lines in 9 files changed: 8 ins; 11 del; 10 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Tue May 2 19:27:16 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 2 May 2023 19:27:16 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v9]
In-Reply-To:
References:
Message-ID:
On Tue, 2 May 2023 09:49:38 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with two additional commits since the last revision:
>
> - Address comments around JavacParser (reuse variableDeclaratorRest in parsePattern)
> - Add new lines and revise comment in Unnamed.java
@mcimadamore
@vicente-romero-oracle
Flag removed in https://github.com/openjdk/jdk/pull/13528/commits/5c9314d3f39dc0e3084c80b7f2ff06e70a363425
re-requesting review ?
cc-ing @lahodaj
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13528#issuecomment-1532022476
From jlahoda at openjdk.org Wed May 3 09:35:03 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Wed, 3 May 2023 09:35:03 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch terminal
to raw mode on selected platforms
Message-ID:
To support JShell and other usecases, the JDK uses JLine, which provides line-editing functionality inside a terminal.
JLine has several ways to work with the terminal, based on various additional libraries and tools. Most of them are not directly usable inside the JDK, so currently, on non-Windows platforms, the JLine inside the JDK will use external programs, like `stty`, to inspect the terminal's properties and to switch the terminal to raw mode.
This is slightly problematic, as the external programs might be missing, and while this is not that big problem for JShell, it might be a problem for other potential uses of JLine, like using it inside `System.console()`.
So, the proposal here is to call the corresponding native methods directly, on selected platforms for now (Linux and Mac OS/X), instead of invoking the external programs. On Windows, this has always been the case, we are using a custom implementation of the interface that maps native and Java function for JNA there, and the proposal is to do the same here. We take the appropriate mapping interface for JNA, and provide hand-written implementation for it, using JNI.
The Windows implementation is mostly unchanged, the changes are mostly non-Windows only. The overview of the changes is:
- `LastErrorException` is moved from the Windows-specific code to the platform-neutral code, as it is used by all the native implementations. This is the only change that directly affects the Windows-specific code
- `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaNativePty.java` and `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaTerminalProvider.java` are created based on the corresponding files from JLine. In JLine, these files directly call platform-specific implementations, but in this patch, the platform specific code is commented out, and replaced with calls to `JDKNativePty`, which is a new platform-specific class, that delegates to the actual platform-specific implementations. Note the `JnaNativePty.java` and `JnaTerminalProvider.java` already exist in the Windows part, but have different pieces of code commented out, which makes them substantially different.
- for Linux and Mac OS/X, there are platform-specific implementations based on the corresponding code from JLine, with the hand-written JNI-based implementation of the JNA-based existing interfaces. They also have an implementation of `JDKNativePty`, which just delegates to the given platform's `"NativePty"` implementation.
- the `JdkConsoleProviderImpl.java` has been tweaked to not allow the implementation based on the external programs, and gracefully falling back to the standard implementation. JShell is kept unchanged.
The reasons for this organization are: limiting duplication, mostly adhering to the JDK's platform specific build (which is different from the normal JLine's platform-neutral build) and limiting the difference between standard JLine and JLine inside JDK, to help future upgrades.
-------------
Commit messages:
- Removing tabs
- Adding handling of errors in the jni code.
- Permit dumb terminals.
- Only create JLine-based Console when the direct terminal access passes.
- Attempting to minimize the diff between JDK and vanilla JLine on Mac.
- Reorganizing the native classes.
- mac impl
- Using direct native calls instead of stty on Linux.
Changes: https://git.openjdk.org/jdk/pull/13687/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13687&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8306983
Stats: 2144 lines in 23 files changed: 2096 ins; 40 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/13687.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13687/head:pull/13687
PR: https://git.openjdk.org/jdk/pull/13687
From erikj at openjdk.org Wed May 3 13:56:16 2023
From: erikj at openjdk.org (Erik Joelsson)
Date: Wed, 3 May 2023 13:56:16 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch
terminal to raw mode on selected platforms
In-Reply-To:
References:
Message-ID:
On Thu, 27 Apr 2023 11:21:04 GMT, Jan Lahoda wrote:
> To support JShell and other usecases, the JDK uses JLine, which provides line-editing functionality inside a terminal.
>
> JLine has several ways to work with the terminal, based on various additional libraries and tools. Most of them are not directly usable inside the JDK, so currently, on non-Windows platforms, the JLine inside the JDK will use external programs, like `stty`, to inspect the terminal's properties and to switch the terminal to raw mode.
>
> This is slightly problematic, as the external programs might be missing, and while this is not that big problem for JShell, it might be a problem for other potential uses of JLine, like using it inside `System.console()`.
>
> So, the proposal here is to call the corresponding native methods directly, on selected platforms for now (Linux and Mac OS/X), instead of invoking the external programs. On Windows, this has always been the case, we are using a custom implementation of the interface that maps native and Java function for JNA there, and the proposal is to do the same here. We take the appropriate mapping interface for JNA, and provide hand-written implementation for it, using JNI.
>
> The Windows implementation is mostly unchanged, the changes are mostly non-Windows only. The overview of the changes is:
> - `LastErrorException` is moved from the Windows-specific code to the platform-neutral code, as it is used by all the native implementations. This is the only change that directly affects the Windows-specific code
> - `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaNativePty.java` and `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaTerminalProvider.java` are created based on the corresponding files from JLine. In JLine, these files directly call platform-specific implementations, but in this patch, the platform specific code is commented out, and replaced with calls to `JDKNativePty`, which is a new platform-specific class, that delegates to the actual platform-specific implementations. Note the `JnaNativePty.java` and `JnaTerminalProvider.java` already exist in the Windows part, but have different pieces of code commented out, which makes them substantially different.
> - for Linux and Mac OS/X, there are platform-specific implementations based on the corresponding code from JLine, with the hand-written JNI-based implementation of the JNA-based existing interfaces. They also have an implementation of `JDKNativePty`, which just delegates to the given platform's `"NativePty"` implementation.
> - the `JdkConsoleProviderImpl.java` has been tweaked to not allow the implementation based on the external programs, and gracefully falling back to the standard implementation. JShell is kept unchanged.
>
> The reasons for this organization are: limiting duplication, mostly adhering to the JDK's platform specific build (which is different from the normal JLine's platform-neutral build) and limiting the difference between standard JLine and JLine inside JDK, to help future upgrades.
make/modules/jdk.internal.le/Lib.gmk line 38:
> 36: LDFLAGS := $(LDFLAGS_JDKLIB), \
> 37: LIBS_windows := $(JDKLIB_LIBS) user32.lib, \
> 38: LIBS_unix := $(JDKLIB_LIBS) -lstdc++, \
If this is a C++ library, I think it's better to specify `TOOLCHAIN := TOOLCHAIN_LINK_CXX` than adding `-lstdc++`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13687#discussion_r1183721435
From erikj at openjdk.org Wed May 3 14:01:23 2023
From: erikj at openjdk.org (Erik Joelsson)
Date: Wed, 3 May 2023 14:01:23 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch
terminal to raw mode on selected platforms
In-Reply-To:
References:
Message-ID:
On Wed, 3 May 2023 13:53:20 GMT, Erik Joelsson wrote:
>> To support JShell and other usecases, the JDK uses JLine, which provides line-editing functionality inside a terminal.
>>
>> JLine has several ways to work with the terminal, based on various additional libraries and tools. Most of them are not directly usable inside the JDK, so currently, on non-Windows platforms, the JLine inside the JDK will use external programs, like `stty`, to inspect the terminal's properties and to switch the terminal to raw mode.
>>
>> This is slightly problematic, as the external programs might be missing, and while this is not that big problem for JShell, it might be a problem for other potential uses of JLine, like using it inside `System.console()`.
>>
>> So, the proposal here is to call the corresponding native methods directly, on selected platforms for now (Linux and Mac OS/X), instead of invoking the external programs. On Windows, this has always been the case, we are using a custom implementation of the interface that maps native and Java function for JNA there, and the proposal is to do the same here. We take the appropriate mapping interface for JNA, and provide hand-written implementation for it, using JNI.
>>
>> The Windows implementation is mostly unchanged, the changes are mostly non-Windows only. The overview of the changes is:
>> - `LastErrorException` is moved from the Windows-specific code to the platform-neutral code, as it is used by all the native implementations. This is the only change that directly affects the Windows-specific code
>> - `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaNativePty.java` and `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaTerminalProvider.java` are created based on the corresponding files from JLine. In JLine, these files directly call platform-specific implementations, but in this patch, the platform specific code is commented out, and replaced with calls to `JDKNativePty`, which is a new platform-specific class, that delegates to the actual platform-specific implementations. Note the `JnaNativePty.java` and `JnaTerminalProvider.java` already exist in the Windows part, but have different pieces of code commented out, which makes them substantially different.
>> - for Linux and Mac OS/X, there are platform-specific implementations based on the corresponding code from JLine, with the hand-written JNI-based implementation of the JNA-based existing interfaces. They also have an implementation of `JDKNativePty`, which just delegates to the given platform's `"NativePty"` implementation.
>> - the `JdkConsoleProviderImpl.java` has been tweaked to not allow the implementation based on the external programs, and gracefully falling back to the standard implementation. JShell is kept unchanged.
>>
>> The reasons for this organization are: limiting duplication, mostly adhering to the JDK's platform specific build (which is different from the normal JLine's platform-neutral build) and limiting the difference between standard JLine and JLine inside JDK, to help future upgrades.
>
> make/modules/jdk.internal.le/Lib.gmk line 38:
>
>> 36: LDFLAGS := $(LDFLAGS_JDKLIB), \
>> 37: LIBS_windows := $(JDKLIB_LIBS) user32.lib, \
>> 38: LIBS_unix := $(JDKLIB_LIBS) -lstdc++, \
>
> If this is a C++ library, I think it's better to specify `TOOLCHAIN := TOOLCHAIN_LINK_CXX` than adding `-lstdc++`.
We may also need `$(LIBCXX)` to force static linking when that is enabled for the build.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13687#discussion_r1183728006
From abimpoudis at openjdk.org Wed May 3 14:29:23 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Wed, 3 May 2023 14:29:23 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v11]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Add guard test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/5c9314d3..e95465ed
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=10
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=09-10
Stats: 15 lines in 2 files changed: 14 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Wed May 3 15:41:19 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Wed, 3 May 2023 15:41:19 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 09:16:29 GMT, Maurizio Cimadamore wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java line 295:
>
>> 293: : tree.vartype.type;
>> 294: Name name;
>> 295: if (Feature.UNNAMED_VARIABLES.allowedInSource(source) && (tree.mods.flags & UNNAMED) != 0) {
>
> Not 100% sure what this code does. E.g. shouldn't we just set the name of the variable as the name stored in the tree? It seems more economical if we could just set in the parser the name as empty (if preview features are enabled etc.) - and then all these special cases can disappear. After all, you still have the flag (and even then, do we need a flag? Can't we just see whether the name is empty to see that it's unnamed?)
This is still needed because we want to have a different name for the Tree API (_) and the symbol (empty).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1183863324
From naoto at openjdk.org Wed May 3 17:51:19 2023
From: naoto at openjdk.org (Naoto Sato)
Date: Wed, 3 May 2023 17:51:19 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch
terminal to raw mode on selected platforms
In-Reply-To:
References:
Message-ID:
On Thu, 27 Apr 2023 11:21:04 GMT, Jan Lahoda wrote:
> To support JShell and other usecases, the JDK uses JLine, which provides line-editing functionality inside a terminal.
>
> JLine has several ways to work with the terminal, based on various additional libraries and tools. Most of them are not directly usable inside the JDK, so currently, on non-Windows platforms, the JLine inside the JDK will use external programs, like `stty`, to inspect the terminal's properties and to switch the terminal to raw mode.
>
> This is slightly problematic, as the external programs might be missing, and while this is not that big problem for JShell, it might be a problem for other potential uses of JLine, like using it inside `System.console()`.
>
> So, the proposal here is to call the corresponding native methods directly, on selected platforms for now (Linux and Mac OS/X), instead of invoking the external programs. On Windows, this has always been the case, we are using a custom implementation of the interface that maps native and Java function for JNA there, and the proposal is to do the same here. We take the appropriate mapping interface for JNA, and provide hand-written implementation for it, using JNI.
>
> The Windows implementation is mostly unchanged, the changes are mostly non-Windows only. The overview of the changes is:
> - `LastErrorException` is moved from the Windows-specific code to the platform-neutral code, as it is used by all the native implementations. This is the only change that directly affects the Windows-specific code
> - `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaNativePty.java` and `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaTerminalProvider.java` are created based on the corresponding files from JLine. In JLine, these files directly call platform-specific implementations, but in this patch, the platform specific code is commented out, and replaced with calls to `JDKNativePty`, which is a new platform-specific class, that delegates to the actual platform-specific implementations. Note the `JnaNativePty.java` and `JnaTerminalProvider.java` already exist in the Windows part, but have different pieces of code commented out, which makes them substantially different.
> - for Linux and Mac OS/X, there are platform-specific implementations based on the corresponding code from JLine, with the hand-written JNI-based implementation of the JNA-based existing interfaces. They also have an implementation of `JDKNativePty`, which just delegates to the given platform's `"NativePty"` implementation.
> - the `JdkConsoleProviderImpl.java` has been tweaked to not allow the implementation based on the external programs, and gracefully falling back to the standard implementation. JShell is kept unchanged.
>
> The reasons for this organization are: limiting duplication, mostly adhering to the JDK's platform specific build (which is different from the normal JLine's platform-neutral build) and limiting the difference between standard JLine and JLine inside JDK, to help future upgrades.
Changes in `JdkConsoleProviderImpl.java` look good to me. Didn't look at other diffs closely, but it seems some other files are missing Oracle copyright text.
-------------
PR Review: https://git.openjdk.org/jdk/pull/13687#pullrequestreview-1411449102
From coffeys at openjdk.org Thu May 4 15:01:19 2023
From: coffeys at openjdk.org (Sean Coffey)
Date: Thu, 4 May 2023 15:01:19 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v2]
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 16:20:24 GMT, Weibing Xiao wrote:
>> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>>
>> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>>
>> Reviewer: @coffeys @lahodaj
>
> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
>
> modify bug id
Looks good - minor suggestions
test/langtools/jdk/jshell/UndefinedClassTest.java line 27:
> 25: * @test
> 26: * @bug 8292755
> 27: * @summary make sure JShell not crashing while throwing undefined exception
I'd suggest "InternalError seen while throwing undefined exception" as summary.
test/langtools/jdk/jshell/UndefinedClassTest.java line 55:
> 53: " void run() throws Throwable;\n" +
> 54: "\n" +
> 55: " // You can also replace `static` with `default` and test again\n" +
why the comment in test code ? maybe you can create a 2nd test instead :
public void testUndefinedClass1() throws Exception{
String code = "@FunctionalInterface\n" +
"interface RunnableWithThrowable {\n" +
" void run() throws Throwable;\n" +
"\n" +
" default RunnableWithThrowable getInstance() {\n" +
" return () -> { throw new NotExist(); };\n" +
" }\n" +
"}";
// set terminal height so that help output won't hit page breaks
System.setProperty("test.terminal.height", "1000000");
doRunTest((inputSink, out) -> {
inputSink.write(code + "\n");
waitOutput(out, "NotExist");
});
}
-------------
PR Review: https://git.openjdk.org/jdk/pull/13719#pullrequestreview-1413326124
PR Review Comment: https://git.openjdk.org/jdk/pull/13719#discussion_r1185147502
PR Review Comment: https://git.openjdk.org/jdk/pull/13719#discussion_r1185147670
From abimpoudis at openjdk.org Thu May 4 15:08:21 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Thu, 4 May 2023 15:08:21 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
8307444: java.lang.AssertionError when using unnamed patterns
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/e95465ed..12ce9e19
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=11
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=10-11
Stats: 18 lines in 2 files changed: 15 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From duke at openjdk.org Thu May 4 16:34:32 2023
From: duke at openjdk.org (Weibing Xiao)
Date: Thu, 4 May 2023 16:34:32 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v3]
In-Reply-To:
References:
Message-ID:
> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>
> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>
> Reviewer: @coffeys @lahodaj
Weibing Xiao has updated the pull request incrementally with two additional commits since the last revision:
- add an empty to see if remote repo got updated
- update according to the comment
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13719/files
- new: https://git.openjdk.org/jdk/pull/13719/files/5750a105..36e72a6f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13719&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13719&range=01-02
Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/13719.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13719/head:pull/13719
PR: https://git.openjdk.org/jdk/pull/13719
From duke at openjdk.org Thu May 4 17:21:50 2023
From: duke at openjdk.org (Weibing Xiao)
Date: Thu, 4 May 2023 17:21:50 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v4]
In-Reply-To:
References:
Message-ID:
> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>
> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>
> Reviewer: @coffeys @lahodaj
Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
Revert "add an empty to see if remote repo got updated"
This reverts commit 36e72a6f3b63813cb4fd8cce94ca6571415c7093.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13719/files
- new: https://git.openjdk.org/jdk/pull/13719/files/36e72a6f..c83caa98
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13719&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13719&range=02-03
Stats: 1 line in 1 file changed: 0 ins; 1 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/13719.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13719/head:pull/13719
PR: https://git.openjdk.org/jdk/pull/13719
From mcimadamore at openjdk.org Thu May 4 17:23:26 2023
From: mcimadamore at openjdk.org (Maurizio Cimadamore)
Date: Thu, 4 May 2023 17:23:26 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 15:08:21 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> 8307444: java.lang.AssertionError when using unnamed patterns
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4165:
> 4163: tree.type = tree.var.type = type;
> 4164: Name name = tree.var.name;
> 4165: if (name == names.underscore) name = names.empty;
Why isn't the parser doing this?
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java line 295:
> 293: : tree.vartype.type;
> 294: Name name = tree.name;
> 295: if (Feature.UNNAMED_VARIABLES.allowedInSource(source) && name == names.underscore) name = names.empty;
Same, I believe the parser should have set the right name on this
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3591:
> 3589: }
> 3590: }
> 3591: result = toP(F.at(pos).VarDef(mods, name, type, init, declaredUsingVar));
I think this should check whether name is underscore (and feature is enabled) and, if that's the case, replace the name with an empty name, so that the rest of the compiler is already correct.
Also, related, no matter what, I think javac's Pretty class should be updated to render variables with empty name as "_" when the tree is turned back into source.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185294832
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185295283
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185299587
From duke at openjdk.org Thu May 4 17:35:19 2023
From: duke at openjdk.org (Weibing Xiao)
Date: Thu, 4 May 2023 17:35:19 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v4]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 17:21:50 GMT, Weibing Xiao wrote:
>> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>>
>> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>>
>> Reviewer: @coffeys @lahodaj
>
> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
>
> Revert "add an empty to see if remote repo got updated"
>
> This reverts commit 36e72a6f3b63813cb4fd8cce94ca6571415c7093.
@lahodaj , let me know if you have any concerns and comments. Thanks.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13719#issuecomment-1535154083
From duke at openjdk.org Thu May 4 17:35:23 2023
From: duke at openjdk.org (Weibing Xiao)
Date: Thu, 4 May 2023 17:35:23 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v2]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 14:57:37 GMT, Sean Coffey wrote:
>> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
>>
>> modify bug id
>
> test/langtools/jdk/jshell/UndefinedClassTest.java line 55:
>
>> 53: " void run() throws Throwable;\n" +
>> 54: "\n" +
>> 55: " // You can also replace `static` with `default` and test again\n" +
>
> why the comment in test code ? maybe you can create a 2nd test instead :
>
>
> public void testUndefinedClass1() throws Exception{
> String code = "@FunctionalInterface\n" +
> "interface RunnableWithThrowable {\n" +
> " void run() throws Throwable;\n" +
> "\n" +
> " default RunnableWithThrowable getInstance() {\n" +
> " return () -> { throw new NotExist(); };\n" +
> " }\n" +
> "}";
> // set terminal height so that help output won't hit page breaks
> System.setProperty("test.terminal.height", "1000000");
> doRunTest((inputSink, out) -> {
> inputSink.write(code + "\n");
> waitOutput(out, "NotExist");
> });
> }
Updated the summary. And I remove the code to set the terminal height. I don't think it is necessary since there are only two lines for the print-out.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13719#discussion_r1185311268
From abimpoudis at openjdk.org Thu May 4 17:48:28 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Thu, 4 May 2023 17:48:28 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
Message-ID: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Add test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/12ce9e19..ffae4e0e
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=12
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=11-12
Stats: 46 lines in 1 file changed: 46 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From vromero at openjdk.org Thu May 4 17:51:22 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Thu, 4 May 2023 17:51:22 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 17:20:35 GMT, Maurizio Cimadamore wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8307444: java.lang.AssertionError when using unnamed patterns
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3591:
>
>> 3589: }
>> 3590: }
>> 3591: result = toP(F.at(pos).VarDef(mods, name, type, init, declaredUsingVar));
>
> I think this should check whether name is underscore (and feature is enabled) and, if that's the case, replace the name with an empty name, so that the rest of the compiler is already correct.
>
> Also, related, no matter what, I think javac's Pretty class should be updated to render variables with empty name as "_" when the tree is turned back into source.
yep I agree with this, the parser should set the right name as soon as it sees a `_`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185327903
From abimpoudis at openjdk.org Thu May 4 18:23:24 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Thu, 4 May 2023 18:23:24 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 17:48:31 GMT, Vicente Romero wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3591:
>>
>>> 3589: }
>>> 3590: }
>>> 3591: result = toP(F.at(pos).VarDef(mods, name, type, init, declaredUsingVar));
>>
>> I think this should check whether name is underscore (and feature is enabled) and, if that's the case, replace the name with an empty name, so that the rest of the compiler is already correct.
>>
>> Also, related, no matter what, I think javac's Pretty class should be updated to render variables with empty name as "_" when the tree is turned back into source.
>
> yep I agree with this, the parser should set the right name as soon as it sees a `_`
We could indeed if we wanted to store `empty` everywhere. However, after some off-list discussions I updated the CSR (and the code) to include `empty` as the name at the symbol-level (for consistency with javax model) and `_` at the Tree API-level for its version of a name. This is the rationale behind what you see in Attr (for patterns) and member enter for all other cases. @jddarcy what do you think?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185358285
From vromero at openjdk.org Thu May 4 18:55:21 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Thu, 4 May 2023 18:55:21 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/jdk.compiler/share/classes/com/sun/source/tree/VariableTree.java line 54:
> 52:
> 53: /**
> 54: * Returns the name of the variable being declared or `_` if the variable
I guess if we go full for the empty name then this will need to change too
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 69:
> 67: import com.sun.tools.javac.util.Names;
> 68:
> 69: import java.util.*;
nit: I think we prefer not using star imports, this was probably done by the IDE
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185336672
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185393785
From vromero at openjdk.org Thu May 4 19:33:28 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Thu, 4 May 2023 19:33:28 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 535:
> 533: if (clearedPatterns.size() > 1) {
> 534: validCaseLabelList = clearedPatterns.stream().allMatch(cP -> cP.hasTag(Tag.PATTERNCASELABEL));
> 535: } else validCaseLabelList = clearedPatterns.size() == 1 && clearedPatterns.head.hasTag(Tag.PATTERNCASELABEL);
style: I would use `{}` for the code in the `else` branch here, same way as it has been done for the `then` branch. Also in the `else` branch isn't the `clearedPatterns.size() == 1` condition always true?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185430664
From darcy at openjdk.org Thu May 4 20:01:23 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Thu, 4 May 2023 20:01:23 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 18:20:30 GMT, Aggelos Biboudis wrote:
>> yep I agree with this, the parser should set the right name as soon as it sees a `_`
>
> We could indeed if we wanted to store `empty` everywhere. However, after some off-list discussions I updated the CSR (and the code) to include `empty` as the name at the symbol-level (for consistency with javax model) and `_` at the Tree API-level for its version of a name. This is the rationale behind what you see in Attr (for patterns) and member enter for all other cases. @jddarcy what do you think?
>
In terms of pretty printing, src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java may need to be updated too.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185457942
From vromero at openjdk.org Thu May 4 20:07:19 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Thu, 4 May 2023 20:07:19 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java line 88:
> 86: * or deletion without notice.
> 87: */
> 88: @SuppressWarnings("preview")
isn't it better to apply the annotation to the method below?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185463034
From duke at openjdk.org Thu May 4 20:30:47 2023
From: duke at openjdk.org (Weibing Xiao)
Date: Thu, 4 May 2023 20:30:47 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v5]
In-Reply-To:
References:
Message-ID:
> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>
> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>
> Reviewer: @coffeys @lahodaj
Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
add one more test case
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13719/files
- new: https://git.openjdk.org/jdk/pull/13719/files/c83caa98..baa82f6f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13719&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13719&range=03-04
Stats: 17 lines in 1 file changed: 15 ins; 1 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/13719.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13719/head:pull/13719
PR: https://git.openjdk.org/jdk/pull/13719
From darcy at openjdk.org Thu May 4 20:50:28 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Thu, 4 May 2023 20:50:28 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID: <2f6yNQHJy1t65PBsSelcHM2episYeYxt7gdYtQV1Zsc=.ff0f7299-3378-496d-ad92-0ed1cbdf90e8@github.com>
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 438:
> 436: }
> 437:
> 438: public boolean isUnnamed() {
Should this method get the '@Override @DefinedBy(Api.LANGUAGE_MODEL)' markup?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185497754
From darcy at openjdk.org Thu May 4 21:00:25 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Thu, 4 May 2023 21:00:25 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java line 114:
> 112: */
> 113: @PreviewFeature(feature=PreviewFeature.Feature.UNNAMED, reflective = true)
> 114: default boolean isUnnamed() { return false; }
Looking at the various sources more closely, I'll revise my previous guidance and recommend the default method be defined as:
return getSimpleName().isEmpty()
which would also avoid the strict need to override the method in Symbol.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185505824
From darcy at openjdk.org Thu May 4 21:06:23 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Thu, 4 May 2023 21:06:23 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 724:
> 722: @PreviewFeature(feature=PreviewFeature.Feature.UNNAMED, reflective = true)
> 723: default boolean isUnnamed(Element element) {
> 724: return false;
Analogous suggestion to switch to "return element.getSimpleName().isEmpty();"
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185512905
From coffeys at openjdk.org Thu May 4 21:42:15 2023
From: coffeys at openjdk.org (Sean Coffey)
Date: Thu, 4 May 2023 21:42:15 GMT
Subject: RFR: 8305714 : Add an extra test for JDK-8292755 [v5]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 20:30:47 GMT, Weibing Xiao wrote:
>> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>>
>> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>>
>> Reviewer: @coffeys @lahodaj
>
> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
>
> add one more test case
Marked as reviewed by coffeys (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/13719#pullrequestreview-1413960279
From darcy at openjdk.org Thu May 4 21:43:22 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Thu, 4 May 2023 21:43:22 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID:
On Thu, 4 May 2023 19:58:37 GMT, Joe Darcy wrote:
>> We could indeed if we wanted to store `empty` everywhere. However, after some off-list discussions I updated the CSR (and the code) to include `empty` as the name at the symbol-level (for consistency with javax model) and `_` at the Tree API-level for its version of a name. This is the rationale behind what you see in Attr (for patterns) and member enter for all other cases. @jddarcy what do you think?
>
>>
>
> In terms of pretty printing, src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java may need to be updated too.
>
For the user-facing javax.lang.model languages, I think the current convention of "empty name means unnamed" is reasonable and is consistent with how other unnamed items are handled in that API.
I assumed for the lower-level tree API "_" would be a more appropriate choice, but I'm open to discussions alternative conventions there.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185544462
From vromero at openjdk.org Thu May 4 22:04:20 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Thu, 4 May 2023 22:04:20 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID: <4dcjzbL_QNyX1L-n4dCOlV6ZvWQBsnrlqbHhDEku8jg=.0c82bcea-6c43-45c5-9e4b-f64aa914bc59@github.com>
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java line 496:
> 494: @DefinedBy(Api.COMPILER_TREE)
> 495: public JCTree visitAnyPattern(AnyPatternTree node, P p) {
> 496: JCBindingPattern t = (JCBindingPattern) node;
not sure this is correct, are we returning a JCBindingPattern?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185555175
From vromero at openjdk.org Thu May 4 22:08:24 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Thu, 4 May 2023 22:08:24 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add test
test/langtools/tools/javac/patterns/Unnamed.java line 4:
> 2:
> 3: /**
> 4: * @test /nodynamiccopyright/
there is no golden file for this test so full copyright will be needed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185559074
From abimpoudis at openjdk.org Thu May 4 23:28:29 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Thu, 4 May 2023 23:28:29 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v14]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
8307482: Compiler should accept var _ in nested patterns in switch case
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/ffae4e0e..888297ef
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=13
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=12-13
Stats: 49 lines in 4 files changed: 35 ins; 0 del; 14 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Thu May 4 23:28:29 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Thu, 4 May 2023 23:28:29 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To:
References:
Message-ID: <_2IbNlxLzlbXs3UkPWmrTTuMVRsvTnHnX4JqN35kbPU=.e1053192-5d69-4b31-b1d0-8bfa12adefda@github.com>
On Thu, 4 May 2023 21:40:38 GMT, Joe Darcy wrote:
>>>
>>
>> In terms of pretty printing, src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java may need to be updated too.
>
>>
>
> For the user-facing javax.lang.model languages, I think the current convention of "empty name means unnamed" is reasonable and is consistent with how other unnamed items are handled in that API.
>
> I assumed for the lower-level tree API "_" would be a more appropriate choice, but I'm open to discussions alternative conventions there.
Recently, I realized that `names.empty` also signifies an error in `variableDeclaratorId` in some occasion around lambdas: https://github.com/openjdk/jdk/blob/ffae4e0e97b19b1c1ad2865ed618ba380a861b7e/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3688-L3697
I don't believe that this would be a blocker but it could pose a possible minor challenge.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185595137
From abimpoudis at openjdk.org Fri May 5 08:44:23 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Fri, 5 May 2023 08:44:23 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Thu, 4 May 2023 20:04:49 GMT, Vicente Romero wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add test
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java line 88:
>
>> 86: * or deletion without notice.
>> 87: */
>> 88: @SuppressWarnings("preview")
>
> isn't it better to apply the annotation to the method below?
Yeap, this is what I thought at first but I was getting "warnings found and -Werror specified". So compilation was failing.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185840546
From jlahoda at openjdk.org Fri May 5 09:29:35 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 09:29:35 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v14]
In-Reply-To:
References:
Message-ID: <3eNbxZ47pN094c130bnXzkaRcts92buDBG_EPBM4DJg=.3d354d72-17c5-4f5f-8c78-2166e56455c6@github.com>
On Thu, 4 May 2023 23:28:29 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> 8307482: Compiler should accept var _ in nested patterns in switch case
src/jdk.compiler/share/classes/com/sun/source/tree/AnyPatternTree.java line 32:
> 30: *
> 31: */
> 32: public interface AnyPatternTree extends PatternTree {
`@PreviewFeature` here.
src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java line 227:
> 225: * @since 21
> 226: */
> 227: ANY_PATTERN(AnyPatternTree.class),
@PreviewFeature here.
src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java line 267:
> 265: * @since 21
> 266: */
> 267: R visitAnyPattern(AnyPatternTree node, P p);
@PreviewFeature here.
src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java line 641:
> 639: */
> 640: @Override
> 641: public R visitAnyPattern(AnyPatternTree node, P p) {
`@PreviewFeature` here.
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java line 773:
> 771: */
> 772: @Override
> 773: public R visitAnyPattern(AnyPatternTree node, P p) {
`@PreviewFeature` here.
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 329:
> 327: nestedBinding = nestedDesugared.primaryPattern();
> 328: allowNull = false;
> 329: } else if (nestedPattern instanceof JCAnyPattern nestedRecordPattern) {
Nit: `nestedRecordPattern` -> `nestedAnyPattern`?
test/langtools/tools/javac/patterns/Unnamed.java line 8:
> 6: * @summary Compiler Implementation for Unnamed patterns and variables
> 7: * @enablePreview
> 8: * @compile --enable-preview -source ${jdk.version} Unnamed.java
+1 on keeping the `@compile` tag, but `--enable-preview -source ${jdk.version}` shouldn't be needed when `@enablePreview` is present.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185805923
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185807097
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185807170
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185807989
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185808102
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185819402
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185871609
From jlahoda at openjdk.org Fri May 5 09:29:40 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 09:29:40 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID: <4GXVg3R1xzO-tFQenVIh_6FGWvSeXUfs5-17WDaM6m0=.ab0ae8c0-9fd0-4f2d-aade-d841f8fbece7@github.com>
On Thu, 4 May 2023 17:56:37 GMT, Vicente Romero wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add test
>
> src/jdk.compiler/share/classes/com/sun/source/tree/VariableTree.java line 54:
>
>> 52:
>> 53: /**
>> 54: * Returns the name of the variable being declared or `_` if the variable
>
> I guess if we go full for the empty name then this will need to change too
Maybe also add a mention that unnamed is a preview feature?
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 535:
>
>> 533: if (clearedPatterns.size() > 1) {
>> 534: validCaseLabelList = clearedPatterns.stream().allMatch(cP -> cP.hasTag(Tag.PATTERNCASELABEL));
>> 535: } else validCaseLabelList = clearedPatterns.size() == 1 && clearedPatterns.head.hasTag(Tag.PATTERNCASELABEL);
>
> style: I would use `{}` for the code in the `else` branch here, same way as it has been done for the `then` branch. Also in the `else` branch isn't the `clearedPatterns.size() == 1` condition always true?
True - if I read the code correctly, the list should never be empty at this place.
> src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeCopier.java line 496:
>
>> 494: @DefinedBy(Api.COMPILER_TREE)
>> 495: public JCTree visitAnyPattern(AnyPatternTree node, P p) {
>> 496: JCBindingPattern t = (JCBindingPattern) node;
>
> not sure this is correct, are we returning a JCBindingPattern?
+1
> test/langtools/tools/javac/patterns/Unnamed.java line 4:
>
>> 2:
>> 3: /**
>> 4: * @test /nodynamiccopyright/
>
> there is no golden file for this test so full copyright will be needed
Also, it is a custom that the comment with `@test` is before any imports, AFAIK.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185807820
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185823113
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185870099
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185871058
From jlahoda at openjdk.org Fri May 5 09:29:49 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 09:29:49 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v12]
In-Reply-To: <_2IbNlxLzlbXs3UkPWmrTTuMVRsvTnHnX4JqN35kbPU=.e1053192-5d69-4b31-b1d0-8bfa12adefda@github.com>
References:
<_2IbNlxLzlbXs3UkPWmrTTuMVRsvTnHnX4JqN35kbPU=.e1053192-5d69-4b31-b1d0-8bfa12adefda@github.com>
Message-ID: <0lJobZbHgtHyGKnoyvKcj8COkObRQo448AlEJxwIzIw=.5061dc4b-0900-4e6c-a36a-93c444c3effd@github.com>
On Thu, 4 May 2023 23:19:26 GMT, Aggelos Biboudis wrote:
>>>
>>
>> For the user-facing javax.lang.model languages, I think the current convention of "empty name means unnamed" is reasonable and is consistent with how other unnamed items are handled in that API.
>>
>> I assumed for the lower-level tree API "_" would be a more appropriate choice, but I'm open to discussions alternative conventions there.
>
> Recently, I realized that `names.empty` also signifies an error in `variableDeclaratorId` in some occasion around lambdas: https://github.com/openjdk/jdk/blob/ffae4e0e97b19b1c1ad2865ed618ba380a861b7e/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3688-L3697
> I don't believe that this would be a blocker but it could pose a possible minor challenge.
FWIW, I don't have a strong opinion on whether the name in the AST should be empty or underscore. (But I agree empty name is more consistent in the Language Model.) For missing names where names are expected (which is the above case), we could revisit later, there are more cases like this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185869588
From jlahoda at openjdk.org Fri May 5 09:29:44 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 09:29:44 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v4]
In-Reply-To:
References:
Message-ID:
On Mon, 1 May 2023 22:29:21 GMT, Aggelos Biboudis wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1777:
>>
>>> 1775: log.error(guard.pos(), Errors.GuardHasConstantExpressionFalse);
>>> 1776: }
>>> 1777: } else if (guard != null) {
>>
>> I guess this is caused by something like:
>>
>> case _ when ...
>>
>> If now a guard can appear regardless of how many labels there are, should be refactor this code so that if `guard != null` it is always attributed? And then we do other stuff in case `labels.tail.isEmpty()` ? Note that the code for attributing the guard is slightly different in the two cases in this patch: the original code creates a nested scope - while the new code doesn't.
>
> Actually this is for the case where we have `case A(_), B(C _) when ... `. In that case we are sure that the only scope we can use is the switch environment (since no bindings are introduced). Hm, I don't see another way of refactoring this without depending on `labels.tail.isEmpty()`
I was looking into this again, and I am afraid this is not quite correct. One of the issues is that this attrib will place any binding variables from the guard into the current `matchBindings`, and when the guard is attributed again, the variables in the `matchBindings` will collide. For example:
String unnamedGuardAddsBindings(Object o1, Object o2) {
return switch (o1) {
case String _, Object _ when o2 instanceof String s: yield s;
case Object _: yield "any";
};
}
My current proposal would be to (try to):
- attribute the guard when handling the first pattern (so that we can detect whether or not it is constant)
- but, do not merge the bindings from the guard immediately, but only after all the patterns are handled
It could look like this:
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index e9c3ca27f1c..bade6b530eb 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -1688,7 +1688,7 @@ public class Attr extends JCTree.Visitor {
wasError = true;
}
MatchBindings currentBindings = null;
- boolean wasUnconditionalPattern = hasUnconditionalPattern;
+ MatchBindings guardBindings = null;
for (List labels = c.labels; labels.nonEmpty(); labels = labels.tail) {
JCCaseLabel label = labels.head;
if (label instanceof JCConstantCaseLabel constLabel) {
@@ -1761,7 +1761,7 @@ public class Attr extends JCTree.Visitor {
checkCastablePattern(pat.pos(), seltype, primaryType);
Type patternType = types.erasure(primaryType);
JCExpression guard = c.guard;
- if (labels.tail.isEmpty() && guard != null) {
+ if (labels == c.labels && guard != null) {
MatchBindings afterPattern = matchBindings;
Env bodyEnv = bindingEnv(switchEnv, matchBindings.bindingsWhenTrue);
try {
@@ -1769,14 +1769,13 @@ public class Attr extends JCTree.Visitor {
} finally {
bodyEnv.info.scope.leave();
}
- matchBindings = matchBindingsComputer.caseGuard(c, afterPattern, matchBindings);
+
+ guardBindings = matchBindings;
+ matchBindings = afterPattern;
if (TreeInfo.isBooleanWithValue(guard, 0)) {
log.error(guard.pos(), Errors.GuardHasConstantExpressionFalse);
}
- } else if (guard != null) {
- // if the label has multiple patterns and a guard (with binding from the switch environment)
- attribExpr(guard, switchEnv, syms.booleanType);
}
boolean unguarded = TreeInfo.unguardedCase(c) && !pat.hasTag(RECORDPATTERN);
boolean unconditional =
@@ -1799,6 +1798,10 @@ public class Attr extends JCTree.Visitor {
currentBindings = matchBindingsComputer.switchCase(label, currentBindings, matchBindings);
}
+ if (guardBindings != null) {
+ currentBindings = matchBindingsComputer.caseGuard(c, currentBindings, guardBindings);
+ }
+
Env caseEnv =
bindingEnv(switchEnv, c, currentBindings.bindingsWhenTrue);
try {
(I didn't run tests on this, though.)
>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 746:
>>
>>> 744:
>>> 745: sealed interface PatternDescription {
>>> 746: public static PatternDescription from(Types types, Type selectorType, JCPattern pattern, Symtab syms) {
>>
>> Optional comment: the fact that this factory needs so much compiler state makes me think that perhaps a better place for it would be as an instance method of Flow, rather than a static method in PatternDescription.
>
> @lahodaj WDYT? Looks like it can be easily refactored and it is used only in one place (apart from the recursive call). I can refactor it in this PR or u can do it in #13074.
I somewhat liked the "factory method" aspect to this, but I admit the parameter list is getting longer. So, up to you, I think.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185881273
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185817955
From jlahoda at openjdk.org Fri May 5 09:29:42 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 09:29:42 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <2f6yNQHJy1t65PBsSelcHM2episYeYxt7gdYtQV1Zsc=.ff0f7299-3378-496d-ad92-0ed1cbdf90e8@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
<2f6yNQHJy1t65PBsSelcHM2episYeYxt7gdYtQV1Zsc=.ff0f7299-3378-496d-ad92-0ed1cbdf90e8@github.com>
Message-ID: <8fbux7W7kkd8KYN9Z6ks6IHYdtrFIPhQPTZ6lI816tw=.156e8b6d-0b18-4690-9f5a-21bbbca30bc5@github.com>
On Thu, 4 May 2023 20:47:54 GMT, Joe Darcy wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add test
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 438:
>
>> 436: }
>> 437:
>> 438: public boolean isUnnamed() {
>
> Should this method get the '@Override @DefinedBy(Api.LANGUAGE_MODEL)' markup?
+1 (I am a bit surprised the tests don't complain, that might be something to look at as well)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185809422
From jlahoda at openjdk.org Fri May 5 09:29:47 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 09:29:47 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Fri, 5 May 2023 08:41:08 GMT, Aggelos Biboudis wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java line 88:
>>
>>> 86: * or deletion without notice.
>>> 87: */
>>> 88: @SuppressWarnings("preview")
>>
>> isn't it better to apply the annotation to the method below?
>
> Yeap, this is what I thought at first but I was getting "warnings found and -Werror specified". So compilation was failing.
IIRC the error is reported on the class level (with position on the class), so suppressing the warning on the method is not sufficient. We might want to review if the warning could have a better position, but we probably should not do it under this patch.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185855689
From abimpoudis at openjdk.org Fri May 5 10:41:24 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Fri, 5 May 2023 10:41:24 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To: <8fbux7W7kkd8KYN9Z6ks6IHYdtrFIPhQPTZ6lI816tw=.156e8b6d-0b18-4690-9f5a-21bbbca30bc5@github.com>
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
<2f6yNQHJy1t65PBsSelcHM2episYeYxt7gdYtQV1Zsc=.ff0f7299-3378-496d-ad92-0ed1cbdf90e8@github.com>
<8fbux7W7kkd8KYN9Z6ks6IHYdtrFIPhQPTZ6lI816tw=.156e8b6d-0b18-4690-9f5a-21bbbca30bc5@github.com>
Message-ID:
On Fri, 5 May 2023 08:06:19 GMT, Jan Lahoda wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 438:
>>
>>> 436: }
>>> 437:
>>> 438: public boolean isUnnamed() {
>>
>> Should this method get the '@Override @DefinedBy(Api.LANGUAGE_MODEL)' markup?
>
> +1 (I am a bit surprised the tests don't complain, that might be something to look at as well)
Note that `Element` does not declare `isUnnamed`.
`isUnnamed` overrides method in `VariableElement` (javax.lang.model.element) via subclass `VarSymbol` in `Symbol`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185944024
From jlahoda at openjdk.org Fri May 5 12:34:29 2023
From: jlahoda at openjdk.org (Jan Lahoda)
Date: Fri, 5 May 2023 12:34:29 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch
terminal to raw mode on selected platforms [v2]
In-Reply-To:
References:
Message-ID:
> To support JShell and other usecases, the JDK uses JLine, which provides line-editing functionality inside a terminal.
>
> JLine has several ways to work with the terminal, based on various additional libraries and tools. Most of them are not directly usable inside the JDK, so currently, on non-Windows platforms, the JLine inside the JDK will use external programs, like `stty`, to inspect the terminal's properties and to switch the terminal to raw mode.
>
> This is slightly problematic, as the external programs might be missing, and while this is not that big problem for JShell, it might be a problem for other potential uses of JLine, like using it inside `System.console()`.
>
> So, the proposal here is to call the corresponding native methods directly, on selected platforms for now (Linux and Mac OS/X), instead of invoking the external programs. On Windows, this has always been the case, we are using a custom implementation of the interface that maps native and Java function for JNA there, and the proposal is to do the same here. We take the appropriate mapping interface for JNA, and provide hand-written implementation for it, using JNI.
>
> The Windows implementation is mostly unchanged, the changes are mostly non-Windows only. The overview of the changes is:
> - `LastErrorException` is moved from the Windows-specific code to the platform-neutral code, as it is used by all the native implementations. This is the only change that directly affects the Windows-specific code
> - `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaNativePty.java` and `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaTerminalProvider.java` are created based on the corresponding files from JLine. In JLine, these files directly call platform-specific implementations, but in this patch, the platform specific code is commented out, and replaced with calls to `JDKNativePty`, which is a new platform-specific class, that delegates to the actual platform-specific implementations. Note the `JnaNativePty.java` and `JnaTerminalProvider.java` already exist in the Windows part, but have different pieces of code commented out, which makes them substantially different.
> - for Linux and Mac OS/X, there are platform-specific implementations based on the corresponding code from JLine, with the hand-written JNI-based implementation of the JNA-based existing interfaces. They also have an implementation of `JDKNativePty`, which just delegates to the given platform's `"NativePty"` implementation.
> - the `JdkConsoleProviderImpl.java` has been tweaked to not allow the implementation based on the external programs, and gracefully falling back to the standard implementation. JShell is kept unchanged.
>
> The reasons for this organization are: limiting duplication, mostly adhering to the JDK's platform specific build (which is different from the normal JLine's platform-neutral build) and limiting the difference between standard JLine and JLine inside JDK, to help future upgrades.
Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
Adjusting build script as suggested on the review.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13687/files
- new: https://git.openjdk.org/jdk/pull/13687/files/f14e7fb5..4cf8f67e
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13687&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13687&range=00-01
Stats: 3 lines in 1 file changed: 2 ins; 1 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/13687.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13687/head:pull/13687
PR: https://git.openjdk.org/jdk/pull/13687
From duke at openjdk.org Fri May 5 13:22:29 2023
From: duke at openjdk.org (Weibing Xiao)
Date: Fri, 5 May 2023 13:22:29 GMT
Subject: Integrated: 8305714 : Add an extra test for JDK-8292755
In-Reply-To:
References:
Message-ID:
On Fri, 28 Apr 2023 13:47:40 GMT, Weibing Xiao wrote:
> Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
>
> This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
>
> Reviewer: @coffeys @lahodaj
This pull request has now been integrated.
Changeset: 746f8d13
Author: Weibing Xiao
Committer: Sean Coffey
URL: https://git.openjdk.org/jdk/commit/746f8d133323c1caca019b507a6ccd9d5c98f2f9
Stats: 79 lines in 1 file changed: 79 ins; 0 del; 0 mod
8305714: Add an extra test for JDK-8292755
Reviewed-by: coffeys
-------------
PR: https://git.openjdk.org/jdk/pull/13719
From erikj at openjdk.org Fri May 5 13:24:17 2023
From: erikj at openjdk.org (Erik Joelsson)
Date: Fri, 5 May 2023 13:24:17 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch
terminal to raw mode on selected platforms [v2]
In-Reply-To:
References:
Message-ID:
On Fri, 5 May 2023 12:34:29 GMT, Jan Lahoda wrote:
>> To support JShell and other usecases, the JDK uses JLine, which provides line-editing functionality inside a terminal.
>>
>> JLine has several ways to work with the terminal, based on various additional libraries and tools. Most of them are not directly usable inside the JDK, so currently, on non-Windows platforms, the JLine inside the JDK will use external programs, like `stty`, to inspect the terminal's properties and to switch the terminal to raw mode.
>>
>> This is slightly problematic, as the external programs might be missing, and while this is not that big problem for JShell, it might be a problem for other potential uses of JLine, like using it inside `System.console()`.
>>
>> So, the proposal here is to call the corresponding native methods directly, on selected platforms for now (Linux and Mac OS/X), instead of invoking the external programs. On Windows, this has always been the case, we are using a custom implementation of the interface that maps native and Java function for JNA there, and the proposal is to do the same here. We take the appropriate mapping interface for JNA, and provide hand-written implementation for it, using JNI.
>>
>> The Windows implementation is mostly unchanged, the changes are mostly non-Windows only. The overview of the changes is:
>> - `LastErrorException` is moved from the Windows-specific code to the platform-neutral code, as it is used by all the native implementations. This is the only change that directly affects the Windows-specific code
>> - `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaNativePty.java` and `unix/classes/jdk/internal/org/jline/terminal/impl/jna/JnaTerminalProvider.java` are created based on the corresponding files from JLine. In JLine, these files directly call platform-specific implementations, but in this patch, the platform specific code is commented out, and replaced with calls to `JDKNativePty`, which is a new platform-specific class, that delegates to the actual platform-specific implementations. Note the `JnaNativePty.java` and `JnaTerminalProvider.java` already exist in the Windows part, but have different pieces of code commented out, which makes them substantially different.
>> - for Linux and Mac OS/X, there are platform-specific implementations based on the corresponding code from JLine, with the hand-written JNI-based implementation of the JNA-based existing interfaces. They also have an implementation of `JDKNativePty`, which just delegates to the given platform's `"NativePty"` implementation.
>> - the `JdkConsoleProviderImpl.java` has been tweaked to not allow the implementation based on the external programs, and gracefully falling back to the standard implementation. JShell is kept unchanged.
>>
>> The reasons for this organization are: limiting duplication, mostly adhering to the JDK's platform specific build (which is different from the normal JLine's platform-neutral build) and limiting the difference between standard JLine and JLine inside JDK, to help future upgrades.
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>
> Adjusting build script as suggested on the review.
Build changes look good.
-------------
Marked as reviewed by erikj (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13687#pullrequestreview-1414782534
From abimpoudis at openjdk.org Fri May 5 16:01:00 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Fri, 5 May 2023 16:01:00 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v15]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Address comments
- Annotate with Preview
- Fix isUnnamed hierarchy
- Flow names.empty for underscore in both model and API
- Adjust pretty printing and annotation pretty printing
- Fix guard bindings (great catch and thx @lahodaj!)
- Fix TreeVisitor
- Remove test with lambda which has a parse error from VarTree (names.empty is used to signal error)
- Various adjustments
Co-authored-by: Jan Lahoda
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/888297ef..5d9a1ba7
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=14
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=13-14
Stats: 348 lines in 25 files changed: 189 ins; 102 del; 57 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Fri May 5 16:07:24 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Fri, 5 May 2023 16:07:24 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v15]
In-Reply-To:
References:
Message-ID:
On Fri, 5 May 2023 16:01:00 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Address comments
>
> - Annotate with Preview
> - Fix isUnnamed hierarchy
> - Flow names.empty for underscore in both model and API
> - Adjust pretty printing and annotation pretty printing
> - Fix guard bindings (great catch and thx @lahodaj!)
> - Fix TreeVisitor
> - Remove test with lambda which has a parse error from VarTree (names.empty is used to signal error)
> - Various adjustments
>
> Co-authored-by: Jan Lahoda
Addressed all comments in https://github.com/openjdk/jdk/pull/13528/commits/5d9a1ba74aad4ee95dad6892d40e0aa68e04af18
Thx @lahodaj, @vicente-romero-oracle, @mcimadamore, @jddarcy ???
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13528#issuecomment-1536469342
From darcy at openjdk.org Fri May 5 21:25:23 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Fri, 5 May 2023 21:25:23 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v15]
In-Reply-To:
References:
Message-ID:
On Fri, 5 May 2023 16:01:00 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Address comments
>
> - Annotate with Preview
> - Fix isUnnamed hierarchy
> - Flow names.empty for underscore in both model and API
> - Adjust pretty printing and annotation pretty printing
> - Fix guard bindings (great catch and thx @lahodaj!)
> - Fix TreeVisitor
> - Remove test with lambda which has a parse error from VarTree (names.empty is used to signal error)
> - Various adjustments
>
> Co-authored-by: Jan Lahoda
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1788:
> 1786: }
> 1787:
> 1788: @Override @DefinedBy(Api.LANGUAGE_MODEL)
It's not incorrect to have this override, but I don't think it is necessary now either with the update to the default method.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1186509423
From duke at openjdk.org Sat May 6 00:40:24 2023
From: duke at openjdk.org (duke)
Date: Sat, 6 May 2023 00:40:24 GMT
Subject: Withdrawn: 8299934: LocalExecutionControl replaces default uncaught
exception handler
In-Reply-To:
References:
Message-ID:
On Fri, 10 Mar 2023 19:48:42 GMT, Jan Lahoda wrote:
> The JShell's `LocalExecutionControl` set the global default uncaught exception handler, causing problems to external code that might rely on it (even if only for logging/debugging purposes).
>
> The proposal here is to do what the bug is suggesting, and only handling the exception inside the `ThreadGroup` that JShell creates. The patch does not strive to do further changes to how the exception handling is done.
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.org/jdk/pull/12982
From darcy at openjdk.org Sat May 6 02:44:30 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Sat, 6 May 2023 02:44:30 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v65]
In-Reply-To:
References:
Message-ID:
On Thu, 27 Apr 2023 17:21:23 GMT, Jim Laskey wrote:
>> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> CSR recommendations
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 123:
> 121: @PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES)
> 122: public static final int MAX_INDY_CONCAT_ARG_SLOTS;
> 123: static { MAX_INDY_CONCAT_ARG_SLOTS = 200; }
I think this deserve a comment such as "use static initialize block to avoid MAX_INDY_CONCAT_ARG_SLOTS being treating as a constant for constant folding," assuming that is the intention here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1186599844
From darcy at openjdk.org Sat May 6 02:57:20 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Sat, 6 May 2023 02:57:20 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v65]
In-Reply-To:
References:
Message-ID: <0lyLXXpOtSz0C8DvkpexUAyj3IPrqUkP4WuLHrw_30c=.512031ec-bacb-4918-a4be-6054a684fddb@github.com>
On Thu, 27 Apr 2023 17:21:23 GMT, Jim Laskey wrote:
>> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> CSR recommendations
src/java.base/share/classes/java/lang/StringTemplate.java line 427:
> 425: * {@link StringTemplate}. To accommodate concatenation, values are converted to strings
> 426: * as if invoking {@link String#valueOf(Object)}.
> 427: * @implNote {@link StringTemplate#STR} is statically imported implicitly into every
IMO the remark regarding STR being auto-imported works better as an apiNote rather than an implNote.
Regarding interning, I think an implSpec of "may or may not be interned" provides maximum flexibility to the implementation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1186601013
From acobbs at openjdk.org Sat May 6 15:28:28 2023
From: acobbs at openjdk.org (Archie Cobbs)
Date: Sat, 6 May 2023 15:28:28 GMT
Subject: RFR: 8247403: JShell: No custom input (e.g. from GUI) possible
with JavaShellToolBuilder [v3]
In-Reply-To:
References:
Message-ID:
On Mon, 24 May 2021 08:20:44 GMT, Jan Lahoda wrote:
>> Basically, JShell's ConsoleIOContext always uses the JLine's default terminal, which uses System.in, or equivalent, for input. But, if the JShell tool has been created using JavaShellToolBuilder, a different input might have been provided. The proposed solution is to use a different JLine's terminal in this case, based on the provided input.
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>
> Adding note about the default behavior, as suggested.
src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java line 4160:
> 4158: sb.append(ch);
> 4159: }
> 4160: if (padToWidth > cols) {
Random blast-from-the-past question: would it be appropriate to submit this change back to the jline project? It doesn't appear to be in the current jline3 master.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/2509#discussion_r1186711227
From abimpoudis at openjdk.org Sat May 6 21:23:32 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Sat, 6 May 2023 21:23:32 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v16]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Remove @Override from VarSymbol.isUnnamed
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/5d9a1ba7..482dbfa2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=15
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=14-15
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Mon May 8 10:17:35 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 10:17:35 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v16]
In-Reply-To:
References:
Message-ID:
On Sat, 6 May 2023 21:23:32 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove @Override from VarSymbol.isUnnamed
BTW we can remove the `isUnnamed` from `VarSymbol` as @jddarcy pointed me out correctly.
By keeping it we avoid sprinkling 5 core places with `@SuppressWarnings("preview")`. However, I think it will be cleaner without that override, despite the annotation and I would be in favor of that. Are there any concerns? e.g.,
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
index 631b0ce61ac..dc84c89f88e 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
@@ -1784,11 +1784,6 @@ public abstract class Symbol extends AnnoConstruct implements PoolConstant, Elem
public R accept(Symbol.Visitor v, P p) {
return v.visitVarSymbol(this, p);
}
-
- @DefinedBy(Api.LANGUAGE_MODEL)
- public boolean isUnnamed() {
- return name.isEmpty();
- }
}
public static class RecordComponent extends VarSymbol implements RecordComponentElement {
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 986f2e9fe89..26ef1c41156 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -93,6 +93,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
* This code and its internal interfaces are subject to change or
* deletion without notice.
*/
+ at SuppressWarnings("preview")
public class Attr extends JCTree.Visitor {
protected static final Context.Key attrKey = new Context.Key<>();
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
index 725a8a5e37d..537635a9490 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
@@ -93,6 +93,7 @@ import javax.lang.model.util.ElementKindVisitor14;
* This code and its internal interfaces are subject to change or
* deletion without notice.
*/
+ at SuppressWarnings("preview")
public class Check {
protected static final Context.Key checkKey = new Context.Key<>();
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
index 452a823a46e..997ae7e3d81 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
@@ -203,6 +203,7 @@ import static java.util.stream.Collectors.groupingBy;
* This code and its internal interfaces are subject to change or
* deletion without notice.
*/
+ at SuppressWarnings("preview")
public class Flow {
protected static final Context.Key flowKey = new Context.Key<>();
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index 13a4dd6c2cd..220aaf220d0 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -53,6 +53,7 @@ import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
* This code and its internal interfaces are subject to change or
* deletion without notice.
*/
+ at SuppressWarnings("preview")
public class MemberEnter extends JCTree.Visitor {
protected static final Context.Key memberEnterKey = new Context.Key<>();
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
index 44ea3f904bd..cdf7d18b599 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
@@ -113,6 +113,7 @@ import com.sun.tools.javac.util.List;
/**
* This pass translates pattern-matching constructs, such as instanceof .
*/
+ at SuppressWarnings("preview")
public class TransPatterns extends TreeTranslator {
protected static final Context.Key transPatternsKey = new Context.Key<>();
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13528#issuecomment-1538121683
From abimpoudis at openjdk.org Mon May 8 12:05:53 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 12:05:53 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v17]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Remove isUnnamed from VarSymbol
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/482dbfa2..a46b674a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=16
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=15-16
Stats: 10 lines in 6 files changed: 5 ins; 5 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From mcimadamore at openjdk.org Mon May 8 12:15:36 2023
From: mcimadamore at openjdk.org (Maurizio Cimadamore)
Date: Mon, 8 May 2023 12:15:36 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v16]
In-Reply-To:
References:
Message-ID: <88NQ70nvZPnIC71TrH1ftnD68fD0df972hGWdKBqgAo=.46bee3cd-75ad-4ddb-a269-cbc0925e7843@github.com>
On Mon, 8 May 2023 10:13:24 GMT, Aggelos Biboudis wrote:
> BTW we can remove the `isUnnamed` from `VarSymbol` as @jddarcy pointed me out correctly.
>
> By keeping it we avoid sprinkling 5 core places with `@SuppressWarnings("preview")`. However, I think it will be cleaner without that override, despite the annotation and I would be in favor of that. Are there any concerns? e.g.,
>
> ```
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
> index 631b0ce61ac..dc84c89f88e 100644
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java
> @@ -1784,11 +1784,6 @@ public abstract class Symbol extends AnnoConstruct implements PoolConstant, Elem
> public R accept(Symbol.Visitor v, P p) {
> return v.visitVarSymbol(this, p);
> }
> -
> - @DefinedBy(Api.LANGUAGE_MODEL)
> - public boolean isUnnamed() {
> - return name.isEmpty();
> - }
> }
>
> public static class RecordComponent extends VarSymbol implements RecordComponentElement {
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
> index 986f2e9fe89..26ef1c41156 100644
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
> @@ -93,6 +93,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
> * This code and its internal interfaces are subject to change or
> * deletion without notice.
> */
> + at SuppressWarnings("preview")
> public class Attr extends JCTree.Visitor {
> protected static final Context.Key attrKey = new Context.Key<>();
>
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
> index 725a8a5e37d..537635a9490 100644
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
> @@ -93,6 +93,7 @@ import javax.lang.model.util.ElementKindVisitor14;
> * This code and its internal interfaces are subject to change or
> * deletion without notice.
> */
> + at SuppressWarnings("preview")
> public class Check {
> protected static final Context.Key checkKey = new Context.Key<>();
>
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
> index 452a823a46e..997ae7e3d81 100644
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
> @@ -203,6 +203,7 @@ import static java.util.stream.Collectors.groupingBy;
> * This code and its internal interfaces are subject to change or
> * deletion without notice.
> */
> + at SuppressWarnings("preview")
> public class Flow {
> protected static final Context.Key flowKey = new Context.Key<>();
>
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
> index 13a4dd6c2cd..220aaf220d0 100644
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
> @@ -53,6 +53,7 @@ import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
> * This code and its internal interfaces are subject to change or
> * deletion without notice.
> */
> + at SuppressWarnings("preview")
> public class MemberEnter extends JCTree.Visitor {
> protected static final Context.Key memberEnterKey = new Context.Key<>();
>
> diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
> index 44ea3f904bd..cdf7d18b599 100644
> --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
> +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
> @@ -113,6 +113,7 @@ import com.sun.tools.javac.util.List;
> /**
> * This pass translates pattern-matching constructs, such as instanceof .
> */
> + at SuppressWarnings("preview")
> public class TransPatterns extends TreeTranslator {
>
> protected static final Context.Key transPatternsKey = new Context.Key<>();
> ```
One thing we did in other places was to have a private equivalent of some public API method, so that we can call it internally from the compiler, w/o too much hassle (the internal version doesn't need to be marked as preview).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13528#issuecomment-1538257990
From jlaskey at openjdk.org Mon May 8 12:51:08 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Mon, 8 May 2023 12:51:08 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v65]
In-Reply-To:
References:
Message-ID:
On Sat, 6 May 2023 02:42:14 GMT, Joe Darcy wrote:
>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>>
>> CSR recommendations
>
> src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 123:
>
>> 121: @PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES)
>> 122: public static final int MAX_INDY_CONCAT_ARG_SLOTS;
>> 123: static { MAX_INDY_CONCAT_ARG_SLOTS = 200; }
>
> I think this deserve a comment such as "use static initialize block to avoid MAX_INDY_CONCAT_ARG_SLOTS being treating as a constant for constant folding," assuming that is the intention here.
Changed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1187407224
From jlaskey at openjdk.org Mon May 8 12:53:16 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Mon, 8 May 2023 12:53:16 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v65]
In-Reply-To: <0lyLXXpOtSz0C8DvkpexUAyj3IPrqUkP4WuLHrw_30c=.512031ec-bacb-4918-a4be-6054a684fddb@github.com>
References:
<0lyLXXpOtSz0C8DvkpexUAyj3IPrqUkP4WuLHrw_30c=.512031ec-bacb-4918-a4be-6054a684fddb@github.com>
Message-ID:
On Sat, 6 May 2023 02:53:49 GMT, Joe Darcy wrote:
>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>>
>> CSR recommendations
>
> src/java.base/share/classes/java/lang/StringTemplate.java line 427:
>
>> 425: * {@link StringTemplate}. To accommodate concatenation, values are converted to strings
>> 426: * as if invoking {@link String#valueOf(Object)}.
>> 427: * @implNote {@link StringTemplate#STR} is statically imported implicitly into every
>
> IMO the remark regarding STR being auto-imported works better as an apiNote rather than an implNote.
>
> Regarding interning, I think an implSpec of "may or may not be interned" provides maximum flexibility to the implementation.
Changed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1187409617
From abimpoudis at openjdk.org Mon May 8 13:27:55 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 13:27:55 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v18]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with two additional commits since the last revision:
- Reintroduce isUnnamed from VarSymbol with different name
- Revert "Remove isUnnamed from VarSymbol"
This reverts commit a46b674a5077da603c400f2005cf4a7a48d104b2.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/a46b674a..8def897a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=17
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=16-17
Stats: 15 lines in 7 files changed: 4 ins; 5 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Mon May 8 13:43:42 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 13:43:42 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v19]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 44 commits:
- Merge branch 'JDK-8300543' into unnamed
- Reintroduce isUnnamed from VarSymbol with different name
- Revert "Remove isUnnamed from VarSymbol"
This reverts commit a46b674a5077da603c400f2005cf4a7a48d104b2.
- Remove isUnnamed from VarSymbol
- Remove @Override from VarSymbol.isUnnamed
- Address comments
- Annotate with Preview
- Fix isUnnamed hierarchy
- Flow names.empty for underscore in both model and API
- Adjust pretty printing and annotation pretty printing
- Fix guard bindings (great catch and thx @lahodaj!)
- Fix TreeVisitor
- Remove test with lambda which has a parse error from VarTree (names.empty is used to signal error)
- Various adjustments
Co-authored-by: Jan Lahoda
- 8307482: Compiler should accept var _ in nested patterns in switch case
- Add test
- 8307444: java.lang.AssertionError when using unnamed patterns
- Add guard test
- ... and 34 more: https://git.openjdk.org/jdk/compare/79bbd717...c9387a26
-------------
Changes: https://git.openjdk.org/jdk/pull/13528/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=18
Stats: 1536 lines in 49 files changed: 1217 ins; 144 del; 175 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Mon May 8 14:07:16 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 14:07:16 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v20]
In-Reply-To:
References:
Message-ID: <7W_6EL5-SFADT46s6FLPgRJejqu5VUcdNbzAX5z9Gss=.99e557be-83c8-4581-b389-f7f208c05434@github.com>
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Doc adjustments
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/c9387a26..2580f603
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=19
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=18-19
Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From vromero at openjdk.org Mon May 8 17:35:36 2023
From: vromero at openjdk.org (Vicente Romero)
Date: Mon, 8 May 2023 17:35:36 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v20]
In-Reply-To: <7W_6EL5-SFADT46s6FLPgRJejqu5VUcdNbzAX5z9Gss=.99e557be-83c8-4581-b389-f7f208c05434@github.com>
References:
<7W_6EL5-SFADT46s6FLPgRJejqu5VUcdNbzAX5z9Gss=.99e557be-83c8-4581-b389-f7f208c05434@github.com>
Message-ID: <-W_OQ97X7IF57Q5y8_-X3lyEWq8dGhtxglrDYG5dP30=.23bcb69d-b2c4-4188-a8d6-4889032b2f52@github.com>
On Mon, 8 May 2023 14:07:16 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Doc adjustments
looks good
-------------
Marked as reviewed by vromero (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13528#pullrequestreview-1417214589
From jlaskey at openjdk.org Mon May 8 19:13:47 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Mon, 8 May 2023 19:13:47 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v66]
In-Reply-To:
References:
Message-ID:
> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
Requested changes
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10889/files
- new: https://git.openjdk.org/jdk/pull/10889/files/fb406d23..53f6280d
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=65
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=64-65
Stats: 16 lines in 3 files changed: 13 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/10889.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/10889/head:pull/10889
PR: https://git.openjdk.org/jdk/pull/10889
From abimpoudis at openjdk.org Mon May 8 20:15:46 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 20:15:46 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v21]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Remove Elements.isUnamed(VariableElement) given the presence of VariableElement.isUnamed
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/2580f603..19870563
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=20
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=19-20
Stats: 52 lines in 4 files changed: 1 ins; 49 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From abimpoudis at openjdk.org Mon May 8 20:36:02 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Mon, 8 May 2023 20:36:02 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v22]
In-Reply-To:
References:
Message-ID:
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Add at since tag
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/19870563..0437b20f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=21
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=20-21
Stats: 2 lines in 1 file changed: 2 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From darcy at openjdk.org Tue May 9 02:12:32 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Tue, 9 May 2023 02:12:32 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v22]
In-Reply-To:
References:
Message-ID:
On Mon, 8 May 2023 20:36:02 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add at since tag
src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 28:
> 26: package javax.lang.model.util;
> 27:
> 28: import jdk.internal.javac.PreviewFeature;
I believe this import can now be removed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1188046153
From darcy at openjdk.org Tue May 9 02:35:31 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Tue, 9 May 2023 02:35:31 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
<2f6yNQHJy1t65PBsSelcHM2episYeYxt7gdYtQV1Zsc=.ff0f7299-3378-496d-ad92-0ed1cbdf90e8@github.com>
<8fbux7W7kkd8KYN9Z6ks6IHYdtrFIPhQPTZ6lI816tw=.156e8b6d-0b18-4690-9f5a-21bbbca30bc5@github.com>
Message-ID:
On Tue, 9 May 2023 02:29:07 GMT, Joe Darcy wrote:
>> Note that `Element` does not declare `isUnnamed`.
>>
>> `isUnnamed` overrides method in `VariableElement` (javax.lang.model.element) via subclass `VarSymbol` in `Symbol`.
>
>> Note that `Element` does not declare `isUnnamed`.
>>
>> `isUnnamed` overrides method in `VariableElement` (javax.lang.model.element) via subclass `VarSymbol` in `Symbol`.
>
> I think it is preferable for VarSymbol.isUnnamed to be deleted; it is functionally the same as the default method defined on VariableElement.
>
PS Just saw the additional discussion on this point below.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1188055782
From darcy at openjdk.org Tue May 9 02:35:30 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Tue, 9 May 2023 02:35:30 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
<2f6yNQHJy1t65PBsSelcHM2episYeYxt7gdYtQV1Zsc=.ff0f7299-3378-496d-ad92-0ed1cbdf90e8@github.com>
<8fbux7W7kkd8KYN9Z6ks6IHYdtrFIPhQPTZ6lI816tw=.156e8b6d-0b18-4690-9f5a-21bbbca30bc5@github.com>
Message-ID:
On Fri, 5 May 2023 10:38:21 GMT, Aggelos Biboudis wrote:
> Note that `Element` does not declare `isUnnamed`.
>
> `isUnnamed` overrides method in `VariableElement` (javax.lang.model.element) via subclass `VarSymbol` in `Symbol`.
I think it is preferable for VarSymbol.isUnnamed to be deleted; it is functionally the same as the default method defined on VariableElement.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1188054212
From darcy at openjdk.org Tue May 9 02:35:32 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Tue, 9 May 2023 02:35:32 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v13]
In-Reply-To:
References:
<7x1mAOBwhQdGgCaHjiOQ1O9BCmgJFKASy7yFJHsGVbI=.842ee2fe-8819-4e43-935a-120303815fd5@github.com>
Message-ID:
On Fri, 5 May 2023 08:57:43 GMT, Jan Lahoda wrote:
>> Yeap, this is what I thought at first but I was getting "warnings found and -Werror specified". So compilation was failing.
>
> IIRC the error is reported on the class level (with position on the class), so suppressing the warning on the method is not sufficient. We might want to review if the warning could have a better position, but we probably should not do it under this patch.
I think the suppress warnings annotation can be deleted now that the isUnnamed method has been removed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1188055506
From darcy at openjdk.org Tue May 9 02:40:25 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Tue, 9 May 2023 02:40:25 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v22]
In-Reply-To:
References:
Message-ID: <-4RKGiOsEIAs4izpQO8bpM90d2N-0sWIilYEtMxlh3s=.ed7e1e05-f29a-4f41-9776-229d3ac32436@github.com>
On Mon, 8 May 2023 20:36:02 GMT, Aggelos Biboudis wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Add at since tag
Modulo the few nits noted, the javax.lang.model changes look fine.
-------------
Marked as reviewed by darcy (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13528#pullrequestreview-1417754881
From abimpoudis at openjdk.org Tue May 9 09:15:44 2023
From: abimpoudis at openjdk.org (Aggelos Biboudis)
Date: Tue, 9 May 2023 09:15:44 GMT
Subject: RFR: 8302344: Compiler Implementation for Unnamed patterns and
variables (Preview) [v23]
In-Reply-To:
References:
Message-ID: <6s6Gpc-w89RTMO6yAQqb3PKmaelt59nvpOoZK0ZSfCM=.a1e933d4-e3e5-496d-b8f6-dbae2f8048a0@github.com>
> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>
> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
Cleanup
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13528/files
- new: https://git.openjdk.org/jdk/pull/13528/files/0437b20f..a0e04e93
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=22
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13528&range=21-22
Stats: 3 lines in 2 files changed: 0 ins; 3 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/13528.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13528/head:pull/13528
PR: https://git.openjdk.org/jdk/pull/13528
From jlaskey at openjdk.org Tue May 9 12:54:50 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Tue, 9 May 2023 12:54:50 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v67]
In-Reply-To:
References:
Message-ID:
> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
Recommended changes
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10889/files
- new: https://git.openjdk.org/jdk/pull/10889/files/53f6280d..8e83e10d
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=66
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=65-66
Stats: 4 lines in 1 file changed: 0 ins; 1 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/10889.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/10889/head:pull/10889
PR: https://git.openjdk.org/jdk/pull/10889
From jlaskey at openjdk.org Tue May 9 12:58:27 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Tue, 9 May 2023 12:58:27 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v68]
In-Reply-To:
References:
Message-ID: <-604u-rNn9gRrC9Q6UVQOjKKmfhlKoNzyTZnhrnv2lw=.448fc7f3-6aea-4352-abc7-2a4a252565da@github.com>
> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
Dangling
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10889/files
- new: https://git.openjdk.org/jdk/pull/10889/files/8e83e10d..2ac6252b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=67
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=66-67
Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/10889.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/10889/head:pull/10889
PR: https://git.openjdk.org/jdk/pull/10889
From darcy at openjdk.org Tue May 9 16:04:48 2023
From: darcy at openjdk.org (Joe Darcy)
Date: Tue, 9 May 2023 16:04:48 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v68]
In-Reply-To: <-604u-rNn9gRrC9Q6UVQOjKKmfhlKoNzyTZnhrnv2lw=.448fc7f3-6aea-4352-abc7-2a4a252565da@github.com>
References:
<-604u-rNn9gRrC9Q6UVQOjKKmfhlKoNzyTZnhrnv2lw=.448fc7f3-6aea-4352-abc7-2a4a252565da@github.com>
Message-ID:
On Tue, 9 May 2023 12:58:27 GMT, Jim Laskey wrote:
>> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> Dangling
Marked as reviewed by darcy (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/10889#pullrequestreview-1418983197
From jlaskey at openjdk.org Tue May 9 16:24:24 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Tue, 9 May 2023 16:24:24 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v69]
In-Reply-To:
References:
Message-ID:
> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 88 commits:
- Merge branch 'master' into 8285932
- Dangling
- Recommended changes
- Requested changes
- CSR recommendations
- Merge branch 'master' into 8285932
- Spacing
- Tidy up
- Remove @PeviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES) from non-public classes
- Typo
- ... and 78 more: https://git.openjdk.org/jdk/compare/44fa12e7...f4f26611
-------------
Changes: https://git.openjdk.org/jdk/pull/10889/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=68
Stats: 9330 lines in 73 files changed: 9233 ins; 23 del; 74 mod
Patch: https://git.openjdk.org/jdk/pull/10889.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/10889/head:pull/10889
PR: https://git.openjdk.org/jdk/pull/10889
From liach at openjdk.org Tue May 9 16:26:08 2023
From: liach at openjdk.org (Chen Liang)
Date: Tue, 9 May 2023 16:26:08 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v68]
In-Reply-To: <-604u-rNn9gRrC9Q6UVQOjKKmfhlKoNzyTZnhrnv2lw=.448fc7f3-6aea-4352-abc7-2a4a252565da@github.com>
References:
<-604u-rNn9gRrC9Q6UVQOjKKmfhlKoNzyTZnhrnv2lw=.448fc7f3-6aea-4352-abc7-2a4a252565da@github.com>
Message-ID:
On Tue, 9 May 2023 12:58:27 GMT, Jim Laskey wrote:
>> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>
> Dangling
TestJavacTaskScanner is failing because of the new `setPrevToken` added that changes the total element count. Just need to update the count to take the changes to `Scanner` into account.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/10889#issuecomment-1540490098
From jlaskey at openjdk.org Tue May 9 16:37:07 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Tue, 9 May 2023 16:37:07 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v69]
In-Reply-To:
References:
Message-ID:
On Tue, 9 May 2023 16:24:24 GMT, Jim Laskey wrote:
>> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
>
> Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 88 commits:
>
> - Merge branch 'master' into 8285932
> - Dangling
> - Recommended changes
> - Requested changes
> - CSR recommendations
> - Merge branch 'master' into 8285932
> - Spacing
> - Tidy up
> - Remove @PeviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES) from non-public classes
> - Typo
> - ... and 78 more: https://git.openjdk.org/jdk/compare/44fa12e7...f4f26611
Thanks for the heads up.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/10889#issuecomment-1540506421
From jlaskey at openjdk.org Tue May 9 16:43:15 2023
From: jlaskey at openjdk.org (Jim Laskey)
Date: Tue, 9 May 2023 16:43:15 GMT
Subject: RFR: JDK-8285932 Implementation of JEP 430 String Templates
(Preview) [v70]
In-Reply-To:
References:
Message-ID: <9L5IuWB-IyF4NqldYaPlYKVt-29_ykeIwOu8z-x9jbk=.bb0ecc60-87aa-4a92-a6a0-d67cdf61050c@github.com>
> Enhance the Java programming language with string templates, which are similar to string literals but contain embedded expressions. A string template is interpreted at run time by replacing each expression with the result of evaluating that expression, possibly after further validation and transformation. This is a [preview language feature and API](http://openjdk.java.net/jeps/12).
Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
Update TestJavacTaskScanner.java
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10889/files
- new: https://git.openjdk.org/jdk/pull/10889/files/f4f26611..6b09d2e4
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=69
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10889&range=68-69
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/10889.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/10889/head:pull/10889
PR: https://git.openjdk.org/jdk/pull/10889
From bpb at openjdk.org Tue May 9 20:59:35 2023
From: bpb at openjdk.org (Brian Burkhalter)
Date: Tue, 9 May 2023 20:59:35 GMT
Subject: RFR: JDK-8306983: Do not invoke external programs when switch
terminal to raw mode on selected platforms [v2]
In-Reply-To:
References:
Message-ID:
On Fri, 5 May 2023 12:34:29 GMT, Jan Lahoda