diff --git a/.travis.yml b/.travis.yml index 24fcf017b..3611465b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,14 @@ language: android android: components: - android-8 +jdk: + - oraclejdk8 + - oraclejdk7 + install: gradle assemble script: gradle check after_success: -- gradle jacocoRootReport coveralls +- JAVAC_VERSION=$((javac -version) 2>&1) +# Only run jacocoRootReport in the Java7 build +- if [[ "$JAVAC_VERSION" = javac\ 1.7.* ]]; then gradle jacocoRootReport coveralls; fi diff --git a/build.gradle b/build.gradle index 8a648c493..a3d32e53d 100644 --- a/build.gradle +++ b/build.gradle @@ -118,6 +118,14 @@ allprojects { options.encoding = "utf8" options.compilerArgs = [ '-Xlint:all', + // Set '-options' because a non-java7 javac will emit a + // warning if source/traget is set to 1.7 and + // bootclasspath is *not* set. + // TODO implement a sound heuristic to determine a java7 + // rt.jar on the build host. And if none is found, + // fallback to using a environment variable, + // e.g. JAVA7_HOME. See SMACK-651. + '-Xlint:-options', '-Werror', ] } @@ -134,6 +142,17 @@ allprojects { xml.enabled true } } + + if (JavaVersion.current().isJava8Compatible()) { + tasks.withType(Javadoc) { + // The '-quiet' as second argument is actually a hack, + // since the one paramater addStringOption doesn't seem to + // work, we extra add '-quiet', which is added anyway by + // gradle. + // TODO enable all doclints, see SMACK-650 + options.addStringOption('Xdoclint:all,-html,-syntax', '-quiet') + } + } } gradle.taskGraph.whenReady { taskGraph -> diff --git a/smack-core/src/main/java/org/jivesoftware/smack/compression/Java7ZlibInputOutputStream.java b/smack-core/src/main/java/org/jivesoftware/smack/compression/Java7ZlibInputOutputStream.java index 08ca3c179..4b2035236 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/compression/Java7ZlibInputOutputStream.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/compression/Java7ZlibInputOutputStream.java @@ -34,12 +34,9 @@ import java.util.zip.InflaterInputStream; *

* See also: *

* * @author Florian Schmaus */ diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java index 63f2f5511..f1be2d0e2 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java @@ -42,6 +42,7 @@ import org.jxmpp.jid.Jid; * For each message type, different message fields are typically used as follows: *

* + * * * * diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java index 64c0e5b21..93c7e3df4 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java @@ -285,7 +285,7 @@ public abstract class Stanza implements TopLevelStreamElement { } /** - * Return a set of all extensions with the given element name and namespace. + * Return a set of all extensions with the given element name and namespace. *

* Changes to the returned set will update the stanza(/packet) extensions, if the returned set is not the empty set. *

diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java index aa8dac852..a9e9564f1 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java @@ -29,6 +29,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * These is the list of stream errors as defined in the XMPP spec:

* *

Message Types
 Message type
FieldNormalChatGroup ChatHeadlineXMPPError
subject SHOULDSHOULD NOTSHOULD NOTSHOULD NOTSHOULD NOT
+ * * * *
Stream Errors
CodeDescription
bad-format the entity has sent XML that cannot be processed
unsupported-encoding the entity has sent a namespace prefix that is diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java index 8a259838f..fb9f18da2 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java @@ -31,6 +31,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * error condition as well as as an optional text explanation. Typical errors are:

* * + * *
* * diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java b/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java index f8be19611..a24c06d49 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/ArrayBlockingQueueWithShutdown.java @@ -236,7 +236,6 @@ public class ArrayBlockingQueueWithShutdown extends AbstractQueue implemen *
  • If the thread was was interrupted.
  • * * So you have to check which is the case, e.g. by calling {@link #isShutdown()}. - *

    * * @param e the element to add. * @throws InterruptedException if interrupted while waiting or if the queue was shut down. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 49d1a43a5..15b895908 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -191,7 +191,7 @@ public class XmlStringBuilder implements Appendable, CharSequence { } /** - * Add a right angle bracket '>'. + * Add a right angle bracket '>'. * * @return a reference to this object. */ @@ -201,7 +201,7 @@ public class XmlStringBuilder implements Appendable, CharSequence { } /** - * Add a right angle bracket '>'. + * Add a right angle bracket '>'. * * @return a reference to this object * @deprecated use {@link #rightAngleBracket()} instead @@ -306,7 +306,7 @@ public class XmlStringBuilder implements Appendable, CharSequence { } /** - * Add the given attribute if value not null and value => 0. + * Add the given attribute if value not null and {@code value => 0}. * * @param name * @param value diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java index 0bbb1395e..74e7fd85c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedConference.java @@ -110,6 +110,7 @@ public class BookmarkedConference implements SharedBookmark { this.password = password; } + @Override public boolean equals(Object obj) { if(obj == null || !(obj instanceof BookmarkedConference)) { return false; @@ -118,6 +119,11 @@ public class BookmarkedConference implements SharedBookmark { return conference.getJid().equalsIgnoreCase(jid); } + @Override + public int hashCode() { + return getJid().hashCode(); + } + protected void setShared(boolean isShared) { this.isShared = isShared; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java index d00161add..0a521bcdf 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/BookmarkedURL.java @@ -84,6 +84,7 @@ public class BookmarkedURL implements SharedBookmark { return isRss; } + @Override public boolean equals(Object obj) { if(!(obj instanceof BookmarkedURL)) { return false; @@ -92,6 +93,11 @@ public class BookmarkedURL implements SharedBookmark { return url.getURL().equalsIgnoreCase(URL); } + @Override + public int hashCode() { + return getURL().hashCode(); + } + protected void setShared(boolean shared) { this.isShared = shared; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java index 84904f99a..7d376e103 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java @@ -27,11 +27,11 @@ import org.jivesoftware.smackx.xdata.packet.DataForm; /** * Represents a Form for gathering data. The form could be of the following types: *
      - *
    • form -> Indicates a form to fill out.
    • - *
    • submit -> The form is filled out, and this is the data that is being returned from + *
    • form → Indicates a form to fill out.
    • + *
    • submit → The form is filled out, and this is the data that is being returned from * the form.
    • - *
    • cancel -> The form was cancelled. Tell the asker that piece of information.
    • - *
    • result -> Data results being returned from a search, or some other query.
    • + *
    • cancel → The form was cancelled. Tell the asker that piece of information.
    • + *
    • result → Data results being returned from a search, or some other query.
    • *
    * * Depending of the form's type different operations are available. For example, it's only possible @@ -383,7 +383,7 @@ public class Form { /** * Returns the description of the data. It is similar to the title on a web page or an X - * window. You can put a on either a form to fill out, or a set of data results. + * window. You can put a title on either a form to fill out, or a set of data results. * * @return description of the data. */ @@ -423,7 +423,7 @@ public class Form { /** * Sets the description of the data. It is similar to the title on a web page or an X window. - * You can put a <title/> on either a form to fill out, or a set of data results. + * You can put a title on either a form to fill out, or a set of data results. * * @param title description of the data. */ diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java index f546fa577..570a9ed8d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java @@ -165,9 +165,10 @@ public class FormField implements NamedElement { /** * Returns a description that provides extra clarification about the question. This information * could be presented to the user either in tool-tip, help button, or as a section of text - * before the question.<p> - * <p/> + * before the question. + * <p> * If the question is of type FIXED then the description should remain empty. + * </p> * * @return description that provides extra clarification about the question. */ @@ -255,9 +256,10 @@ public class FormField implements NamedElement { /** * Sets a description that provides extra clarification about the question. This information * could be presented to the user either in tool-tip, help button, or as a section of text - * before the question.<p> - * <p/> + * before the question. + * <p> * If the question is of type FIXED then the description should remain empty. + * </p> * * @param description provides extra clarification about the question. */ diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java index ebd948d99..54a226da8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/XDataManager.java @@ -51,7 +51,7 @@ public class XDataManager extends Manager { /** * Get the XDataManager for the given XMPP connection. * - * @param connection + * @param connection the XMPPConnection. * @return the XDataManager */ public static synchronized XDataManager getInstanceFor(XMPPConnection connection) { diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index f77f5d7e4..8bad2b65b 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -69,14 +69,15 @@ import org.jxmpp.jid.parts.Resourcepart; /** * Represents a user's roster, which is the collection of users a person receives - * presence updates for. Roster items are categorized into groups for easier management.<p> - * <p/> + * presence updates for. Roster items are categorized into groups for easier management. + * <p> * Others users may attempt to subscribe to this user using a subscription request. Three * modes are supported for handling these requests: <ul> * <li>{@link SubscriptionMode#accept_all accept_all} -- accept all subscription requests.</li> * <li>{@link SubscriptionMode#reject_all reject_all} -- reject all subscription requests.</li> * <li>{@link SubscriptionMode#manual manual} -- manually process all subscription requests.</li> * </ul> + * </p> * * @author Matt Tucker * @see #getInstanceFor(XMPPConnection) @@ -253,11 +254,12 @@ public class Roster extends Manager { /** * Returns the subscription processing mode, which dictates what action * Smack will take when subscription requests from other users are made. - * The default subscription mode is {@link SubscriptionMode#accept_all}.<p> - * <p/> + * The default subscription mode is {@link SubscriptionMode#accept_all}. + * <p> * If using the manual mode, a PacketListener should be registered that * listens for Presence packets that have a type of * {@link org.jivesoftware.smack.packet.Presence.Type#subscribe}. + * </p> * * @return the subscription mode. */ @@ -268,11 +270,12 @@ public class Roster extends Manager { /** * Sets the subscription processing mode, which dictates what action * Smack will take when subscription requests from other users are made. - * The default subscription mode is {@link SubscriptionMode#accept_all}.<p> - * <p/> + * The default subscription mode is {@link SubscriptionMode#accept_all}. + * <p> * If using the manual mode, a PacketListener should be registered that * listens for Presence packets that have a type of * {@link org.jivesoftware.smack.packet.Presence.Type#subscribe}. + * </p> * * @param subscriptionMode the subscription mode. */ @@ -427,10 +430,11 @@ public class Roster extends Manager { } /** - * Creates a new group.<p> - * <p/> + * Creates a new group. + * <p> * Note: you must add at least one entry to the group for the group to be kept * after a logout/login. This is due to the way that XMPP stores group information. + * </p> * * @param name the name of the group. * @return a new group, or null if the group already exists diff --git a/smack-java7/src/main/java/org/jivesoftware/smack/util/stringencoder/java7/Base64.java b/smack-java7/src/main/java/org/jivesoftware/smack/util/stringencoder/java7/Base64.java index 6aa7d3cb7..093c60639 100644 --- a/smack-java7/src/main/java/org/jivesoftware/smack/util/stringencoder/java7/Base64.java +++ b/smack-java7/src/main/java/org/jivesoftware/smack/util/stringencoder/java7/Base64.java @@ -20,9 +20,10 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * <p>Encodes and decodes to and from Base64 notation.</p> - * This code was obtained from <a href="http://iharder.net/base64">http://iharder.net/base64</a></p> - * + * Encodes and decodes to and from Base64 notation. + * <p> + * This code was obtained from <a href="http://iharder.net/base64">http://iharder.net/base64</a> + * </p> * * @author Robert Harder * @author rob@iharder.net diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java index f89d1d70a..20b37e068 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICECandidate.java @@ -293,11 +293,7 @@ public class ICECandidate extends TransportCandidate implements Comparable<ICECa checkThread.start(); } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -382,6 +378,22 @@ public class ICECandidate extends TransportCandidate implements Comparable<ICECa return true; } + @Override + public int hashCode() { + int res = 37; + res = 37 * res + (getChannel() == null ? 0 : getChannel().hashCode()); + res = 37 * res + (getId() == null ? 0 : getId().hashCode()); + res = 37 * res + getNetwork(); + res = 37 * res + (getPassword() == null ? 0 : getPassword().hashCode()); + res = 37 * res + getPreference(); + res = 37 * res + (getProto() == null ? 0 : getProto().hashCode()); + res = 37 * res + (getUsername() == null ? 0 : getUsername().hashCode()); + res = 37 * res + (getIp() == null ? 0 : getIp().hashCode()); + res = 37 * res + getPort(); + res = 37 * res + (getType() == null ? 0 : getType().hashCode()); + return res; + } + public boolean isNull() { if (super.isNull()) { return true; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java index d5f967cde..d179b0669 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportCandidate.java @@ -489,11 +489,7 @@ public abstract class TransportCandidate { } } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -515,6 +511,14 @@ public abstract class TransportCandidate { return true; } + @Override + public int hashCode() { + if (value == null) { + return -1; + } + return value.hashCode(); + } + /** * Return true if the protocol is not valid. * @@ -567,11 +571,7 @@ public abstract class TransportCandidate { } } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ + @Override public boolean equals(Object obj) { if (this == obj) { return true; @@ -593,6 +593,14 @@ public abstract class TransportCandidate { return true; } + @Override + public int hashCode() { + if (value == null) { + return -1; + } + return value.hashCode(); + } + /** * Return true if the channel is not valid. *
    XMPP Errors
    XMPP Error ConditionTypeRFC 6120 Section
    bad-requestMODIFY8.3.3.1
    conflictCANCEL8.3.3.2