Revert "Fix eclipse warnings"

This reverts commit 3175942514.

Reason for revert: this change leads to breakages inside google. We are still on BC 1.5.5

gerrit-gpg/test/java/com/google/gerrit/gpg/testutil/TestKey.java:80: error: incompatible types: Object cannot be converted to String
    return getPublicKey().getUserIDs().next();
                                           ^

Change-Id: Idc603ad379f1265da8b851afed3fdea6598bf27c
This commit is contained in:
Han-Wen Nienhuys
2017-06-26 12:12:19 +00:00
parent 3175942514
commit a5c310bf35
8 changed files with 10 additions and 3 deletions

View File

@@ -176,6 +176,7 @@ public class GerritPublicKeyChecker extends PublicKeyChecker {
private boolean hasAllowedUserId(PGPPublicKey key, Set<String> allowedUserIds)
throws PGPException {
@SuppressWarnings("unchecked")
Iterator<String> userIds = key.getUserIDs();
while (userIds.hasNext()) {
String userId = userIds.next();

View File

@@ -381,6 +381,7 @@ public class PublicKeyChecker {
}
List<CheckResult> signerResults = new ArrayList<>();
@SuppressWarnings("unchecked")
Iterator<String> userIds = key.getUserIDs();
while (userIds.hasNext()) {
String userId = userIds.next();

View File

@@ -398,6 +398,7 @@ public class PublicKeyStore implements AutoCloseable {
}
public static String keyToString(PGPPublicKey key) {
@SuppressWarnings("unchecked")
Iterator<String> it = key.getUserIDs();
return String.format(
"%s %s(%s)",

View File

@@ -219,6 +219,7 @@ public class GpgKeys implements ChildCollection<AccountResource, GpgKey> {
if (key != null) {
info.id = PublicKeyStore.keyIdToString(key.getKeyID());
info.fingerprint = Fingerprint.toString(key.getFingerprint());
@SuppressWarnings("unchecked")
Iterator<String> userIds = key.getUserIDs();
info.userIds = ImmutableList.copyOf(userIds);

View File

@@ -374,7 +374,7 @@ public class GerritPublicKeyCheckerTest {
PGPPublicKeyRing keyRingB = keyB().getPublicKeyRing();
PGPPublicKey keyB = keyRingB.getPublicKey();
keyB = PGPPublicKey.removeCertification(keyB, keyB.getUserIDs().next());
keyB = PGPPublicKey.removeCertification(keyB, (String) keyB.getUserIDs().next());
keyRingB = PGPPublicKeyRing.insertPublicKey(keyRingB, keyB);
add(keyRingB, addUser("userB"));
@@ -392,7 +392,8 @@ public class GerritPublicKeyCheckerTest {
List<ExternalId> newExtIds = new ArrayList<>(2);
newExtIds.add(ExternalId.create(toExtIdKey(kr.getPublicKey()), id));
String userId = Iterators.getOnlyElement(kr.getPublicKey().getUserIDs(), null);
@SuppressWarnings("unchecked")
String userId = (String) Iterators.getOnlyElement(kr.getPublicKey().getUserIDs(), null);
if (userId != null) {
String email = PushCertificateIdent.parse(userId).getEmailAddress();
assertThat(email).contains("@");

View File

@@ -231,6 +231,7 @@ public class PublicKeyStoreTest {
private void assertUserIds(PGPPublicKeyRing keyRing, String... expected) throws Exception {
List<String> actual = new ArrayList<>();
@SuppressWarnings("unchecked")
Iterator<String> userIds =
store.get(keyRing.getPublicKey().getKeyID()).iterator().next().getPublicKey().getUserIDs();
while (userIds.hasNext()) {

View File

@@ -77,7 +77,7 @@ public class TestKey {
}
public String getFirstUserId() {
return getPublicKey().getUserIDs().next();
return (String) getPublicKey().getUserIDs().next();
}
public PGPPrivateKey getPrivateKey() throws PGPException {