The standard libraries (which means anything outside of javax.realtime except for a small handful of special cases) are not scope-aware and their use within scopes is likely to be problematic. The stacktrace (need the try/catch inside the run() method in the scope) will show you exactly where the problem is occuring. Basically IllegalAssignmentError means that an object has been allocated in a scope and now a reference to that object is being attempted to be stored into a field that is longer lived than the current scope - this is either a static field, or a field of an object that is allocated in heap, immortal or an outer scope.Recall that static initialization always occurs in ImmortalMemory, so many of the objects used in the initialization of the main class libraries end up being immortal.
Avoiding this depends on exactly what is happening and the class involved. For example, sometimes the issue is growing an internal array or similar data structure - the new array is in scope, the reference is static, or in an immortal allocate dobject - and you can avoid the problem by not requiring growth to occur, such as by increasing a collections capacity, for example.
Otherwise you need to avoid creating such instances in scoped memory.