Self reference in sequence diagram points beyond object's lifeline

0 votes
asked Jun 16, 2023 in Bug by AdrianH (140 points)

The following code:

@startuml
participant ProducerThread1
participant ConsumerThread

activate ProducerThread1
ProducerThread1 -> ProducerThread1: Sleep for delay
ProducerThread1 -> ProducerThread1: Set bit 2
ProducerThread1 -> ConsumerThread: Notify
deactivate ProducerThread1

activate ConsumerThread
ConsumerThread -> ConsumerThread: Wait for message
ConsumerThread -> ConsumerThread: Process message
deactivate ConsumerThread

@enduml

Results in the following image:

Image showing issue

1 Answer

0 votes
answered Jun 16, 2023 by The-Lu (65,240 points)

Hi A., and all,

As workaround you can add a dummy (hidden) self-ref, as:

@startuml

participant ProducerThread1
participant ConsumerThread

activate ProducerThread1
ProducerThread1 -> ProducerThread1: Sleep for delay
ProducerThread1 -> ProducerThread1: Set bit 2
ProducerThread1 -> ConsumerThread: Notify
deactivate ProducerThread1

activate ConsumerThread
ConsumerThread -> ConsumerThread: Wait for message
ConsumerThread -> ConsumerThread: Process message
ConsumerThread -[hidden]> ConsumerThread:
deactivate ConsumerThread

@enduml

Regards.

commented Jun 17, 2023 by AdrianH (140 points)
Hi The-Lu,

Thanks. I figured that there would be a workaround like this. However, this still should be fixed. Is there a bug tracker for this tool? I couldn't find any link to one.

Cheers,

Adrian
commented Jun 17, 2023 by albert (3,520 points)
I think @plantuml is reading these threads as well and acts upon it, but I think for better overview etc. a forum is indeed not the best. The plantuml repository can be found at https://github.com/plantuml/plantuml and here you can file issues (and proposed solutions / pull requests).
...