mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 14:01:08 +01:00
Do not have Stanza.getExtension(String, String) return a generic type
Returning a generic would allow for
List<ExtensionElement> list = stanza.getExtension("foo", "bar");
to compile (Note the we are calling getExtension(), not
getExtension*s*()).
Users are encouraged to use the type safe getExtension(Class<? extends
ExtensionElement) variant instead.
Fixes SMACK-825.
This commit is contained in:
parent
62916b8490
commit
07da9ffb48
65 changed files with 207 additions and 121 deletions
|
|
@ -95,7 +95,7 @@ public class JivePropertiesManager {
|
|||
*/
|
||||
public static Object getProperty(StanzaView packet, String name) {
|
||||
Object res = null;
|
||||
JivePropertiesExtension jpe = (JivePropertiesExtension) packet.getExtension(JivePropertiesExtension.QNAME);
|
||||
JivePropertiesExtension jpe = packet.getExtension(JivePropertiesExtension.class);
|
||||
if (jpe != null) {
|
||||
res = jpe.getProperty(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,6 +213,6 @@ public class JivePropertiesExtension implements ExtensionElement {
|
|||
* @since 4.2
|
||||
*/
|
||||
public static JivePropertiesExtension from(Message message) {
|
||||
return message.getExtension(ELEMENT, NAMESPACE);
|
||||
return message.getExtension(JivePropertiesExtension.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue