staruml / staruml-java

Java extension for StarUML
MIT License
220 stars 89 forks source link

Java 8 #14

Closed cristovao-trevisan closed 6 years ago

cristovao-trevisan commented 7 years ago

Can you please add support to Java 8 (I'm having some trouble because files with lambda expression are not reverse engineered) ?

cristovao-trevisan commented 7 years ago

A few related errors (to java 8 probably) are: Can not get enum diagram because the parser throws this error: "Cannot assign to read only property 'compilationUnitNode' of static" Can not get interface diagram (probably because interface extension is not described in the parser, I guess), with this error: "Cannot assign to read only property 'compilationUnitNode' of {"

For the first case my code is this:

import java.util.HashMap;
import java.util.Map;

/**
 *
 */
public enum GuitarString {
    E(6),
    A(5),
    D(4),
    G(3),
    B(2),
    e(1);

    private final Integer value;

    GuitarString(int value) {
        this.value = value;
    }

    private static final Map<Integer, GuitarString> lookup = new HashMap<>();

    static {
        for (GuitarString d : GuitarString.values()) {
            lookup.put(d.toInt(), d);
        }
    }

    public static GuitarString fromInt(int i){
        return lookup.get(i);
    };

    /**
     * String value as convention (1-based; e=1, E=6)
     *
     * @return Integer value
     */
    public Integer toInt() {
        return value;
    }

    public static Integer length = 6;
}

For the second case it looks like this:

public interface GuitarDataListener extends TransferCallback, Runnable{

}