Commit 40fdb370 authored by Daniel Le Berre's avatar Daniel Le Berre
Browse files

fixed a few sonar violations (var with Java 11)

parent 5d39eb37
Pipeline #20027 passed with stages
in 45 minutes and 58 seconds
......@@ -19,7 +19,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
......
......@@ -11,9 +11,9 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
......@@ -21,7 +21,9 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
......
......@@ -35,8 +35,6 @@ import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.net.URL;
import java.util.Properties;
import org.sat4j.core.ASolverFactory;
import org.sat4j.minisat.core.ICDCL;
......@@ -129,18 +127,18 @@ public abstract class AbstractLauncher implements Serializable, ILogAble {
protected final void displayHeader() {
displayLicense();
URL url = AbstractLauncher.class.getResource("/sat4j.version"); //$NON-NLS-1$
var url = AbstractLauncher.class.getResource("/sat4j.version"); //$NON-NLS-1$
if (url == null) {
log("no version file found!!!"); //$NON-NLS-1$
} else {
try (BufferedReader in = new BufferedReader(
try (var in = new BufferedReader(
new InputStreamReader(url.openStream()))) {
log("version " + in.readLine()); //$NON-NLS-1$
} catch (IOException e) {
log("c ERROR: " + e.getMessage());
}
}
Properties prop = System.getProperties();
var prop = System.getProperties();
String[] infoskeys = { "java.runtime.name", "java.vm.name", //$NON-NLS-1$//$NON-NLS-2$
"java.vm.version", "java.vm.vendor", "sun.arch.data.model", //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
"java.version", "os.name", "os.version", "os.arch" };
......@@ -148,7 +146,7 @@ public abstract class AbstractLauncher implements Serializable, ILogAble {
log(key + (key.length() < 14 ? "\t\t" : "\t") //$NON-NLS-1$
+ prop.getProperty(key));
}
Runtime runtime = Runtime.getRuntime();
var runtime = Runtime.getRuntime();
log("Free memory \t\t" + runtime.freeMemory()); //$NON-NLS-1$
log("Max memory \t\t" + runtime.maxMemory()); //$NON-NLS-1$
log("Total memory \t\t" + runtime.totalMemory()); //$NON-NLS-1$
......@@ -273,16 +271,14 @@ public abstract class AbstractLauncher implements Serializable, ILogAble {
System.out.println(this.solver.getLogPrefix()
+ "model enumeration using the external way");
} else {
SearchEnumeratorListener enumerator = new SearchEnumeratorListener(
launcherMode);
var enumerator = new SearchEnumeratorListener(launcherMode);
this.solver.setSearchListener(enumerator);
System.out.println(this.solver.getLogPrefix()
+ "model enumeration using the internal way");
}
}
if (System.getProperty("minone") != null) {
SearchMinOneListener minone = new SearchMinOneListener(
launcherMode);
var minone = new SearchMinOneListener(launcherMode);
this.solver.setSearchListener(minone);
}
}
......
......@@ -128,7 +128,7 @@ public final class DecisionMode implements ILauncherMode {
reader.decode(model, out);
out.println();
} else {
int[] stats = new int[AssignmentOrigin.values().length];
var stats = new int[AssignmentOrigin.values().length];
AssignmentOrigin origin;
for (int p : model) {
origin = solver.getOriginInModel(p);
......
......@@ -111,7 +111,7 @@ public class MUSLauncher extends AbstractLauncher {
try {
this.xplain.setMinimizationStrategy(
(MinimizationStrategy) Class.forName(className)
.newInstance());
.getDeclaredConstructor().newInstance());
} catch (Exception e) {
log(e.getMessage());
}
......@@ -160,6 +160,10 @@ public class MUSLauncher extends AbstractLauncher {
double beginmus = System.currentTimeMillis();
if (allMuses != null) {
SolutionFoundListener mssListener = new SolutionFoundListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
private int msscount = 0;
public void onUnsatTermination() {
......@@ -178,6 +182,11 @@ public class MUSLauncher extends AbstractLauncher {
}
};
SolutionFoundListener musListener = new SolutionFoundListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void onSolutionFound(int[] solution) {
}
......
......@@ -29,6 +29,7 @@
*******************************************************************************/
package org.sat4j.tools;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
......@@ -48,7 +49,12 @@ import org.sat4j.specs.TimeoutException;
* @author sroussel
* @since 2.3.3
*/
public class AllMUSes {
public class AllMUSes implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private final AbstractClauseSelectorSolver<? extends ISolver> css;
private final List<IVecInt> mssList;
......
......@@ -48,6 +48,11 @@ public interface SolutionFoundListener extends Serializable {
SolutionFoundListener VOID = new SolutionFoundListener() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void onSolutionFound(int[] model) {
// do nothing
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment