Community
Participate
Working Groups
When I added support for -outjar in the test harness, I was surprised to find duplicate entry exceptions coming from the output file writing to the outjar. I traced it through, and found that every source file passed to an incremental compile is in fact compiled twice! The first time round we note the references, and of course each file has a reference to itself. Then we call "AjState.getFilesToCompile" looking to see if there are any further files to compile in another iteration. This method does not remember the set of files it just compiled, so since we have referenced each type we just compiled, and we have no reord of that fact, we compile them again. Second time around, the bytecodes are identical to the previous go, so recordClassFile doesn't note their dependents - and thus this time we terminate.
Fixed by remembering list of files we compiled on the last iteration in AjState.