Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#518 arrays and incorrect indentation

release_4.4
closed
nobody
None
5
2014-04-04
2008-07-04
feniks
No

Hello,

I think there is a problem with the Indentation test when using arrays.
The following line gives a problem (see attachment for complete code example):

test.getArrayOfStrings()[0] = "A string";

I'm using the Eclipse checkstyle plugin, but that imo just a gui for checkstyle, and the problem is in checkstyle itself.

Under Miscellaneous -> Indentation, I use the default check (basicOffset=4, braceAdjustment=0, caseInd=4).

When the line is indented on 8 positions (what we use) I get this message:
Indentation: method call child at indentation level 8 not at correct indentation, 12
If I indent it at 12 position, I get another message:
Indentation: method def child at indentation level 12 not at correct indentation, 8

There does not seem to be any way to validate the line, so I think this is a bug.

Discussion

  • feniks
    feniks
    2008-07-04

    Test.java example code, unable to remove the warning

     
    Attachments
  • feniks
    feniks
    2008-11-07

    In fact it's not only when using arrays the same type of problem can occur with simple classes.
    I'll attach another file that proves this.

     
  • feniks
    feniks
    2008-11-07

    Same problem but without arrays

     
    Attachments
  • feniks
    feniks
    2008-11-07

    File Added: IndentProblem.java

     
  • Kyung Tae Kang
    Kyung Tae Kang
    2009-10-29

    Hi.
    I resolved the above method call's indentation bug.
    This bug happens because there is a collision between Method Call's Indentation and Assingment Indentation.
    Our companay uses Checkstyle 4.4. So if you use Checkstyle 4.4 I can send checkstyle-all-4.4.jar or checkstyle-4.4.jar.

     
  • Roman Ivanov
    Roman Ivanov
    2013-11-13

    • status: open --> closed
     
  • Pavel Sakun
    Pavel Sakun
    2014-04-03

    Was it fixed? There is still issue with methods returning array .doSmth()[i].
    Is there some workaround available other that using //CHECKSTYLE:Indentation:OFF ?