Alissa Bonas has posted comments on this change.
Change subject: build: checkstyle to disallow final members
......................................................................
Patch Set 2: (2 inline comments)
....................................................
File
build-tools-root/ovirt-checkstyle-extension/src/main/java/checks/NoFinalMemberCheck.java
Line 22: public void visitToken(DetailAST aAST) {
Line 23: if (run) {
Line 24: if (aAST.getType() == TokenTypes.VARIABLE_DEF // A variable
Line 25: && aAST.getParent().getType() ==
TokenTypes.OBJBLOCK // which is a class variable
Line 26: && aAST.getParent().getParent().getType() !=
TokenTypes.ENUM_DEF // and not in an enum
why here is getParent.getParent twice? Isn't it just one level of hierarchy?
Line 27: ) {
Line 28:
Line 29: // find the modifiers
Line 30: DetailAST child = aAST.getFirstChild();
Line 31: while (child != null) {
Line 32: // final is only allowed for statics (i.e.,
constants)
Line 33: if (child.branchContains(TokenTypes.FINAL) &&
Line 34:
!child.branchContains(TokenTypes.LITERAL_STATIC)) {
Line 35: log(child.getLineNo(), child.getColumnNo(),
"non-static final member variables are not allowed");
if the message is printed in loop for each problematic member (and not exiting
the loop after the first one), won't it just print the same general message
several times?
I'd rather either print it only once, or at least inject the member name to the
message if applicable.
Line 36: }
Line 37: child = child.getNextSibling();
Line 38: }
Line 39: }
--
To view, visit http://gerrit.ovirt.org/16252
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I809e7f670cf86b47dbd7ae1fc6f73eff9837a129
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Alissa Bonas <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches