Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalAccessException when running example guessing game #14

Closed
nicvst opened this issue Feb 24, 2021 · 1 comment
Closed
Assignees
Labels
bug Something isn't working finished This issue is resolved, but is awaiting release.
Projects

Comments

@nicvst
Copy link
Contributor

nicvst commented Feb 24, 2021

Version:
both 0.0.8 and 0.0.9.

Issue:
When running the example guessing game, the following will occur:

> Task :GuessingGameExample.main()
Welcome to Guessing Game!
Your goal is to find the secret entity with the special number.

Would you like to play a round? (y/N): 
Alllllright, let's get into it!

Exception in thread "main" java.lang.IllegalStateException: java.lang.IllegalAccessException: class io.github.lucasstarsz.slopeecs.system.ECSSystemManager (in module slope.ecs) cannot access class examples.guessinggame.systems.NumberSystem (in module Slope.ECS.examples) because module Slope.ECS.examples does not export examples.guessinggame.systems to module slope.ecs
	at slope.ecs/io.github.lucasstarsz.slopeecs.system.ECSSystemManager.registerSystem(ECSSystemManager.java:81)
	at slope.ecs/io.github.lucasstarsz.slopeecs.World.registerSystem(World.java:183)
	at slope.ecs/io.github.lucasstarsz.slopeecs.system.ECSSystemBuilder.construct(ECSSystemBuilder.java:96)
	at slope.ecs/io.github.lucasstarsz.slopeecs.system.ECSSystemBuilder.<init>(ECSSystemBuilder.java:91)
	at slope.ecs/io.github.lucasstarsz.slopeecs.system.ECSSystemBuilder.<init>(ECSSystemBuilder.java:71)
	at Slope.ECS.examples/examples.guessinggame.game.GuessingGame.reset(GuessingGame.java:34)
	at Slope.ECS.examples/examples.guessinggame.GuessingGameExample.main(GuessingGameExample.java:23)
Caused by: java.lang.IllegalAccessException: class io.github.lucasstarsz.slopeecs.system.ECSSystemManager (in module slope.ecs) cannot access class examples.guessinggame.systems.NumberSystem (in module Slope.ECS.examples) because module Slope.ECS.examples does not export examples.guessinggame.systems to module slope.ecs
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:385)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:693)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:490)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
Caused by: java.lang.IllegalAccessException: class io.github.lucasstarsz.slopeecs.system.ECSSystemManager (in module slope.ecs) cannot access class examples.guessinggame.systems.NumberSystem (in module Slope.ECS.examples) because module Slope.ECS.examples does not export examples.guessinggame.systems to module slope.ecs

	at slope.ecs/io.github.lucasstarsz.slopeecs.system.ECSSystemManager.registerSystem(ECSSystemManager.java:74)
	... 6 more

> Task :GuessingGameExample.main() FAILED

Execution failed for task ':GuessingGameExample.main()'.
> Process 'command 'C:/Program Files/AdoptOpenJDK/jdk-15.0.2.7-hotspot/bin/java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

This is because the module Slope.ECS.examples does not export to slope.ecs , as given in the examples.guessinggame.module-info.java file.

Fix:
This can simply fixed by setting the Slope.ECS.examples module to open. I'll create a PR for this.

@nicvst nicvst changed the title java.lang.IllegalAccessException: class io.github.lucasstarsz.slopeecs.system.ECSSystemManager (in module slope.ecs) cannot access class examples.guessinggame.systems.NumberSystem (in module Slope.ECS.examples) because module Slope.ECS.examples does not export examples.guessinggame.systems to module slope.ecs java.lang.IllegalAccessException when running example guessing game Feb 24, 2021
@lucasstarsz lucasstarsz self-assigned this Feb 25, 2021
@lucasstarsz lucasstarsz added bug Something isn't working in progress This issue is currently being worked on. labels Feb 25, 2021
@lucasstarsz lucasstarsz added this to v0.0.9 In progress in v0.1 Feb 25, 2021
@lucasstarsz lucasstarsz added finished This issue is resolved, but is awaiting release. and removed in progress This issue is currently being worked on. labels Feb 25, 2021
@lucasstarsz
Copy link
Owner

Fixed by merge request #15. Awaiting release before pushing to main.

v0.1 automation moved this from v0.0.9 In progress to Done Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working finished This issue is resolved, but is awaiting release.
Projects
No open projects
v0.1
Done
Development

No branches or pull requests

2 participants