blob: 418de865c4e730ce2734dcbdab571b14210fbd3a [file] [log] [blame]
// Copyright (c) 2021, 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.graph;
import com.android.tools.r8.errors.Unreachable;
import com.android.tools.r8.ir.code.IRCode;
import com.android.tools.r8.naming.ClassNameMapper;
import com.android.tools.r8.origin.Origin;
public class InvalidCode extends Code {
private static final InvalidCode INSTANCE = new InvalidCode();
public static Code getInstance() {
return INSTANCE;
}
public static boolean isInvalidCode(Code code) {
return code == INSTANCE;
}
private InvalidCode() {}
@Override
public IRCode buildIR(ProgramMethod method, AppView<?> appView, Origin origin) {
throw new Unreachable();
}
@Override
public void registerCodeReferences(ProgramMethod method, UseRegistry registry) {
throw new Unreachable();
}
@Override
public void registerCodeReferencesForDesugaring(ClasspathMethod method, UseRegistry registry) {
throw new Unreachable();
}
@Override
public String toString() {
return "<invalid-code>";
}
@Override
public String toString(DexEncodedMethod method, ClassNameMapper naming) {
return toString();
}
@Override
public int estimatedDexCodeSizeUpperBoundInBytes() {
throw new Unreachable();
}
@Override
public boolean isEmptyVoidMethod() {
throw new Unreachable();
}
@Override
protected int computeHashCode() {
return System.identityHashCode(this);
}
@Override
protected boolean computeEquals(Object other) {
return this == other;
}
}