REPL code review -- TypePrinter
Robert Field
robert.field at oracle.com
Sat Sep 19 19:29:59 UTC 2015
On 09/11/15 08:25, Maurizio Cimadamore wrote:
> * TypePrinter - so, this is needed when you need to print the type of
> some expression; it seems the exact copy of the printer used by the
> RichDiagnosticFormatter, except for the fact that you want to omit the
> captured type-variable details. So, maybe you could split this process
> in two: first you map the original type onto a type where all captured
> variables have been replaced by their bounds (i.e from List<#CAP1> to
> List<Object>) - then you call the RichDiagnosticFormatter printer onto
> it (the best way to do that would probably be to create a fake
> diagnostic with a type as its argument, and then feed that to the
> diagnostic formatter - that should give you back a string). The
> RichDiagnosticFormatter, by default will also generate stuff that you
> probably don't want, such as 'where' clauses to disambiguate
> type-variable names with the same names but different owners - but
> such features can be selectively disabled (via javac command line
> options).
By "the printer used by the RichDiagnosticFormatter" do you mean
RichDiagnosticFormatter.RichPrinter? They are both subclasses of
Printer and share similar structures.
That approach seems convoluted and fragile. Am I missing something?
-Robert
More information about the kulla-dev
mailing list