[testing] illegal reflective access operation

87 views
Skip to first unread message

Anders

unread,
Aug 23, 2018, 7:06:01 PM8/23/18
to robocode-developers
Hallo,

great project for teaching and other stuff. had a lot of fun building robots a while ago.
Now i wanted to play around with the code and maybe add a feature or two.
However, i cant even start, because issues.
"Please consider reporting this to the maintainers of net.sf.robocode.io.URLJarCollector."

$ java -version
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running net.sf.robocode.host.jarjar.JarJarTest
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.robocode.io.URLJarCollector (===/robocode/robocode.core/target/robocode.core-1.9.3.0.jar) to field sun.net.www.protocol.jar.JarFileFactory.fileCache
WARNING: Please consider reporting this to the maintainers of net.sf.robocode.io.URLJarCollector
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
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.174 sec <<< FAILURE!
runClassLoader(net.sf.robocode.host.jarjar.JarJarTest)  Time elapsed: 0.006 sec  <<< ERROR!
java.lang.ClassNotFoundException: tested.robots.Ahead
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        at net.sf.robocode.host.jarjar.JarJarTest.runClassLoader(JarJarTest.java:70)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)


Results :

Tests in error:
  runClassLoader(net.sf.robocode.host.jarjar.JarJarTest): tested.robots.Ahead

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Thanx for help.
Anders

Anders

unread,
Aug 28, 2018, 1:04:26 PM8/28/18
to robocode-developers
Im so sorry. The illegal access ist just a warning. However, I dont know what it means.

However, the failure seems to be that The URL class loader doesnt find the tests.robots.Ahead file.
The src is located in ===\robocode\robocode.tests.robots\src\main\java\tested\robots
Where does the .class go? Why isnt it found?

Flemming Larsen

unread,
Aug 28, 2018, 1:13:07 PM8/28/18
to robocode-developers
Hi Anders,

The Robocode game itself cannot compile with Java compilers never than version 8. It gives all kinds of trouble with version 9, 10 and 11. I might look into this later on.
Normally, I use JDK 6 or JDK 8 for compiling Robocode, as Robocode is able to run on Java SE 6 as minimum.
Robots in Robocode can be compiled in any version. But if the Java version is too new (e.g. using version 11), some systems might not be able to run the robots (yet), as they need to be upgraded to a newer Java version.

I recommend you use Java 8 (JDK 8 from Oracle) when compiling Robocode. You can set JAVA_HOME and PATH in the path you override your preferred system settings, when compiling Robocode.

Best regards,
- Flemming

Anders

unread,
Sep 1, 2018, 3:14:33 PM9/1/18
to robocode-developers
Java version 8 worked.
Thanx.

might be wise to add it to requirements in readme and wiki.
Can i do that?

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 minutes 56 seconds
[INFO] Finished at: Wed Aug 29 12:27:06 CEST 2018



On Friday, August 24, 2018 at 1:06:01 AM UTC+2, Anders wrote:

Flemming Larsen

unread,
Sep 12, 2018, 5:01:04 PM9/12/18
to robocode-developers
Hi Anders,

You are very welcome to update the ReadMe. The readme is a part of the sources. You can update it on GitHub using a pull request, or just send the updated version to me, and I will update it.

On the Wiki, you just need to join as a new user in order to edit the Wiki, and you are always welcome to update/correct the Wiki. Other people do this as well. :-)

Thanks!

- Flemming
Reply all
Reply to author
Forward
0 new messages