fesch / Structorizer.Desktop

Structorizer is a little tool which you can use to create Nassi-Schneiderman Diagrams (NSD).
https://structorizer.fisch.lu
GNU General Public License v3.0
65 stars 20 forks source link

Java import crashes if the imported file contains more than one normal class definition on top level. #1145

Closed codemanyak closed 8 months ago

codemanyak commented 8 months ago

Java files happening to define more than one top level "normal" classes (i.e., other than an enum declaration) then the import aborts with following error:

**Severe error on importing file "<file_path>":
java.lang.ClassCastException: class lu.fisch.structorizer.elements.Instruction cannot be cast to class lu.fisch.structorizer.elements.Forever (lu.fisch.structorizer.elements.Instruction and lu.fisch.structorizer.elements.Forever are in unnamed module of loader 'app')

The Java Parser relied on the wrong assumption (though expected good style) that a Java file contains exactly one class definition on top level (inner classes reserved).

codemanyak commented 8 months ago

Bugfix is prepared for version 3.32-18