RFR: 8284220: TypeMirror#toString omits enclosing class names after JDK-8281238 [v4]

Joe Darcy darcy at openjdk.java.net
Tue Apr 26 04:41:00 UTC 2022


On Mon, 18 Apr 2022 18:18:30 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> Please consider this fix for https://bugs.openjdk.java.net/browse/JDK-8284220, which updates `ClassType#toString` to include enclosing class names when type annotations are present.
>> 
>> For example, `java.util. at A Map.Entry<?,?>` is now printed as `java.util. at A Map.Entry<?,?>`, instead of `java.util. at A Entry<?,?>` (note the missing `Map`).
>
> Liam Miller-Cushon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into JDK-8284220
>  - Refactor test based on review feedback
>  - 8284220: TypeMirror#toString omits enclosing class names after JDK-8281238

Marked as reviewed by darcy (Reviewer).

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java line 1046:

> 1044:                         buf.append(".");
> 1045:                     }
> 1046:                     ListBuffer<Name> names = new ListBuffer<>();

There may be a more idiomataic way to javac to construct this string, but offhand I don't know what it is.

test/langtools/tools/javac/processing/model/type/AnnotatedTypeToString/AnnotatedTypeToString.java line 1:

> 1: /*

>From personal experience with similar tests, they can look obscure when revisting them months in the future. I suggest putting a sentence or two description of what the test is trying to do. Also, if all the types can fit in one file, that can be easier to understand.

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

PR: https://git.openjdk.java.net/jdk/pull/8084


More information about the compiler-dev mailing list