mirror of
https://github.com/google/nomulus.git
synced 2025-08-05 09:21:49 +02:00
Clean up some code quality issues
This removes some qualifiers that aren't necessary (e.g. public/abstract on interfaces, private on enum constructors, final on private methods, static on nested interfaces/enums), uses Java 8 lambdas and features where that's an improvement ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177182945
This commit is contained in:
parent
0935ba6450
commit
e2db3f914e
109 changed files with 286 additions and 379 deletions
|
@ -298,12 +298,7 @@ public final class AppEngineRule extends ExternalResource {
|
|||
}
|
||||
|
||||
if (clock != null) {
|
||||
helper.setClock(new com.google.appengine.tools.development.Clock() {
|
||||
@Override
|
||||
public long getCurrentTime() {
|
||||
return clock.nowUtc().getMillis();
|
||||
}
|
||||
});
|
||||
helper.setClock(() -> clock.nowUtc().getMillis());
|
||||
}
|
||||
|
||||
if (withLocalModules) {
|
||||
|
|
|
@ -56,7 +56,6 @@ import com.google.common.collect.Streams;
|
|||
import com.google.common.net.InetAddresses;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import com.googlecode.objectify.Work;
|
||||
import com.googlecode.objectify.cmd.Saver;
|
||||
import google.registry.dns.writer.VoidDnsWriter;
|
||||
import google.registry.model.Buildable;
|
||||
|
@ -1030,11 +1029,7 @@ public class DatastoreHelper {
|
|||
|
||||
/** Force the create and update timestamps to get written into the resource. **/
|
||||
public static <R> R cloneAndSetAutoTimestamps(final R resource) {
|
||||
return ofy().transact(new Work<R>() {
|
||||
@Override
|
||||
public R run() {
|
||||
return ofy().load().fromEntity(ofy().save().toEntity(resource));
|
||||
}});
|
||||
return ofy().transact(() -> ofy().load().fromEntity(ofy().save().toEntity(resource)));
|
||||
}
|
||||
|
||||
/** Returns the entire map of {@link PremiumListEntry}s for the given {@link PremiumList}. */
|
||||
|
|
|
@ -60,16 +60,16 @@ public class DeterministicStringGenerator extends StringGenerator {
|
|||
@Override
|
||||
public String createString(int length) {
|
||||
checkArgument(length > 0, "String length must be positive.");
|
||||
String password = "";
|
||||
StringBuilder password = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
password += iterator.next();
|
||||
password.append(iterator.next());
|
||||
}
|
||||
switch (rule) {
|
||||
case PREPEND_COUNTER:
|
||||
return String.format("%04d_%s", counter++, password);
|
||||
return String.format("%04d_%s", counter++, password.toString());
|
||||
case DEFAULT:
|
||||
default:
|
||||
return password;
|
||||
return password.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,6 @@ public final class FakeKeyringModule {
|
|||
PgpHelper.lookupKeyPair(publics, privates, SIGNING_KEY_EMAIL, SIGN);
|
||||
final PGPPublicKey rdeReceiverKey =
|
||||
PgpHelper.lookupPublicKey(publics, RECEIVER_KEY_EMAIL, ENCRYPT);
|
||||
final PGPKeyPair brdaSigningKey = rdeSigningKey;
|
||||
final PGPPublicKey brdaReceiverKey = rdeReceiverKey;
|
||||
final String sshPublic =
|
||||
readResourceUtf8(FakeKeyringModule.class, "testdata/registry-unittest.id_rsa.pub");
|
||||
final String sshPrivate =
|
||||
|
@ -141,12 +139,12 @@ public final class FakeKeyringModule {
|
|||
|
||||
@Override
|
||||
public PGPKeyPair getBrdaSigningKey() {
|
||||
return brdaSigningKey;
|
||||
return rdeSigningKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PGPPublicKey getBrdaReceiverKey() {
|
||||
return brdaReceiverKey;
|
||||
return rdeReceiverKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class FullFieldsTestEntityHelper {
|
|||
|
||||
public static Registrar makeRegistrar(
|
||||
String clientId, String registrarName, Registrar.State state, Long ianaIdentifier) {
|
||||
Registrar registrar = new Registrar.Builder()
|
||||
return new Registrar.Builder()
|
||||
.setClientId(clientId)
|
||||
.setRegistrarName(registrarName)
|
||||
.setType(Registrar.Type.REAL)
|
||||
|
@ -82,7 +82,6 @@ public final class FullFieldsTestEntityHelper {
|
|||
.setWhoisServer("whois.example.com")
|
||||
.setReferralUrl("http://www.example.com")
|
||||
.build();
|
||||
return registrar;
|
||||
}
|
||||
|
||||
public static ImmutableList<RegistrarContact> makeRegistrarContacts(Registrar registrar) {
|
||||
|
|
|
@ -23,10 +23,6 @@ public final class Lazies {
|
|||
* Returns a {@link Lazy} that supplies a constant value.
|
||||
*/
|
||||
public static <T> Lazy<T> of(final T instance) {
|
||||
return new Lazy<T>() {
|
||||
@Override
|
||||
public T get() {
|
||||
return instance;
|
||||
}};
|
||||
return () -> instance;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,6 @@ public final class Providers {
|
|||
*
|
||||
*/
|
||||
public static <T> Provider<T> of(final T instance) {
|
||||
return new Provider<T>() {
|
||||
@Override
|
||||
public T get() {
|
||||
return instance;
|
||||
}};
|
||||
return () -> instance;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue