diff --git a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java index d337181a..8939780d 100644 --- a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java +++ b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java @@ -379,6 +379,10 @@ public ImmutableList get() { ImmutableList.Builder methods = ImmutableList.builder(); int idx = 0; for (ClassFile.MethodInfo m : classFile.get().methods()) { + if (m.name().equals("")) { + // Don't bother reading class initializers, which we don't need + continue; + } methods.add(bindMethod(idx++, m)); } return methods.build(); diff --git a/javatests/com/google/turbine/lower/LowerIntegrationTest.java b/javatests/com/google/turbine/lower/LowerIntegrationTest.java index 85c3450a..0bc883d1 100644 --- a/javatests/com/google/turbine/lower/LowerIntegrationTest.java +++ b/javatests/com/google/turbine/lower/LowerIntegrationTest.java @@ -180,6 +180,7 @@ public static Iterable parameters() { "field_anno.test", "annotation_bool_default.test", "annotation_class_default.test", + "annotation_clinit.test", "annotation_declaration.test", "annotation_enum_default.test", "annotations_default.test", diff --git a/javatests/com/google/turbine/lower/testdata/annotation_clinit.test b/javatests/com/google/turbine/lower/testdata/annotation_clinit.test new file mode 100644 index 00000000..7419ed65 --- /dev/null +++ b/javatests/com/google/turbine/lower/testdata/annotation_clinit.test @@ -0,0 +1,18 @@ +%%% pkg/Anno.java %%% +package pkg; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Anno { + String CONSTANT = Anno.class.toString(); + + String value() default ""; +} + +=== pkg/T.java === +package pkg; + +@Anno +class T {}