Crash when calling constructor on static associations end.

Issue #344 resolved
Cécile Camillieri created an issue

Normally we cannot call constructors in message view, except on metaClasses. But in the case of a static association end, constructors will be callable. However, this should not be possible.

Steps to reproduce:

  • Map any class to Singleton
  • In any operation of this class try to call the create() operation on the singleton instance.

This results in a ClassCastException:

Exception in thread "Animation Thread" java.lang.ClassCastException: ca.mcgill.sel.ram.impl.AssociationEndImpl cannot be cast to ca.mcgill.sel.ram.Reference
    at ca.mcgill.sel.ram.controller.MessageViewController.createSingleMessageCommand(MessageViewController.java:449)
    at ca.mcgill.sel.ram.controller.MessageViewController.createMessageCommand(MessageViewController.java:306)

Comments (3)

  1. Matthias Schoettle

    Resolves #344: Fixes the ClassCastException when a constructor is called on an existing static reference. This should be allowed, because the end result is the same as calling the constructor on the metaclass and assigning it to that static association.

    → <<cset bfeac7ac22d4>>

  2. Log in to comment