!preprocessorV2 error (V1.2019.5)

0 votes
asked Apr 26 in Question / help by StefanDensow (430 points)

I have a class and a sequence diagram: _view_class.puml and _view_seq.puml in https://github.com/zimtkeks/zimtkeks.github.io/tree/master/static/2019-03-08-plantuml-diagrams-without-redundancy (as ZIP)

I'm trying to convert them to preprocessorV2, so I added !preprocessorV2 to a _common.iuml, that is included in both diagrams, see this branch: https://github.com/zimtkeks/zimtkeks.github.io/tree/plantuml-preprocessor-V2/static/2019-03-08-plantuml-diagrams-without-redundancy (as ZIP)

However, I get a !preprocessorV2 syntax error with V1.2019.5, maybe because it occurs multiple times. Is that an issue in plantuml or should I take care that multiple inclusions don't happen in my diagrams (by avoiding !include_many or by using include-guards as with the C preprocessor)?

This is the generated PlantUML (from the SVG comment):

@startuml
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
left header
Created by @StefanDensow for PlantUML illustration.
endheader
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
class Concierge {
Gets a tip from a ""Tourist"", seats
him/her into a taxi and sends it to
one of the top 10 sights in the area.
..
+ init()
+ run() <color:blue>**ASYNC**</color>
+ add(Tourist)
..
- TaxiManager mTaxiManager
- List<Location> mTop10Sights
- <&lock-locked> List<Tourist> mGuests
}
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
class Tourist {
+ int payCash(amount)
..
- int mCashAmount
}
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
class Taxi {
Takes a ""Tourist"" to a given location,
gets a fee before dropoff.
Calls ""onAvailable()"" when
tourist has been dropped off.
- -
+ enter(Tourist)
+ goTo(Location) <color:blue>**ASYNC**</color>
..
- dropOff(Tourist)
- Tourist mTourist
- ITaxiListener mListener
}
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
interface ITaxiListener #tan {
- onAvailable(Taxi)
- signOff(Taxi)
}
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
class TaxiManager <<abstract>> {
""getNewInstance()"" randomly selects
a concrete ""TaxiManager"" child for
instantiation to maintain fairness
between the cab companies.
..
+ {static} TaxiManager getNewInstance()
+ {abstract} Optional<Taxi> requestTaxi()
.. ITaxiListener ..
+ {abstract} onAvailable(Taxi)
..
# List<Taxi> mAvailableTaxis
# List<Taxi> mOccupiedTaxis
# <&lock-locked> mTaxiLock 
}
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
class InstaCab {
//<Insert catchy slogan here>//
.. TaxiManager ..
+ Optional<Taxi> requestTaxi()
.. ITaxiListener ..
+ onAvailable(Taxi)
}
!preprocessorV2
skinparam DefaultMonospacedFontName Menlo
hide empty members
class SpeedyCab {
//We put the pedal to the metal!//
.. TaxiManager ..
+ Optional<Taxi> requestTaxi()
.. ITaxiListener ..
+ onAvailable(Taxi)
}
Concierge o..> Taxi: calls >
Concierge "1" o- -> "1" TaxiManager: calls >
Concierge o- -> Tourist: gets tip\nfrom >
Taxi <- -* TaxiManager: owns <
Taxi o-> Tourist: gets fee\nfrom >
Taxi o-[#tan]l-> ITaxiListener: calls >
ITaxiListener <-[#tan]-+ TaxiManager: provides\nimplementation <
TaxiManager <|- - InstaCab
TaxiManager <|- - SpeedyCab
@enduml
PlantUML version 1.2019.05(Sat Apr 20 18:45:36 CEST 2019)

1 Answer

+1 vote
answered Apr 26 by plantuml (201,100 points)
selected Apr 30 by StefanDensow
 
Best answer
Could you try with last beta http://beta.plantuml.net/plantuml.jar ?

The last beta does not required !preprocessorV2 since the new preprocessor is enabled by default there.

Thanks !
commented Apr 26 by StefanDensow (430 points)
edited Apr 26 by StefanDensow
Unfortunately, I get an error there as well - after replacing !include_many by !include (full SVG file content below).

But I do prefer a solution where I don't have to modify my editing environment when trying out preprocessorV2 - so it would be great if !preprocessorV2 worked for me. Does plantuml need a fix or my diagrams?

SVG-Error:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="103px" preserveAspectRatio="none" style="width:412px;height:103px;background:#000000;" version="1.1" viewBox="0 0 412 103" width="412px" zoomAndPan="magnify"><defs/><g><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="206" x="5" y="19.5332">[From _common.iuml (line 2) ]</text><line style="stroke: #33FF02; stroke-width: 1.0;" x1="5" x2="410" y1="27.6094" y2="27.6094"/><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="71" x="5" y="47.1426">@startuml</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="64.752"/><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="405" x="5" y="82.3613">' this file contains definitions common to all diagram types</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="99.9707"/><text fill="#FF0000" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="9" y="99.9707">Syntax Error?</text><!--
@startuml
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
left header
Created by @StefanDensow for PlantUML illustration.
endheader
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
class Concierge {
    Gets a tip from a ""Tourist"", seats
    him/her into a taxi and sends it to
    one of the top 10 sights in the area.
    ..
    + init()
    + run() <color:blue>**ASYNC**</color>
    + add(Tourist)
    ..
    - TaxiManager mTaxiManager
    - List<Location> mTop10Sights
    - <&lock-locked> List<Tourist> mGuests
}
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
class Tourist {
    + int payCash(amount)
    ..
    - int mCashAmount
}
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
class Taxi {
    Takes a ""Tourist"" to a given location,
    gets a fee before dropoff.
    Calls ""onAvailable()"" when
    tourist has been dropped off.
    - -
    + enter(Tourist)
    + goTo(Location) <color:blue>**ASYNC**</color>
    ..
    - dropOff(Tourist)
    - Tourist mTourist
    - ITaxiListener mListener
}
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
interface ITaxiListener #tan {
    - onAvailable(Taxi)
    - signOff(Taxi)
}
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
class TaxiManager <<abstract>> {
    ""getNewInstance()"" randomly selects
    a concrete ""TaxiManager"" child for
    instantiation to maintain fairness
    between the cab companies.
    ..
    + {static} TaxiManager getNewInstance()
    + {abstract} Optional<Taxi> requestTaxi()
    .. ITaxiListener ..
    + {abstract} onAvailable(Taxi)
    ..
    # List<Taxi> mAvailableTaxis
    # List<Taxi> mOccupiedTaxis
    # <&lock-locked> mTaxiLock
}
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
class InstaCab {
    //<Insert catchy slogan here>//
    .. TaxiManager ..
    + Optional<Taxi> requestTaxi()
    .. ITaxiListener ..
    + onAvailable(Taxi)
}
' this file contains definitions common to all diagram types
' re-usable color definitions with purpose
' Consolas is ok on Windows, Menlo on macOS
skinparam DefaultMonospacedFontName Menlo
' hide member/function areas when they would be empty anyway to save space
hide empty members
class SpeedyCab {
    //We put the pedal to the metal!//
    .. TaxiManager ..
    + Optional<Taxi> requestTaxi()
    .. ITaxiListener ..
    + onAvailable(Taxi)
}
Concierge o..> Taxi: calls >
Concierge "1" o- -> "1" TaxiManager: calls >
Concierge o- -> Tourist: gets tip\nfrom >
Taxi <- -* TaxiManager: owns <
Taxi o-> Tourist: gets fee\nfrom >
Taxi o-[#tan]l-> ITaxiListener: calls >
ITaxiListener <-[#tan]-+ TaxiManager: provides\nimplementation <
TaxiManager <|- - InstaCab
TaxiManager <|- - SpeedyCab
@enduml
PlantUML version 1.2019.06beta4(Unknown compile time)
(GPL source distribution)
Java Runtime: Java(TM) SE Runtime Environment
JVM: Java HotSpot(TM) 64-Bit Server VM
Java Version: 1.8.0_201-b09
Operating System: Windows 10
OS Version: 10.0
Default Encoding: Cp1252
Language: en
Country: GB
--></g></svg>
commented Apr 26 by plantuml (201,100 points)
> Does plantuml need a fix or my diagrams?
>
Right now, it's plantuml that need some fix, not your diagrams.
This preprocessor V2 code is fairly new, that's why there are some issues.
But we will fix them :-)

We've just published a new beta http://beta.plantuml.net/plantuml.jar that should work better in your case.
We are curious to see the result :-)
commented Apr 26 by StefanDensow (430 points)
edited Apr 26 by StefanDensow
(2 comments, because of long stack trace and 8000 character comment limit ;-)

Thanks for the quick update! :)

I tried with this code: https://github.com/zimtkeks/zimtkeks.github.io/tree/plantuml-preprocessor-V2/static/2019-03-08-plantuml-diagrams-without-redundancy

Or, as ZIP: https://kinolien.github.io/gitzip/?download=https://github.com/zimtkeks/zimtkeks.github.io/tree/plantuml-preprocessor-V2/static/2019-03-08-plantuml-diagrams-without-redundancy

Rendering _view_class.puml works fine.
However, rendering _view_seq.puml yields a stacktrace on the command line and an error message in the SVG:

    java -jar C:\<..>\plantuml.jar -tsvg _view_seq.puml
    net.sourceforge.plantuml.tim.EaterException: cannot include
            at net.sourceforge.plantuml.tim.TFunctionImpl.executeVoid(TFunctionImpl.java:95)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:384)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:346)
            at net.sourceforge.plantuml.tim.TContext.addPlain(TContext.java:198)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:165)
            at net.sourceforge.plantuml.tim.TContext.executeInclude(TContext.java:465)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:182)
            at net.sourceforge.plantuml.tim.TFunctionImpl.executeVoid(TFunctionImpl.java:92)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:384)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:346)
            at net.sourceforge.plantuml.tim.TContext.addPlain(TContext.java:198)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:165)
            at net.sourceforge.plantuml.tim.TContext.executeInclude(TContext.java:465)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:182)
            at net.sourceforge.plantuml.tim.TFunctionImpl.executeVoid(TFunctionImpl.java:92)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:384)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:346)
            at net.sourceforge.plantuml.tim.TContext.addPlain(TContext.java:198)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:165)
            at net.sourceforge.plantuml.tim.TimLoader.load(TimLoader.java:63)
            at net.sourceforge.plantuml.BlockUml.<init>(BlockUml.java:107)
            at net.sourceforge.plantuml.BlockUmlBuilder.init(BlockUmlBuilder.java:127)
            at net.sourceforge.plantuml.BlockUmlBuilder.<init>(BlockUmlBuilder.java:79)
            at net.sourceforge.plantuml.SourceFileReader.<init>(SourceFileReader.java:87)
            at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:480)
            at net.sourceforge.plantuml.Run.processArgs(Run.java:403)
            at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:372)
            at net.sourceforge.plantuml.Run.main(Run.java:188)
    net.sourceforge.plantuml.tim.EaterException: cannot include
            at net.sourceforge.plantuml.tim.TFunctionImpl.executeVoid(TFunctionImpl.java:95)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:384)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:346)
            at net.sourceforge.plantuml.tim.TContext.addPlain(TContext.java:198)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:165)
            at net.sourceforge.plantuml.tim.TContext.executeInclude(TContext.java:465)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:182)
            at net.sourceforge.plantuml.tim.TFunctionImpl.executeVoid(TFunctionImpl.java:92)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:384)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:346)
            at net.sourceforge.plantuml.tim.TContext.addPlain(TContext.java:198)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:165)
            at net.sourceforge.plantuml.tim.TimLoader.load(TimLoader.java:63)
            at net.sourceforge.plantuml.BlockUml.<init>(BlockUml.java:107)
            at net.sourceforge.plantuml.BlockUmlBuilder.init(BlockUmlBuilder.java:127)
            at net.sourceforge.plantuml.BlockUmlBuilder.<init>(BlockUmlBuilder.java:79)
            at net.sourceforge.plantuml.SourceFileReader.<init>(SourceFileReader.java:87)
            at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:480)
            at net.sourceforge.plantuml.Run.processArgs(Run.java:403)
            at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:372)
            at net.sourceforge.plantuml.Run.main(Run.java:188)
    net.sourceforge.plantuml.tim.EaterException: cannot include
            at net.sourceforge.plantuml.tim.TFunctionImpl.executeVoid(TFunctionImpl.java:95)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:384)
            at net.sourceforge.plantuml.tim.TContext.applyFunctionsAndVariables(TContext.java:346)
            at net.sourceforge.plantuml.tim.TContext.addPlain(TContext.java:198)
            at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:165)
            at net.sourceforge.plantuml.tim.TimLoader.load(TimLoader.java:63)
            at net.sourceforge.plantuml.BlockUml.<init>(BlockUml.java:107)
            at net.sourceforge.plantuml.BlockUmlBuilder.init(BlockUmlBuilder.java:127)
            at net.sourceforge.plantuml.BlockUmlBuilder.<init>(BlockUmlBuilder.java:79)
            at net.sourceforge.plantuml.SourceFileReader.<init>(SourceFileReader.java:87)
            at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:480)
            at net.sourceforge.plantuml.Run.processArgs(Run.java:403)
            at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:372)
            at net.sourceforge.plantuml.Run.main(Run.java:188)
    Preprocessor Error: cannot include
    Error line 19 in file: C:\<..>\_view_seq.puml
    Some diagram description contains errors
commented Apr 26 by StefanDensow (430 points)
The SVG error message suggests that TaxiManager_DELEGATE is not expanded (maybe because it is defined in an included file block):

<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="138px" preserveAspectRatio="none" style="width:494px;height:138px;background:#000000;" version="1.1" viewBox="0 0 494 138" width="494px" zoomAndPan="magnify"><defs/><g><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="227" x="5" y="19.5332">[From _view_seq.puml (line 20) ]</text><line style="stroke: #33FF02; stroke-width: 1.0;" x1="5" x2="492" y1="27.6094" y2="27.6094"/><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="160" x="5" y="47.1426">... (skipping 54 lines) ...</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="63" x="5" y="64.752">end note</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="471" x="21" y="82.3613">TaxiManager -&gt; TaxiManager_DELEGATE: TaxiManager_DELEGATE()</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="231" x="21" y="99.9707">activate TaxiManager_DELEGATE</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="260" x="5" y="117.5801">CALL_METHOD(Boss, Concierge, init)</text><text fill="#33FF02" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="0" x="9" y="135.1895"/><text fill="#FF0000" font-family="sans-serif" font-size="14" font-******="bold" lengthAdjust="spacingAndGlyphs" textLength="104" x="9" y="135.1895">cannot include</text><!--
@startuml
skinparam DefaultMonospacedFontName Menlo
left header
Created by @StefanDensow for PlantUML illustration.
endheader
participant Boss as "Boss <&person>"
participant Concierge
participant Tourist
participant Taxi
participant ITaxiListener #tan
participant TaxiManager
participant SpeedyCab
== Initialization ==
    Boss -> Concierge: init()
    activate Concierge
skinparam DefaultMonospacedFontName Menlo
    Concierge -> TaxiManager: getNewInstance()
    activate TaxiManager
skinparam DefaultMonospacedFontName Menlo
note over TaxiManager
randomly decide which concrete
subclass to instantiate
end note
    TaxiManager -> TaxiManager_DELEGATE: TaxiManager_DELEGATE()
    activate TaxiManager_DELEGATE
CALL_METHOD(Boss, Concierge, init)
PlantUML version 1.2019.06beta6(Unknown compile time)
(GPL source distribution)
Java Runtime: Java(TM) SE Runtime Environment
JVM: Java HotSpot(TM) 64-Bit Server VM
Java Version: 1.8.0_201-b09
Operating System: Windows 10
OS Version: 10.0
Default Encoding: Cp1252
Language: en
Country: GB
--></g></svg>
commented Apr 26 by plantuml (201,100 points)
Ok, thanks for the example.
This should be fixed in newly beta http://beta.plantuml.net/plantuml.jar
Both file _view_class.puml and _view_seq.puml seems to be working now.
There must be some other issues, so please go on with your tests and posts :-)

Thanks again!
commented Apr 30 by StefanDensow (430 points)
Yep, works well, thanks! :)
I'll continue testing..
...