blob: 44fb54a40af4f50af3f730c0ed98d1f5949dd98f [file] [log] [blame]
// Copyright (c) 2018, 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.references;
import com.android.tools.r8.Keep;
import com.android.tools.r8.utils.DescriptorUtils;
@Keep
public interface TypeReference {
/**
* Get the JVM descriptor for this type.
*
* @return The descriptor for the type.
*/
String getDescriptor();
/** Predicate that is true iff the TypeReference is an instance of ClassTypeReference. */
default boolean isClass() {
return false;
}
/** Predicate that is true iff the TypeReference is an instance of ArrayTypeReference. */
default boolean isArray() {
return false;
}
/** Predicate that is true iff the TypeReference is an instance of PrimitiveTypeReference. */
default boolean isPrimitive() {
return false;
}
default String getTypeName() {
return DescriptorUtils.descriptorToJavaType(getDescriptor());
}
}