Closed maxvetrenko closed 10 years ago
We have to cover the following cases:
Agree with Ruslan.
@Partial @Mock DataLoader loader;
According to a GoogleStyle it is an exception which is applied only to fields. We can use both: @Partial @Mock DataLoader loader; and @Partial @Mock DataLoader loader;
What GoogleStyle says about fields:
but in this case, multiple annotations (possibly parameterized) may be listed on the same line
What GoogleStyle says about class, method or constructor:
each annotation is listed on a line of its own (that is, one annotation per line)
Roman, let's discuss it via Skype if you're disagree
You forgot about single parameterless annotation. It may instead appear together with the first line of the signature, for example:
@Override public int hashCode() { ... }
I'm ready to discuss it with you.
my bad - I call back my point "2.". But we have to allow single no argument annotation for method as Max posted above.
1)
Проверить indentation. Если он отличается от indentation MethodDef, CtorDef или ClassDef - ОШИБКА Indentation: если Indentation аннотации и Variable_Def отличается, то ОШИБКА.
Why do we have to check the indentation? I don't think it is a job of this check
2) Don't forget about enums and interfaces
@romani
<module name="AnnotationIndentation"/>
@rdiachenko
Why do we have to check the indentation? I don't think it is a job of this check
I agree with you. We shouldn't check Indentation. I have updated issue: https://github.com/maxvetrenko/checkstyle/issues/26
Don't forget about enums and interfaces
Done
I do not like that implementation, i do not see how you diff location on annotation for methods and fields separately. Check should be named - AnnotationLocation, as we do not check indentation only, we mostly focused location( same line or separate line). Please provide me links who do indentation verification of annotation. That check should be desined to have two options:
User will create few intances of configuration- for fileds, for methods, for class, ...
@romani
I redesigned Check, now it separately checks fields annotations and else annotations. checkAnnotations()
and checkFieldAnnotations()
validate both cases. Also was added allowSamelineParametrizedAnnotation
and allowSameLineSingleParrametterlessAnnotation
options.
http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.8.5-annotations
These line breaks do not constitute line-wrappin, so the indentation level is not increased. Example: