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:
@@ -54,7 +54,7 @@ public class RefreshableResourceScriptSource implements ScriptSource {
|
||||
public String getScriptAsString() throws IOException {
|
||||
if (this.script == null || this.isModified()) {
|
||||
this.lastModifiedChecked.set(System.currentTimeMillis());
|
||||
this.script = source.getScriptAsString();
|
||||
this.script = this.source.getScriptAsString();
|
||||
}
|
||||
return this.script;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-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.
|
||||
@@ -42,6 +42,6 @@ public class ScriptExecutingMessageSource extends AbstractMessageSource<Object>
|
||||
|
||||
@Override
|
||||
protected Object doReceive() {
|
||||
return scriptMessageProcessor.processMessage(null);
|
||||
return this.scriptMessageProcessor.processMessage(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ public abstract class AbstractScriptExecutor implements ScriptExecutor {
|
||||
|
||||
this.scriptEngine = new ScriptEngineManager().getEngineByName(this.language);
|
||||
Assert.notNull(this.scriptEngine, invalidLanguageMessage(this.language));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Using script engine : " + scriptEngine.getFactory().getEngineName());
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Using script engine : " + this.scriptEngine.getFactory().getEngineName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,23 +72,23 @@ public abstract class AbstractScriptExecutor implements ScriptExecutor {
|
||||
try {
|
||||
String script = scriptSource.getScriptAsString();
|
||||
Date start = new Date();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("executing script: " + script);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("executing script: " + script);
|
||||
}
|
||||
|
||||
Bindings bindings = null;
|
||||
if (variables != null && variables.size() > 0) {
|
||||
bindings = new SimpleBindings(variables);
|
||||
result = scriptEngine.eval(script, bindings);
|
||||
result = this.scriptEngine.eval(script, bindings);
|
||||
}
|
||||
else {
|
||||
result = scriptEngine.eval(script);
|
||||
result = this.scriptEngine.eval(script);
|
||||
}
|
||||
|
||||
result = postProcess(result, scriptEngine, script, bindings);
|
||||
result = postProcess(result, this.scriptEngine, script, bindings);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("script executed in " + (new Date().getTime() - start.getTime()) + " ms");
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("script executed in " + (new Date().getTime() - start.getTime()) + " ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user