Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Karen Kinnear
JVM Runtime Lead, Oracle
April 2017
Reliable configuration
Strong encapsulation
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Copyright © 2016, Oracle and/or its affiliates. All rights reserved.
9
Accessibility: Can I access Class D?
• accessibility Java 8:
• containers: class, package
• class access: default (package), public Module Y
Package Q
class Q.D
module-info.java:
module MN { // module name
requires {modifier} ModuleName; // some have dependences
exports PackageName [to ModuleName {, ModuleName}];// some declare exports
opens PackageName [to ModuleName {, ModuleName}]; // some open for reflection
}
Module X Module Y
Package P Package Q
class Q.D
class P.C class Q.D
module X { module Y {
requires Y; exports Q;
} }
java.base
// module-info.java
java.lang module java.base {
java.io
java.net exports java.lang;
java.util exports java.io;
exports java.net;
com.sun.crypto.provider
sun.nio.ch
exports java.util;
sun.reflect.annotation }
sun.security.provider
• Module Path
• Modules form a partition of packages
• no package can be in more than one runtime module
• Modules perform a directed search
• Once the runtime finds a module,it remembers its packages
• Never has to search for those packages again
• Class loading becomes O(1), not O(n)
hello.worl
d
Y lib (v2)
• NoClassDefFoundError ?
• Check your dependences with jdeps -s
• Command-line flags: —add-modules=
• to add a non java.se module to your module graph
• May need to change source to adopt a supported API
• All the code on the classpath gets put into one big module, called the
unnamed module
• Requires everything
• Exports / opens everything
• Maximum compatibility with classpath behavior
jackson- jackson-
jackson-core-2.6.2.jar
databind-2.6.2.jar annotations-2.6.2.jar
• Performance
• Optimize Java calls to native
• Optimize Java access to native data
• Performant
• High quality of generated code
• compiled to supported SIMD instructions
• Competitive with existing facilities for auto-vectorization