3 ms·
Kind of, but not quite. There is also: - compiling to a single binary (I guess jpackage fixes this) - saner / less elaborate / more ergonomic interfaces to im
by spion 4y ago
Kind of, but not quite. There is also:
- compiling to a single binary (I guess jpackage fixes this)
- saner / less elaborate / more ergonomic interfaces to implement and use e.g. compare `io.Reader` (https://go.dev/tour/methods/21 https://go.dev/tour/methods/21) to the Java equivalent
- pjmlp 4y agoSeveral commercial JDK options have offered compiling to single binary for 20 years, even if out of reach for common folks. GraalVM and OpenJ9 now make it available as free beer as well. https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/io/Reader.html https://docs.oracle.com/en/java/javase/20/docs/api/java.base...
- jsiepkes 4y agoWe used ExcelsiorJET to create (pre-compiled) executables for Java (Swing) applications back in 2009 if memory serves me right.
- pjmlp 4y agoYes, unfortunely they went out of business, leaving PTC and Aicas as survivors from those days.
- spion 4y agoIs that the modern Java equivalent of the single-method interface in Go? I can see its an abstract class - what do you do if you want to implement both Reader and Writer?
- pjmlp 4y agoYou implement both, duh. Single method interfaces are what lambdas are for.
- spion 4y agoIts not an interface though: public abstract class Reader Did Java add multiple inheritance or am I missing something?
- Quekid5 4y agoThe interface you'd want to implement is probably https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/Readable.html https://docs.oracle.com/en/java/javase/20/docs/api/java.base... (and Appendable for the equivalent to Writer, probably AutoCloseable and Flushable as well.) However, there's lots of code which just takes a Reader/Writer and then you're SOL. (In general, the I/O interface/class hierarchy in Java is a bit of a mess because a lot of it was retrofitted to maintain binary compatibility. The equivalent stuff in Guava seems a bit saner, but of course not directly usable with all the 3rd party libraries you might want -- it has shims for the most part, though.)