kieler / klighd-vscode

Eclipse Public License 2.0
8 stars 6 forks source link

Error in Diagram Synthesis #166

Closed jjrev closed 5 months ago

jjrev commented 5 months ago

On a Windows 11 system with JDK 17 installed, I see the following error in VSCode when trying to display the diagram for *.lf source files:

An exception occurred during diagram synthesis\
java.nio.file.InvalidPathException: Illegal character [:] in path at index 4: \\\c:\Users\xxxxxxxx\Development\lingua-franca\test\C\src\Deadline.lf
\
    at java.base/sun.nio.fs.WindowsPathParser.nextSlash(WindowsPathParser.java:212)
\
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:111)
\
    at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
\
    at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
\
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
\
    at java.base/java.nio.file.Path.of(Path.java:147)
\
    at org.lflang.generator.CodeMap$Correspondence.tag(CodeMap.java:144)
\
    at org.lflang.ast.ASTUtils.toText(ASTUtils.java:693)
\
    at org.lflang.generator.ReactionInstance.<init>(ReactionInstance.java:70)
\
    at org.lflang.generator.ReactorInstance.createReactionInstances(ReactorInstance.java:758)
\
    at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:902)
\
    at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:882)
\
    at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:105)
\
    at org.lflang.diagram.synthesis.LinguaFrancaSynthesis.transform(LinguaFrancaSynthesis.java:322)
\
    at org.lflang.diagram.synthesis.LinguaFrancaSynthesis.transform(LinguaFrancaSynthesis.java:144)
\
    at de.cau.cs.kieler.klighd.syntheses.AbstractDiagramSynthesis.transform(AbstractDiagramSynthesis.java:220)
\
    at de.cau.cs.kieler.klighd.syntheses.ReinitializingDiagramSynthesisProxy.transform(ReinitializingDiagramSynthesisProxy.java:289)
\
    at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:454)
\
    at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:389)
\
    at de.cau.cs.kieler.klighd.ViewContext.update(ViewContext.java:346)
\
    at de.cau.cs.kieler.klighd.lsp.KGraphDiagramUpdater.lambda$6(KGraphDiagramUpdater.java:267)
\
    at de.cau.cs.kieler.klighd.lsp.launch.AbstractLanguageServer.lambda$1(AbstractLanguageServer.java:117)
\
    at de.cau.cs.kieler.klighd.lsp.launch.AbstractLanguageServer.configureAndRun(AbstractLanguageServer.java:96)
\
    at org.lflang.diagram.lsp.LanguageDiagramServer.start(LanguageDiagramServer.java:111)
\
    at org.lflang.diagram.lsp.LanguageDiagramServer.main(LanguageDiagramServer.java:107)

Google searches indicate there is something improper with how the Path is handled. I suspect the triple backslash in the beginning of the Path is where things are going awry but not sure where that prefix is coming from.

NiklasRentzCAU commented 5 months ago

As the relevant parts of the stack trace point to the LF Synthesis and some internal LF generator code I would like to ask @a-sr if he knows anything about this. In Windows 10 we never heard about such a problem, but I will try to reproduce this on a Windows 11 machine soon when I have access to one. Does this happen for any model or just a specific one?

jjrev commented 5 months ago

It happens for all the models I've tried (multiple *.lf files for C and Python languages).

a-sr commented 5 months ago

It looks like a problem with the ASTUtils, which is used in both the code generation and the diagram synthesis. Yet, sometimes the methods are not written with both contexts in mind, causing errors in the diagram generation (e.g. https://github.com/lf-lang/lingua-franca/issues/1930).

@jjrev Could you please open an issue in the LF repo for this problem.

I will close this issue since it is not related to klighd-vscode.