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:
		| @@ -1174,6 +1174,7 @@ public class AccountIT extends AbstractDaemonTest { | ||||
|     assertThat(actual.fingerprint) | ||||
|         .named(id) | ||||
|         .isEqualTo(Fingerprint.toString(expected.getPublicKey().getFingerprint())); | ||||
|     @SuppressWarnings("unchecked") | ||||
|     List<String> userIds = ImmutableList.copyOf(expected.getPublicKey().getUserIDs()); | ||||
|     assertThat(actual.userIds).named(id).containsExactlyElementsIn(userIds); | ||||
|     assertThat(actual.key).named(id).startsWith("-----BEGIN PGP PUBLIC KEY BLOCK-----\n"); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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)", | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   | ||||
| @@ -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("@"); | ||||
|   | ||||
| @@ -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()) { | ||||
|   | ||||
| @@ -77,7 +77,7 @@ public class TestKey { | ||||
|   } | ||||
|  | ||||
|   public String getFirstUserId() { | ||||
|     return getPublicKey().getUserIDs().next(); | ||||
|     return (String) getPublicKey().getUserIDs().next(); | ||||
|   } | ||||
|  | ||||
|   public PGPPrivateKey getPrivateKey() throws PGPException { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Han-Wen Nienhuys
					Han-Wen Nienhuys