Skip to content

Commit

Permalink
Support "GWT Project Authors" as copyright owner and update checkstyle (
Browse files Browse the repository at this point in the history
#9916)

Updates checkstyle to the current latest, requiring a few small changes
in configuration. A few updates were also made to fix minor style points
brought up in the update.

Fixes #9823
  • Loading branch information
niloc132 authored Feb 8, 2024
1 parent 7c9a4c4 commit 3e84582
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 104 deletions.
8 changes: 4 additions & 4 deletions common.ant.xml
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@
<attribute name="outputdirectory" default="${project.build}"/>
<element name="sourcepath" implicit="yes" optional="true"/>
<sequential>
<taskdef resource="checkstyletask.properties"
classpath="${gwt.tools.antlib}/checkstyle-6.0-all.jar"/>
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpath="${gwt.tools.antlib}/checkstyle-10.13.0-all.jar"/>
<mkdir dir="@{outputdirectory}"/>
<checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle.xml" maxErrors="0"
failOnViolation="false" failureProperty="gwt.checkstyle.failed">
Expand All @@ -357,8 +357,8 @@
<attribute name="outputdirectory" default="${project.build}"/>
<element name="sourcepath" implicit="yes" optional="true"/>
<sequential>
<taskdef resource="checkstyletask.properties"
classpath="${gwt.tools.antlib}/checkstyle-6.0-all.jar"/>
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpath="${gwt.tools.antlib}/checkstyle-10.13.0-all.jar"/>
<mkdir dir="@{outputdirectory}"/>
<checkstyle config="${gwt.root}/eclipse/settings/code-style/gwt-checkstyle-tests.xml"
maxErrors="0" failOnViolation="false"
Expand Down
1 change: 0 additions & 1 deletion dev/core/src/com/google/gwt/dev/javac/MemoryUnitCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.UnableToCompleteException;
import com.google.gwt.dev.javac.MemoryUnitCache.UnitCacheEntry;
import com.google.gwt.thirdparty.guava.common.collect.Maps;

import java.util.Map;
Expand Down
3 changes: 2 additions & 1 deletion dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,9 @@ private InlineResult tryInlineBody(JMethodCall x, Context ctx,
return InlineResult.DO_NOT_BLACKLIST;
}
}
// Fall through!
// CHECKSTYLE_OFF: Fall through!
case CORRECT_ORDER:
// CHECKSTYLE_ON
default:
if (!x.hasSideEffects()) {
markCallsAsSideEffectFree(bodyAsExpressionList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public enum TypeOrder {

/**
* Maps a type into a type id literal.
*
* @param <T> the runtime type to use when replacing a type id
*/
public interface TypeMapper<T extends JExpression> {
T getOrCreateTypeId(JType type);
Expand Down
2 changes: 2 additions & 0 deletions dev/core/src/com/google/gwt/dev/shell/BrowserChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ public interface RemoteObjectRef {

/**
* Hook interface for responding to messages.
*
* @param <T> the BrowserChannel type this implementation is built to handle.
*/
public abstract static class SessionHandler<T extends BrowserChannel> {

Expand Down
20 changes: 0 additions & 20 deletions eclipse/settings/code-style/gwt-checkstyle-suppressions.xml

This file was deleted.

57 changes: 24 additions & 33 deletions eclipse/settings/code-style/gwt-checkstyle-tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Checkstyle-Configuration: GWT Checks for Tests
Description:
A more lenient set of style checks for test cases, needed because test often need to do funkier stuff.
-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="RegexpHeader">
<property name="fileExtensions" value="java"/>
<property name="severity" value="error"/>
<property name="header" value="^/\*[ ]*$\n^ \* Copyright 20(0[6789]|[12][0-9]) Google Inc\.$\n^ \*[ ]*$\n^ \* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\); you may not( use this file except)?$\n^ \* (use this file except )?in compliance with the License\. You may obtain a copy of( the License at)?$\n^ \* the License at$\n^ \*[ ]*$\n^ \* http://www\.apache\.org/licenses/LICENSE-2\.0$\n^ \*[ ]*\n \* Unless required by applicable law or agreed to in writing, software( distributed under the License)?$\n^ \* (distributed under the License )?is distributed on an &quot;AS IS&quot; BASIS, WITHOUT( WARRANTIES OR CONDITIONS OF ANY KIND, either express)?$\n^ \* (WARRANTIES OR CONDITIONS OF ANY KIND, either express )?or implied\. See the( License for the specific language governing permissions and limitations under)?$\n^ \* License for the specific language governing permissions and limitations under$\n^ \* the License\.$\n^ \*/$"/>
<property name="header" value="^/\*[ ]*$\n^ \* Copyright 20(0[6789]|[12][0-9]) (Google Inc\.|GWT Project Authors)$\n^ \*[ ]*$\n^ \* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\); you may not( use this file except)?$\n^ \* (use this file except )?in compliance with the License\. You may obtain a copy of( the License at)?$\n^ \* the License at$\n^ \*[ ]*$\n^ \* http://www\.apache\.org/licenses/LICENSE-2\.0$\n^ \*[ ]*\n \* Unless required by applicable law or agreed to in writing, software( distributed under the License)?$\n^ \* (distributed under the License )?is distributed on an &quot;AS IS&quot; BASIS, WITHOUT( WARRANTIES OR CONDITIONS OF ANY KIND, either express)?$\n^ \* (WARRANTIES OR CONDITIONS OF ANY KIND, either express )?or implied\. See the( License for the specific language governing permissions and limitations under)?$\n^ \* License for the specific language governing permissions and limitations under$\n^ \* the License\.$\n^ \*/$"/>
<property name="multiLines" value="6,13"/>
</module>
<module name="FileTabCharacter">
Expand All @@ -23,7 +23,6 @@ A more lenient set of style checks for test cases, needed because test often nee
</module>
<module name="TreeWalker">
<property name="fileExtensions" value="java"/>
<module name="FileContentsHolder"/>
<module name="InterfaceIsType">
<metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="error"/>
<property name="severity" value="ignore"/>
Expand Down Expand Up @@ -90,14 +89,9 @@ A more lenient set of style checks for test cases, needed because test often nee
<module name="JavadocMethod">
<metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="info"/>
<property name="severity" value="info"/>
<property name="scope" value="protected"/>
<property name="allowUndeclaredRTE" value="true"/>
<property name="accessModifiers" value="public, protected"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowMissingJavadoc" value="true"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="logLoadErrors" value="true"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="CustomImportOrder">
Expand Down Expand Up @@ -215,33 +209,30 @@ A more lenient set of style checks for test cases, needed because test often nee
</module>
<module name="RedundantModifier"/>
<module name="EqualsHashCode"/>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MethodName"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MemberName"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="ParameterName"/>
</module>
</module>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
</module>
<module name="SuppressionCommentFilter">
<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MethodName"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MemberName"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="ParameterName"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="eclipse/settings/code-style/gwt-checkstyle-suppressions.xml"/>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
</module>
</module>
73 changes: 33 additions & 40 deletions eclipse/settings/code-style/gwt-checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,26 @@ Checkstyle-Configuration: GWT Checks
Description:
-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="RegexpHeader">
<property name="fileExtensions" value="java"/>
<property name="severity" value="error"/>
<property name="header" value="^/\*[ ]*$\n^ \* Copyright 20(0[6789]|[12][0-9]) Google Inc\.$\n^ \*[ ]*$\n^ \* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\); you may not( use this file except)?$\n^ \* (use this file except )?in compliance with the License\. You may obtain a copy of( the License at)?$\n^ \* the License at$\n^ \*[ ]*$\n^ \* http://www\.apache\.org/licenses/LICENSE-2\.0$\n^ \*[ ]*\n \* Unless required by applicable law or agreed to in writing, software( distributed under the License)?$\n^ \* (distributed under the License )?is distributed on an &quot;AS IS&quot; BASIS, WITHOUT( WARRANTIES OR CONDITIONS OF ANY KIND, either express)?$\n^ \* (WARRANTIES OR CONDITIONS OF ANY KIND, either express )?or implied\. See the( License for the specific language governing permissions and limitations under)?$\n^ \* License for the specific language governing permissions and limitations under$\n^ \* the License\.$\n^ \*/$"/>
<property name="header" value="^/\*[ ]*$\n^ \* Copyright 20(0[6789]|[12][0-9]) (Google Inc\.|GWT Project Authors)$\n^ \*[ ]*$\n^ \* Licensed under the Apache License, Version 2\.0 \(the &quot;License&quot;\); you may not( use this file except)?$\n^ \* (use this file except )?in compliance with the License\. You may obtain a copy of( the License at)?$\n^ \* the License at$\n^ \*[ ]*$\n^ \* http://www\.apache\.org/licenses/LICENSE-2\.0$\n^ \*[ ]*\n \* Unless required by applicable law or agreed to in writing, software( distributed under the License)?$\n^ \* (distributed under the License )?is distributed on an &quot;AS IS&quot; BASIS, WITHOUT( WARRANTIES OR CONDITIONS OF ANY KIND, either express)?$\n^ \* (WARRANTIES OR CONDITIONS OF ANY KIND, either express )?or implied\. See the( License for the specific language governing permissions and limitations under)?$\n^ \* License for the specific language governing permissions and limitations under$\n^ \* the License\.$\n^ \*/$"/>
<property name="multiLines" value="6,13"/>
</module>
<module name="FileTabCharacter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="no tabs"/>
<property name="fileExtensions" value="java"/>
<property name="severity" value="error"/>
</module>
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<property name="fileExtensions" value="java"/>
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="FileContentsHolder" />
<property name="fileExtensions" value="java"/>
<module name="InterfaceIsType">
<property name="severity" value="ignore"/>
</module>
Expand All @@ -40,6 +39,7 @@ Description:
<module name="JavadocType">
<property name="severity" value="error"/>
<property name="scope" value="protected"/>
<property name="allowMissingParamTags" value="true"/>
</module>
<module name="PackageName">
<property name="severity" value="error"/>
Expand All @@ -53,7 +53,7 @@ Description:
</module>
<module name="LocalVariableName">
<property name="severity" value="error"/>
<property name="tokens" value="PARAMETER_DEF,VARIABLE_DEF"/>
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="LeftCurly"/>
<module name="RightCurly"/>
Expand Down Expand Up @@ -86,14 +86,9 @@ Description:
<module name="JavadocMethod">
<metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="info"/>
<property name="severity" value="info"/>
<property name="scope" value="protected"/>
<property name="allowUndeclaredRTE" value="true"/>
<property name="accessModifiers" value="public, protected"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowMissingJavadoc" value="true"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="logLoadErrors" value="true"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="CustomImportOrder">
Expand Down Expand Up @@ -198,33 +193,31 @@ Description:
</module>
<module name="RedundantModifier"/>
<module name="EqualsHashCode"/>
</module>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
</module>

<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MethodName"/>
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MethodName"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MemberName"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="ParameterName"/>
</module>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="MemberName"/>
<module name="SuppressWithPlainTextCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_ON"/>
</module>
<module name="SuppressionCommentFilter">
<metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Avoid name checking"/>
<property name="offCommentFormat" value="CHECKSTYLE_NAMING_OFF"/>
<property name="onCommentFormat" value="CHECKSTYLE_NAMING_ON"/>
<property name="checkFormat" value="ParameterName"/>
<module name="JavadocPackage">
<property name="severity" value="ignore"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="eclipse/settings/code-style/gwt-checkstyle-suppressions.xml"/>
</module>
</module>
3 changes: 2 additions & 1 deletion user/src/com/google/gwt/i18n/shared/DateTimeFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -1906,9 +1906,10 @@ private boolean subParse(String text, int[] pos, PatternPart part,
cal.setTzOffset(0);
return true;
}
// $FALL-THROUGH$
// CHECKSTYLE_OFF: Fall through
case 'z': // time zone offset
case 'v': // time zone generic
// CHECKSTYLE_ON
return subParseTimeZoneInGMT(text, start, pos, cal);
default:
return false;
Expand Down
2 changes: 1 addition & 1 deletion user/super/com/google/gwt/emul/java/lang/Boolean.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ public String toString() {
protected static boolean $isInstance(Object instance) {
return "boolean".equals(JsUtils.typeOf(instance));
}
//CHECKSTYLE_ON: End utility methods
// CHECKSTYLE_ON: End utility methods
}
2 changes: 1 addition & 1 deletion user/super/com/google/gwt/emul/java/lang/Double.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,5 @@ public String toString() {
protected static boolean $isInstance(Object instance) {
return "number".equals(JsUtils.typeOf(instance));
}
//CHECKSTYLE_ON: End utility methods
// CHECKSTYLE_ON: End utility methods
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testLocalVarType_DenotableTypes() {

Supplier<String> initializer = () -> "37";
var s2 = initializer.get();
//to be sure that s2 was inferred as a string and not an Object
// to be sure that s2 was inferred as a string and not an Object
String s3 = s2;
assertEquals("37", s3);
}
Expand Down
Loading

0 comments on commit 3e84582

Please sign in to comment.