Use type parameter bounds for the 'to' set in OpenPgpgContentElement

This commit is contained in:
Florian Schmaus 2019-03-25 12:29:40 +01:00
parent 89c0fa4b99
commit ab7d81e7b5
4 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017 Florian Schmaus, 2018 Paul Schaub. * Copyright 2017-2019 Florian Schmaus, 2018 Paul Schaub.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,11 +32,11 @@ public class CryptElement extends EncryptedOpenPgpContentElement {
public static final String ELEMENT = "crypt"; public static final String ELEMENT = "crypt";
public CryptElement(Set<Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) { public CryptElement(Set<? extends Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) {
super(to, rpad, timestamp, payload); super(to, rpad, timestamp, payload);
} }
public CryptElement(Set<Jid> to, List<ExtensionElement> payload) { public CryptElement(Set<? extends Jid> to, List<ExtensionElement> payload) {
super(to, payload); super(to, payload);
} }

View File

@ -38,14 +38,14 @@ public abstract class EncryptedOpenPgpContentElement extends OpenPgpContentEleme
private final String rpad; private final String rpad;
protected EncryptedOpenPgpContentElement(Set<Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) { protected EncryptedOpenPgpContentElement(Set<? extends Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) {
super(Objects.requireNonNullNorEmpty( super(Objects.requireNonNullNorEmpty(
to, "Encrypted OpenPGP content elements must have at least one 'to' attribute."), to, "Encrypted OpenPGP content elements must have at least one 'to' attribute."),
timestamp, payload); timestamp, payload);
this.rpad = Objects.requireNonNull(rpad); this.rpad = Objects.requireNonNull(rpad);
} }
protected EncryptedOpenPgpContentElement(Set<Jid> to, List<ExtensionElement> payload) { protected EncryptedOpenPgpContentElement(Set<? extends Jid> to, List<ExtensionElement> payload) {
super(Objects.requireNonNullNorEmpty( super(Objects.requireNonNullNorEmpty(
to, "Encrypted OpenPGP content elements must have at least one 'to' attribute."), to, "Encrypted OpenPGP content elements must have at least one 'to' attribute."),
new Date(), payload); new Date(), payload);

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017 Florian Schmaus, 2018 Paul Schaub. * Copyright 2017-2019 Florian Schmaus, 2018 Paul Schaub.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -48,13 +48,13 @@ public abstract class OpenPgpContentElement implements ExtensionElement {
public static final String ATTR_STAMP = "stamp"; public static final String ATTR_STAMP = "stamp";
public static final String ELEM_PAYLOAD = "payload"; public static final String ELEM_PAYLOAD = "payload";
private final Set<Jid> to; private final Set<? extends Jid> to;
private final Date timestamp; private final Date timestamp;
private final MultiMap<String, ExtensionElement> payload; private final MultiMap<String, ExtensionElement> payload;
private String timestampString; private String timestampString;
protected OpenPgpContentElement(Set<Jid> to, Date timestamp, List<ExtensionElement> payload) { protected OpenPgpContentElement(Set<? extends Jid> to, Date timestamp, List<ExtensionElement> payload) {
this.to = to; this.to = to;
this.timestamp = Objects.requireNonNull(timestamp); this.timestamp = Objects.requireNonNull(timestamp);
this.payload = new MultiMap<>(); this.payload = new MultiMap<>();
@ -68,7 +68,7 @@ public abstract class OpenPgpContentElement implements ExtensionElement {
* *
* @return recipients. * @return recipients.
*/ */
public final Set<Jid> getTo() { public final Set<? extends Jid> getTo() {
return to; return to;
} }

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017 Florian Schmaus, 2018 Paul Schaub. * Copyright 2017-2019 Florian Schmaus, 2018 Paul Schaub.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -35,11 +35,11 @@ public class SigncryptElement extends EncryptedOpenPgpContentElement {
public static final String ELEMENT = "signcrypt"; public static final String ELEMENT = "signcrypt";
public SigncryptElement(Set<Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) { public SigncryptElement(Set<? extends Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) {
super(to, rpad, timestamp, payload); super(to, rpad, timestamp, payload);
} }
public SigncryptElement(Set<Jid> to, List<ExtensionElement> payload) { public SigncryptElement(Set<? extends Jid> to, List<ExtensionElement> payload) {
super(to, payload); super(to, payload);
} }