This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In my <mof> Ant task, when asked to generate JMI interface files, I always re-regenerate every single JMI source file, regardless of whether it is really required or not. As a result, if the user is using the <mof> task to generate JMI interfaces at a very early stage of the build script (as I know am when I bootstrap my modules), the mindless re-generation causes pretty much everything to be rebuilt. In the process of rectifying this, I found that the JMIMapper API is not well suited to any solution. For example, if I need to re-generate just the package proxy interface for a top-level package, then the mapper will generate all classes and interfaces in the model. Furthermore, even if there was a generate(JMIStreamFactory, Collection objects) method that accepted a complete list of elements that should be generated, it still wouldn't be fine-grained enough because I wouldn't be to generate a class proxy interface file without generating the class instance interface file along with it (and similarly for enumerations). My proposed change to the JMI mapping API is to allow the JMIStreamFactory to return null to indicate that nothing needs to be done. If the stream factory returns null from a particular invocation of createStream(), then the JMI mapper will just assume that the interface/class was already written by a previous invocation and skip it. Currently, if the JMIStreamFactory returns null then the JavaMapper will fail with a NullPointerException. I have started to implement this by changing JavaMapper to deal with the null pointer being returned. I reorganized the code as necessary so that JavaMapper doesn't do any work unless the stream was created. In the process I also changed JavaMapper's implementation so that it is more vigilent about closing the stream in the case some exception was thrown (by adding try...catch blocks). I could also do the same thing for ClassFileMapper, although currently I don't use ClassFileMapper for anything. As a result of this change my Ant task is now generating files in the way I explained above: If the source files (XMI or SMN) change, everything is still rebuilt since I don't have any model-diffing facility yet, but if the source files haven't changed then only the minimal number of JMI source files are generated (i.e. only the ones that have been deleted). Also, I can contribute changes to FSSFImpl and/or FileStreamFactory that allow them to accept a "lastModified" parameter that they check against the timestamp of the files they generate, and only return a stream when the file (seems) to need regenerated. Currently, I am using a wrapper around FileStreamFactory to do this, but it would be more efficient to merge the timestamp checking directly into FileStreamFactory and FSSFImpl. I can do this just by changing the implementations and adding an extra constructor to each. If this change or a similar change is okay, please let me know and I will supply the patches.
All the changes that you have described seem great to me. Feel free to integrate all of the described changes directly to the CVS. I will let you know if I find anything that I am not sure about in the CVS commit log.
All of these changes are integrated.