1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-01 16:32:08 +01:00
Smack/smack-java11/build.gradle

21 lines
530 B
Groovy
Raw Normal View History

Bump to Gradle 8.10.2, require Java 11 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
2024-09-25 11:43:47 +02:00
plugins {
id 'org.igniterealtime.smack.java-common-conventions'
}
2014-07-20 12:58:36 +02:00
description = """\
Bump to Gradle 8.10.2, require Java 11 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
2024-09-25 11:43:47 +02:00
Smack for Java 11 (or higher).
2014-07-20 12:58:36 +02:00
This is a pseudo-artifact that pulls all the required dependencies to
Bump to Gradle 8.10.2, require Java 11 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
2024-09-25 11:43:47 +02:00
run Smack on Java 11 (or higher) JVMs. Usually you want to add additional
dependencies to smack-tcp, smack-extensions and smack-experimental."""
2014-07-20 12:58:36 +02:00
dependencies {
api project(":smack-core")
api project(":smack-resolver-javax")
api project(":smack-sasl-javax")
smack-java7: Add missing smack-xmlparser-stax dependency Since 2f667f95a ("gradle: Remove archives configuration") the :smack-repl:printXmppNioTcpConnectionStateGraph JavaExec task failed with > Task :smack-repl:printXmppNioTcpConnectionStateGraph FAILED Exception in thread "main" java.lang.ExceptionInInitializerError at org.jivesoftware.smack.SmackConfiguration.getVersion(SmackConfiguration.java:108) at org.jivesoftware.smack.AbstractXMPPConnection.<clinit>(AbstractXMPPConnection.java:187) at org.igniterealtime.smack.smackrepl.StateGraph.main(StateGraph.java:37) Caused by: java.lang.IllegalStateException: Could not parse Smack configuration file at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:100) ... 3 more Caused by: java.lang.IllegalStateException: Could not load a XmlPullParserFactory via Service Provider Interface (SPI) at org.jivesoftware.smack.xml.SmackXmlParser.getXmlPullParserFactory(SmackXmlParser.java:34) at org.jivesoftware.smack.xml.SmackXmlParser.newXmlParser(SmackXmlParser.java:53) at org.jivesoftware.smack.util.PacketParserUtils.getParserFor(PacketParserUtils.java:76) at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:144) at org.jivesoftware.smack.SmackInitialization.processConfigFile(SmackInitialization.java:139) at org.jivesoftware.smack.SmackInitialization.<clinit>(SmackInitialization.java:97) ... 3 more because no XmlPullParser was registered via SPI. The 'archives' configuration which was removed with 2f667f95a ("gradle: Remove archives configuration"), previously pulled in the parser. Just like smack-android delcares a dependency on smack-xmlparser-xpp3, smack-java7 should declare a dependency on smack-xmlparser-stax.
2019-09-23 15:11:22 +02:00
implementation project(":smack-xmlparser-stax")
2014-07-20 12:58:36 +02:00
}
javadoc {
enabled = false
}