Skip to content
Advertisement

I am getting a syntex error when making a UML class in IntelliJ, how can i fix it?

I am making a UML class diagram in IntelliJ with the “Sketch it!” plugin, but it says there is a syntax error in line 5, where it says namespace the first time. I don’t get why, as it says the same on many times below as well without an error. I can’t find a tutorial to this program online, so I’m having trouble fixing it.

@startuml

title __STREAMINGSERVICE's Class Diagram__n

  namespace  {    \   <--- this is where I get the syntax error!!
    class ChangeLoginGUI {
    }
  }
  

  namespace  {
    class Episode {
    }
  }
  

  namespace  {
    class EpisodeGUI {
    }
  }
  

  namespace  {
    class FileReader {
    }
  }
  

  namespace  {
    class IncorrectLoginException {
    }
  }
  

  namespace  {
    class InfoGUI {
    }
  }
  

  namespace  {
    class InfoSGUI {
    }
  }
  

  namespace  {
    abstract class InfoSuper {
    }
  }
  

  namespace  {
    class LoginGUI {
    }
  }
  

  namespace  {
    class Main {
    }
  }
  

  namespace  {
    class MainGUI {
    }
  }
  

  namespace  {
    abstract class Media {
    }
  }
  

  namespace  {
    class MediaLibrary {
    }
  }
  

  namespace  {
    class MediaPlayer {
    }
  }
  

  namespace  {
    class Movie {
    }
  }
  

  namespace  {
    class MovieGenerator {
    }
  }
  

  namespace  {
    class MovieGeneratorTest {
    }
  }
  

  namespace  {
    class NotificationGUI {
    }
  }
  

  namespace  {
    abstract class ObjectGenerator {
    }
  }
  

  namespace  {
    interface Playable {
    }
  }
  

  namespace  {
    class SearchEngine {
    }
  }
  

  namespace  {
    class SearchEngineTest {
    }
  }
  

  namespace  {
    class Series {
    }
  }
  

  namespace  {
    class SeriesGenerator {
    }
  }
  

  namespace  {
    class SeriesGeneratorTest {
    }
  }
  

  namespace  {
    class User {
    }
  }
  

  namespace  {
    class UserList {
    }
  }
  

  ChangeLoginGUI -up-|> javax.swing.JFrame
  ChangeLoginGUI o-- User : user
  ChangeLoginGUI o-- UserList : userList
  Episode .up.|> Playable
  EpisodeGUI -up-|> javax.swing.JFrame
  EpisodeGUI o-- MediaPlayer : play
  EpisodeGUI o-- Series : media
  EpisodeGUI o-- MediaLibrary : ml
  EpisodeGUI o-- User : user
  InfoGUI -up-|> InfoSuper
  InfoSGUI -up-|> InfoSuper
  InfoSuper -up-|> javax.swing.JFrame
  InfoSuper o-- Media : media
  InfoSuper o-- MediaPlayer : play
  InfoSuper o-- User : user
  LoginGUI -up-|> javax.swing.JFrame
  LoginGUI o-- MainGUI : launchProgram
  LoginGUI o-- UserList : userList
  MainGUI -up-|> javax.swing.JFrame
  MainGUI o-- MediaLibrary : mediaLibrary
  MainGUI o-- SearchEngine : searchEngine
  MainGUI o-- User : user
  MediaLibrary o-- SeriesGenerator : m1
  MediaLibrary o-- MovieGenerator : m2
  MediaPlayer -up-|> javax.swing.JFrame
  Movie .up.|> Playable
  Movie -up-|> Media
  MovieGenerator -up-|> ObjectGenerator
  MovieGeneratorTest o-- FileReader : fr
  MovieGeneratorTest o-- MovieGenerator : mg
  MovieGeneratorTest o-- MovieGeneratorTest : mgt
  ObjectGenerator o-- FileReader : fr
  SearchEngine o-- MediaLibrary : mediaLibrary
  SearchEngineTest o-- SearchEngine : searchEngine
  Series -up-|> Media
  SeriesGenerator -up-|> ObjectGenerator
  SeriesGeneratorTest o-- FileReader : fr
  SeriesGeneratorTest o-- SeriesGenerator : sg


right footer


PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
For more information about this tool, please contact philippe.mesmeur@gmail.com
endfooter

@enduml

Advertisement

Answer

The definition is incompatible with PlantUML syntax, with all these namespace {..} without naming the namespace and these {} after introducing each class

Placing the two first classes in a dedicated namespace but not the next :

@startuml

title __STREAMINGSERVICE's Class Diagram__n

namespace A {    
     class ChangeLoginGUI 
}

  namespace B {
     class Episode
  }
  

  class   EpisodeGUI
 
   class  FileReader
 
   class  IncorrectLoginException
 
    class InfoGUI
  
    class InfoSGUI 
 
    abstract class InfoSuper
  
    class LoginGUI

    class Main

    class MainGUI 
  
    abstract class Media

    class MediaLibrary 

    class MediaPlayer

    class Movie

    class MovieGenerator 

    class MovieGeneratorTest

    class NotificationGUI

    abstract class ObjectGenerator

    interface Playable

    class SearchEngine 

    class SearchEngineTest

    class Series

    class SeriesGenerator

    class SeriesGeneratorTest

    class User 

    class UserList

  ChangeLoginGUI -up-|> javax.swing.JFrame
  ChangeLoginGUI o-- User : user
  ChangeLoginGUI o-- UserList : userList
  Episode .up.|> Playable
  EpisodeGUI -up-|> javax.swing.JFrame
  EpisodeGUI o-- MediaPlayer : play
  EpisodeGUI o-- Series : media
  EpisodeGUI o-- MediaLibrary : ml
  EpisodeGUI o-- User : user
  InfoGUI -up-|> InfoSuper
  InfoSGUI -up-|> InfoSuper
  InfoSuper -up-|> javax.swing.JFrame
  InfoSuper o-- Media : media
  InfoSuper o-- MediaPlayer : play
  InfoSuper o-- User : user
  LoginGUI -up-|> javax.swing.JFrame
  LoginGUI o-- MainGUI : launchProgram
  LoginGUI o-- UserList : userList
  MainGUI -up-|> javax.swing.JFrame
  MainGUI o-- MediaLibrary : mediaLibrary
  MainGUI o-- SearchEngine : searchEngine
  MainGUI o-- User : user
  MediaLibrary o-- SeriesGenerator : m1
  MediaLibrary o-- MovieGenerator : m2
  MediaPlayer -up-|> javax.swing.JFrame
  Movie .up.|> Playable
  Movie -up-|> Media
  MovieGenerator -up-|> ObjectGenerator
  MovieGeneratorTest o-- FileReader : fr
  MovieGeneratorTest o-- MovieGenerator : mg
  MovieGeneratorTest o-- MovieGeneratorTest : mgt
  ObjectGenerator o-- FileReader : fr
  SearchEngine o-- MediaLibrary : mediaLibrary
  SearchEngineTest o-- SearchEngine : searchEngine
  Series -up-|> Media
  SeriesGenerator -up-|> ObjectGenerator
  SeriesGeneratorTest o-- FileReader : fr
  SeriesGeneratorTest o-- SeriesGenerator : sg


right footer


PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
For more information about this tool, please contact philippe.mesmeur@gmail.com
endfooter
@enduml

produces :

enter image description here

Note your diagram is not easy to read because containing a lot of classes, and some of them are orphan.

The footer indicates this is generated by SketchIt, I do not know it, perhaps that tool needs to have all classes defined in a namespace rather than out of a namespace ?

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement