You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rainer Jung <ra...@kippdata.de> on 2019/07/17 05:56:36 UTC

Illegal reflective access in TC 9

I noticed (no regression) warnings during unit test run of the following 
types for modern JDK:

     [junit] WARNING: An illegal reflective access operation has occurred
     [junit] WARNING: Illegal reflective access by ...
     [junit] WARNING: Please consider reporting this to the maintainers 
of ...
     [junit] WARNING: Use --illegal-access=warn to enable warnings of 
further illegal reflective access operations
     [junit] WARNING: All illegal access operations will be denied in a 
future release

For the two lines with "..." I have the following statistics:

Count type

348   by org.apache.catalina.loader.WebappClassLoaderBase 
(file:/path/to/my/output/classes/) to field 
java.io.ObjectStreamClass$Caches.localDescs

=> clearReferencesObjectStreamClassCaches() / clearCache()

   2   by org.apache.catalina.loader.WebappClassLoaderBase 
(file:/path/to/my/output/classes/) to field 
java.util.TimerThread.newTasksMayBeScheduled

=> clearReferencesStopTimerThread()

   2   by org.apache.catalina.loader.WebappClassLoaderBase 
(file:/path/to/my/output/classes/) to field java.lang.Thread.target

=> clearReferencesThreads()

  12   by net.sf.cglib.core.ReflectUtils$2 
(file:/path/to/my/deps/cglib-2.2.2/cglib-nodep-2.2.2.jar) to method 
java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

In the docs under 
http://tomcat.apache.org/tomcat-9.0-doc/config/context.html a Java 9 
hint about reflection is only mentioned for 
clearReferencesObjectStreamClassCaches (and clearReferencesRmiTargets). 
Furthermore in the source file WebappClassLoaderBase.java, there's 
comments about Java 9 and an exception capture plus test 
jreCompat.isInstanceOfInaccessibleObjectException() in 
checkThreadLocalsForLeaks() and clearReferencesRmiTargets(), but not all 
of the above. Do we need to sync docs and code plus both with the above 
list of runtime warnings?

Finally the docs contain a hint to -XaddExports:...=ALL-UNNAMED, but our 
startup scripts contain --add-opens=...=ALL-UNNAMED for the same modules 
and packages. Not sure, whether we should sync that and in which direction.

Should I open a BZ?

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Illegal reflective access in TC 9

Posted by Mark Thomas <ma...@apache.org>.
On July 17, 2019 5:56:36 AM UTC, Rainer Jung <ra...@kippdata.de> wrote:
>I noticed (no regression) warnings during unit test run of the
>following 
>types for modern JDK:
>
>   [junit] WARNING: An illegal reflective access operation has occurred
>     [junit] WARNING: Illegal reflective access by ...
>    [junit] WARNING: Please consider reporting this to the maintainers 
>of ...
>     [junit] WARNING: Use --illegal-access=warn to enable warnings of 
>further illegal reflective access operations
>    [junit] WARNING: All illegal access operations will be denied in a 
>future release
>
>For the two lines with "..." I have the following statistics:
>
>Count type
>
>348   by org.apache.catalina.loader.WebappClassLoaderBase 
>(file:/path/to/my/output/classes/) to field 
>java.io.ObjectStreamClass$Caches.localDescs
>
>=> clearReferencesObjectStreamClassCaches() / clearCache()
>
>   2   by org.apache.catalina.loader.WebappClassLoaderBase 
>(file:/path/to/my/output/classes/) to field 
>java.util.TimerThread.newTasksMayBeScheduled
>
>=> clearReferencesStopTimerThread()
>
>   2   by org.apache.catalina.loader.WebappClassLoaderBase 
>(file:/path/to/my/output/classes/) to field java.lang.Thread.target
>
>=> clearReferencesThreads()
>
>  12   by net.sf.cglib.core.ReflectUtils$2 
>(file:/path/to/my/deps/cglib-2.2.2/cglib-nodep-2.2.2.jar) to method 
>java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
>
>In the docs under 
>http://tomcat.apache.org/tomcat-9.0-doc/config/context.html a Java 9 
>hint about reflection is only mentioned for 
>clearReferencesObjectStreamClassCaches (and clearReferencesRmiTargets).
>
>Furthermore in the source file WebappClassLoaderBase.java, there's 
>comments about Java 9 and an exception capture plus test 
>jreCompat.isInstanceOfInaccessibleObjectException() in 
>checkThreadLocalsForLeaks() and clearReferencesRmiTargets(), but not
>all 
>of the above. Do we need to sync docs and code plus both with the above
>
>list of runtime warnings?
>
>Finally the docs contain a hint to -XaddExports:...=ALL-UNNAMED, but
>our 
>startup scripts contain --add-opens=...=ALL-UNNAMED for the same
>modules 
>and packages. Not sure, whether we should sync that and in which
>direction.
>
>Should I open a BZ?

Probably best to so we don't lose track of it.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org