From 62d9e654f3b96f3970ee490d7a7b27639a99c75f Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 19 Jan 2024 12:44:00 -0800 Subject: [PATCH] Fix deannotation of wildcard types Previously type annotations were being preserved on the upper and lower bounds of wildcard types. PiperOrigin-RevId: 599910757 --- java/com/google/turbine/types/Deannotate.java | 4 ++-- .../google/turbine/processing/AbstractTurbineTypesTest.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/java/com/google/turbine/types/Deannotate.java b/java/com/google/turbine/types/Deannotate.java index 744187cf..d8811318 100644 --- a/java/com/google/turbine/types/Deannotate.java +++ b/java/com/google/turbine/types/Deannotate.java @@ -68,9 +68,9 @@ private static Type deannotateWildTy(Type.WildTy ty) { case NONE: return Type.WildUnboundedTy.create(ImmutableList.of()); case LOWER: - return Type.WildLowerBoundedTy.create(ty.bound(), ImmutableList.of()); + return Type.WildLowerBoundedTy.create(deannotate(ty.bound()), ImmutableList.of()); case UPPER: - return Type.WildUpperBoundedTy.create(ty.bound(), ImmutableList.of()); + return Type.WildUpperBoundedTy.create(deannotate(ty.bound()), ImmutableList.of()); } throw new AssertionError(ty.boundKind()); } diff --git a/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java b/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java index 02df1ece..307b71ad 100644 --- a/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java +++ b/javatests/com/google/turbine/processing/AbstractTurbineTypesTest.java @@ -244,6 +244,8 @@ protected static TypeParameters typeParameters() throws Exception { annotatedTypes.add("@A List"); annotatedTypes.add("@A List<@A int @B []>"); annotatedTypes.add("Map.@A Entry<@B Integer, @C Number>"); + annotatedTypes.add("@A List<@B ? extends @C String>"); + annotatedTypes.add("@A List<@B ? super @C String>"); } List files = new ArrayList<>();