Skip to content

Commit

Permalink
use ClassReader(InputStream)
Browse files Browse the repository at this point in the history
com.google.common.io.ByteStreams.toByteArray(InputStream) says

"Java 9+ users: use in#readAllBytes() instead."
  • Loading branch information
LorenzoBettini committed Feb 19, 2025
1 parent 1614e77 commit 94e4960
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.Opcodes;

import com.google.common.io.ByteStreams;
import com.google.inject.Inject;

/**
Expand Down Expand Up @@ -66,8 +65,7 @@ def dosomething() {
final AtomicBoolean debugInfoFound = new AtomicBoolean(false);
Path classFile = clazz.getLocation().toPath();
try (var in = Files.newInputStream(classFile)) {
final byte[] bytes = ByteStreams.toByteArray(in);
final ClassReader r = new ClassReader(bytes);
final ClassReader r = new ClassReader(in);
r.accept(new ClassVisitor(Opcodes.ASM9) {
@Override
public void visitSource(final String source, final String debug) {
Expand Down

0 comments on commit 94e4960

Please sign in to comment.