Cleanup and fix some warnings.
This commit is contained in:
parent
596ace51ea
commit
3403449ca2
@ -14,14 +14,13 @@ artifacts {
|
|||||||
from 'lib'
|
from 'lib'
|
||||||
|
|
||||||
components.withType( ComponentWithRuntimeFile ) {
|
components.withType( ComponentWithRuntimeFile ) {
|
||||||
if (isOptimized()) {
|
if (optimized)
|
||||||
from runtimeFile, {
|
from runtimeFile, {
|
||||||
into standardOperatingSystem( targetPlatform ) + '/' + standardArchitecture( targetPlatform )
|
into standardOperatingSystem( targetPlatform ) + '/' + standardArchitecture( targetPlatform )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
library {
|
library {
|
||||||
baseName.set( 'mpw' )
|
baseName.set( 'mpw' )
|
||||||
@ -55,31 +54,33 @@ library {
|
|||||||
from files( new File( Jvm.current().javaHome, 'include' ) ) { first().eachDir { from it } }
|
from files( new File( Jvm.current().javaHome, 'include' ) ) { first().eachDir { from it } }
|
||||||
}
|
}
|
||||||
|
|
||||||
binaries.configureEach {
|
binaries.whenElementFinalized {
|
||||||
|
project.dependencies {
|
||||||
def system = standardOperatingSystem( targetPlatform )
|
def system = standardOperatingSystem( targetPlatform )
|
||||||
|
|
||||||
project.dependencies {
|
// libsodium
|
||||||
add( linkLibraries.name,
|
archive.dependsOn project.tasks.maybeCreate( "build_libsodium-${system}", Exec ).configure {
|
||||||
fileTree( "$rootDir/../lib/libsodium/build-${system}~/out/lib" ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
archive.dependsOn project.tasks.maybeCreate( "build_libsodium-${system}", Exec.class ).configure {
|
|
||||||
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}"
|
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}"
|
||||||
privateHeaders.from "$rootDir/../lib/libsodium/build-${system}~/out/include"
|
privateHeaders.from "$rootDir/../lib/libsodium/build-${system}~/out/include"
|
||||||
|
add( linkLibraries.name, fileTree( "$rootDir/../lib/libsodium/build-${system}~/out/lib" ) )
|
||||||
}
|
}
|
||||||
clean.dependsOn project.tasks.maybeCreate( "clean_libsodium-${system}", Exec.class ).configure {
|
clean.dependsOn project.tasks.maybeCreate( "clean_libsodium-${system}", Exec ).configure {
|
||||||
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}", 'clean'
|
commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}", 'clean'
|
||||||
}
|
}
|
||||||
archive.dependsOn project.tasks.maybeCreate( "build_libjson-c-${system}", Exec.class ).configure {
|
|
||||||
|
// libjson-c
|
||||||
|
archive.dependsOn project.tasks.maybeCreate( "build_libjson-c-${system}", Exec ).configure {
|
||||||
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}"
|
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}"
|
||||||
privateHeaders.from "$rootDir/../lib/libjson-c/build-${system}~/out/include"
|
privateHeaders.from "$rootDir/../lib/libjson-c/build-${system}~/out/include"
|
||||||
|
add( linkLibraries.name, fileTree( "$rootDir/../lib/libjson-c/build-${system}~/out/lib" ) )
|
||||||
}
|
}
|
||||||
clean.dependsOn project.tasks.maybeCreate( "clean_libjson-c-${system}", Exec.class ).configure {
|
clean.dependsOn project.tasks.maybeCreate( "clean_libjson-c-${system}", Exec ).configure {
|
||||||
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}", 'clean'
|
commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}", 'clean'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static String standardOperatingSystem(NativePlatform platform) {
|
static String standardOperatingSystem(NativePlatform platform) {
|
||||||
OperatingSystem os = platform.getOperatingSystem()
|
OperatingSystem os = platform.getOperatingSystem()
|
||||||
|
@ -47,7 +47,7 @@ public class GUI {
|
|||||||
|
|
||||||
public static void main(final String... args) {
|
public static void main(final String... args) {
|
||||||
Thread.setDefaultUncaughtExceptionHandler(
|
Thread.setDefaultUncaughtExceptionHandler(
|
||||||
(t, e) -> logger.err( e, "Uncaught: %s", e.getLocalizedMessage() ) );
|
(t, e) -> logger.bug( e, "Uncaught: %s", e.getLocalizedMessage() ) );
|
||||||
|
|
||||||
if (Config.get().checkForUpdates())
|
if (Config.get().checkForUpdates())
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
|
@ -33,7 +33,7 @@ public class SwingExecutorService extends AbstractExecutorService {
|
|||||||
|
|
||||||
synchronized (pendingCommands) {
|
synchronized (pendingCommands) {
|
||||||
if (pendingCommands.isEmpty())
|
if (pendingCommands.isEmpty())
|
||||||
terminated.offer( true );
|
terminated.add( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class SwingExecutorService extends AbstractExecutorService {
|
|||||||
pendingCommands.remove( command );
|
pendingCommands.remove( command );
|
||||||
|
|
||||||
if (shutdown && pendingCommands.isEmpty())
|
if (shutdown && pendingCommands.isEmpty())
|
||||||
terminated.offer( true );
|
terminated.add( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,12 @@ public class Changeable {
|
|||||||
|
|
||||||
private static final ExecutorService changeExecutor = Executors.newSingleThreadExecutor();
|
private static final ExecutorService changeExecutor = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
private boolean changed;
|
private final Object mutex = new Object();
|
||||||
private Grouping grouping = Grouping.APPLY;
|
private Grouping grouping = Grouping.APPLY;
|
||||||
|
private boolean changed;
|
||||||
|
|
||||||
void setChanged() {
|
void setChanged() {
|
||||||
synchronized (changeExecutor) {
|
synchronized (mutex) {
|
||||||
if (changed)
|
if (changed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ public class Changeable {
|
|||||||
changed = true;
|
changed = true;
|
||||||
if (grouping != Grouping.APPLY)
|
if (grouping != Grouping.APPLY)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
changeExecutor.submit( () -> {
|
changeExecutor.submit( () -> {
|
||||||
synchronized (changeExecutor) {
|
synchronized (changeExecutor) {
|
||||||
@ -34,25 +36,24 @@ public class Changeable {
|
|||||||
onChanged();
|
onChanged();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected void onChanged() {
|
protected void onChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beginChanges() {
|
public void beginChanges() {
|
||||||
synchronized (changeExecutor) {
|
synchronized (mutex) {
|
||||||
grouping = Grouping.BATCH;
|
grouping = Grouping.BATCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ignoreChanges() {
|
public void ignoreChanges() {
|
||||||
synchronized (changeExecutor) {
|
synchronized (mutex) {
|
||||||
grouping = Grouping.IGNORE;
|
grouping = Grouping.IGNORE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean endChanges() {
|
public boolean endChanges() {
|
||||||
synchronized (changeExecutor) {
|
synchronized (mutex) {
|
||||||
grouping = Grouping.APPLY;
|
grouping = Grouping.APPLY;
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
@ -159,7 +159,7 @@ public class MPFileSite extends MPBasicSite<MPFileQuestion> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final MPSite<?> o) {
|
public int compareTo(final MPSite<?> o) {
|
||||||
int comparison = (o instanceof MPFileSite)? -getLastUsed().compareTo( ((MPFileSite) o).getLastUsed() ): 0;
|
int comparison = (o instanceof MPFileSite)? ((MPFileSite) o).getLastUsed().compareTo( getLastUsed() ): 0;
|
||||||
if (comparison != 0)
|
if (comparison != 0)
|
||||||
return comparison;
|
return comparison;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class MPFileUser extends MPBasicUser<MPFileSite> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final MPUser<?> o) {
|
public int compareTo(final MPUser<?> o) {
|
||||||
int comparison = (o instanceof MPFileUser)? -getLastUsed().compareTo( ((MPFileUser) o).getLastUsed() ): 0;
|
int comparison = (o instanceof MPFileUser)? ((MPFileUser) o).getLastUsed().compareTo( getLastUsed() ): 0;
|
||||||
if (comparison != 0)
|
if (comparison != 0)
|
||||||
return comparison;
|
return comparison;
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.lyndir.masterpassword.model.impl;
|
package com.lyndir.masterpassword.model.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.*;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ class MPJSONAnyObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "ChainOfInstanceofChecks", "Contract" })
|
@SuppressWarnings({ "ChainOfInstanceofChecks", "Contract" })
|
||||||
|
@SuppressFBWarnings({"EQ_UNUSUAL","EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS", "HE_EQUALS_USE_HASHCODE"})
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (obj instanceof Collection<?>)
|
if (obj instanceof Collection<?>)
|
||||||
return ((Collection<?>) obj).isEmpty();
|
return ((Collection<?>) obj).isEmpty();
|
||||||
|
@ -82,7 +82,6 @@ public class MPJSONFile extends MPJSONAnyObject {
|
|||||||
user.default_type = modelUser.getDefaultType();
|
user.default_type = modelUser.getDefaultType();
|
||||||
|
|
||||||
// Section "sites"
|
// Section "sites"
|
||||||
if (sites == null)
|
|
||||||
sites = new LinkedHashMap<>();
|
sites = new LinkedHashMap<>();
|
||||||
for (final MPFileSite modelSite : modelUser.getSites()) {
|
for (final MPFileSite modelSite : modelUser.getSites()) {
|
||||||
String content = null, loginContent = null;
|
String content = null, loginContent = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user