umple
umple copied to clipboard
Umple parsing and output of annotations needs some more work
Consider the following example:
class X{
@SuppressWarnings("unchecked")
public void analyzeToken(Token token)
{
analyze(token);
}
public void analyze(Token token){}
public void analyze2(Token token){}
}
If we generate the code we won't see the method analyze while it has got the method analyze2.
The issue comes to the place because of @SuppressWarnings. I think it should be related to the Umple grammar.
The main issue is that Umple detects the method analyzeToken but not the one after it which is analyze. Then, it again can detect the other methods which in this case is the method analyze2.
yes, of course. The Umple grammar expects all methods to follow a certain syntax. The presence of the @ breaks that syntax. To fix this we would have to allow parsing of the annotations. Maybe it is not worth bothering.
I assume analyzeToken has some old stuff in it. I assume we can't just get rid of that old stuff?
I don't think this issue is worth fixing.
The issue is not related to what is inside the method analyzeToken. This is not a big issue, we just wanted to get rid of those warnings in the build process.
What about adding actual annotations? Then something similar to Xtend's Active Annotations could be added.
https://eclipse.org/xtend/documentation/204_activeannotations.html
Just a thought.
actually the method analyzeToken is not parsed. It's considered as extra code.
I would be fine to have annotations pass through from methods to Java generated code if they are parsed, stored in the metamodel, and then output. But I have lowered the priority.
One minor semnatics, which @TimLethbridge spoke of but I want to make more apparent is that it's not that "UmpleParser doesn't support Language Feature X", it's that "UmpleParser doesn't support Feature X".
Umple is it's own language, that yes draws heavily on Java, but it is not Java. Support for any syntactic feature should be thought of as a new feature, instead of simply porting support from language X.
Maybe the notion of annotations is worth adding to Umple, but maybe the syntax need not be identical to Java.
An example of such a decision to stray from the Java syntax was the decision to use namespace not package.
Annotations (by other names) are a pretty common idiom in other languages, too. That being said, @aforward is right... just this case happens to also match the justification.
There is a growing need to support annotations, not just on methods, but on attributes and classes too. They should be treated as a special kind of comments and output right before the element in question.
This issue is being re-opened, since it would be desirable for annotations (if not all comments) to be attached to the variables of all attributes, not just internal attributes.
This should be done with #1984