javac: ending positions generation and DiagnosticListener

Per Bothner per.bothner at
Fri Dec 6 13:41:19 PST 2013

It is of course possible to implement the 'end-pos-table' much
more compactly.  Currently, it uses a Map<JCTree, Integer> (see
class SimpleEndPosTable in  This is of course
very space-inefficient, as it requires an Integer object and
a Map.Entry object for each entry.

Kawa has a class IntHashTable which maps Object to int in an
optimized fashion, with no per-entry allocation:

This code was written by Charles Turner (as a Google Summer of Code 
based on my design/suggestions.  The Kawa project (led by me) would be happy
to donate this class as a much-more efficient re-implementation of
SimpleEndPosTable.  (If there is interest, as a courtesy I'll check with 

The code could probably be simplified a bit, as long as we don't
care about general deletions, though replaceTree needs special handling.
	--Per Bothner
per.bothner at   per at

More information about the compiler-dev mailing list