Notification upon completion of compilation

Jonathan Gibbons jonathan.gibbons at
Sun Jan 6 16:34:24 UTC 2019

FWIW, the com.sun.source.* API is a supported API, albeit a JDK API and 
not a Java SE API.

Tracking started/ended events seems like a reasonable way to infer when 
compilation is complete, but note that after parsing all the files on 
the command line at the beginning of the compilation, javac may read 
additional files later on, while analyzing files that have been read. 
These additional files are those that javac needs to implicitly compile 
in order to complete the compilation of the files given on the command line.

-- Jon

On 1/6/19 12:51 AM, Gunnar Morling wrote:
> So I've found one solution that seems good enough for my purposes: I'm
> counting the PARSE finished events. That way I know when I've received
> the last ANALYZE finished event, at which point I can take my required
> action (generating a resource file in this case).
> Thanks again,
> --Gunnar
> Am Sa., 5. Jan. 2019 um 23:04 Uhr schrieb Gunnar Morling <gunnar at>:
>> Hi,
>> I'm exploring the (unsupported) plug-in API of javac. Java 9 added a
>> task event kind TaskEvent.Kind.COMPILATION which allows a listener to
>> react to the completion of the compilation.
>> Is there a way to achieve the same under Java 8? JDK-8033414 [1],
>> which introduced the new event kind states "there is no easy way to be
>> notified when the compilation is complete". What way would that be,
>> from looking into the code I couldn't see any approach, be it easy or
>> more complex.
>> Thanks,
>> --Gunnar
>> [1]

More information about the compiler-dev mailing list