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.
Deep Learning with Python by François Chollet(12568)
Hello! Python by Anthony Briggs(9912)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Dependency Injection in .NET by Mark Seemann(9337)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8295)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7761)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7049)
Microservices with Go by Alexander Shuiskov(6815)
Practical Design Patterns for Java Developers by Miroslav Wengner(6727)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6671)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6076)
The Art of Crafting User Stories by The Art of Crafting User Stories(5603)
NetSuite for Consultants - Second Edition by Peter Ries(5543)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5344)
Kotlin in Action by Dmitry Jemerov(5062)
