Skip to content

Commit 3d132b3

Browse files
committed
Use the same Checkstyle configuration as in branch POOL_2_X
1 parent e200ab6 commit 3d132b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+847
-834
lines changed

pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<commons.componentid>pool</commons.componentid>
9090
<commons.module.name>org.apache.commons.pool3</commons.module.name>
9191
<commons.rc.version>RC1</commons.rc.version>
92+
<checkstyle.suppress.file>${basedir}/src/conf/checkstyle-suppressions.xml</checkstyle.suppress.file>
9293
<!-- Java 17 -->
9394
<commons.release.version>3.0.0</commons.release.version>
9495
<commons.release.desc>(Java 17)</commons.release.desc>
@@ -137,8 +138,10 @@
137138
<artifactId>maven-checkstyle-plugin</artifactId>
138139
<configuration>
139140
<configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
140-
<enableRulesSummary>false</enableRulesSummary>
141+
<suppressionsLocation>${checkstyle.suppress.file}</suppressionsLocation>
141142
<headerLocation>${basedir}/license-header.txt</headerLocation>
143+
<enableRulesSummary>false</enableRulesSummary>
144+
<includeTestSourceDirectory>true</includeTestSourceDirectory>
142145
</configuration>
143146
</plugin>
144147
<plugin>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
https://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<!DOCTYPE suppressions PUBLIC
19+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
20+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
21+
<!-- SEE: http://checkstyle.sourceforge.net/config.html#Examples -->
22+
<suppressions>
23+
<suppress checks="JavadocPackage" files="src[/\\]test[/\\]java[/\\]" />
24+
<suppress checks="NewlineAtEndOfFile" files="./target/classes/META-INF/maven/org.apache.commons/commons-pool3/pom.properties" />
25+
</suppressions>

src/conf/checkstyle.xml

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -22,78 +22,78 @@
2222
<!--
2323
Checkstyle checks configured for Maven.
2424
-->
25-
2625
<module name="Checker">
27-
28-
<property name="localeLanguage" value="en"/>
29-
30-
<!-- No tabs allowed! -->
31-
<module name="FileTabCharacter"/>
32-
33-
<module name="TreeWalker">
34-
35-
<!-- Operator must be at end of wrapped line -->
36-
<module name="OperatorWrap">
37-
<property name="option" value="eol"/>
38-
</module>
39-
40-
<!-- Interfaces must be types (not just constants) -->
41-
<module name="InterfaceIsType"/>
42-
43-
<!-- Must have class / interface header comments -->
44-
<module name="JavadocType"/>
45-
46-
<!-- Require method javadocs, allow undeclared RTE -->
47-
<module name="JavadocMethod">
48-
</module>
49-
50-
<!-- Require field javadoc -->
51-
<module name="JavadocVariable">
52-
<property name="scope" value="protected"/>
53-
</module>
54-
55-
<!-- No public fields -->
56-
<module name="VisibilityModifier">
57-
<property name="packageAllowed" value="true"/>
58-
<property name="protectedAllowed" value="true"/>
59-
</module>
60-
61-
<!-- Require hash code override when equals is -->
62-
<module name="EqualsHashCode"/>
63-
64-
<!-- Disallow unnecessary instantiation of Boolean, String -->
65-
<module name="IllegalInstantiation">
66-
<property name="classes" value="java.lang.Boolean, java.lang.String"/>
67-
</module>
68-
<module name="ImportOrder">
69-
<property name="option" value="top"/>
70-
<property name="groups" value="java,javax,org"/>
71-
<property name="ordered" value="true"/>
72-
<property name="separated" value="true"/>
73-
</module>
74-
<module name="ParenPad" />
75-
<module name="TypecastParenPad" />
76-
</module>
77-
78-
<!-- Require package Javadoc -->
26+
<property name="localeLanguage" value="en" />
27+
<module name="FileTabCharacter" />
7928
<module name="JavadocPackage">
80-
<!-- setting allowLegacy means it will check for package.html instead of just package-info.java -->
81-
<property name="allowLegacy" value="true"/>
29+
<property name="allowLegacy" value="true" />
8230
</module>
83-
8431
<module name="LineLength">
85-
<property name="max" value="160"/>
32+
<property name="max" value="160" />
33+
</module>
34+
<module name="NewlineAtEndOfFile">
35+
<!-- Files are saved in the repository with LF line endings; on Windows, use git config core.autocrlf input -->
36+
<property name="lineSeparator" value="lf" />
8637
</module>
87-
<!-- @author tags are deprecated -->
8838
<module name="RegexpSingleline">
8939
<property name="format" value="^\s+\*\s+@author\s" />
9040
<property name="message" value="Deprecated @author tag" />
9141
<property name="fileExtensions" value="java" />
9242
<property name="severity" value="warning" />
9343
</module>
9444
<module name="RegexpSingleline">
95-
<!-- \s matches whitespace character, $ matches end of line. -->
9645
<property name="format" value="\s+$" />
9746
<property name="message" value="Line has trailing spaces." />
9847
</module>
48+
<module name="TreeWalker">
49+
<module name="ArrayTypeStyle" />
50+
<module name="AvoidStarImport" />
51+
<module name="CovariantEquals" />
52+
<module name="DefaultComesLast" />
53+
<module name="EmptyBlock">
54+
<property name="option" value="text" />
55+
</module>
56+
<module name="EqualsHashCode" />
57+
<module name="ExplicitInitialization" />
58+
<module name="FinalLocalVariable" />
59+
<module name="IllegalInstantiation" />
60+
<module name="ImportOrder">
61+
<property name="option" value="top" />
62+
<property name="groups" value="java,javax,org" />
63+
<property name="ordered" value="true" />
64+
<property name="separated" value="true" />
65+
</module>
66+
<module name="InterfaceIsType" />
67+
<module name="JavadocType" />
68+
<module name="JavadocMethod">
69+
</module>
70+
<module name="JavadocVariable">
71+
<property name="scope" value="protected" />
72+
</module>
73+
<module name="LeftCurly" />
74+
<module name="MethodParamPad"/>
75+
<module name="MissingOverride" />
76+
<module name="ModifierOrder" />
77+
<module name="MultipleVariableDeclarations" />
78+
<module name="NeedBraces" />
79+
<module name="ParenPad" />
80+
<module name="RedundantImport" />
81+
<module name="RedundantModifier" />
82+
<module name="RightCurly" />
83+
<module name="SimplifyBooleanExpression" />
84+
<module name="SimplifyBooleanReturn" />
85+
<module name="StringLiteralEquality" />
86+
<module name="SuperClone" />
87+
<module name="SuperFinalize" />
88+
<module name="TypecastParenPad" />
89+
<module name="UnnecessaryParentheses" />
90+
<module name="UnusedImports" />
91+
<module name="UpperEll" />
92+
<module name="VisibilityModifier">
93+
<property name="packageAllowed" value="true" />
94+
<property name="protectedAllowed" value="true" />
95+
</module>
96+
<module name="WhitespaceAfter" />
97+
<module name="WhitespaceAround" />
98+
</module>
9999
</module>

src/main/java/org/apache/commons/pool3/PoolUtils.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static final class ErodingFactor {
6464
* @param factor
6565
* erosion factor
6666
*/
67-
public ErodingFactor(final float factor) {
67+
ErodingFactor(final float factor) {
6868
this.factor = factor;
6969
nextShrinkMillis = System.currentTimeMillis() + (long) (900000 * factor); // now + 15 min * factor
7070
idleHighWaterMark = 1;
@@ -133,11 +133,9 @@ private static class ErodingKeyedObjectPool<K, V, E extends Exception> implement
133133
* events
134134
* @see #erodingFactor
135135
*/
136-
protected ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool,
137-
final ErodingFactor erodingFactor) {
136+
ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final ErodingFactor erodingFactor) {
138137
if (keyedPool == null) {
139-
throw new IllegalArgumentException(
140-
MSG_NULL_KEYED_POOL);
138+
throw new IllegalArgumentException(MSG_NULL_KEYED_POOL);
141139
}
142140
this.keyedPool = keyedPool;
143141
this.erodingFactor = erodingFactor;
@@ -154,8 +152,7 @@ protected ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool,
154152
* events
155153
* @see #erodingFactor
156154
*/
157-
public ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool,
158-
final float factor) {
155+
ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final float factor) {
159156
this(keyedPool, new ErodingFactor(factor));
160157
}
161158

@@ -351,7 +348,7 @@ private static final class ErodingObjectPool<T, E extends Exception> implements
351348
* events
352349
* @see #factor
353350
*/
354-
public ErodingObjectPool(final ObjectPool<T, E> pool, final float factor) {
351+
ErodingObjectPool(final ObjectPool<T, E> pool, final float factor) {
355352
this.pool = pool;
356353
this.factor = new ErodingFactor(factor);
357354
}
@@ -360,7 +357,7 @@ public ErodingObjectPool(final ObjectPool<T, E> pool, final float factor) {
360357
* {@inheritDoc}
361358
*/
362359
@Override
363-
public void addObject() throws E, IllegalStateException, UnsupportedOperationException{
360+
public void addObject() throws E, IllegalStateException, UnsupportedOperationException {
364361
pool.addObject();
365362
}
366363

@@ -492,7 +489,7 @@ private static final class ErodingPerKeyKeyedObjectPool<K, V, E extends Exceptio
492489
* @param factor
493490
* erosion factor
494491
*/
495-
public ErodingPerKeyKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final float factor) {
492+
ErodingPerKeyKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final float factor) {
496493
super(keyedPool, null);
497494
this.factor = factor;
498495
}

src/main/java/org/apache/commons/pool3/impl/BaseGenericObjectPool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static <T> IdentityWrapper<T> on(final PooledObject<T> pooledObject) {
226226
*
227227
* @param instance object to wrap.
228228
*/
229-
public IdentityWrapper(final T instance) {
229+
IdentityWrapper(final T instance) {
230230
this.instance = instance;
231231
}
232232

@@ -1153,7 +1153,7 @@ private ObjectName jmxRegister(final BaseObjectPoolConfig<T> config,
11531153
}
11541154
while (!registered) {
11551155
try {
1156-
ObjectName objName;
1156+
final ObjectName objName;
11571157
// Skip the numeric suffix for the first pool in case there is
11581158
// only one so the names are cleaner.
11591159
if (i == 1) {

src/main/java/org/apache/commons/pool3/impl/CallStack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ public interface CallStack {
5050
* @param writer a PrintWriter to write the current stack trace to if available
5151
* @return true if a stack trace was available to print or false if nothing was printed
5252
*/
53-
boolean printStackTrace(final PrintWriter writer);
53+
boolean printStackTrace(PrintWriter writer);
5454
}

src/main/java/org/apache/commons/pool3/impl/DefaultPooledObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,4 @@ public void use() {
295295
usedBy.fillInStackTrace();
296296
}
297297

298-
}
298+
}

src/main/java/org/apache/commons/pool3/impl/GenericKeyedObjectPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static final class ObjectDeque<S> {
129129
* @param fairness true means client threads waiting to borrow / return instances
130130
* will be served as if waiting in a FIFO queue.
131131
*/
132-
public ObjectDeque(final boolean fairness) {
132+
ObjectDeque(final boolean fairness) {
133133
idleObjects = new LinkedBlockingDeque<>(fairness);
134134
}
135135

src/main/java/org/apache/commons/pool3/impl/InterruptibleReentrantLock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class InterruptibleReentrantLock extends ReentrantLock {
3939
* @param fairness true means threads should acquire contended locks as if
4040
* waiting in a FIFO queue
4141
*/
42-
public InterruptibleReentrantLock(final boolean fairness) {
42+
InterruptibleReentrantLock(final boolean fairness) {
4343
super(fairness);
4444
}
4545

@@ -48,7 +48,7 @@ public InterruptibleReentrantLock(final boolean fairness) {
4848
*
4949
* @param condition the condition on which the threads are waiting.
5050
*/
51-
public void interruptWaiters(final Condition condition) {
51+
void interruptWaiters(final Condition condition) {
5252
getWaitingThreads(condition).forEach(Thread::interrupt);
5353
}
5454
}

0 commit comments

Comments
 (0)