We have to develope a game, where the user can upload their code, for example Rock Paper Scissor. They have to implement some methods from an interface class and we call them in our game Class, nothing special.
The code of the users are in packages, that we have no name-collision,
but to the main topic: How we can ensure, that user A don’t call methods from the class of user B ?
These are all guesses, but look to:
Alternatively, you could let users upload scripts instead of real Java code, e.g. ECMAScript which you can run with Rhino.