Skip to content

Commit 2a8b571

Browse files
authored
Broaden files that checkstyle sees, fix errors it found (#10251)
1 parent a433a55 commit 2a8b571

13 files changed

Lines changed: 30 additions & 36 deletions

File tree

dev/build.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,20 +283,18 @@
283283
<filename name="com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java"
284284
negate="yes"/>
285285
<filename name="com/google/gwt/dev/js/rhino/**/*.java" negate="yes"/>
286-
<filename name="org/eclipse/**/*.java" negate="yes"/>
287-
<filename name="org/apache/**/*.java" negate="yes"/>
288286
</fileset>
289287
<fileset dir="core/super"/>
288+
<fileset dir="codeserver/java"/>
290289
</gwt.checkstyle>
291290
</target>
292291

293292
<target name="checkstyle-tests" description="Static analysis of tests">
294293
<gwt.checkstyle.tests>
295294
<fileset dir="core/test">
296-
<filename name="com/google/gwt/dev/js/rhino/**/*.java" negate="yes"/>
297-
<filename name="org/eclipse/**/*.java" negate="yes"/>
298295
<filename name="org/apache/**/*.java" negate="yes"/>
299296
</fileset>
297+
<fileset dir="codeserver/javatests" />
300298
</gwt.checkstyle.tests>
301299
</target>
302300

dev/codeserver/java/com/google/gwt/dev/codeserver/WebServer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@
3737
import java.io.IOException;
3838
import java.io.InputStream;
3939
import java.util.Date;
40-
import java.util.EnumSet;
4140
import java.util.HashMap;
4241
import java.util.List;
4342
import java.util.Map;
4443
import java.util.concurrent.ExecutionException;
4544
import java.util.regex.Matcher;
4645
import java.util.regex.Pattern;
4746

48-
import javax.servlet.DispatcherType;
4947
import javax.servlet.ServletException;
5048
import javax.servlet.http.HttpServlet;
5149
import javax.servlet.http.HttpServletRequest;

dev/codeserver/javatests/com/google/gwt/dev/codeserver/client/CodeServerGwtTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public native void testRecompiler() /*-{
150150
// do the test
151151
recompiler.compile(function(result) {
152152
callbackCalled = true;
153-
//compile is done
153+
// compile is done
154154
assertStringEquals('ok', result.status);
155155
assertStringEquals('http://mytesthost:7812/recompile/testModule' +
156156
'?prop1=val1&prop2=val2&_callback=__gwt_sdm_globals.callbacks.c1234',
@@ -200,7 +200,7 @@ public native void testMetaTagParser() /*-{
200200
assertStringEquals('test2', props.test1);
201201
}-*/;
202202

203-
public native void testBaseUrlProvider_nocache () /*-{
203+
public native void testBaseUrlProvider_nocache() /*-{
204204
var assertStringEquals = @CodeServerGwtTest::assertEquals(Ljava/lang/String;Ljava/lang/String;);
205205
var BaseUrlProvider = $wnd.namespace.lib.BaseUrlProvider;
206206
var baseUrlProvider = new BaseUrlProvider('testModule');
@@ -228,7 +228,7 @@ public native void testBaseUrlProvider_nocache () /*-{
228228
}-*/;
229229

230230
// Issue #8973
231-
public native void testBaseUrlProvider_nocache_relative_with_querystring () /*-{
231+
public native void testBaseUrlProvider_nocache_relative_with_querystring() /*-{
232232
var assertStringEquals = @CodeServerGwtTest::assertEquals(Ljava/lang/String;Ljava/lang/String;);
233233
var BaseUrlProvider = $wnd.namespace.lib.BaseUrlProvider;
234234
var baseUrlProvider = new BaseUrlProvider('testModule');
@@ -293,7 +293,6 @@ public native void testBaseUrlProvider_basetag() /*-{
293293
return null;
294294
};
295295
296-
297296
baseUrlProvider.__getBaseElements = function() {
298297
return [
299298
{href: 'http://localhost:9876/somepath1/'},
@@ -312,7 +311,7 @@ public native void testBaseUrlProvider_basetag() /*-{
312311
}-*/;
313312

314313
private void ensureJsInjected() {
315-
if(injected) {
314+
if (injected) {
316315
return;
317316
}
318317
Resource res = GWT.create(Resource.class);

tools/datetimefmtcreator/src/com/google/gwt/tools/datetimefmtcreator/DateTimeFormatCreator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ private void generateAlias(GwtLocale locale, GwtLocale parent) throws IOExceptio
232232
out.close();
233233
}
234234
}
235-
236235
}
237236

238237
private void generateLocale(GwtLocale locale, GwtLocale parent, Map<String, String[]> values)

user/build.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,23 +313,24 @@
313313
<target name="checkstyle-source" description="Static analysis of source">
314314
<gwt.checkstyle>
315315
<fileset dir="src">
316+
<exclude name="org/hibernate/validator/ValidationMessages.java"/>
317+
</fileset>
318+
<fileset dir="super">
316319
<exclude name="javax/validation/super/javax/validation/constraints/Pattern.java"/>
317320
<exclude name="javax/validation/super/javax/validation/spi/ConfigurationState.java"/>
318321
<exclude name="javax/validation/super/javax/validation/MessageInterpolator.java"/>
319322
<exclude name="javax/validation/super/javax/validation/Configuration.java"/>
320-
<exclude name="javax/validation/super/javax/validation/Validation.java"/>
321-
<exclude name="org/hibernate/validator/super/org/hibernate/validator/**/*.java"/>
322-
<exclude name="org/hibernate/validator/ValidationMessages.java"/>
323+
<exclude name="org/hibernate/validator/super/org/hibernate/validator/engine/PathImpl.java"/>
323324
</fileset>
324-
<fileset dir="super/com/google/gwt/emul"/>
325-
<fileset dir="super/com/google/gwt/junit/translatable"/>
326325
</gwt.checkstyle>
327326
</target>
328327
<target name="checkstyle-tests" description="Static analysis of source">
329328
<gwt.checkstyle.tests>
330329
<fileset dir="test">
331-
<include name="com/google/**/*.java"/>
332-
<include name="test/**"/>
330+
<exclude name="org/**" />
331+
</fileset>
332+
<fileset dir="test-super">
333+
<exclude name="org/**" />
333334
</fileset>
334335
</gwt.checkstyle.tests>
335336
</target>

user/super/com/google/gwt/emul/java/lang/Math.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static int floorMod(long dividend, int divisor) {
154154
return (int) floorMod(dividend, (long) divisor);
155155
}
156156

157-
@SuppressWarnings("CheckStyle.MethodName")
157+
@SuppressWarnings("checkstyle:MethodName")
158158
public static double IEEEremainder(double v, double m) {
159159
double ratio = v / m;
160160
double closest = Math.ceil(ratio);

user/super/com/google/gwt/emul/java/lang/StrictMath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public static double cbrt(double x) {
285285
return Math.cbrt(x);
286286
}
287287

288-
@SuppressWarnings("CheckStyle.MethodName")
288+
@SuppressWarnings("checkstyle:MethodName")
289289
public static double IEEEremainder(double x, double y) {
290290
return Math.IEEEremainder(x, y);
291291
}

user/test-super/com/google/gwt/dev/jjs/super/com/google/gwt/dev/jjs/test/Java17Test.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020

2121
import java.util.Arrays;
2222
import java.util.List;
23-
24-
import jsinterop.annotations.*;
23+
import jsinterop.annotations.JsMethod;
24+
import jsinterop.annotations.JsProperty;
25+
import jsinterop.annotations.JsType;
2526

2627
/**
2728
* Tests Java 17 features. It is super sourced so that gwt can be compiles under Java 11.
@@ -45,11 +46,10 @@ public interface TextBlock {
4546
public sealed class Shape permits Square, Circle {
4647
public static int count = 0;
4748

48-
public static Shape returnAndIncrement(Shape shape){
49+
public static Shape returnAndIncrement(Shape shape) {
4950
count++;
5051
return shape;
5152
}
52-
5353
}
5454

5555
public final class Square extends Shape {
@@ -174,7 +174,7 @@ public String toString() {
174174
assertEquals("bar", RecordWithStaticField.foo);
175175
// Under the current implementation this next line would fail - this is not inconsistent with the spec,
176176
// but it is different than what the JVM does.
177-
// assertEquals(0, new TopLevelRecord("", 0).hashCode());
177+
// assertEquals(0, new TopLevelRecord("", 0).hashCode());
178178
assertFalse(0 == new TopLevelRecord("", 7).hashCode());
179179
assertFalse(0 == new TopLevelRecord("Pear", 0).hashCode());
180180

@@ -188,7 +188,7 @@ public String toString() {
188188
// check that an instance is equal to itself
189189
assertEquals(sameA, sameA);
190190
assertEquals(sameA.hashCode(), sameA.hashCode());
191-
//check that an instance is equal to a different record instance with same values
191+
// check that an instance is equal to a different record instance with same values
192192
assertEquals(sameA, sameB);
193193
assertEquals(sameA.hashCode(), sameB.hashCode());
194194

user/test-super/com/google/gwt/emultest/super/com/google/gwt/emultest/java17/lang/MathTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public void testAbsExact() {
2828
assertEquals(1, Math.absExact(hideFromCompiler(-1)));
2929
assertThrowsArithmetic(() -> Math.absExact(hideFromCompiler(Integer.MIN_VALUE)));
3030
assertEquals(Long.MAX_VALUE, Math.absExact(hideFromCompiler(Long.MAX_VALUE)));
31-
assertEquals(0, Math.absExact(hideFromCompiler(0l)));
32-
assertEquals(1, Math.absExact(hideFromCompiler(-1l)));
31+
assertEquals(0, Math.absExact(hideFromCompiler(0L)));
32+
assertEquals(1, Math.absExact(hideFromCompiler(-1L)));
3333
assertThrowsArithmetic(() -> Math.absExact(hideFromCompiler(Long.MIN_VALUE)));
3434
}
3535

user/test-super/com/google/gwt/emultest/super/com/google/gwt/emultest/java17/util/stream/DoubleStreamTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public void testMapMulti() {
3434
assertEquals(new double[]{1.0, 2.0, 3.0, 6.0},
3535
DoubleStream.of(1.0, 3.0).mapMulti(doubling).toArray());
3636
assertEquals(new double[0],
37-
DoubleStream.of(1.0, 2.0).mapMulti((a, b) -> {}).toArray());
37+
DoubleStream.of(1.0, 2.0).mapMulti((a, b) -> { }).toArray());
3838
}
3939
}

0 commit comments

Comments
 (0)