Skip to content

Commit 8e3b2e4

Browse files
authored
build: Migrate to Checkstyle 10 (#1842)
1 parent 37ac6e4 commit 8e3b2e4

File tree

11 files changed

+75
-89
lines changed

11 files changed

+75
-89
lines changed

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
java-version: ${{ matrix.java }}
3434
cache: 'gradle'
3535
- name: Build with Gradle
36-
run: ./gradlew clean build -x unitTest -x checkstyleTest
36+
run: ./gradlew clean build -x unitTest

appium-style.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@
175175
<module name="AtclauseOrder">
176176
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
177177
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
178-
<property name="severity" value="warning"/>
179178
</module>
180179
<module name="JavadocMethod">
181-
<property name="scope" value="public"/>
180+
<property name="accessModifiers" value="public"/>
182181
<property name="allowMissingParamTags" value="true"/>
183182
<property name="allowMissingReturnTag" value="true"/>
184183
<property name="allowedAnnotations" value="Override, Test, BeforeClass, AfterClass, Before, After"/>

azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
jdkArchitectureOption: 'x64'
4444
publishJUnitResults: true
4545
tasks: 'build'
46-
options: 'uiAutomationTest -x checkstyleTest -x test'
46+
options: 'uiAutomationTest -x test'
4747
- job: iOS_E2E_Tests
4848
# timeoutInMinutes: '90'
4949
steps:
@@ -63,7 +63,7 @@ jobs:
6363
jdkArchitectureOption: 'x64'
6464
publishJUnitResults: true
6565
tasks: 'build'
66-
options: 'xcuiTest -x checkstyleTest -x test'
66+
options: 'xcuiTest -x test'
6767
- job: Misc_Tests
6868
steps:
6969
- task: Gradle@2
@@ -75,4 +75,4 @@ jobs:
7575
jdkArchitectureOption: 'x64'
7676
publishJUnitResults: true
7777
tasks: 'build'
78-
options: 'miscTest -x checkstyleTest -x test -x signMavenJavaPublication'
78+
options: 'miscTest -x test -x signMavenJavaPublication'

build.gradle

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plugins {
66
id 'eclipse'
77
id 'maven-publish'
88
id 'jacoco'
9-
id 'checkstyle'
109
id 'signing'
1110
id 'org.owasp.dependencycheck' version '8.0.1'
1211
id 'com.github.johnrengelman.shadow' version '7.1.2'
@@ -94,11 +93,17 @@ tasks.withType(JacocoReport) {
9493
}
9594
jacocoTestReport.dependsOn test
9695

97-
checkstyle {
98-
toolVersion = '8.32'
99-
configFile = file("$projectDir/appium-style.xml")
100-
showViolations = true
101-
ignoreFailures = false
96+
// Checkstyle requires Java 11 starting from 10.0
97+
if (JavaVersion.current().isJava11Compatible()) {
98+
apply plugin: 'checkstyle'
99+
100+
checkstyle {
101+
toolVersion = '10.6.0'
102+
configFile = file("$projectDir/appium-style.xml")
103+
showViolations = true
104+
ignoreFailures = false
105+
}
106+
checkstyleTest.enabled = false
102107
}
103108

104109
javadoc {

jitpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
jdk:
22
- openjdk8
33
install:
4-
- ./gradlew clean build publishToMavenLocal -x signMavenJavaPublication -x test -x checkstyleTest
4+
- ./gradlew clean build publishToMavenLocal -x signMavenJavaPublication -x test

src/main/java/io/appium/java_client/MobileBy.java

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ protected MobileBy(String selector, String locatorString, String locatorName) {
3535

3636
/**
3737
* Refer to https://developer.android.com/training/testing/ui-automator
38-
* @deprecated Use {@link AppiumBy#androidUIAutomator(String)} instead.
38+
*
3939
* @param uiautomatorText is Android UIAutomator string
4040
* @return an instance of {@link ByAndroidUIAutomator}
41+
* @deprecated Use {@link AppiumBy#androidUIAutomator(String)} instead.
4142
*/
4243
@Deprecated
4344
public static By AndroidUIAutomator(final String uiautomatorText) {
@@ -50,9 +51,10 @@ public static By AndroidUIAutomator(final String uiautomatorText) {
5051
* About iOS accessibility
5152
* https://developer.apple.com/library/ios/documentation/UIKit/Reference/
5253
* UIAccessibilityIdentification_Protocol/index.html
53-
* @deprecated Use {@link AppiumBy#accessibilityId(String)} instead.
54+
*
5455
* @param accessibilityId id is a convenient UI automation accessibility Id.
5556
* @return an instance of {@link ByAndroidUIAutomator}
57+
* @deprecated Use {@link AppiumBy#accessibilityId(String)} instead.
5658
*/
5759
@Deprecated
5860
public static By AccessibilityId(final String accessibilityId) {
@@ -61,11 +63,12 @@ public static By AccessibilityId(final String accessibilityId) {
6163

6264
/**
6365
* This locator strategy is available in XCUITest Driver mode.
64-
* @deprecated Use {@link AppiumBy#iOSClassChain(String)} instead.
66+
*
6567
* @param iOSClassChainString is a valid class chain locator string.
6668
* See <a href="https://github.com/facebookarchive/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules">
6769
* the documentation</a> for more details
6870
* @return an instance of {@link ByIosClassChain}
71+
* @deprecated Use {@link AppiumBy#iOSClassChain(String)} instead.
6972
*/
7073
@Deprecated
7174
public static By iOSClassChain(final String iOSClassChainString) {
@@ -74,11 +77,12 @@ public static By iOSClassChain(final String iOSClassChainString) {
7477

7578
/**
7679
* This locator strategy is only available in Espresso Driver mode.
77-
* @deprecated Use {@link AppiumBy#androidDataMatcher(String)} instead.
80+
*
7881
* @param dataMatcherString is a valid json string detailing hamcrest matcher for Espresso onData().
79-
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
80-
* the documentation</a> for more details
82+
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
83+
* the documentation</a> for more details
8184
* @return an instance of {@link ByAndroidDataMatcher}
85+
* @deprecated Use {@link AppiumBy#androidDataMatcher(String)} instead.
8286
*/
8387
@Deprecated
8488
public static By androidDataMatcher(final String dataMatcherString) {
@@ -87,11 +91,12 @@ public static By androidDataMatcher(final String dataMatcherString) {
8791

8892
/**
8993
* This locator strategy is only available in Espresso Driver mode.
90-
* @deprecated Use {@link AppiumBy#androidViewMatcher(String)} instead.
94+
*
9195
* @param viewMatcherString is a valid json string detailing hamcrest matcher for Espresso onView().
92-
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
93-
* the documentation</a> for more details
96+
* See <a href="http://appium.io/docs/en/writing-running-appium/android/espresso-datamatcher-selector/">
97+
* the documentation</a> for more details
9498
* @return an instance of {@link ByAndroidViewMatcher}
99+
* @deprecated Use {@link AppiumBy#androidViewMatcher(String)} instead.
95100
*/
96101
@Deprecated
97102
public static By androidViewMatcher(final String viewMatcherString) {
@@ -100,9 +105,10 @@ public static By androidViewMatcher(final String viewMatcherString) {
100105

101106
/**
102107
* This locator strategy is available in XCUITest Driver mode.
103-
* @deprecated Use {@link AppiumBy#iOSNsPredicateString(String)} instead.
108+
*
104109
* @param iOSNsPredicateString is an iOS NsPredicate String
105110
* @return an instance of {@link ByIosNsPredicate}
111+
* @deprecated Use {@link AppiumBy#iOSNsPredicateString(String)} instead.
106112
*/
107113
@Deprecated
108114
public static By iOSNsPredicateString(final String iOSNsPredicateString) {
@@ -111,9 +117,10 @@ public static By iOSNsPredicateString(final String iOSNsPredicateString) {
111117

112118
/**
113119
* The Windows UIAutomation selector.
114-
* @deprecated Not supported on the server side.
120+
*
115121
* @param windowsAutomation The element name in the Windows UIAutomation selector
116122
* @return an instance of {@link MobileBy.ByWindowsAutomation}
123+
* @deprecated Not supported on the server side.
117124
*/
118125
@Deprecated
119126
public static By windowsAutomation(final String windowsAutomation) {
@@ -122,10 +129,11 @@ public static By windowsAutomation(final String windowsAutomation) {
122129

123130
/**
124131
* This locator strategy is available in Espresso Driver mode.
125-
* @deprecated Use {@link AppiumBy#androidViewTag(String)} instead.
126-
* @since Appium 1.8.2 beta
132+
*
127133
* @param tag is an view tag string
128134
* @return an instance of {@link ByAndroidViewTag}
135+
* @since Appium 1.8.2 beta
136+
* @deprecated Use {@link AppiumBy#androidViewTag(String)} instead.
129137
*/
130138
@Deprecated
131139
public static By AndroidViewTag(final String tag) {
@@ -136,15 +144,15 @@ public static By AndroidViewTag(final String tag) {
136144
* This locator strategy is available only if OpenCV libraries and
137145
* NodeJS bindings are installed on the server machine.
138146
*
139-
* @deprecated Use {@link AppiumBy#image(String)} instead.
147+
* @param b64Template base64-encoded template image string. Supported image formats are the same
148+
* as for OpenCV library.
149+
* @return an instance of {@link ByImage}
140150
* @see <a href="https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md">
141151
* The documentation on Image Comparison Features</a>
142152
* @see <a href="https://github.com/appium/appium-base-driver/blob/master/lib/basedriver/device-settings.js">
143153
* The settings available for lookup fine-tuning</a>
144154
* @since Appium 1.8.2
145-
* @param b64Template base64-encoded template image string. Supported image formats are the same
146-
* as for OpenCV library.
147-
* @return an instance of {@link ByImage}
155+
* @deprecated Use {@link AppiumBy#image(String)} instead.
148156
*/
149157
@Deprecated
150158
public static By image(final String b64Template) {
@@ -155,10 +163,10 @@ public static By image(final String b64Template) {
155163
* This type of locator requires the use of the 'customFindModules' capability and a
156164
* separately-installed element finding plugin.
157165
*
158-
* @deprecated Use {@link AppiumBy#custom(String)} instead.
159166
* @param selector selector to pass to the custom element finding plugin
160167
* @return an instance of {@link ByCustom}
161168
* @since Appium 1.9.2
169+
* @deprecated Use {@link AppiumBy#custom(String)} instead.
162170
*/
163171
@Deprecated
164172
public static By custom(final String selector) {

src/main/java/io/appium/java_client/MobileCommand.java

Lines changed: 21 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -317,28 +317,24 @@ public static AppiumCommandInfo deleteC(String url) {
317317
}
318318

319319
/**
320-
* This method forms a {@link java.util.Map} of parameters for the
321-
* keyboard hiding.
320+
* This method forms a {@link Map} of parameters for the keyboard hiding.
322321
*
323322
* @param keyName The button pressed by the mobile driver to attempt hiding the
324323
* keyboard.
325-
* @return a key-value pair. The key is the command name. The value is a
326-
* {@link java.util.Map} command arguments.
324+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
327325
*/
328326
public static Map.Entry<String, Map<String, ?>> hideKeyboardCommand(String keyName) {
329327
return new AbstractMap.SimpleEntry<>(
330328
HIDE_KEYBOARD, prepareArguments("keyName", keyName));
331329
}
332330

333331
/**
334-
* This method forms a {@link java.util.Map} of parameters for the
335-
* keyboard hiding.
332+
* This method forms a {@link Map} of parameters for the keyboard hiding.
336333
*
337334
* @param strategy HideKeyboardStrategy.
338335
* @param keyName a String, representing the text displayed on the button of the
339336
* keyboard you want to press. For example: "Done".
340-
* @return a key-value pair. The key is the command name. The value is a
341-
* {@link java.util.Map} command arguments.
337+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
342338
*/
343339
public static Map.Entry<String, Map<String, ?>> hideKeyboardCommand(String strategy,
344340
String keyName) {
@@ -381,26 +377,22 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
381377
}
382378

383379
/**
384-
* This method forms a {@link java.util.Map} of parameters for the
385-
* key event invocation.
380+
* This method forms a {@link Map} of parameters for the key event invocation.
386381
*
387382
* @param key code for the key pressed on the device.
388-
* @return a key-value pair. The key is the command name. The value is a
389-
* {@link java.util.Map} command arguments.
383+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
390384
*/
391385
public static Map.Entry<String, Map<String, ?>> pressKeyCodeCommand(int key) {
392386
return new AbstractMap.SimpleEntry<>(
393387
PRESS_KEY_CODE, prepareArguments("keycode", key));
394388
}
395389

396390
/**
397-
* This method forms a {@link java.util.Map} of parameters for the
398-
* key event invocation.
391+
* This method forms a {@link Map} of parameters for the key event invocation.
399392
*
400393
* @param key code for the key pressed on the Android device.
401394
* @param metastate metastate for the keypress.
402-
* @return a key-value pair. The key is the command name. The value is a
403-
* {@link java.util.Map} command arguments.
395+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
404396
*/
405397
public static Map.Entry<String, Map<String, ?>> pressKeyCodeCommand(int key,
406398
Integer metastate) {
@@ -411,26 +403,22 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
411403
}
412404

413405
/**
414-
* This method forms a {@link java.util.Map} of parameters for the
415-
* long key event invocation.
406+
* This method forms a {@link Map} of parameters for the long key event invocation.
416407
*
417408
* @param key code for the long key pressed on the device.
418-
* @return a key-value pair. The key is the command name. The value is a
419-
* {@link java.util.Map} command arguments.
409+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
420410
*/
421411
public static Map.Entry<String, Map<String, ?>> longPressKeyCodeCommand(int key) {
422412
return new AbstractMap.SimpleEntry<>(
423413
LONG_PRESS_KEY_CODE, prepareArguments("keycode", key));
424414
}
425415

426416
/**
427-
* This method forms a {@link java.util.Map} of parameters for the
428-
* long key event invocation.
417+
* This method forms a {@link Map} of parameters for the long key event invocation.
429418
*
430419
* @param key code for the long key pressed on the Android device.
431420
* @param metastate metastate for the long key press.
432-
* @return a key-value pair. The key is the command name. The value is a
433-
* {@link java.util.Map} command arguments.
421+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
434422
*/
435423
public static Map.Entry<String, Map<String, ?>> longPressKeyCodeCommand(int key,
436424
Integer metastate) {
@@ -441,35 +429,29 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
441429
}
442430

443431
/**
444-
* This method forms a {@link java.util.Map} of parameters for the
445-
* device locking.
432+
* This method forms a {@link Map} of parameters for the device locking.
446433
*
447434
* @param duration for how long to lock the screen for. Minimum time resolution is one second
448-
* @return a key-value pair. The key is the command name. The value is a
449-
* {@link java.util.Map} command arguments.
435+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
450436
*/
451437
public static Map.Entry<String, Map<String, ?>> lockDeviceCommand(Duration duration) {
452438
return new AbstractMap.SimpleEntry<>(
453439
LOCK, prepareArguments("seconds", duration.getSeconds()));
454440
}
455441

456442
/**
457-
* This method forms a {@link java.util.Map} of parameters for the
458-
* device unlocking.
443+
* This method forms a {@link Map} of parameters for the device unlocking.
459444
*
460-
* @return a key-value pair. The key is the command name. The value is a
461-
* {@link java.util.Map} command arguments.
445+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
462446
*/
463447
public static Map.Entry<String, Map<String, ?>> unlockDeviceCommand() {
464448
return new AbstractMap.SimpleEntry<>(UNLOCK, ImmutableMap.of());
465449
}
466450

467451
/**
468-
* This method forms a {@link java.util.Map} of parameters for the
469-
* device locked query.
452+
* This method forms a {@link Map} of parameters for the device locked query.
470453
*
471-
* @return a key-value pair. The key is the command name. The value is a
472-
* {@link java.util.Map} command arguments.
454+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
473455
*/
474456
public static Map.Entry<String, Map<String, ?>> getIsDeviceLockedCommand() {
475457
return new AbstractMap.SimpleEntry<>(IS_LOCKED, ImmutableMap.of());
@@ -488,13 +470,11 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
488470
}
489471

490472
/**
491-
* This method forms a {@link java.util.Map} of parameters for the
492-
* file pushing.
473+
* This method forms a {@link Map} of parameters for the file pushing.
493474
*
494475
* @param remotePath Path to file to write data to on remote device
495476
* @param base64Data Base64 encoded byte array of data to write to remote device
496-
* @return a key-value pair. The key is the command name. The value is a
497-
* {@link java.util.Map} command arguments.
477+
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
498478
*/
499479
public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) {
500480
String[] parameters = new String[]{"path", "data"};
@@ -513,7 +493,7 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
513493
}
514494

515495
/**
516-
* Forms a {@link java.util.Map} of parameters for images comparison.
496+
* Forms a {@link Map} of parameters for images comparison.
517497
*
518498
* @param mode one of possible comparison modes
519499
* @param img1Data base64-encoded data of the first image

0 commit comments

Comments
 (0)