blob: 0cc237b2029e994715c67bc7b7a2516e19d8c43c [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;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.utils.InternalOptions;
import java.util.function.Consumer;
public class GlobalSyntheticsGeneratorVerifier {
public static void forEachExpectedClass(InternalOptions options, Consumer<DexType> consumer) {
DexItemFactory dexItemFactory = options.dexItemFactory();
consumer.accept(dexItemFactory.methodHandlesType);
consumer.accept(dexItemFactory.methodHandlesLookupType);
consumer.accept(dexItemFactory.recordType);
consumer.accept(dexItemFactory.varHandleType);
consumer.accept(dexItemFactory.lambdaMethodAnnotation);
}
public static boolean verifyExpectedClassesArePresent(AppView<?> appView) {
forEachExpectedClass(
appView.options(),
type -> {
assert appView.hasDefinitionFor(type) : "Missing type: " + type;
});
return true;
}
}