blob: 86c74d8d7a3de2e7937b8a0e515f081b8d42bb31 [file] [log] [blame]
// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.ir.desugar;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.profile.art.rewriting.ProfileCollectionAdditions;
import com.android.tools.r8.profile.art.rewriting.ProfileRewritingCovariantReturnTypeAnnotationTransformerEventConsumer;
public interface CovariantReturnTypeAnnotationTransformerEventConsumer {
void acceptCovariantReturnTypeBridgeMethod(ProgramMethod bridge, ProgramMethod target);
static CovariantReturnTypeAnnotationTransformerEventConsumer create(
ProfileCollectionAdditions profileCollectionAdditions) {
if (profileCollectionAdditions.isNop()) {
return empty();
}
return ProfileRewritingCovariantReturnTypeAnnotationTransformerEventConsumer.attach(
profileCollectionAdditions, empty());
}
static EmptyCovariantReturnTypeAnnotationTransformerEventConsumer empty() {
return EmptyCovariantReturnTypeAnnotationTransformerEventConsumer.getInstance();
}
class EmptyCovariantReturnTypeAnnotationTransformerEventConsumer
implements CovariantReturnTypeAnnotationTransformerEventConsumer {
private static final EmptyCovariantReturnTypeAnnotationTransformerEventConsumer INSTANCE =
new EmptyCovariantReturnTypeAnnotationTransformerEventConsumer();
private EmptyCovariantReturnTypeAnnotationTransformerEventConsumer() {}
static EmptyCovariantReturnTypeAnnotationTransformerEventConsumer getInstance() {
return INSTANCE;
}
@Override
public void acceptCovariantReturnTypeBridgeMethod(ProgramMethod bridge, ProgramMethod target) {
// Intentionally empty.
}
}
}