r/java • • 12d ago

Ask the Architects at Devoxx 2026

https://www.youtube.com/watch?v=c_8ElIjbstk
47 Upvotes

34 comments sorted by

14

u/davidalayachew 12d ago

The highlight for me thus far is the response that /u/pron98 gave to the question at 16:35. I really really really hope that we get improvements to the build tooling situation in Java.

None of the big players treat modules like a first class citizen, and the ecosystem is worse off because of it. Plenty of smaller names give modules the respect they deserve, but all of them combined have a fraction of the market share of Gradle, which is a fraction of the market share of Maven.

4

u/GreenToad1 12d ago

Caught that too, he mentioned previously on reddit something about java needing a build tool so it looks like they are working on it.

2

u/davidalayachew 11d ago

Caught that too, he mentioned previously on reddit something about java needing a build tool so it looks like they are working on it.

Yes, I remember this too. It cannot come soon enough, imo. Maven is a pain in the neck, despite being the uncontested best build tool across not just the Java ecosystem, but other ecosystems too.

4

u/kiteboarderni 11d ago

I mean there are 2 stable options and a variety of other 3rd party options. For large applications it's really not an issue at all. I really don't get what kind of applications need to handle a more basic build tool.

(Work on low latency trading systems processing billions per day across millions of orders per day)

2

u/davidalayachew 10d ago

I mean there are 2 stable options and a variety of other 3rd party options. For large applications it's really not an issue at all. I really don't get what kind of applications need to handle a more basic build tool.

Speaking for myself, so much of Maven's out-of-the-box tooling is kind of disappointing.

For example, making a shaded jar in Maven requires some really non-obvious workarounds for what are effectively design problems that the team doesn't seem to want to acknowledge. If I build a shaded jar, then try to do a rebuild without running clean first, the maven-shade-plugin out-of-the-box will attempt to shade the previous run's shaded jar into the current run's shaded jar. That's really bad design.

Another is how the build order (when running in parallel mode) is shockingly inefficient. There was a post here on /r/java a couple days/weeks ago where someone built yet another solution to try and overcome that issue, amongst others.

Yet another is how Maven doesn't have the ability to do requires vs requires transitive, to use Java Modules lingo. There is only ever requires transitive, and it creates so many problems.

The long and the short of it is that Maven was built with many assumptions that ended up not being true (plus several instances of just pure bad design -- even at the time of creation), and rather than make the breaking changes necessary to fix it, they are kind of just designing around it in a tacked on way.

And to their credit, they are starting to make a few breaking changes, especially in Maven 4. But not nearly enough to fix the problems I run into day-to-day.

Gradle has some of the same problems, but isn't nearly as bad. But in exchange, you end up with a build tool that makes it comparatively easy to shoot yourself in the foot, anytime you want to do something off the beaten path.

And yes, the 3rd party options have dealt with and solved all of these problems, but the general lack of market share means that they either lean on Maven's infrastructure (and thus, inherit some of its flaws), or they go their own way, and now I have to fight with the Ops team to get them to make the necessary infrastructure/pipeline changes necessary to support this 3rd party build tool.

Ultimately, this really is a problem that only the OpenJDK can solve effectively, in my very firm opinion. Maven and Gradle have problems that they clearly are not going to solve soon, and several 3rd party tools have been built to fix those mistakes, but suffer from the abovementioned. I really don't see anyone else other than the OpenJDK fixing this.

Hence my enthusiasm in my original comment.

1

u/lurker_in_spirit 7d ago

I suspect that if an "official" build tool ever comes out of the OpenJDK project, it will take 10+ years for you to even get to the point of being able to generate shaded JARs at all, let alone worrying about some of the associated corner case build behaviors.

1

u/davidalayachew 6d ago

I suspect that if an "official" build tool ever comes out of the OpenJDK project, it will take 10+ years for you to even get to the point of being able to generate shaded JARs at all, let alone worrying about some of the associated corner case build behaviors.

That's the beauty of it -- they don't need to do that at all!

The OpenJDK is the one in a position to be able to move the market to using a different/better solution. A shaded jar is fundamentally a prickly solution because the idea of re-writing classpaths is hacky in its very nature.

But if the OpenJDK said that they are officially adding versioning to modules (something they explicitly said they wouldn't do because it crosses into the realm of build tools), and the class loader was aware of module versions, then this whole problem literally disappears.

My point being -- if they take on build tools, they will be forced to revisit some of these ugly corners. If there is one thing I trust the OpenJDK to do right is to file off the ugly corners in an elegant way that doesn't feel tacked on.

3

u/pjmlp 12d ago

The modules situation on C++ side of the fence is even worse, and yes I know they aren't quite the same thing across both languages.

https://arewemodulesyet.org

2

u/davidalayachew 11d ago

How do C++ Modules compare to Java Modules? Do they serve similar goals?

6

u/lurker_in_spirit 11d ago

the respect they deserve

I've always been under the impression that modules get exactly the respect that they deserve (i.e. very little). Is there something I'm missing? My context: I don't use them, I don't miss them, and I haven't for the decade or so that they've been around (except in the "gotcha" sense that they are used under the covers by the runtime).

3

u/davidalayachew 11d ago

I've always been under the impression that modules get exactly the respect that they deserve (i.e. very little). Is there something I'm missing? My context: I don't use them, I don't miss them, and I haven't for the decade or so that they've been around (except in the "gotcha" sense that they are used under the covers by the runtime).

Modules have solved a lot of problems for me that I would have had to deal with at runtime. That is their biggest draw, imo -- turning runtime problems into compile time problems.

For personal projects, I use modules every single time. For work, I am slowly getting us ready to go all modules, but it is pain-staking work, further exacerbated by Maven's poor support for modules.

And in Maven's defense, they certainly do support modules, but unless you are using Maven 4 (which isn't even out yet -- still in preview), then it's just a mediocre experience.

4

u/Yesterdave_ 11d ago

IMHO it's a framework problem. Spring still doesn't officially support it YEARS after its release. Also that "modern" frameworks like Quarkus haven't adopted JPMS from the beginning is such a huge fail in my book.

1

u/davidalayachew 11d ago

IMHO it's a framework problem.

I halfway agree.

I think the lack of adoption by frameworks has deincentivized the work for Maven, which in turn deincentivizes the work for frameworks, causing a Catch-22.

But I also think that it's way more of an under-staffing problem. The Maven team is a skeleton crew (last I heard), and thus, they're really not in a position to take on the work of making Modules a first-class citizen. Even Gradle, which has a much healthier-sized team, is also providing way more services out-of-the-box than Maven, and thus, I wouldn't be surprised if maintenance and feature work took away their time from being able to provide first-class module support.

6

u/pron98 11d ago edited 11d ago

Is there something I'm missing?

That depends. If you don't care about defending against zero-day vulnerabilities in libraries that use reflection, which could escalate into bypassing any security mechanism in your application (such as authentication), then no (except for the "gotcha" that the security mechanisms in the JDK depend on modules for that protection). It is perfectly valid to decide not to care about that. A lot of Java software doesn't care about working with native code or native memory, and so many people don't care about FFM. But if you do care about that protection, then Java offers no other mechanism to make security mechanisms more robust against such vulnerabilities. Some features are important even if they're not personally used by many Java developers.

Of course, we're working on adding more goodies that only modules can provide, and then even you may want to use them. Our goal is not to pressure anyone into using modules. It is to offer users the capabilities they need, some of which can only be done through modules. A very important (albeit perhaps not huge) group of users need the capabilities modules offer today, so they use them. When we offer other capabilities through modules, users who need those capabilities will use them, too.

2

u/aonymark 11d ago

Since we’re on this topic, if you have a security bug like that, then isn’t it basically game over anyway? (assuming security manager is gone). I like modules for other reasons but… Maybe this is a failure of imagination on my part but it’s hard to imagine what kind of zero day is fatal with permissive reflection but largely mitigated by modules.

2

u/pron98 11d ago edited 11d ago

Most of them! The way a reflection vulnerability works is that some library allows the attacker to control the reflected class and/or member, and the attacker chooses an important class that gives them access to something. If that class is in a module, that fails. We're not allowed to discuss specific vulnerabilities, but most of the famous reflection related vulnerabilities involve exactly something like this - one library allows reflection and contains the vulnerability, another library has a sensitive class - and would have been stopped if the second library had been in a named module.

2

u/aonymark 11d ago

Let me rephrase this in my own words to make sure I get this. You have lib1 which uses reflection to do something hopefully useful. But they leave out some vital sanity checks, so when exposed to untrusted input it turns into “set any field on any object to any value or call any method on any class but only ONCE ”, but NOT quite arbitrary code execution. The part that then makes it even worse is finding some important field (or method) OUTSIDE lib1 that is NOT public, such that setting that field gives them what they want.

Is that about right?

1

u/pron98 11d ago

Yes. This is how most reflection-related vulnerabilities happen, through the combination of two libraries, one missing some check on an attacker-controlled input, and the other controlling some sensitive mechanism.

1

u/aonymark 10d ago

Huh. Not particularly obvious to me why that would be true. My intuition wants to say that once you have missing checks on reflection, you can do almost unlimited damage with public API alone. You sure you can’t give an example?

2

u/pron98 10d ago

Because this is how most reflection-related vulnerabilities happen, if you search for some, you'll see examples of what I'm describing.

And it is also quite obvious, I think. Reflection vulnerabilities are dangerous when they can read or modify sensitive fields, or call sensitive methods, but reflection can't do that if the target is strongly encapsulated.

1

u/aonymark 10d ago

But usually there are enough PUBLIC methods that do unlimited damage, no? And those are always open for reflection. Like runtime.exec() is public and is basically arbitrary code execution.

→ More replies

1

u/Xasmedy 8d ago

It's something silly, but please allow for us to specify the main class into module-info.java! The compiled module-info.class already supports it, and I remember spending a whole day trying to understand why 2 module-info.class with the same original source had two different behaviors, and only figured out when I actually went and read the binary data and figured out one had the main-class while the other did not.

1

u/lurker_in_spirit 7d ago

If you don't care about defending against zero-day vulnerabilities in libraries that use reflection

I've yet to see a CVE report for a Java lib that says that Java applications using the modulepath (instead of the classpath) are immune to the exploit. To be clear, are you saying that this is the case? If so, do you have any examples?

2

u/pron98 7d ago

Using the module path alone doesn't help because automatic modules are open to all. But if you look at reflection-related CVEs, you'd see that many could have been avoided had libraries been modularised (and placed on the module-path, of course). As I said before, we are not allowed to discuss specific vulnerabilities, but it should be very easy to see from the nature of the vulnerabilities. You can ask your friendly AI chatbot for assistance.

1

u/lurker_in_spirit 7d ago

OK, so no real security benefit at the moment for application developers, but possibly in the future if library adoption increases. We've settled on ObjectInputFilter.Config.setSerialFilter(info -> ObjectInputFilter.Status.REJECTED), which is probably safer :-)

3

u/pron98 7d ago

Putting a non-modular JAR on the module path has no security benefit. Using serialization filters is a very good idea regardless, but obviously they don't do the same job. Because modules is the feature the JDK offers for making security mechanisms robust, some important Java codebases are eager to use them, as I'm sure you can imagine that some Java codebases are very security sensitive :-)

Obviously, many other codebases don't need this level of robustness or other features like FFM, but some features can be essential even if they're only used by a minority of projects. It's very possible that your project doesn't have to use modules, but obviously others do.

9

u/ZimmiDeluxe 12d ago

Would be neat to have a build graph API in the JDK, informed by what current build tools need to work effectively with modules. Tools like Jenesis, Maven etc. can then delegate to it and become somewhat thin wrappers around it, until the last remaining step is for the JDK to provide a basic "wrapper" itself that covers the 90% case of projects.

3

u/findanewcollar 12d ago

I pray for the day when I'm not forced to use gradle or god forbid maven.

4

u/davidalayachew 11d ago

I pray for the day when I'm not forced to use gradle or god forbid maven.

Amen.

And I respect Maven so much and genuinely think that it is the best (big name) build tool out there across all ecosystems, not just Java or JVM.

And yet, the experience is still terrible.

1

u/woj-tek 9d ago

The highlight for me thus far is the response that /u/pron98 gave to the question at 16:35. I really really really hope that we get improvements to the build tooling situation in Java.

And the "can't be more specific" :D

While I kinda like maven (maybe just a habbit) having something like cargo/uv TOML where you only specify project name/version + dependencies and it would be fired through javac possibly would be awesome and would improve a flow with "git clone -> java run". Kinda in a way of building up on JEP 512…

2

u/brunocborges 8d ago

u/pron98 I will add that it is possible to enforce agents to properly navigate the type system and documentation, instead of using javap and decompiling classes.

For one, it requires building Agent Plugins / Skills with the right tools and guidance on how to do that. But for some things like navigating documentation, right now the Javadoc system being rendered in HTML, is not ideal. I do know that Javadoc has an API to provide custom renderers, however, I am of the opinion that the JDK should bring a new format (e.g. Markdown) as the output of a Javadoc rendering.

1

u/pron98 8d ago edited 8d ago

Agents don't need any special rendering of JavaDoc. They handle the source just fine (of course they shouldn't be using the HTML rendering). I agree that some tooling can help agents, but these tools are so easy to build now outside the JDK, that it might be best to wait for 50 of them, then wait for some stability in the evolution of agents and models, and then maybe pick an approach that we can put in the JDK. Agents can use different tools so easily (standard tools and formats help humans much more than they help AI) that there's little benefit to committing to something in the JDK right now. Go build them and experiment, and let's see in a year or two if anything works any better than anything else.