Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies {
implementation(libs.telegram.bot.api)
implementation(libs.tika)

testCompileOnly(libs.jspecify)
testImplementation(libs.hamcrest)
testImplementation(libs.junit.jupiter)
testImplementation(libs.mockwebserver)
Expand Down Expand Up @@ -53,6 +54,15 @@ def jlink = tasks.register('jlink', JlinkTask) {
description = 'Generates a minimal JRE for the project.'
}

nullability {
errorProneVersion = libs.errorprone.get().version
nullAwayVersion = libs.nullaway.get().version
}

tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}

test {
inputs.dir(jlink.map { it.outputDirectory.get().asFile })
javaLauncher = providers.provider { new JlinkJavaLauncher(jlink.get()) }
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[libraries]
errorprone = "com.google.errorprone:error_prone_core:2.42.0"
gson = "com.google.code.gson:gson:2.13.2"
hamcrest = "org.hamcrest:hamcrest:3.0"
jspecify = "org.jspecify:jspecify:1.0.0"
junit-jupiter = "org.junit.jupiter:junit-jupiter:5.14.0"
junit-platform = "org.junit.platform:junit-platform-launcher:1.14.0"
logback-classic = "ch.qos.logback:logback-classic:1.5.18"
mockwebserver = "com.squareup.okhttp3:mockwebserver3-junit5:5.1.0"
nullaway = "com.uber.nullaway:nullaway:0.12.10"
telegram-bot-api = "com.github.pengrad:java-telegram-bot-api:9.2.0"
tika = "org.apache.tika:tika-core:3.2.3"

[plugins]
spring-nullability = "io.spring.nullability:0.0.4"
spring-nullability = "io.spring.nullability:0.0.5"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ch.qos.logback.classic.spi.StackTraceElementProxy;
import ch.qos.logback.classic.spi.ThrowableProxyVO;
import com.github.stickerifier.stickerify.exception.TelegramApiException;
import org.jspecify.annotations.Nullable;

/**
* Test double that serves as an implementation of {@link ILoggingEvent}.
Expand All @@ -15,7 +16,7 @@ class LoggingEvent extends LoggingEventVO {
static final String EXCEPTION_CLASS = TelegramApiException.class.getName();

private final String formattedMessage;
private IThrowableProxy throwableProxy;
private @Nullable IThrowableProxy throwableProxy;

LoggingEvent(String formattedMessage) {
this.formattedMessage = formattedMessage;
Expand Down Expand Up @@ -54,6 +55,7 @@ public String getFormattedMessage() {
return formattedMessage;
}

@Nullable
@Override
public IThrowableProxy getThrowableProxy() {
return throwableProxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.github.stickerifier.stickerify.junit.ClearTempFiles;
import com.github.stickerifier.stickerify.junit.Tags;
import com.github.stickerifier.stickerify.process.ProcessHelper;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
Expand All @@ -45,7 +46,9 @@ void resizeRectangularImage() throws Exception {
assertImageConsistency(result, 512, 341);
}

private static void assertImageConsistency(File image, int expectedWidth, int expectedHeight) throws Exception {
private static void assertImageConsistency(@Nullable File image, int expectedWidth, int expectedHeight) throws Exception {
assertNotNull(image);

var mediaInfo = MediaHelper.retrieveMultimediaInfo(image);
var imageInfo = mediaInfo.video();
assertNotNull(imageInfo);
Expand Down Expand Up @@ -154,7 +157,9 @@ void convertLongMovVideo() throws Exception {
assertVideoConsistency(result, 512, 288, 29.97003F, 2.969F);
}

private static void assertVideoConsistency(File video, int expectedWidth, int expectedHeight, float expectedFrameRate, float expectedDuration) throws Exception {
private static void assertVideoConsistency(@Nullable File video, int expectedWidth, int expectedHeight, float expectedFrameRate, float expectedDuration) throws Exception {
assertNotNull(video);

var mediaInfo = MediaHelper.retrieveMultimediaInfo(video);
var videoInfo = mediaInfo.video();
assertNotNull(videoInfo);
Expand Down
Loading