diff options
author | Liam Miller-Cushon <cushon@google.com> | 2021-03-02 17:33:27 -0800 |
---|---|---|
committer | Javac Team <javac-team+copybara@google.com> | 2021-03-02 17:33:58 -0800 |
commit | 617a8f61b47d31f710386331b4380ba3c9c93872 (patch) | |
tree | 0ff28b16c687c087110af674deb2a4a9f0f66c98 /java | |
parent | aabe1f4166b54f2826b08d93f396ac1a9ec16e8e (diff) | |
download | turbine-617a8f61b47d31f710386331b4380ba3c9c93872.tar.gz |
Don't read `<clinit>`s from class files
This was causing an error when checking required annotation elements for
annotations with `<clinit>`s read from bytecode:
```
error: missing required annotation argument: <clinit>
@Foo
```
https://github.com/bazelbuild/bazel/issues/13144
PiperOrigin-RevId: 360553027
Diffstat (limited to 'java')
-rw-r--r-- | java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java index d337181..8939780 100644 --- a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java +++ b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java @@ -379,6 +379,10 @@ public class BytecodeBoundClass implements TypeBoundClass { ImmutableList.Builder<MethodInfo> methods = ImmutableList.builder(); int idx = 0; for (ClassFile.MethodInfo m : classFile.get().methods()) { + if (m.name().equals("<clinit>")) { + // Don't bother reading class initializers, which we don't need + continue; + } methods.add(bindMethod(idx++, m)); } return methods.build(); |