Skip to content

Commit 140247f

Browse files
Fix spi loading (#480)
We should ignore NoClassDefFoundError, this improves the experience when using incremental compilation in intellij because some compiled classes might still be lingering around for removed services.
1 parent 0a65def commit 140247f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sdk-common/src/main/java/dev/restate/sdk/endpoint/definition/ServiceDefinitionFactories.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ public boolean supports(Object serviceObject) {
8282
}
8383

8484
private @Nullable ServiceDefinitionFactory discoverFactory(Object service) {
85-
return this.factories.stream().filter(sa -> sa.supports(service)).findFirst().orElse(null);
85+
return this.factories.stream()
86+
.filter(
87+
sa -> {
88+
try {
89+
return sa.supports(service);
90+
} catch (Throwable e) {
91+
return false;
92+
}
93+
})
94+
.findFirst()
95+
.orElse(null);
8696
}
8797
}

0 commit comments

Comments
 (0)