Sounds reasonable, removes the need to create a temporary list and a double pass to safely delete.
Lastly, after making the attached changes, I now fail to see what the need for the classFiles list is. I added some logging in and the only methods which use the classFiles list are:
getOutputFile() and
setBytecode()
Even though this array are referenced in saveClassFile() the method doesnt appear to get called by the web container. (see note below about my choice of java container, this may not hold true in all cases)
The problem is that the classFiles list continues to grow and in my case, there are many instances of the Jsr199JavaCompiler class created, all of which grow its own list.
Would there be any reason that we couldnt clear() or null the classFiles list once the Bytecode has been stored in the overall runtime context?
Confession I have to make is that Im running this within Sun Web Server 7.0 ... so the above conditions may not hold 100% true for Glassfish implementation.
Wish my organisation was brave enough to make the switch :)
[Message sent by forum member 'finbarro' (finbarro)]
http://forums.java.net/jive/thread.jspa?messageID=326357