aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/android/tools/r8/graph/Code.java
blob: 84d6d5da69cc24ea73610f0b43ce7b42bc829995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (c) 2016, 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.dex.IndexedItemCollection;
import com.android.tools.r8.dex.MixedSectionCollection;
import com.android.tools.r8.errors.Unreachable;
import com.android.tools.r8.ir.code.IRCode;
import com.android.tools.r8.ir.optimize.Outliner.OutlineCode;
import com.android.tools.r8.naming.ClassNameMapper;
import com.android.tools.r8.utils.InternalOptions;

public abstract class Code extends CanonicalizedDexItem {

  public abstract IRCode buildIR(DexEncodedMethod encodedMethod, InternalOptions options);

  public abstract void registerReachableDefinitions(UseRegistry registry);

  public abstract String toString();

  public abstract String toString(DexEncodedMethod method, ClassNameMapper naming);

  public boolean isDexCode() {
    return false;
  }

  public boolean isJarCode() {
    return false;
  }

  public boolean isOutlineCode() {
    return false;
  }

  public DexCode asDexCode() {
    throw new Unreachable(getClass().getCanonicalName() + ".asDexCode()");
  }

  public JarCode asJarCode() {
    throw new Unreachable(getClass().getCanonicalName() + ".asJarCode()");
  }

  public OutlineCode asOutlineCode() {
    throw new Unreachable(getClass().getCanonicalName() + ".asOutlineCode()");
  }

  @Override
  void collectIndexedItems(IndexedItemCollection collection) {
    throw new Unreachable();
  }

  @Override
  void collectMixedSectionItems(MixedSectionCollection collection) {
    throw new Unreachable();
  }
}