dspinellis / UMLGraph

Declarative specification and drawing of UML diagrams
http://www.spinellis.gr/umlgraph
BSD 3-Clause "New" or "Revised" License
343 stars 92 forks source link

Inner classes not working right #20

Closed kno10 closed 6 years ago

kno10 commented 10 years ago

Inner classes don't seem to properly work for me. I've tried three different syntaxes, and gotten mostly two results: 1. an arrow for the outer class self-referencing itself, and 2. an arrow that is seemingly correct (with $ syntax) but the class isn't recognized, and it links to oracle instead.

Below is not a tested example.

/**
 * @has - - - B <--- graph links A to A, not B.
 * @has - - - A.B <-- graph links A to A, not B.
 * @has - - - A$B  <--- graph is okay, but links to java.
 */
public class A {
  public class B {
  }
}

P.S. "@opt nodecolor" also isn't working in the doclet.

kno10 commented 6 years ago

Apparently, the problem arises if the outer class has generics.

/**
 * @has - - - Child
 */
public class Test<A> {
  public class Child {}
}

the inner class then uses the name Test<A>.Child, and this gives UMLGraph example and when we remove the Generic, we get the expected UMLGraph example If the child is static, it also works: UMLGraph example

dspinellis commented 6 years ago

Excellent, this is very useful! It should help us find a fix and test it.

kno10 commented 6 years ago

The removeTemplate function apparently kills the inner class name.