diff --git a/tunnel/publish.gradle b/tunnel/publish.gradle index 064a901b..f8d086f8 100644 --- a/tunnel/publish.gradle +++ b/tunnel/publish.gradle @@ -52,11 +52,25 @@ bintray { } } -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - archiveClassifier = 'sources' -} - -artifacts { - archives sourcesJar +android.libraryVariants.all { variant -> + if (variant.name == 'release') { + task javadoc(type: Javadoc) { + source = variant.javaCompiler.source + classpath = files((android.bootClasspath.join(File.pathSeparator))) + classpath += variant.javaCompiler.classpath + title = 'Embeddable WireGuard Tunnel for Android v$wireguardVersionName' + } + task javadocJar(type: Jar, dependsOn: javadoc) { + archiveClassifier = 'javadoc' + from javadoc.destinationDir + } + task sourcesJar(type: Jar) { + archiveClassifier = 'sources' + from android.sourceSets.main.java.srcDirs + } + artifacts { + archives sourcesJar + archives javadocJar + } + } } diff --git a/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java b/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java index b9508b1a..a9761929 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/Tunnel.java @@ -33,7 +33,6 @@ public interface Tunnel { * React to a change in state of the tunnel. Should only be directly called by Backend. * * @param newState The new state of the tunnel. - * @return The new state of the tunnel. */ void onStateChange(State newState); diff --git a/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java b/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java index efc22d6e..10f51351 100644 --- a/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java +++ b/tunnel/src/main/java/com/wireguard/crypto/Curve25519.java @@ -28,7 +28,7 @@ import androidx.annotation.Nullable; */ @SuppressWarnings({"MagicNumber", "NonConstantFieldWithUpperCaseName", "SuspiciousNameCombination"}) @NonNullForAll -public final class Curve25519 { +final class Curve25519 { // Numbers modulo 2^255 - 19 are broken up into ten 26-bit words. private static final int NUM_LIMBS_255BIT = 10; private static final int NUM_LIMBS_510BIT = 20; diff --git a/tunnel/src/main/java/com/wireguard/util/NonNullForAll.java b/tunnel/src/main/java/com/wireguard/util/NonNullForAll.java index 2c2d9400..eb5b683f 100644 --- a/tunnel/src/main/java/com/wireguard/util/NonNullForAll.java +++ b/tunnel/src/main/java/com/wireguard/util/NonNullForAll.java @@ -5,7 +5,6 @@ package com.wireguard.util; -import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -13,12 +12,15 @@ import java.lang.annotation.RetentionPolicy; import javax.annotation.Nonnull; import javax.annotation.meta.TypeQualifierDefault; +import androidx.annotation.RestrictTo; +import androidx.annotation.RestrictTo.Scope; + /** * This annotation can be applied to a package, class or method to indicate that all * class fields and method parameters and return values in that element are nonnull * by default unless overridden. */ -@Documented +@RestrictTo(Scope.LIBRARY_GROUP) @Nonnull @TypeQualifierDefault({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME)