Community
Participate
Working Groups
Compiling hundrets of resources in memory is fast. Writing them first to a filesystem is slow. Unfortuneately to use the compiler for in-memory compiling requires the use of internal packages.
Compiling in-memory is using lots of memory... and not fairly robust. Though we could offer to provide support to compile using working copies... would this do the trick for you ? Or what exactly would you need to do this ? The compiler internals are not public yet, and we will likely wait until JSR- 199 is resolved to provide some official compiler APIs, which hopefully should offer what you are looking for.
We have to compile hundrets, sometimes about 1000 classes. We generate source code in memory. To be fast, we like to compile in memory and write only one jar to the file system, containing everything. We implement org.eclipse.jdt.internal.compiler.env.ICompilationUnit in the generated files. Then we call compiler.compile(ICompilationUnit[]) like in the batch compiler Main class. We checked IWorkingCopy, but could not get the link to the compiler. Maybe we missed something. So, if there is another way to compile in memory, please point us to it.
There is nothing available at the moment, but the closest notion of in-memory compilation unit is a working copy. Though as you noticed, these cannot be fed to the compiler directly. Looks like you are requesting a compiler only story, nothing to do with the Java builder.
Will wait until JSR-199 is resolved. For now the internal story is your best take.
Reopening to mark as dup of bug 81471
*** This bug has been marked as a duplicate of 81471 ***