[java] Update CommentDefaultAccessModifier#3188
Conversation
Generated by 🚫 Danger |
|
|
||
| /** | ||
| * Returns true if this is a regular interface declaration (not an annotation). | ||
| * Note that {@link #isInterface()} counts annotations in. |
There was a problem hiding this comment.
Not sure, if we should do it the other way round. If you ask be in the middle of the night, whether Interface should return true as "isInterface" and what Annotation would return. I'd tell you, Annotations should return false....
I want to say, on first glance, I'd say, it's easier to have "isInterface" and "isAnnotation" rather than "isInterface", "isAnnotation" and "isRegularInterface"...
But I see, we also have "isRegularClass"....
We still have the possibility to change the semantics of those APIs in PMD 7
Update: Or in other words: What is less surprising? That isInterface returns true for annotations or that it returns false?
There was a problem hiding this comment.
I think it's true that isInterface may be surprising, especially since in pmd 6 we have ASTClassOrInterfaceDeclaration#isInterface which is basically this isRegularInterface method. But it's in line with the JClassSymbol#isInterface, JTypeMirror#isInterface (and ultimately java.lang.Class#isInterface, after which the other two are modeled)... And this way !isInterface() actually means isClass(), with the same meaning as JClassSymbol#isClass vs JClassSymbol#isInterface. If we exclude annotations then !isInterface() means "is class or annotation", which doesn't seem very useful
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by travis)