It seems that duplicate class names are allowed in a class diagram. This has interesting repercussions, as I have just found out. Somehow I created two classes with the same name. One had attributes, the other did not. The one on my model had the attributes and clearly showed in the outline list. (I did not notice the “Diagram-Centric” heading) Every time I tried to generate Java code from the model, my class file appeared, but with no class variables defined, even though they were clearly shown as attributes on my model.
After much poking around I switched to “Class-Centric” outline view and there they were, two classes, one with attributes and one without. Naturally, the one without was first in the list, so the happy old Java code creator used that definition, not the one I had intended, and had used in my model.
Moral to this story is, be careful of duplicate class names. Hint to tool developers – why allow duplicate class names?
– John