RFR: 8340721: Clarify special case handling of unboxedType and getWildcardType [v2]

Pavel Rappo prappo at openjdk.org
Fri Sep 27 09:01:44 UTC 2024


On Thu, 26 Sep 2024 16:48:17 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> First piece of a larger set of updates that may be made for JDK-8055219 to clarify the exceptional behavior of `javax.lang.model.util.Types`.
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Respond to review feedback.

test/langtools/tools/javac/processing/model/util/types/TestInvalidInputs.java line 147:

> 145:             try {
> 146:                 PrimitiveType pt = types.unboxedType(tm);
> 147:                 throw new RuntimeException("Should not reach" + tm);

Suggestion:

                throw new RuntimeException("Should not reach " + tm);

test/langtools/tools/javac/processing/model/util/types/TestInvalidInputs.java line 164:

> 162:         // Reference types are ArrayType, DeclaredType, ErrorType, NullType, TypeVariable
> 163:         // non-reference: ExecutableType, IntersectionType, NoType, PrimitiveType, UnionType, WildcardType
> 164:         var invalidInputs = List.of( arrayType,

Do we need to change `getWildcardType`'s behaviour for `ArrayType` or specification? `ArrayType` is a reference type, and `getWildcardType` is now specified to throw IAE for all reference types.

test/langtools/tools/javac/processing/model/util/types/TestInvalidInputs.java line 177:

> 175:             try {
> 176:                 WildcardType wc2 = types.getWildcardType(null, tm);
> 177:                 throw new RuntimeException("Should not reach" + tm);

Suggestion:

                throw new RuntimeException("Should not reach " + tm);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21193#discussion_r1778262300
PR Review Comment: https://git.openjdk.org/jdk/pull/21193#discussion_r1778281333
PR Review Comment: https://git.openjdk.org/jdk/pull/21193#discussion_r1778262044


More information about the compiler-dev mailing list