Skip to content

Commit 7b1a3ac

Browse files
committed
cleanup
1 parent 1277bb8 commit 7b1a3ac

17 files changed

Lines changed: 232 additions & 152 deletions

checkstyle.xml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,82 @@
1717
<property name="eachLine" value="true"/>
1818
</module>
1919

20+
<module name="LineLength">
21+
<property name="max" value="120"/>
22+
</module>
23+
24+
<!-- Prevent two spaces after @xxxx -->
25+
<module name="RegexpSingleline">
26+
<property name="format" value="\* *@\w* "/>
27+
</module>
28+
29+
<module name="RegexpSingleline">
30+
<property name="format" value="\*\*/"/>
31+
<property name="message" value="Trailing two asterisks."/>
32+
</module>
33+
34+
<module name="RegexpSingleline">
35+
<property name="format" value="\s$"/>
36+
<property name="message" value="Trailing whitespace found."/>
37+
</module>
38+
39+
<module name="RegexpSingleline">
40+
<property name="format" value="\(value = (\w|\d)+\)"/>
41+
<property name="message" value="Unneeded 'value' literal."/>
42+
</module>
43+
44+
<module name="RegexpMultiline">
45+
<property name="format" value="(?&lt;=\r?\n)\r?\n\r?\n"/>
46+
<property name="message" value="Two empty contiguous lines"/>
47+
</module>
48+
49+
<module name="RegexpMultiline">
50+
<property name="format" value="package .*\r?\nimport"/>
51+
<property name="message" value="Package declaration should be followed by an empty line"/>
52+
</module>
53+
54+
<module name="RegexpMultiline">
55+
<property name="format" value="\r?\n\r?\npackage"/>
56+
<property name="message" value="Package declaration should not be preceeded by an empty line"/>
57+
</module>
58+
59+
<module name="RegexpSingleline">
60+
<property name="format" value="@JsxFunction\(\)|@JsxGetter\(\)|@JsxSetter\(\)|@JsxConstructor\(\)|@Alerts\(\)$"/>
61+
<property name="message" value="No need to specify parentheses"/>
62+
</module>
63+
64+
<module name="RegexpSingleline">
65+
<property name="format" value="@Alerts$"/>
66+
<property name="message" value="No need to specify empty @Alerts"/>
67+
</module>
68+
69+
<module name="RegexpSingleline">
70+
<property name="format" value="serialVersionUID"/>
71+
<property name="message" value="No need to specify serialVersionUID"/>
72+
</module>
73+
74+
<module name="RegexpSingleline">
75+
<property name="format" value="\{ &quot;&quot; \}"/>
76+
<property name="message" value="No need for the curly brackets"/>
77+
</module>
78+
79+
<module name="RegexpSingleline">
80+
<property name="format" value="@version"/>
81+
</module>
82+
83+
<module name="RegexpSingleline">
84+
<property name="format" value="^(?!import).*BrowserVersionFeatures\.[A-Z]"/>
85+
<property name="message" value="Use static import for BrowserVersionFeatures"/>
86+
</module>
87+
88+
<!--
89+
<module name="RegexpMultiline">
90+
<property name="id" value="sysout"/>
91+
<property name="format" value="System\s*\.\s*(out)|(err)\s*\.\s*print(ln)?\("/>
92+
<property name="message" value="System.out.print/ln found"/>
93+
</module>
94+
-->
95+
2096
<module name="TreeWalker">
2197

2298

src/main/java/org/htmlunit/xpath/axes/PredicatedNodeTest.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Object clone() throws CloneNotSupportedException {
7373
* @return the number of predicates that this walker has.
7474
*/
7575
public int getPredicateCount() {
76-
if (-1 == m_predCount) return (null == m_predicates) ? 0 : m_predicates.length;
76+
if (-1 == m_predCount) return (null == predicates_) ? 0 : predicates_.length;
7777
return m_predCount;
7878
}
7979

@@ -88,9 +88,9 @@ public int getPredicateCount() {
8888
public void setPredicateCount(final int count) {
8989
if (count > 0) {
9090
final Expression[] newPredicates = new Expression[count];
91-
System.arraycopy(m_predicates, 0, newPredicates, 0, count);
92-
m_predicates = newPredicates;
93-
} else m_predicates = null;
91+
System.arraycopy(predicates_, 0, newPredicates, 0, count);
92+
predicates_ = newPredicates;
93+
} else predicates_ = null;
9494
}
9595

9696
/**
@@ -106,10 +106,10 @@ protected void initPredicateInfo(final Compiler compiler, final int opPos)
106106
final int pos = compiler.getFirstPredicateOpPos(opPos);
107107

108108
if (pos > 0) {
109-
m_predicates = compiler.getCompiledPredicates(pos);
110-
if (null != m_predicates) {
111-
for (final Expression m_predicate : m_predicates) {
112-
m_predicate.exprSetParent(this);
109+
predicates_ = compiler.getCompiledPredicates(pos);
110+
if (null != predicates_) {
111+
for (final Expression predicate : predicates_) {
112+
predicate.exprSetParent(this);
113113
}
114114
}
115115
}
@@ -122,7 +122,7 @@ protected void initPredicateInfo(final Compiler compiler, final int opPos)
122122
* @return A predicate expression.
123123
*/
124124
public Expression getPredicate(final int index) {
125-
return m_predicates[index];
125+
return predicates_[index];
126126
}
127127

128128
/**
@@ -223,7 +223,7 @@ boolean executePredicates(final int context, final XPathContext xctxt)
223223
xctxt.pushCurrentNode(context);
224224

225225
for (int i = 0; i < nPredicates; i++) {
226-
final XObject pred = m_predicates[i].execute(xctxt);
226+
final XObject pred = predicates_[i].execute(xctxt);
227227
// System.out.println("\nBack from executing predicate expression - waiting
228228
// count:
229229
// "+m_lpi.getWaitingCount());
@@ -262,7 +262,7 @@ boolean executePredicates(final int context, final XPathContext xctxt)
262262
// We can't set m_foundLast = true unless we're sure that -all-
263263
// remaining parameters are stable, or else last() fails. Fixed so
264264
// only sets m_foundLast if on the last predicate
265-
if (m_predicates[i].isStableNumber() && i == nPredicates - 1) {
265+
if (predicates_[i].isStableNumber() && i == nPredicates - 1) {
266266
m_foundLast = true;
267267
}
268268
} else if (!pred.bool()) return false;
@@ -362,10 +362,10 @@ public boolean canTraverseOutsideSubtree() {
362362
* @param visitor The visitor whose appropriate method will be called.
363363
*/
364364
public void callPredicateVisitors(final XPathVisitor visitor) {
365-
if (null != m_predicates) {
366-
for (final Expression m_predicate : m_predicates) {
367-
if (visitor.visitPredicate(m_predicate)) {
368-
m_predicate.callVisitors(visitor);
365+
if (null != predicates_) {
366+
for (final Expression predicate : predicates_) {
367+
if (visitor.visitPredicate(predicate)) {
368+
predicate.callVisitors(visitor);
369369
}
370370
}
371371
}
@@ -377,14 +377,14 @@ public boolean deepEquals(final Expression expr) {
377377
if (!super.deepEquals(expr)) return false;
378378

379379
final PredicatedNodeTest pnt = (PredicatedNodeTest) expr;
380-
if (null != m_predicates) {
380+
if (null != predicates_) {
381381

382-
final int n = m_predicates.length;
383-
if ((null == pnt.m_predicates) || (pnt.m_predicates.length != n)) return false;
382+
final int n = predicates_.length;
383+
if ((null == pnt.predicates_) || (pnt.predicates_.length != n)) return false;
384384
for (int i = 0; i < n; i++) {
385-
if (!m_predicates[i].deepEquals(pnt.m_predicates[i])) return false;
385+
if (!predicates_[i].deepEquals(pnt.predicates_[i])) return false;
386386
}
387-
} else if (null != pnt.m_predicates) return false;
387+
} else if (null != pnt.predicates_) return false;
388388

389389
return true;
390390
}
@@ -407,7 +407,7 @@ public boolean deepEquals(final Expression expr) {
407407
*
408408
* @serial
409409
*/
410-
private Expression[] m_predicates;
410+
private Expression[] predicates_;
411411

412412
/** An array of counts that correspond to the number of predicates the step contains. */
413413
protected transient int[] m_proximityPositions;

0 commit comments

Comments
 (0)