Hey,
I struggled for quite some time and on different occasions now to be conform with supported types in the said libraries. Unfortunately there were only complicated workarounds as solution yet and it slowed development significantly for me.
Especially since it is not easy to add module specific CopyStrategies through some access protection with @RegisterCopyStrategy . (You can't define those outside the engine package it seems).
EDIT: Extending the typehandlers doesn't make any problems when done outside the engine with @RegisterTypeHandler. That leaves just the weird permission thing with copystrategies.
Here is a log post as an example:
So as @Cervator pointed out, this is due to the whitelist of the sandbox as a security measure. However, as typehandlers, which are already on the whitelist, have the same potential imho to introduce malicious code I suggest that copystrategies are added too. What's your opinion on that?
I struggled for quite some time and on different occasions now to be conform with supported types in the said libraries. Unfortunately there were only complicated workarounds as solution yet and it slowed development significantly for me.
Especially since it is not easy to add module specific CopyStrategies through some access protection with @RegisterCopyStrategy . (You can't define those outside the engine package it seems).
EDIT: Extending the typehandlers doesn't make any problems when done outside the engine with @RegisterTypeHandler. That leaves just the weird permission thing with copystrategies.
Here is a log post as an example:
Code:
[Thread-13] ERROR o.t.module.sandbox.ModuleClassLoader - Denied access to class (not allowed with this module's permissions): org.terasology.reflection.copy.CopyStrategy
21:38:16.908 [Thread-13] WARN org.reflections.Reflections - could not get type for name org.terasology.dynamicCities.reflection.Rect2iCopyStrategy from any class loader
org.reflections.ReflectionsException: could not get type for name org.terasology.dynamicCities.reflection.Rect2iCopyStrategy
at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:378)
at org.reflections.ReflectionUtils.forNames(ReflectionUtils.java:397)
at org.reflections.Reflections.getSubTypesOf(Reflections.java:367)
at org.terasology.module.ModuleEnvironment.getSubtypesOf(ModuleEnvironment.java:328)
at org.terasology.engine.bootstrap.EnvironmentSwitchHandler.handleSwitchToGameEnvironment(EnvironmentSwitchHandler.java:72)
at org.terasology.engine.modes.loadProcesses.RegisterMods.lambda$step$0(RegisterMods.java:89)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.terasology.dynamicCities.reflection.Rect2iCopyStrategy
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:376)
... 6 common frames omitted
So as @Cervator pointed out, this is due to the whitelist of the sandbox as a security measure. However, as typehandlers, which are already on the whitelist, have the same potential imho to introduce malicious code I suggest that copystrategies are added too. What's your opinion on that?
Last edited: