4 ms·
I thought I knew all about Java, but this thing makes me feel like I haven't got a clue! How can it achieve this stuff by just being in the classpath?? No Java
by brabel 8y ago
I thought I knew all about Java, but this thing makes me feel like I haven't got a clue! How can it achieve this stuff by just being in the classpath?? No Java agent can be involved, no codegen during the build?! This shouldn't be possible, or??
- brabel 8y agoOk just checked this deeper. The [docs](http://manifold.systems/docs.html http://manifold.systems/docs.html) actually show this is a javac plugin (I didn't know about the `-Xplugin` flag, but you ALSO need to pass that to javac for Manifold to work)... you also need the `tools.jar` file (which includes the JavaCompiler) on the runtime classpath... so suddenly, there's no magic... it's a bit misleading to say this does not require a build step, it clearly does, but as it integrates with javac itself, it "feels" seamless...
- mckinney 8y agoThere's a significant difference between a code gen build step and what Manifold is doing with javac. Resource files are virtual source files, this represents a leap in terms of dev productivity.
- brabel 8y agoYes, I agree... just wished they made it clearer how they achieve that!
- jillesvangurp 8y agoThe documentation is a bit handwavy on how it works indeed. Just drop a jar file in the code doesn't quite tell the whole story. However, I'm impressed with how amazingly awesome this stuff is. A lot of the stuff it does is already in Kotlin but being able to use json and property files without boiler plate code is nice. I'd like to be able to do that in Kotlin as well.
- mckinney 8y agoNote tools.jar is needed only for Java 8, and only for compile-time, unless you use Manifold's dynamic loading feature. The JREs for Java 9+ bundle what used to be called tools.jar.
- the8472 8y agoHow much of an update hazard is this? Does it break with every major java upgrade?
- mckinney 8y agoSee my earlier comment re javac plugin API, Manifold uses that as a means to hook into the compiler. Probably the most interesting aspect of Manifold is its role as a type name resolver for the compiler. Manifold provides an API to dynamically resolve types corresponding with, well anything, but mostly with resources like JSON files, GraphQL schemas, SQL, DDL, CSV, scripting languages, you name it. So from the compiler's perspective it has no idea what is going on beyond normal type name resolution, but the source files it's loading up are coming from deep, dark places ;) But yeah, no code generation step in your build, no agents, no custom class loaders, etc.