diff --git a/build.xml b/build.xml index 111d1518e..6181b114a 100644 --- a/build.xml +++ b/build.xml @@ -72,6 +72,7 @@ + diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java index 1536fdf3c..e00bf5134 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheck.java @@ -113,21 +113,16 @@ public class GenericIllegalRegexpCheck extends AbstractFormatCheck public RE getRegexp() { final RE regexp = super.getRegexp(); + + // we should explicitly set match flags because + // we caching RE and another check (or instance + // of this check could change match flags. if (mIgnoreCase) { regexp.setMatchFlags(RE.MATCH_CASEINDEPENDENT); } - // Without the else, in a sequence of GenericIllegalRegexpCheck's, - // the first with mIgnoreCase true, the second with mIgnoreCase - // false, the second still has match behaviour flags as - // RE.MATCH_CASEINDEPENDENT. - // This happens with GenericIllegalRegexpCheckTest method - // testIgnoreCaseFalse(), for example. - // TODO: Check whether this a bug or known feature of - // org.apache.regexp.RE. else { regexp.setMatchFlags(RE.MATCH_NORMAL); } return regexp; } - } diff --git a/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputInvalidBlockIndent.java b/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputInvalidBlockIndent.java index 8ca3111a8..e456dc5b3 100644 --- a/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputInvalidBlockIndent.java +++ b/src/testinputs/com/puppycrawl/tools/checkstyle/indentation/InputInvalidBlockIndent.java @@ -84,8 +84,8 @@ public class InputInvalidBlockIndent { } -/* - static init at beginning of line is broken for now + +// static init at beginning of line is broken for now static { int var = 4; } @@ -93,7 +93,7 @@ public class InputInvalidBlockIndent { static { - int var = 4; + int var = 4; } static { @@ -112,7 +112,7 @@ public class InputInvalidBlockIndent { { int var = 4; } - */ + static { diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/IndentationCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/IndentationCheckTest.java index fb0e240e2..2460cec6b 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/IndentationCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/IndentationCheckTest.java @@ -364,7 +364,18 @@ public class IndentationCheckTest extends BaseCheckTestCase { "66: block lcurly at indentation level 10 not at correct indentation, 12", "67: block child at indentation level 14 not at correct indentation, 16", "82: block rcurly at indentation level 10 not at correct indentation, 12", -// TODO: static gives back wrong colno "87: block static at indentation level 2 not at correct indentation, 4", + "91: static initialization at indentation level 2 not at correct indentation, 4", + "92: static initialization at indentation level 6 not at correct indentation, 4", + "96: static initialization child at indentation level 7 not at correct indentation, 8", + "99: static initialization at indentation level 6 not at correct indentation, 4", + "101: static initialization rcurly at indentation level 2 not at correct indentation, 4", + "103: static initialization at indentation level 2 not at correct indentation, 4", + "105: static initialization rcurly at indentation level 6 not at correct indentation, 4", + "107: static initialization at indentation level 2 not at correct indentation, 4", + "109: static initialization child at indentation level 6 not at correct indentation, 8", + "112: static initialization lcurly at indentation level 2 not at correct indentation, 4", + "113: static initialization child at indentation level 6 not at correct indentation, 8", + "114: static initialization rcurly at indentation level 6 not at correct indentation, 4", "119: static initialization child at indentation level 6 not at correct indentation, 8", "124: static initialization child at indentation level 4 not at correct indentation, 8", "125: static initialization rcurly at indentation level 2 not at correct indentation, 4",