WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.example.App (file:/D:/Java1.8/Java9/target/classes/) to field com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl._name WARNING: Please consider reporting this to the maintainers of org.example.App WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
看起来该版本下对以往版本中为所欲为的反射操作有了警告,类似Field.set等操作都会被警告。
defineClass
defineClass也是反射,也同样会有警告:
1 2 3 4 5
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.example.App (file:/D:/Java1.8/Java9/target/classes/) to method java.lang.ClassLoader.defineClass(byte[],int,int) WARNING: Please consider reporting this to the maintainers of org.example.App WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release