rspec/rules/S3340/java/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

60 lines
1.4 KiB
Plaintext

== Why is this an issue?
For optimal code readability, annotation arguments should be specified in the same order that they were declared in the annotation definition.
=== Noncompliant code example
[source,java]
----
@interface Pet {
String name();
String surname();
}
@Pet(surname ="", name="") // Noncompliant
----
=== Compliant solution
[source,java]
----
@interface Pet {
String name();
String surname();
}
@Pet(name ="", surname="") // Compliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Reorder these annotation arguments to match their order of declaration.
'''
== Comments And Links
(visible only on this page)
=== on 1 Sep 2015, 12:30:47 Ann Campbell wrote:
In my editing, [~nicolas.peru], I haven't filled in a message. It's unclear to me whether you want to raise an issue per argument or an issue per annotation. So I've left that to you to fill in. :-)
=== on 23 Sep 2015, 13:34:36 Nicolas Peru wrote:
\[~ann.campbell.2] can you review message and mark as complete if it is ok for you ?
=== on 28 Sep 2015, 18:07:53 Ann Campbell wrote:
done [~nicolas.peru]
=== on 1 Oct 2019, 11:32:16 Michael Gumowski wrote:
This rule is deprecated, without alternative. Nothing in JVMLS, or JLS, guarantees that order of annotation members will be preserved once compiled. See SONARJAVA-3194 for more details.
endif::env-github,rspecator-view[]