JDK 9 b148 including a refresh of the module system is available on java.net
"Rory O'Donnell" <[email protected]> Fri, 9 Dec 2016 10:31:06 +0000
| Newsgroups | gmane.comp.java.cruise-control.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============2885547230437740041==
Content-Type: multipart/alternative;
boundary="------------32BA2AEF09B23FA1D93BB943"
This is a multi-part message in MIME format.
--------------32BA2AEF09B23FA1D93BB943
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Kent,
JDK 9 build b148 <https://jdk9.java.net/download/> includes an important
Refresh of the module system [1] , summary of changes are listed here
<http://download.java.net/java/jdk9/changes/jdk-9+148.html>.
*This refresh includes a disruptive change that is important to understand.
*For those that have been trying out modules with regular JDK 9 builds
then be aware that `requires public` changes to `requires transitive`.
In addition, the binary representation of the module declaration
(module-info.class) has changed so that you need to recompile any
modules that were compiled with previous JDK 9 builds.
As things stand today in JDK 9 then you use setAccessible to break into
non-public elements of any type in exported packages. However, it cannot
be used to break into any type in non-exported package. The current
specified behavior was a compromise for the initial integration of the
module system. It is of course not very satisfactory, hence the
#AwkwardStrongEncapsulation issue [2] on the JSR 376 issues list. With
the updated proposal in the JSR, this refresh changes setAccessible
further so that it cannot be used to break into non-public types, or
non-public elements of public types, in exported packages. Code that
uses setAccessible to hack into the private constructor of
java.lang.invoke.MethodHandles.Lookup will be disappointed for example.
This change will expose hacks in many existing libraries and tools. As a
workaround then a new command line option `--add-opens` can be used to
open specific packages for "deep reflection". For example, a really
popular build tool fails with this refresh because it uses setAccessible
+ core reflection to hack into a private field of an unmodifiable
collection so that it can mutate it, facepalm! This code will continue
to work as before when run with `--add-opens
java.base/java.util=ALL-UNNAMED` to open the package java.util in module
java.base to "all unnamed modules" (think class path).
*Any help reporting issues to popular tools and libraries would be
appreciated. *
A debugging aid that is useful to identify issues is to run with
-Dsun.reflect.debugModuleAccessChecks=true to get a stack trace when
setAccessible fails, this is particularly useful when code swallows
exceptions without any logging.
Rgds,Rory
[1]
http://mail.openjdk.java.net/pipermail/jdk9-dev/2016-November/005276.html
<http://mail.openjdk.java.net/pipermail/jpms-spec-experts/2016-October/000430.html>
[2]
http://openjdk.java.net/projects/jigsaw/spec/issues/#AwkwardStrongEncapsulation
--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland
--------------32BA2AEF09B23FA1D93BB943
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by userp1040.oracle.com id
uB9AVAwk017234
<html>
<head>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<p><br>
Hi Kent, </p>
<br>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
JDK 9 build <a href=3D"https://jdk9.java.net/download/">b148</a>
includes an important Refresh of the module system [1] , summary of=C2=
=A0
changes are listed <a
href=3D"http://download.java.net/java/jdk9/changes/jdk-9+148.html">=
here
</a>. <br>
<br>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
<b>This refresh includes a disruptive change that is important to
understand. <br>
<br>
</b>For those that have been trying out modules with regular JDK 9
builds then be aware that `requires public` changes to `requires
transitive`. In addition, the binary representation of the module
declaration (module-info.class) has changed so that you need to
recompile any modules that were compiled with previous JDK 9 builds.
<br>
<br>
As things stand today in JDK 9 then you use setAccessible to break
into non-public elements of any type in exported packages. However,
it cannot be used to break into any type in non-exported package.
The current specified behavior was a compromise for the initial
integration of the module system. It is of course not very
satisfactory, hence the #AwkwardStrongEncapsulation issue [2] on the
JSR 376 issues list. With the updated proposal in the JSR, this
refresh changes setAccessible further so that it cannot be used to
break into non-public types, or non-public elements of public types,
in exported packages. Code that uses setAccessible to hack into the
private constructor of java.lang.invoke.MethodHandles.Lookup will be
disappointed for example.<br>
<br>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
This change will expose hacks in many existing libraries and tools.
As a workaround then a new command line option `--add-opens` can be
used to open specific packages for "deep reflection". For example, a
really popular build tool fails with this refresh because it uses
setAccessible + core reflection to hack into a private field of an
unmodifiable collection so that it can mutate it, facepalm! This
code will continue to work as before when run with `--add-opens
java.base/java.util=3DALL-UNNAMED` to open the package java.util in
module java.base to "all unnamed modules" (think class path).<br>
<br>
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
<b>Any help reporting issues to popular tools and libraries would be
appreciated. </b><br>
<br>
A debugging aid that is useful to identify issues is to run with
-Dsun.reflect.debugModuleAccessChecks=3Dtrue to get a stack trace whe=
n
setAccessible fails, this is particularly useful when code swallows
exceptions without any logging.<br>
<br>
<br>
Rgds,Rory<br>
<br>
<br>
[1] <a
href=3D"http://mail.openjdk.java.net/pipermail/jpms-spec-experts/2016-Oct=
ober/000430.html">http://mail.openjdk.java.net/pipermail/jdk9-dev/2016-No=
vember/005276.html</a><br>
[2] <a
href=3D"http://openjdk.java.net/projects/jigsaw/spec/issues/#AwkwardStron=
gEncapsulation">http://openjdk.java.net/projects/jigsaw/spec/issues/#Awkw=
ardStrongEncapsulation</a><br>
<pre class=3D"moz-signature" cols=3D"72">--=20
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland </pre>
</body>
</html>
--------------32BA2AEF09B23FA1D93BB943--
--===============2885547230437740041==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
--===============2885547230437740041==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Cruisecontrol-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cruisecontrol-devel
--===============2885547230437740041==--