File tree Expand file tree Collapse file tree
java-checks-test-sources/default/src/main/java/checks
java-checks/src/main/java/org/sonar/java/checks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // SONARJAVA-6028: FPs ahead. Only the line with "Too much." should be noncompliant.
2-
3- void main () { // Noncompliant
4- System .out .println ("Just right." ); // Noncompliant
1+ void main () {
2+ System .out .println ("Just right." );
53 if (true ) {
64 System .out .println ("Too much." ); // Noncompliant
75 }
86}
97
10- class MyClass { // Noncompliant
8+ class MyClass {
9+ void myMethod () {
10+ System .err .println ("Error message" );
11+ }
12+
13+ static private class MyNestedClass {
14+ private final static int VALUE = 42 ;
15+ public float pi = 3.14f ;
16+ public String badlyIndentedField = "Oops" ; // Noncompliant
17+ public String secondBadlyIndentedField = "Oops x 2" ; // Compliant, raised on previous line
18+
19+
20+ void anotherMethod () {
21+ System .out .println ("Nested class output" );
22+ }
23+ }
1124}
25+
26+ int i = 0 ;
27+ public String badlyIndentedField = "Oops" ; // Noncompliant
28+ public String secondBadlyIndentedField = "Oops x 2" ; // Compliant, raised on previous line
29+ int j = 0 ;
Original file line number Diff line number Diff line change @@ -82,7 +82,9 @@ public void visitClass(ClassTree tree) {
8282 excludeIssueAtLine = LineUtils .startLine (tree .openBraceToken ());
8383 expectedLevel = Position .startOf (tree .closeBraceToken ()).columnOffset ();
8484 }
85- newBlock ();
85+ if (!tree .is (Kind .IMPLICIT_CLASS )) {
86+ newBlock ();
87+ }
8688 checkIndentation (tree .members ());
8789 super .visitClass (tree );
8890 leaveNode (tree );
You can’t perform that action at this time.
0 commit comments