From e2f947baaae9bf09fc8df311e8b71d147f5d0bb6 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 26 Oct 2015 18:52:46 +0300 Subject: [PATCH] cleanup --- .../ide/passwordSafe/impl/PasswordSafeTimed.java | 4 ++-- .../providers/masterKey/MasterKeyPasswordSafe.java | 14 +++++++------- .../impl/providers/memory/MemoryPasswordSafe.java | 7 ++++--- .../src/com/intellij/util/TimedComputable.java | 6 +++--- .../util/src/com/intellij/util/TimedReference.java | 4 ++-- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeTimed.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeTimed.java index 3d6f5005f105..a65fe9262e32 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeTimed.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/PasswordSafeTimed.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; public abstract class PasswordSafeTimed extends TimedReference { private int myCheckCount; - public PasswordSafeTimed() { + protected PasswordSafeTimed() { super(null); } diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java index a31d31ec2407..336637a42746 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/MasterKeyPasswordSafe.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,8 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider { private static final String TEST_PASSWORD_VALUE = "test password"; private final PasswordDatabase myDatabase; - private transient final PasswordSafeTimed> myKey = new PasswordSafeTimed>() { + private final transient PasswordSafeTimed> myKey = new PasswordSafeTimed>() { + @Override protected Ref compute() { return Ref.create(); } @@ -62,7 +63,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider { }; public MasterKeyPasswordSafe(PasswordDatabase database) { - this.myDatabase = database; + myDatabase = database; } /** @@ -118,7 +119,6 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider { * * @param oldPassword the old password * @param newPassword the new password - * @param encrypt * @return re-encrypted database */ boolean changeMasterPassword(String oldPassword, String newPassword, boolean encrypt) { @@ -209,7 +209,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider { return computable.compute(); } - final AsyncFutureResult future = AsyncFutureFactory.getInstance().createAsyncFutureResult(); + final AsyncFutureResult future = AsyncFutureFactory.getInstance().createAsyncFutureResult(); final ExpirableRunnable runnable = new ExpirableRunnable() { @Override public boolean isExpired() { @@ -244,7 +244,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(runnable); } try { - return (T)future.get(); + return future.get(); } catch (InterruptedException e) { throw new ProcessCanceledException(e); @@ -307,7 +307,7 @@ public class MasterKeyPasswordSafe extends BasePasswordSafeProvider { return setMasterPassword(""); } - @SuppressWarnings({"MethodMayBeStatic"}) + @SuppressWarnings("MethodMayBeStatic") public boolean isOsProtectedPasswordSupported() { // TODO extension point needed? return SystemInfo.isWindows; diff --git a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java index b2fae146bd9d..a3a0432bbf70 100644 --- a/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java +++ b/platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/memory/MemoryPasswordSafe.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,11 +38,12 @@ public class MemoryPasswordSafe extends BasePasswordSafeProvider { /** * The key to use to encrypt data */ - private transient final AtomicReference key = new AtomicReference(); + private final transient AtomicReference key = new AtomicReference(); /** * The password database */ - private transient final PasswordSafeTimed> database = new PasswordSafeTimed>() { + private final transient PasswordSafeTimed> database = new PasswordSafeTimed>() { + @Override protected Map compute() { return Collections.synchronizedMap(ContainerUtil.newHashMap()); } diff --git a/platform/util/src/com/intellij/util/TimedComputable.java b/platform/util/src/com/intellij/util/TimedComputable.java index 1becbfe0a109..dcaf0fa63b9f 100644 --- a/platform/util/src/com/intellij/util/TimedComputable.java +++ b/platform/util/src/com/intellij/util/TimedComputable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ package com.intellij.util; import com.intellij.openapi.Disposable; import org.jetbrains.annotations.NotNull; -@SuppressWarnings({"NonPrivateFieldAccessedInSynchronizedContext"}) +@SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext") public abstract class TimedComputable extends Timed { - private int myAcquireCount = 0; + private int myAcquireCount; public TimedComputable(Disposable parentDisposable) { super(parentDisposable); diff --git a/platform/util/src/com/intellij/util/TimedReference.java b/platform/util/src/com/intellij/util/TimedReference.java index 393c8c802528..df67d3d12849 100644 --- a/platform/util/src/com/intellij/util/TimedReference.java +++ b/platform/util/src/com/intellij/util/TimedReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package com.intellij.util; import com.intellij.openapi.Disposable; import org.jetbrains.annotations.Nullable; -@SuppressWarnings({"NonPrivateFieldAccessedInSynchronizedContext"}) +@SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext") public class TimedReference extends Timed { public TimedReference(@Nullable Disposable parentDisposable) { super(parentDisposable);