Modular Programming in Java 9 by Kothagal Koushik
Author:Kothagal, Koushik [Kothagal, Koushik]
Language: eng
Format: azw3, epub
Tags: COM051210 - COMPUTERS / Programming / Object Oriented, COM051000 - COMPUTERS / Programming / General, COM051280 - COMPUTERS / Programming Languages / Java
Publisher: Packt Publishing
Published: 2017-08-29T04:00:00+00:00
Optimizing module imports
In the previous chapter, we created the GUI address viewer module that required the Java FX modules necessary for building the UI. Here's what the module descriptor looked like:
module packt.addressbook.ui { exports packt.addressbook.ui; requires java.logging; requires javafx.base; requires javafx.controls; requires javafx.graphics; requires packt.addressbook.lib; }
We'll now see that not all the modules imported are actually required, and we can optimize this list a bit, thanks to our new knowledge of transitive dependencies. Running java -d on javafx.controls gives us:
$ java -d javafx.controls module javafx.controls@9 ... requires transitive javafx.base requires transitive javafx.graphics
Turns out the javafx.base and javafx.graphics modules are transitive dependencies of javafx.controls already. So, any module that reads javafx.controls also reads javafx.base and javafx.graphics! So, we can remove those two modules and just declare our dependency on javafx.controls, since that module alone pulls in all the dependencies we need. Here's the updated module descriptor for packt.addressbook.ui:
module packt.addressbook.ui { exports packt.addressbook.ui; requires java.logging; requires javafx.controls; requires packt.addressbook.lib; }
You should be able to recompile and execute the UI module to make sure things still work just the same.
Download
Modular Programming in Java 9 by Kothagal Koushik.epub
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(20971)
Hello! Python by Anthony Briggs(20250)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(18610)
Dependency Injection in .NET by Mark Seemann(18406)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(17929)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(17687)
Kotlin in Action by Dmitry Jemerov(17587)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16937)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(16508)
Grails in Action by Glen Smith Peter Ledbrook(15651)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(10483)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(8057)
Microservices with Go by Alexander Shuiskov(7820)
Practical Design Patterns for Java Developers by Miroslav Wengner(7725)
Test Automation Engineering Handbook by Manikandan Sambamurthy(7675)
Angular Projects - Third Edition by Aristeidis Bampakos(7162)
The Art of Crafting User Stories by The Art of Crafting User Stories(6613)
NetSuite for Consultants - Second Edition by Peter Ries(6534)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(6306)