Skip to content

Commit

Permalink
Fix generated BrotliInputStream constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Jan 9, 2025
1 parent a90f8e7 commit ccec32c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,17 @@ void generateBrotliInputStreamClass(BuildProducer<GeneratedClassBuildItem> gener

try (MethodCreator defaultConstructor = classCreator.getMethodCreator("<init>", void.class)) {
defaultConstructor.setModifiers(Modifier.PUBLIC);
defaultConstructor.invokeSpecialMethod(
MethodDescriptor.ofMethod(BROTLI_INPUT_STREAM_CLASS_NAME, "<init>", void.class),
defaultConstructor.invokeSpecialMethod(MethodDescriptor.ofConstructor(InputStream.class),
defaultConstructor.getThis());
defaultConstructor.returnValue(null);
defaultConstructor.returnNull();
}

try (MethodCreator constructorWithInputStreamArg = classCreator.getMethodCreator("<init>", void.class,
InputStream.class)) {
constructorWithInputStreamArg.setModifiers(Modifier.PUBLIC);
constructorWithInputStreamArg.invokeSpecialMethod(
MethodDescriptor.ofMethod(BROTLI_INPUT_STREAM_CLASS_NAME, "<init>", void.class),
constructorWithInputStreamArg.invokeSpecialMethod(MethodDescriptor.ofConstructor(InputStream.class),
constructorWithInputStreamArg.getThis());
constructorWithInputStreamArg.returnValue(null);
constructorWithInputStreamArg.returnNull();
}

try (MethodCreator readMethod = classCreator.getMethodCreator("read", int.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BrotliAbsentBooleanSupplier implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
try {
Thread.currentThread().getContextClassLoader().loadClass("org.brotli.dec.BrotliInputStream");
Thread.currentThread().getContextClassLoader().loadClass("org.brotli.dec.Decoder");
return false;
} catch (ClassNotFoundException e) {
return true;
Expand Down

0 comments on commit ccec32c

Please sign in to comment.