blob: af3c6a0e854730fe30bf55869a77ad4360a89ad9 [file] [log] [blame]
// Copyright (c) 2019, 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.desugar.graph;
import com.android.tools.r8.D8TestBuilder;
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.origin.Origin;
import java.io.IOException;
public class DesugarGraphUtils {
public static Origin addClassWithOrigin(Class<?> clazz, D8TestBuilder builder)
throws IOException {
Origin origin = makeOrigin(clazz.getTypeName());
builder.getBuilder().addClassProgramData(ToolHelper.getClassAsBytes(clazz), origin);
return origin;
}
private static Origin makeOrigin(String name) {
return new Origin(Origin.root()) {
@Override
public String part() {
return name;
}
};
}
}