Skip to content

Commit 224e224

Browse files
tholenstcopybara-github
authored andcommitted
Remove usages of androidx.annotation from the code which goes into the Java jar.
Context: #3 https://issuetracker.google.com/issues/273498073#comment8 PiperOrigin-RevId: 525422733 Change-Id: I119852be5326696a38c4daa94f5a2f9fd1a32406
1 parent 56259d9 commit 224e224

File tree

10 files changed

+0
-35
lines changed

10 files changed

+0
-35
lines changed

maven/tink-java.pom.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484

8585
<properties>
8686
<java.version>1.8</java.version>
87-
<annotation.version>1.3.0</annotation.version>
8887
<jsr305.version>3.0.2</jsr305.version>
8988
<gson.version>2.10</gson.version>
9089
<error_prone_annotations.version>2.16</error_prone_annotations.version>
@@ -94,11 +93,6 @@
9493
</properties>
9594

9695
<dependencies>
97-
<dependency>
98-
<groupId>androidx.annotation</groupId>
99-
<artifactId>annotation</artifactId>
100-
<version>${annotation.version}</version>
101-
</dependency>
10296
<dependency>
10397
<groupId>com.google.code.findbugs</groupId>
10498
<artifactId>jsr305</artifactId>
@@ -130,12 +124,7 @@
130124
<version>${joda-time.version}</version>
131125
</dependency>
132126
</dependencies>
133-
134127
<repositories>
135-
<repository>
136-
<id>google-maven-repository</id>
137-
<url>https://maven.google.com</url>
138-
</repository>
139128
<repository>
140129
<id>maven-central-repository</id>
141130
<url>https://repo1.maven.org/maven2</url>

src/main/java/com/google/crypto/tink/BUILD.bazel

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ java_library(
1616
java_library(
1717
name = "streaming_aead",
1818
srcs = ["StreamingAead.java"],
19-
deps = ["@maven//:androidx_annotation_annotation"],
2019
)
2120

2221
java_library(
@@ -138,7 +137,6 @@ java_library(
138137
":keyset_writer",
139138
"//proto:tink_java_proto",
140139
"//src/main/java/com/google/crypto/tink/subtle:base64",
141-
"@maven//:androidx_annotation_annotation",
142140
"@maven//:com_google_code_gson_gson",
143141
"@maven//:com_google_errorprone_error_prone_annotations",
144142
],
@@ -151,7 +149,6 @@ android_library(
151149
":keyset_writer-android",
152150
"//proto:tink_java_proto_lite",
153151
"//src/main/java/com/google/crypto/tink/subtle:base64-android",
154-
"@maven//:androidx_annotation_annotation",
155152
"@maven//:com_google_code_gson_gson",
156153
"@maven//:com_google_errorprone_error_prone_annotations",
157154
],
@@ -200,7 +197,6 @@ java_library(
200197
"//proto:tink_java_proto",
201198
"//src/main/java/com/google/crypto/tink/internal:json_parser",
202199
"//src/main/java/com/google/crypto/tink/subtle:base64",
203-
"@maven//:androidx_annotation_annotation",
204200
"@maven//:com_google_code_gson_gson",
205201
"@maven//:com_google_errorprone_error_prone_annotations",
206202
"@maven//:com_google_protobuf_protobuf_java",
@@ -216,7 +212,6 @@ android_library(
216212
"//proto:tink_java_proto_lite",
217213
"//src/main/java/com/google/crypto/tink/internal:json_parser-android",
218214
"//src/main/java/com/google/crypto/tink/subtle:base64-android",
219-
"@maven//:androidx_annotation_annotation",
220215
"@maven//:com_google_code_gson_gson",
221216
"@maven//:com_google_errorprone_error_prone_annotations",
222217
"@maven//:com_google_protobuf_protobuf_javalite",
@@ -871,7 +866,6 @@ android_library(
871866
android_library(
872867
name = "streaming_aead-android",
873868
srcs = ["StreamingAead.java"],
874-
deps = ["@maven//:androidx_annotation_annotation"],
875869
)
876870

877871
android_library(

src/main/java/com/google/crypto/tink/JsonKeysetReader.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.crypto.tink;
1818

19-
import androidx.annotation.RequiresApi;
2019
import com.google.crypto.tink.internal.JsonParser;
2120
import com.google.crypto.tink.proto.EncryptedKeyset;
2221
import com.google.crypto.tink.proto.KeyData;
@@ -146,7 +145,6 @@ public static JsonKeysetReader withPath(String path) throws IOException {
146145
@InlineMe(
147146
replacement = "JsonKeysetReader.withInputStream(new FileInputStream(path.toFile()))",
148147
imports = {"com.google.crypto.tink.JsonKeysetReader", "java.io.FileInputStream"})
149-
@RequiresApi(26) // https://developer.android.com/reference/java/nio/file/Path
150148
@Deprecated
151149
public static JsonKeysetReader withPath(Path path) throws IOException {
152150
return JsonKeysetReader.withInputStream(new FileInputStream(path.toFile()));

src/main/java/com/google/crypto/tink/JsonKeysetWriter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.crypto.tink;
1818

19-
import androidx.annotation.RequiresApi;
2019
import com.google.crypto.tink.proto.EncryptedKeyset;
2120
import com.google.crypto.tink.proto.KeyData;
2221
import com.google.crypto.tink.proto.Keyset;
@@ -95,7 +94,6 @@ public static KeysetWriter withPath(String path) throws IOException {
9594
*
9695
* @deprecated Method should be inlined.
9796
*/
98-
@RequiresApi(26) // https://developer.android.com/reference/java/nio/file/Path
9997
@InlineMe(
10098
replacement = "JsonKeysetWriter.withOutputStream(new FileOutputStream(path.toFile()))",
10199
imports = {"com.google.crypto.tink.JsonKeysetWriter", "java.io.FileOutputStream"})

src/main/java/com/google/crypto/tink/StreamingAead.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.crypto.tink;
1818

19-
import androidx.annotation.RequiresApi;
2019
import java.io.IOException;
2120
import java.io.InputStream;
2221
import java.io.OutputStream;
@@ -162,7 +161,6 @@ WritableByteChannel newEncryptingChannel(
162161
* associatedData is not correct.
163162
* @throws IOException if an IOException occurred while reading from ciphertextDestination.
164163
*/
165-
@RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
166164
SeekableByteChannel newSeekableDecryptingChannel(
167165
SeekableByteChannel ciphertextSource, byte[] associatedData)
168166
throws GeneralSecurityException, IOException;

src/main/java/com/google/crypto/tink/streamingaead/BUILD.bazel

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ java_library(
4242
deps = [
4343
"//src/main/java/com/google/crypto/tink:primitive_set",
4444
"//src/main/java/com/google/crypto/tink:streaming_aead",
45-
"@maven//:androidx_annotation_annotation",
4645
"@maven//:com_google_code_findbugs_jsr305",
4746
"@maven//:com_google_errorprone_error_prone_annotations",
4847
],
@@ -67,7 +66,6 @@ java_library(
6766
":seekable_byte_channel_decrypter",
6867
"//src/main/java/com/google/crypto/tink:primitive_set",
6968
"//src/main/java/com/google/crypto/tink:streaming_aead",
70-
"@maven//:androidx_annotation_annotation",
7169
],
7270
)
7371

@@ -260,7 +258,6 @@ android_library(
260258
deps = [
261259
"//src/main/java/com/google/crypto/tink:primitive_set-android",
262260
"//src/main/java/com/google/crypto/tink:streaming_aead-android",
263-
"@maven//:androidx_annotation_annotation",
264261
"@maven//:com_google_code_findbugs_jsr305",
265262
"@maven//:com_google_errorprone_error_prone_annotations",
266263
],
@@ -285,7 +282,6 @@ android_library(
285282
":seekable_byte_channel_decrypter-android",
286283
"//src/main/java/com/google/crypto/tink:primitive_set-android",
287284
"//src/main/java/com/google/crypto/tink:streaming_aead-android",
288-
"@maven//:androidx_annotation_annotation",
289285
],
290286
)
291287

src/main/java/com/google/crypto/tink/streamingaead/SeekableByteChannelDecrypter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.crypto.tink.streamingaead;
1818

19-
import androidx.annotation.RequiresApi;
2019
import com.google.crypto.tink.StreamingAead;
2120
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2221
import java.io.IOException;
@@ -30,7 +29,6 @@
3029
import javax.annotation.concurrent.GuardedBy;
3130

3231
/** A decrypter for ciphertext given in a {@link SeekableByteChannel}. */
33-
@RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
3432
final class SeekableByteChannelDecrypter implements SeekableByteChannel {
3533
@GuardedBy("this")
3634
SeekableByteChannel attemptingChannel;

src/main/java/com/google/crypto/tink/streamingaead/StreamingAeadHelper.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.crypto.tink.streamingaead;
1818

19-
import androidx.annotation.RequiresApi;
2019
import com.google.crypto.tink.StreamingAead;
2120
import java.io.IOException;
2221
import java.io.InputStream;
@@ -61,7 +60,6 @@ public ReadableByteChannel newDecryptingChannel(
6160
}
6261

6362
@Override
64-
@RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
6563
public SeekableByteChannel newSeekableDecryptingChannel(
6664
SeekableByteChannel ciphertextChannel, byte[] associatedData)
6765
throws GeneralSecurityException, IOException {

src/main/java/com/google/crypto/tink/subtle/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ java_library(
471471
":stream_segment_decrypter",
472472
":stream_segment_encrypter",
473473
"//src/main/java/com/google/crypto/tink:streaming_aead",
474-
"@maven//:androidx_annotation_annotation",
475474
"@maven//:com_google_errorprone_error_prone_annotations",
476475
],
477476
)
@@ -780,7 +779,6 @@ android_library(
780779
":stream_segment_decrypter-android",
781780
":stream_segment_encrypter-android",
782781
"//src/main/java/com/google/crypto/tink:streaming_aead-android",
783-
"@maven//:androidx_annotation_annotation",
784782
"@maven//:com_google_errorprone_error_prone_annotations",
785783
],
786784
)

src/main/java/com/google/crypto/tink/subtle/StreamingAeadSeekableDecryptingChannel.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.crypto.tink.subtle;
1818

19-
import androidx.annotation.RequiresApi;
2019
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2120
import java.io.IOException;
2221
import java.nio.ByteBuffer;
@@ -30,7 +29,6 @@
3029
* An instance of {@link SeekableByteChannel} that allows random access to the plaintext of some
3130
* ciphertext.
3231
*/
33-
@RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
3432
class StreamingAeadSeekableDecryptingChannel implements SeekableByteChannel {
3533
// Each plaintext segment has 16 bytes more of memory than the actual plaintext that it contains.
3634
// This is a workaround for an incompatibility between Conscrypt and OpenJDK in their

0 commit comments

Comments
 (0)