I often rely on the JDK source code to understand how I should implement an interface, and I often find some very strange indentation style at use. For instance, in DefaultCellEditor.java:
public DefaultCellEditor(final JTextField textField) {
editorComponent = textField;
this.clickCountToStart = 2;
delegate = new EditorDelegate() {
public void setValue(Object value) {
textField.setText((value != null) ? value.toString() : "");
}
public Object getCellEditorValue() {
return textField.getText();
}
};
textField.addActionListener(delegate);
}
I’m wondering if this is due to my IDE or not, since I find this kind of indentation quite strange and difficult to read.
If the indentation is consistent across different methods, then there’s probably some (unwritten) reason why it’s that way.
If there’s no rhyme or reason, then (a) the coder(s) didn’t care about indentation, or (b) the coder(s) did care, and something happened en route to your computer. The likely culprit is that not enough attention was given to how tabs and spaces were used to structure the code, and your IDE’s indentation settings for tabs are different than those of the last person’s who touched the code.
If you can make the whitespace characters visible in your text editor, that should show you if a mix of tabs and spaces was used.