RFR: 8338910: [lw5] enhance the Signature attribute to represent nullability [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Aug 29 22:45:07 UTC 2024
On Sun, 25 Aug 2024 19:54:44 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Enhance the Signature attribute so that we can represent nullability and null restrictions
>
> Vicente Romero has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>
> - merge with lw5
> - 8338910: [lw5] enhance the Signature attribute to represent nullability
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 5314:
> 5312: append('T');
> 5313: append(type.tsym.name);
> 5314: NullMarker nullMarker = type.getNullMarker();
Better to use the predicates in `Types` which take into account the command line options (e.g. whether to treat type-variables as `*` or not) ?
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java line 599:
> 597: ClassType res = new ClassType(et.getEnclosingType(), List.nil(), et.tsym, et.getMetadata());
> 598: if (nm != NullMarker.UNSPECIFIED) {
> 599: res = (ClassType) res.addMetadata(new TypeMetadata.NullMarker(nm));
We have an `asNullMarked` to create nullness-marked types
test/langtools/tools/javac/nullability/NullabilitySignatureAttrTests.java line 91:
> 89: }
> 90: """,
> 91: "LTest!;"
My feeling is that the `!`/`?` should go _before_ the type in the sig attribute, similar to what we do for arrays and wildcards. Otherwise parsing becomes more complex.
test/langtools/tools/javac/nullability/NullabilitySignatureAttrTests.java line 156:
> 154:
> 155: /*@Test
> 156: void testCheckFieldSignature() throws Exception {
This should be uncommented?
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1223#discussion_r1731050961
PR Review Comment: https://git.openjdk.org/valhalla/pull/1223#discussion_r1731053700
PR Review Comment: https://git.openjdk.org/valhalla/pull/1223#discussion_r1731057487
PR Review Comment: https://git.openjdk.org/valhalla/pull/1223#discussion_r1731056375
More information about the valhalla-dev
mailing list