Skip to content

Commit ab67a30

Browse files
committed
Replace custom AndroidSignatureIgnore with standard @IgnoreJRERequirement
sqlite-jdbc's AndroidSignatureIgnore was a custom marker annotation that only had meaning when their pom.xml configured the animal-sniffer-maven-plugin with <annotation>org.sqlite.util.AndroidSignatureIgnore</animation>. This project does not configure animal-sniffer, so the vendored copy of the annotation was inert. Replaced with the standard @IgnoreJRERequirement from org.codehaus.mojo:animal-sniffer-annotations 1.27 (latest stable). The plugin recognises this annotation out of the box, so if signature checking is ever enabled here it will work with zero further config. Changes: - pom.xml: add animal-sniffer-annotations 1.27, scope=provided (retention=CLASS, not needed at runtime). - Delete src/main/java/net/ladenthin/llama/AndroidSignatureIgnore.java - OSInfo.java: * Import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement. * Replace the three @AndroidSignatureIgnore(explanation = "Should not reach this code path") sites in isMusl, toRealPathOrEmpty, and isAlpineLinux with @IgnoreJRERequirement plus a one-line // comment preserving the explanation (the standard annotation has no explanation field). * Header lists this as a 4th documented deviation from upstream. Verified: - mvn clean compile: BUILD SUCCESS - mvn test -Dtest=OSInfoTest,LlamaLoaderTest: 37/37 pass - reuse lint: 137/137 files compliant with REUSE 3.3.
1 parent f1d3f82 commit ab67a30

3 files changed

Lines changed: 22 additions & 26 deletions

File tree

pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ SPDX-License-Identifier: MIT
8787
<version>1.5.32</version>
8888
<scope>runtime</scope>
8989
</dependency>
90+
<!-- @IgnoreJRERequirement marker used by OSInfo (vendored from xerial/sqlite-jdbc)
91+
on a few methods that touch APIs unavailable on Android. Retention=CLASS, so
92+
the dep is compile-only (provided scope). -->
93+
<dependency>
94+
<groupId>org.codehaus.mojo</groupId>
95+
<artifactId>animal-sniffer-annotations</artifactId>
96+
<version>1.27</version>
97+
<scope>provided</scope>
98+
</dependency>
9099
</dependencies>
91100

92101
<build>

src/main/java/net/ladenthin/llama/AndroidSignatureIgnore.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/main/java/net/ladenthin/llama/OSInfo.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
// wrapper) -> org.slf4j.Logger / org.slf4j.LoggerFactory
3232
// and drop the Supplier<String> lazy form (the two messages
3333
// are constant strings, so eager construction is free).
34+
// 4. @AndroidSignatureIgnore(explanation = "...") (sqlite-jdbc's
35+
// custom marker for animal-sniffer-maven-plugin)
36+
// -> @IgnoreJRERequirement from
37+
// org.codehaus.mojo:animal-sniffer-annotations. The standard
38+
// marker has no explanation field; the original strings are
39+
// preserved as adjacent // comments.
3440
// The original Apache-2.0 copyright header from the upstream file is
3541
// preserved verbatim below.
3642

@@ -69,6 +75,7 @@
6975
import java.util.Locale;
7076
import java.util.stream.Stream;
7177

78+
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
7279
import org.slf4j.Logger;
7380
import org.slf4j.LoggerFactory;
7481

@@ -183,7 +190,8 @@ public static boolean isAndroidTermux() {
183190
}
184191
}
185192

186-
@AndroidSignatureIgnore(explanation = "Should not reach this code path")
193+
// Should not reach this code path on Android.
194+
@IgnoreJRERequirement
187195
public static boolean isMusl() {
188196
Path mapFilesDir = Paths.get("/proc/self/map_files");
189197
try (Stream<Path> dirStream = Files.list(mapFilesDir)) {
@@ -197,7 +205,8 @@ public static boolean isMusl() {
197205
}
198206
}
199207

200-
@AndroidSignatureIgnore(explanation = "Should not reach this code path")
208+
// Should not reach this code path on Android.
209+
@IgnoreJRERequirement
201210
private static String toRealPathOrEmpty(Path path) {
202211
try {
203212
return path.toRealPath().toString();
@@ -206,7 +215,8 @@ private static String toRealPathOrEmpty(Path path) {
206215
}
207216
}
208217

209-
@AndroidSignatureIgnore(explanation = "Should not reach this code path")
218+
// Should not reach this code path on Android.
219+
@IgnoreJRERequirement
210220
private static boolean isAlpineLinux() {
211221
try (Stream<String> osLines = Files.lines(Paths.get("/etc/os-release"))) {
212222
return osLines.anyMatch(l -> l.startsWith("ID") && l.contains("alpine"));

0 commit comments

Comments
 (0)