Resolve warnings and inspections.
This commit is contained in:
@@ -48,5 +48,5 @@ public interface MPQuestion extends Comparable<MPQuestion> {
|
||||
// -- Relationship
|
||||
|
||||
@Nonnull
|
||||
MPSite getSite();
|
||||
MPSite<?> getSite();
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* @author lhunath, 2018-05-14
|
||||
*/
|
||||
public interface MPSite<Q extends MPQuestion> extends Comparable<MPSite<Q>> {
|
||||
public interface MPSite<Q extends MPQuestion> extends Comparable<MPSite<?>> {
|
||||
|
||||
// - Meta
|
||||
|
||||
|
@@ -29,13 +29,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public class MPSiteResult implements Comparable<MPSiteResult> {
|
||||
|
||||
private final MPSite site;
|
||||
private final MPSite<?> site;
|
||||
|
||||
public MPSiteResult(final MPSite site) {
|
||||
public MPSiteResult(final MPSite<?> site) {
|
||||
this.site = site;
|
||||
}
|
||||
|
||||
public MPSite getSite() {
|
||||
public MPSite<?> getSite() {
|
||||
return site;
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* @author lhunath, 2018-05-14
|
||||
*/
|
||||
public interface MPUser<S extends MPSite> extends Comparable<MPUser<?>> {
|
||||
public interface MPUser<S extends MPSite<?>> extends Comparable<MPUser<?>> {
|
||||
|
||||
// - Meta
|
||||
|
||||
|
@@ -19,8 +19,8 @@
|
||||
package com.lyndir.masterpassword.model;
|
||||
|
||||
import com.google.common.collect.*;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,8 +35,8 @@ public abstract class MPUserManager<U extends MPUser<?>> {
|
||||
usersByName.put( user.getFullName(), user );
|
||||
}
|
||||
|
||||
public SortedSet<U> getUsers() {
|
||||
return FluentIterable.from( usersByName.values() ).toSortedSet( Ordering.natural() );
|
||||
public Collection<U> getUsers() {
|
||||
return ImmutableList.copyOf( usersByName.values() );
|
||||
}
|
||||
|
||||
public U getUserNamed(final String fullName) {
|
||||
|
@@ -68,7 +68,7 @@ public abstract class MPBasicQuestion implements MPQuestion {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public abstract MPBasicSite getSite();
|
||||
public abstract MPBasicSite<?> getSite();
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
@@ -164,7 +164,7 @@ public abstract class MPBasicSite<Q extends MPQuestion> implements MPSite<Q> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull final MPSite<Q> o) {
|
||||
public int compareTo(@NotNull final MPSite<?> o) {
|
||||
return getName().compareTo( o.getName() );
|
||||
}
|
||||
|
||||
|
@@ -33,7 +33,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* @author lhunath, 2014-06-08
|
||||
*/
|
||||
public abstract class MPBasicUser<S extends MPBasicSite> implements MPUser<S> {
|
||||
public abstract class MPBasicUser<S extends MPBasicSite<?>> implements MPUser<S> {
|
||||
|
||||
private int avatar;
|
||||
private final String fullName;
|
||||
|
@@ -20,8 +20,6 @@ package com.lyndir.masterpassword.model.impl;
|
||||
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
import com.lyndir.masterpassword.*;
|
||||
import com.lyndir.masterpassword.model.MPSite;
|
||||
import com.lyndir.masterpassword.model.MPUser;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.Instant;
|
||||
|
@@ -96,15 +96,12 @@ public class MPFileUserManager extends MPUserManager<MPFileUser> {
|
||||
}
|
||||
|
||||
private static ImmutableList<File> listUserFiles(final File userFilesDirectory) {
|
||||
return ImmutableList.copyOf( ifNotNullElse( userFilesDirectory.listFiles( new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(final File dir, final String name) {
|
||||
for (final MPMarshalFormat format : MPMarshalFormat.values())
|
||||
if (name.endsWith( format.fileSuffix() ))
|
||||
return true;
|
||||
return ImmutableList.copyOf( ifNotNullElse( userFilesDirectory.listFiles( (dir, name) -> {
|
||||
for (final MPMarshalFormat format : MPMarshalFormat.values())
|
||||
if (name.endsWith( format.fileSuffix() ))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
} ), new File[0] ) );
|
||||
}
|
||||
|
||||
@@ -124,7 +121,7 @@ public class MPFileUserManager extends MPUserManager<MPFileUser> {
|
||||
public void save(final MPFileUser user, final MPMasterKey masterKey)
|
||||
throws MPKeyUnavailableException {
|
||||
try {
|
||||
final MPMarshalFormat format = user.getFormat();
|
||||
MPMarshalFormat format = user.getFormat();
|
||||
new CharSink() {
|
||||
@Override
|
||||
public Writer openStream()
|
||||
|
@@ -33,6 +33,7 @@ import java.util.regex.Pattern;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Instant;
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,7 +78,7 @@ public class MPFlatUnmarshaller implements MPUnmarshaller {
|
||||
else
|
||||
// Ends the header.
|
||||
user = new MPFileUser( fullName, keyID, MPAlgorithm.Version.fromInt( mpVersion ).getAlgorithm(),
|
||||
avatar, defaultType, new DateTime( 0 ), MPMarshalFormat.Flat,
|
||||
avatar, defaultType, new Instant( 0 ), MPMarshalFormat.Flat,
|
||||
clearContent? MPMarshaller.ContentMode.VISIBLE: MPMarshaller.ContentMode.PROTECTED );
|
||||
|
||||
// Comment.
|
||||
|
@@ -25,6 +25,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* @author lhunath, 14-12-07
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface MPMarshaller {
|
||||
|
||||
@Nonnull
|
||||
|
Reference in New Issue
Block a user