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 2002-2014 the original author or authors.
* Copyright 2002-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.
@@ -77,22 +77,22 @@ public class CacheListeningMessageProducer extends ExpressionMessageProducerSupp
@Override
protected void doStart() {
if (logger.isInfoEnabled()) {
logger.info("adding MessageProducingCacheListener to GemFire Region '" + this.region.getName() + "'");
if (this.logger.isInfoEnabled()) {
this.logger.info("adding MessageProducingCacheListener to GemFire Region '" + this.region.getName() + "'");
}
this.region.getAttributesMutator().addCacheListener(this.listener);
}
@Override
protected void doStop() {
if (logger.isInfoEnabled()) {
logger.info("removing MessageProducingCacheListener from GemFire Region '" + this.region.getName() + "'");
if (this.logger.isInfoEnabled()) {
this.logger.info("removing MessageProducingCacheListener from GemFire Region '" + this.region.getName() + "'");
}
try {
this.region.getAttributesMutator().removeCacheListener(this.listener);
} catch (CacheClosedException e) {
if (logger.isDebugEnabled()){
logger.debug(e.getMessage(),e);
if (this.logger.isDebugEnabled()){
this.logger.debug(e.getMessage(),e);
}
}
@@ -102,28 +102,28 @@ public class CacheListeningMessageProducer extends ExpressionMessageProducerSupp
@Override
public void afterCreate(EntryEvent event) {
if (supportedEventTypes.contains(EventType.CREATED)) {
if (CacheListeningMessageProducer.this.supportedEventTypes.contains(EventType.CREATED)) {
this.processEvent(event);
}
}
@Override
public void afterUpdate(EntryEvent event) {
if (supportedEventTypes.contains(EventType.UPDATED)) {
if (CacheListeningMessageProducer.this.supportedEventTypes.contains(EventType.UPDATED)) {
this.processEvent(event);
}
}
@Override
public void afterInvalidate(EntryEvent event) {
if (supportedEventTypes.contains(EventType.INVALIDATED)) {
if (CacheListeningMessageProducer.this.supportedEventTypes.contains(EventType.INVALIDATED)) {
this.processEvent(event);
}
}
@Override
public void afterDestroy(EntryEvent event) {
if (supportedEventTypes.contains(EventType.DESTROYED)) {
if (CacheListeningMessageProducer.this.supportedEventTypes.contains(EventType.DESTROYED)) {
this.processEvent(event);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-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.
@@ -98,11 +98,11 @@ public class ContinuousQueryMessageProducer extends ExpressionMessageProducerSup
@Override
protected void onInit() {
super.onInit();
if (queryName == null) {
queryListenerContainer.addListener(new ContinuousQueryDefinition(this.query, this, this.durable));
if (this.queryName == null) {
this.queryListenerContainer.addListener(new ContinuousQueryDefinition(this.query, this, this.durable));
}
else {
queryListenerContainer.addListener(new ContinuousQueryDefinition(this.queryName, this.query, this,
this.queryListenerContainer.addListener(new ContinuousQueryDefinition(this.queryName, this.query, this,
this.durable));
}
}
@@ -135,7 +135,7 @@ public class ContinuousQueryMessageProducer extends ExpressionMessageProducerSup
String eventName = event.getQueryOperation().toString() +
(event.getQueryOperation().toString().endsWith("Y") ? "ED" : "D");
CqEventType eventType = CqEventType.valueOf(eventName);
return supportedEventTypes.contains(eventType);
return this.supportedEventTypes.contains(eventType);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-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.
@@ -59,7 +59,7 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements
* @param messageStoreRegion The region.
*/
public GemfireMessageStore(Region<Object,Object> messageStoreRegion) {
cache = null;
this.cache = null;
this.messageStoreRegion = messageStoreRegion;
}
/**
@@ -98,7 +98,7 @@ public class GemfireMessageStore extends AbstractKeyValueMessageStore implements
RegionFactoryBean<Object, Object> messageRegionFactoryBean = new RegionFactoryBean<Object, Object>() {};
messageRegionFactoryBean.setBeanName(MESSAGE_STORE_REGION_NAME);
messageRegionFactoryBean.setAttributes(attributesFactoryBean.getObject());
messageRegionFactoryBean.setCache(cache);
messageRegionFactoryBean.setCache(this.cache);
messageRegionFactoryBean.afterPropertiesSet();
this.messageStoreRegion = messageRegionFactoryBean.getObject();
}