RequireThis rule and fixThis Gradle task

* `gradlew clean check -x test --parallel --continue` - to collect reports
* `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows

Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`,
therefore we still have to fix those cases manually.
Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems.
Not so easy to fix for good readability though...

* Upgrade to Grade 2.12
* Upgrade to SonarQube native plugin

The fix contains at about 300 files. So, will be done on merge.

Fix `fixThis.gradle` according PR comments

Apply `fixThis` and also `fixModifiers` for test classes.
 Fix some `this.` inner issues manually.
 Make code polishing for long lines after `fixThis`

Fix conflicts and vulnerabilities after the rebase
This commit is contained in:
Artem Bilan
2016-03-17 17:02:15 -04:00
parent e189307ab6
commit 2b0598291c
348 changed files with 1828 additions and 1781 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -130,7 +130,7 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean {
session.close(CloseStatus.GOING_AWAY);
}
catch (Exception e) {
logger.error("Failed to close session id '" + session.getId() + "': " + e.getMessage());
this.logger.error("Failed to close session id '" + session.getId() + "': " + e.getMessage());
}
}
}
@@ -160,8 +160,8 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean {
IntegrationWebSocketContainer.this.sendBufferSizeLimit);
IntegrationWebSocketContainer.this.sessions.put(session.getId(), session);
if (logger.isDebugEnabled()) {
logger.debug("Started WebSocket session = " + session.getId() + ", number of sessions = "
if (IntegrationWebSocketContainer.this.logger.isDebugEnabled()) {
IntegrationWebSocketContainer.this.logger.debug("Started WebSocket session = " + session.getId() + ", number of sessions = "
+ IntegrationWebSocketContainer.this.sessions.size());
}
if (IntegrationWebSocketContainer.this.messageListener != null) {
@@ -190,8 +190,8 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean {
if (IntegrationWebSocketContainer.this.messageListener != null) {
IntegrationWebSocketContainer.this.messageListener.onMessage(session, message);
}
else if (logger.isInfoEnabled()) {
logger.info("This 'WebSocketHandlerContainer' isn't configured with 'WebSocketMessageListener'."
else if (IntegrationWebSocketContainer.this.logger.isInfoEnabled()) {
IntegrationWebSocketContainer.this.logger.info("This 'WebSocketHandlerContainer' isn't configured with 'WebSocketMessageListener'."
+ " Received messages are ignored. Current message is: " + message);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public class PassThruSubProtocolHandler implements SubProtocolHandler {
@Override
public List<String> getSupportedProtocols() {
return supportedProtocols;
return this.supportedProtocols;
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -326,7 +326,7 @@ public class WebSocketServerTests {
private class TestWebSocketHandler extends WebSocketHandlerDecorator {
public TestWebSocketHandler(WebSocketHandler delegate) {
TestWebSocketHandler(WebSocketHandler delegate) {
super(delegate);
}