2013/11/13

Devoxx 2013: The Modular Java Platform and Project Jigsaw

Mark Reinhold
Java platform layers; total of 54 mb:
  • compact 1: 11mb: core
  • compact 2: 16mb (Jdbc, rmi, jaxp,...)
  • compact 3: 30mb (rowset, jdbc, prefs, xmldsig)
  • 54mb: javafx, crypto, httpservers, corba...
  • + extra tools (jaxws, devtools,...)
Not a perfect solution -> better to make a dependency model of each component (directed graph).
Performance solution needed for:
  • fast class lookup
  • aggressive inlining
  • ahead of time compilation (startup speed)
  • JVM-specific memory images
  • removal of unused fields/methods/classes
Solution:Jlink (optional tool)
  • input: *.jar, *.class, *.jmod
  • output: jmod, jar, JVM image
  • e.g.:
    • jlink -mods javafx,rmi,nashorn -d $JRE
    • javac -mods javafx,rmi,nashorn -d classes *.java
    • java -mods javafx,rmi,nashorn -jar ...
  • requires changes to the Java Runtime: no rt.jar & tools.jar anymore (bad representation for JVM)
Security & modularity
  • current setup can't hide some parts. E.g.: sun.misc.Unsafe
  • historic checks: java.lang.SecurityManager::checkPackageAccess: no static checks possible
  • modules & dependency graph can help validate access to sensitive packages
  • some internal packages will be removed -> must be fixed!:
    • sun.*
    • *.internal.*

No comments: