johncarl81 / transfuse

:syringe: Transfuse - A Dependency Injection and Integration framework for Google Android
http://androidtransfuse.org/
Apache License 2.0
220 stars 28 forks source link

Using JavaFileObject.openOutputStream is very slow #233

Open oehme opened 3 years ago

oehme commented 3 years ago

https://github.com/johncarl81/transfuse/blob/a8ee2e9b7263f4c88d93f0f85113a5e99b2a9011/transfuse-core/src/main/java/org/androidtransfuse/gen/FilerSourceCodeWriter.java#L53

This method returns an output stream that writes each byte individually, which makes builds very slow. This Javac bug exists all the way up to JDK 15. The FilerOutputStream extends FilterOutputStream without overriding the write(byte[], offset, length) method. I've opened a JDK bug.

In the meantime you can use JavaFileObject.openWriter instead, which does not have this performance problem. You can adapt it back to OutputStream using org.apache.commons.io.output.WriterOutputStream