Bump Gradle from 6.8.3 to 8.10.2 and increase the minimum required
Java version from 8 to 11 (SMACK-953).
The switch from Java 8 to 11 caused some Bytecode portability issues
regarding NIO Buffers. Java changed with version 9 the return type of
some subclasses of Buffer to return the specific Buffer type instead
of the Buffer superclass [JDK-4774077]. For example, ByteBuffer.filp()
previously returned Buffer, while it does return ByteBuffer now.
This sensible change was not reflected by the Android API [1], which
means that AnimalSniffer rightfully started to complain that there is
no method "ByteBuffer ByteBuffer.flip()" in Android, there is only
"Buffer ByteBuffer.flip()", and those are incompatible methods on
Java's Bytecode layer.
As workaround, this changes
return charBuffer.flip().toString();
to
((java.nio.Buffer) charBuffer).flip();
return charBuffer.toString();
to restore the Bytecode portability between Android and Java.
Errorprone also got new checks, of which JavaUtilDate and JdkObsolete
are wroth mentioning.
JavaUtilData basically strongly recommends to use Java's newer time
API over java.util.Date. But since Smack was Java 8 until now,
j.u.Date is widely used.
Similar JdkObsolete mentions obsolete JDK APIs, like data structures
like Vector and Stack. But mostly LinkedList, which should usually be
replaced by ArrayList. And this is what this commit largely does.
JDK-4774077: https://bugs.openjdk.org/browse/JDK-4774077
1: https://issuetracker.google.com/issues/369219141
This is a complete redesign of what was previously
XmppNioTcpConnection. The new architecture allows to extend an XMPP
client to server (c2s) connection with new transport bindings and
other extensions.
This is needed for javadocAll since otherwhise there will be
smack-core/src/main/java/org/jivesoftware/smack/package-info.java:21:
warning: a package-info.java file has already been seen for
package org.jivesoftware.smack
warnings.
This commit adds
- SmackReactor / NIO
- a framework for finite state machine connections
- support for Java 8
- pretty printed XML debug output
It also
- reworks the integration test framework
- raises the minimum Android API level to 19
- introduces XmppNioTcpConnection
Furthermore fixes SMACK-801 (at least partly). Java 8 language
features are available, but not all runtime library methods. For that
we would need to raise the Android API level to 24 or higher.
Also add minidns-core as dependency to smack-core. This requires
increasing the minimum required Android SDK level to 9, as this is
what MiniDNS requires.
in case hostAddresses was null, the isEmpty() check before the log()
invocation would throw an NPE. Thanks to Ingo Bauersachs for reporting
this.
Fixes SMACK-788.
W/System.err: java.lang.IllegalStateException: Can not perform operation because the DNS resolution was unsuccessful
W/System.err: at de.measite.minidns.hla.ResolverResult.throwIseIfErrorResponse(ResolverResult.ja va:113)
W/System.err: at de.measite.minidns.hla.ResolverResult.getAnswers(ResolverResult.java:56)
W/System.err: at org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver.lookupHostAddress0(Mini DnsResolver.java:130)
W/System.err: at org.jivesoftware.smack.util.dns.DNSResolver.lookupHostAddress(DNSResolver.java: 52)
W/System.err: at org.jivesoftware.smack.AbstractXMPPConnection.populateHostAddresses(AbstractXMP PConnection.java:612)
W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:555)
W/System.err: at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:885)
W/System.err: at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:374)
W/System.err: at com.example.bosleo.chatapp.ChatConnection.connect(ChatConnection.java:147)
W/System.err: at com.example.bosleo.chatapp.ChatConnectionService.initConnection(ChatConnectionS ervice.java:82)
W/System.err: at com.example.bosleo.chatapp.ChatConnectionService.access$100(ChatConnectionServi ce.java:20)
W/System.err: at com.example.bosleo.chatapp.ChatConnectionService$1.run(ChatConnectionService.ja va:105)
W/System.err: at java.lang.Thread.run(Thread.java:818)
W/System.err: Caused by: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for 192.168.2.128. IN AAAA yielded an error response NX_DOMAIN
W/System.err: at de.measite.minidns.hla.ResolverResult.getResolutionUnsuccessfulException(Resolv erResult.java:89)
W/System.err: at de.measite.minidns.hla.ResolverResult.throwIseIfErrorResponse(ResolverResult.ja va:111)
W/System.err: ... 12 more
on package layer instead of Declarative Service (DS) approach.
Restructuring and cleanup of initialization process to ensure that all
internal config files are found by the corresponding bundle
classloaders.
SMACK-343
In dd84d53bbc the usage of dynamic
dependencies was removed because OSS Sonatype would not longer allow
them, i.e. the '1.2.+' notation, on release artifacts. But they allow
the mathematical range notation '(1.2,1.3]', therefore we use this now.