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 fails on class definitions with type parameters #1150

Closed codemanyak closed 8 months ago

codemanyak commented 8 months ago

If a source file contains a class with type parameters, e.g.

package de.codemanyak;

public class Tuple<X, Y> {
    public final X variable;
    public final Y position;

    public Tuple(X x, Y y) {
        this.variable = x;
        this.position = y;
    }

    @Override
    public String toString() {
        return "Tuple{" +
                "variable=" + variable +
                ", position=" + position +
                '}';
    }
}

then the parser fails after the first type parameter (if this doesn't bear an extends clause):

error.syntax in file "D:\Structorizer\tests\Issue1150_Java_import\Tuple.java"

Preceding source context:
    1:   package de.codemanyak;
    2:   
    3:   public class Tuple<X» , Y> {

Found token ','

Expected: extends

The reason is a missing (empty) grammar rule for the linguistic variable <TypeBoundOpt>.

codemanyak commented 8 months ago

Fixed for version 3.32-19.