Fix handling of source-retention type annotations

MOE_MIGRATED_REVID=137839386
diff --git a/java/com/google/turbine/lower/Lower.java b/java/com/google/turbine/lower/Lower.java
index 62c0843..4da59ad 100644
--- a/java/com/google/turbine/lower/Lower.java
+++ b/java/com/google/turbine/lower/Lower.java
@@ -541,12 +541,16 @@
     int typeParameterIndex = 0;
     for (TyVarInfo p : typeParameters) {
       for (AnnoInfo anno : p.annotations()) {
+        AnnotationInfo info = lowerAnnotation(anno);
+        if (info == null) {
+          continue;
+        }
         result.add(
             new TypeAnnotationInfo(
                 targetType,
                 new TypeAnnotationInfo.TypeParameterTarget(typeParameterIndex),
                 TypePath.root(),
-                lowerAnnotation(anno)));
+                info));
       }
       if (p.superClassBound() != null) {
         lowerTypeAnnotations(
@@ -618,7 +622,11 @@
     /** Lower a list of type annotations. */
     private void lowerTypeAnnotations(ImmutableList<AnnoInfo> annos, TypePath path) {
       for (AnnoInfo anno : annos) {
-        result.add(new TypeAnnotationInfo(targetType, target, path, lowerAnnotation(anno)));
+        AnnotationInfo info = lowerAnnotation(anno);
+        if (info == null) {
+          continue;
+        }
+        result.add(new TypeAnnotationInfo(targetType, target, path, info));
       }
     }
 
diff --git a/javatests/com/google/turbine/lower/LowerIntegrationTest.java b/javatests/com/google/turbine/lower/LowerIntegrationTest.java
index 368d5ce..b7cacf0 100644
--- a/javatests/com/google/turbine/lower/LowerIntegrationTest.java
+++ b/javatests/com/google/turbine/lower/LowerIntegrationTest.java
@@ -257,6 +257,7 @@
       "array_class_literal.test",
       "underscore_literal.test",
       "c_array.test",
+      "type_anno_retention.test",
     };
     List<Object[]> tests =
         ImmutableList.copyOf(testCases).stream().map(x -> new Object[] {x}).collect(toList());
diff --git a/javatests/com/google/turbine/lower/testdata/type_anno_retention.test b/javatests/com/google/turbine/lower/testdata/type_anno_retention.test
new file mode 100644
index 0000000..85a2280
--- /dev/null
+++ b/javatests/com/google/turbine/lower/testdata/type_anno_retention.test
@@ -0,0 +1,21 @@
+=== Test.java ===
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.SOURCE)
+@Target(ElementType.TYPE_USE)
+@interface A {}
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE_USE)
+@interface B {}
+
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE_USE)
+@interface C {}
+
+class Test {
+  @A @B @C int x;
+}