Project Jigsaw and Java8: Is it really going to solve anything?
Project Jigsaw deals with making of the java compiler module aware. Since long Java API was seen too monolithic in nature. This means that you can see the entire API from any part of the code equally. Also, you have no option to declare a code’s dependency on any other user libraries. Project Jigsaw helps in sorting out these and other issues in a clean and neat way. Currently, you can see the Project Jigsaw confined to Java 8, which is considered to be a big change unlike the generics seen in Java 5. The below points reflect some important benefits of employing Project Jigsaw with Java 8.
The dependency graph
Jigsaw renders you a unique method to identify a specific codebase and also helps in declaring codebase’s dependencies on the other codebases. This helps in creating a complete dependency graph for some specific set of classes. For instance, if you are interested in writing a program which is based on Apache BCEL library, using Jigsaw, you can articulate this very requirement in the code which helps in allowing the tools to resolve the dependency element. Before the advent of Jigsaw, there was no other option to articulate this requirement in the code.
Modularization of Java Platform Itself
The ongoing Java platform API is simply too big in size with too many irrelevant stuffs to each other in some case or the other. In the same way, the embedded environments can strip down a couple of unimportant APIs and thus making things small and fast. In the current Java platform, you do not have the option of doing these things since any standard java platform is required to see all the APIs implementations. However, this is not the case with Jigsaw as it helps you to find a way wherein only a small API part is set relevant to the specific platform. As a module has the option to clearly declare its dependency on any specific Java API module, it will run only when you see the platform having the modules implementation as per the module requirements.
Module Entry Point
The Java modules can now specify any entry point class unlike how the jars specify the same. When you run a module, you can see the main method of entry point being invoked. As you can now see the operating system installing and executing the Java module, this has therefore become pretty similar to an OS’s native program.
Now, every time when you see JVM running, it simply verifies the integrity of each and every single class which is seen loaded during the program run. This generally consumes lots of time. Further, the classes too are seen accessing OS file system individually. As you see modules now being easily installed before running, the installation can now incorporate the verification step which will help in reducing the classes’ verification need during the runtime. This can therefore help in enhancing the overall performance. Lastly, the module system can now be seen storing the classes in its own optimized way which will give more opportunity to improve the performance.
Now it has become possible to render an abstraction for a specific module. So, if module A depends on the module X, now you can see module D rendering for module X, in this way providing its smooth execution. For instance, if the Apache Xerces modules would like to render for jdk.jaxp module then it can easily satisfy the jdk.jaxp dependency requirement.
The project Jigsaw is seen modified every passing day and would certainly turn the table of Java 8 platform. However, the experts feel that the basic idea would remain the same. The above are some of the important benefits of using project Jigsaw with Java 8.
About the author: Alyssa Clarke is a freelance blogger who is passionate about writing. She frequently writes on SEO, marketing and social media related topics. Her favorite sites are Gizmowatch and Cellphonebeat, which she also happens to work for. She is a social media addict and can be actively found on twitter @alyssagclarke.