Skip to content

Commit 6d408e8

Browse files
valfirstSrinivasanTarget
authored andcommitted
Clean up (appium#993)
* Remove unused imports * Fix checkstyle warning * Fix generic type references * Fix JavaDocs
1 parent 24cec01 commit 6d408e8

17 files changed

+32
-31
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ public List<MobileElement> findElementsByXPath(String using) {
9191
*
9292
* @param value is the new value which should be set
9393
*/
94-
@SuppressWarnings({"rawtypes", "unchecked"})
9594
public void setValue(String value) {
96-
ImmutableMap.Builder builder = ImmutableMap.builder();
95+
ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
9796
builder.put("id", id).put("value", value);
9897
execute(MobileCommand.SET_VALUE, builder.build());
9998
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public class ScreenshotState {
4040
private Duration comparisonInterval = DEFAULT_INTERVAL_MS;
4141

4242
/**
43-
* The class constructor accepts single argument, which is
44-
* lambda function, that provides the screenshot of the necessary
43+
* The class constructor accepts two arguments. The first one is image comparator, the second
44+
* parameter is lambda function, that provides the screenshot of the necessary
4545
* screen area to be verified for similarity.
4646
* This lambda method is NOT called upon class creation.
4747
* One has to invoke {@link #remember()} method in order to call it.
@@ -67,6 +67,7 @@ public class ScreenshotState {
6767
* }
6868
* </code>
6969
*
70+
* @param comparator image comparator
7071
* @param stateProvider lambda function, which returns a screenshot for further comparison
7172
*/
7273
public ScreenshotState(ComparesImages comparator, Supplier<BufferedImage> stateProvider) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public T release() {
8484
* Important: some older Appium drivers releases have a bug when moveTo
8585
* coordinates are calculated as relative to the recent pointer position
8686
* in the chain instead of being absolute.
87-
* @see <a href="https://github.com/appium/appium/issues/7486">Appium Issue #7486</a>
88-
* for more details.
87+
* @see <a href="https://github.com/appium/appium/issues/7486">Appium Issue #7486
88+
* for more details.</a>
8989
* @return this TouchAction, for chaining.
9090
*/
9191
public T moveTo(PointOption moveToOptions) {

src/main/java/io/appium/java_client/android/AndroidStartScreenRecordingOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ public AndroidStartScreenRecordingOptions enableBugReport() {
8181
* Setting values greater than this or less than zero will cause an exception. The minimum
8282
* time resolution unit is one second.
8383
*
84-
* Since Appium 1.8.2 the time limit can be up to 1800 seconds (30 minutes).
84+
* <p>Since Appium 1.8.2 the time limit can be up to 1800 seconds (30 minutes).
8585
* Appium will automatically try to merge the 3-minutes chunks recorded
8686
* by the screenrecord utility, however, this requires FFMPEG utility
8787
* to be installed and available in PATH on the server machine. If the utility is not
88-
* present then the most recent screen recording chunk is going to be returned as the result.
88+
* present then the most recent screen recording chunk is going to be returned as the result.</p>
8989
*
9090
* @param timeLimit The actual time limit of the recorded video.
9191
* @return self instance for chaining.

src/main/java/io/appium/java_client/android/appmanagement/AndroidInstallApplicationOptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ public AndroidInstallApplicationOptions withGrantPermissionsDisabled() {
137137
return this;
138138
}
139139

140-
@SuppressWarnings("unchecked")
141140
@Override
142141
public Map<String, Object> build() {
143-
final ImmutableMap.Builder builder = new ImmutableMap.Builder<String, Object>();
142+
final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
144143
ofNullable(replace).map(x -> builder.put("replace", x));
145144
ofNullable(timeout).map(x -> builder.put("timeout", x.toMillis()));
146145
ofNullable(allowTestPackages).map(x -> builder.put("allowTestPackages", x));

src/main/java/io/appium/java_client/android/appmanagement/AndroidRemoveApplicationOptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ public AndroidRemoveApplicationOptions withKeepDataDisabled() {
6767
return this;
6868
}
6969

70-
@SuppressWarnings("unchecked")
7170
@Override
7271
public Map<String, Object> build() {
73-
final ImmutableMap.Builder builder = new ImmutableMap.Builder<String, Object>();
72+
final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
7473
ofNullable(timeout).map(x -> builder.put("timeout", x.toMillis()));
7574
ofNullable(keepData).map(x -> builder.put("keepData", x));
7675
return builder.build();

src/main/java/io/appium/java_client/android/appmanagement/AndroidTerminateApplicationOptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ public AndroidTerminateApplicationOptions withTimeout(Duration timeout) {
4444
return this;
4545
}
4646

47-
@SuppressWarnings("unchecked")
4847
@Override
4948
public Map<String, Object> build() {
50-
final ImmutableMap.Builder builder = new ImmutableMap.Builder<String, Object>();
49+
final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
5150
ofNullable(timeout).map(x -> builder.put("timeout", x.toMillis()));
5251
return builder.build();
5352
}

src/main/java/io/appium/java_client/android/nativekey/AndroidKey.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,8 @@ public boolean isGamepadButton() {
13351335

13361336
/**
13371337
* Whether key will, by default, trigger a click on the focused view.
1338+
*
1339+
* @return true if this is a confirm key.
13381340
*/
13391341
public boolean isConfirmKey() {
13401342
switch (this) {
@@ -1351,6 +1353,8 @@ public boolean isConfirmKey() {
13511353
/**
13521354
* Whether this key is a media key, which can be send to apps that are
13531355
* interested in media key events.
1356+
*
1357+
* @return true if this is a media key.
13541358
*/
13551359
public boolean isMediaKey() {
13561360
switch (this) {
@@ -1374,6 +1378,8 @@ public boolean isMediaKey() {
13741378

13751379
/**
13761380
* Is this a system key? System keys can not be used for menu shortcuts.
1381+
*
1382+
* @return true if this is a system key.
13771383
*/
13781384
public boolean isSystemKey() {
13791385
switch (this) {
@@ -1413,7 +1419,7 @@ public boolean isSystemKey() {
14131419
/**
14141420
* Is it wake key or not.
14151421
*
1416-
* @return true if this a wakeup key.
1422+
* @return true if this is a wakeup key.
14171423
*/
14181424
public boolean isWakeKey() {
14191425
switch (this) {
@@ -1429,4 +1435,4 @@ public boolean isWakeKey() {
14291435
return false;
14301436
}
14311437
}
1432-
}
1438+
}

src/main/java/io/appium/java_client/events/api/general/WindowEventListener.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void afterWindowIsMoved(WebDriver driver, WebDriver.Window window,
8383
* This action will be performed each time before
8484
* {@link org.openqa.selenium.WebDriver.TargetLocator#window(java.lang.String)}.
8585
*
86+
* @param windowName the name of the window to switch
8687
* @param driver WebDriver
8788
*/
8889
void beforeSwitchToWindow(String windowName, WebDriver driver);
@@ -91,6 +92,7 @@ void afterWindowIsMoved(WebDriver driver, WebDriver.Window window,
9192
* This action will be performed each time after
9293
* {@link org.openqa.selenium.WebDriver.TargetLocator#window(java.lang.String)}.
9394
*
95+
* @param windowName the name of the window to switch
9496
* @param driver WebDriver
9597
*/
9698
void afterSwitchToWindow(String windowName, WebDriver driver);

src/main/java/io/appium/java_client/imagecomparison/BaseComparisonOptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ public T withEnabledVisualization() {
4444
*
4545
* @return comparison options mapping.
4646
*/
47-
@SuppressWarnings("unchecked")
4847
public Map<String, Object> build() {
49-
final ImmutableMap.Builder builder = new ImmutableMap.Builder<String, Object>();
48+
final ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
5049
ofNullable(visualize).map(x -> builder.put("visualize", x));
5150
return builder.build();
5251
}

0 commit comments

Comments
 (0)