I came across a reported javac performance bug while reading about a Java modules migration. Beyond that bug, how useful are modules in practice, and where does adoption get difficult?
Are Java modules worth the migration hassle?
Answers
Modules give you a way to declare dependencies and distinguish exported APIs from internal packages. That can make accidental reliance on implementation details harder, which is useful when maintaining libraries or larger systems.
Whether that benefit pays for the migration depends on the project. If your existing boundaries are working well, the extra setup and dependency work may not be worth it. New projects can be a reasonable place to try modules without converting everything at once.
Reply to this answer
Automatic modules are a handy bridge, but they can also become a stopping point. A dependency may be usable on the module path without its maintainers ever adding a full module descriptor, leaving downstream projects to work around the limitations.
That is partly an incentives problem. A library maintainer may not see enough benefit to do more if the automatic module already meets their own needs.
Reply to this answer
Keep the compiler bug separate from the broader adoption question. The reported issue concerns javac performance, not necessarily a failure of module encapsulation. Check the bug's current status and the JDK version you're using before assuming a fix is available.
Reply to this answer
Tooling can be the frustrating part. JavaFX in particular can bring up questions about module paths, build plugins, and packaging a runtime with jlink. Those are distinct choices, and confusion over how to run or package an application can make the module system feel harder to adopt than the descriptor itself.
Reply to this answer
Also check the size of the dependency graph before blaming modules for a slow build. If a project pulls in an entire SDK, using only the service packages it needs may reduce the work the compiler has to do. That doesn't make a compiler performance bug any less real, though.
Reply to this answer
Add your answer
Answers are reviewed before publication.
BUBBLE WRAP FORECAST:
Right, and a plugin or a custom runtime shouldn't automatically be treated as the only possible way to launch an application.