diff options
Diffstat (limited to 'src/main/java/com/android/tools/r8/graph/DexItemFactory.java')
-rw-r--r-- | src/main/java/com/android/tools/r8/graph/DexItemFactory.java | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/main/java/com/android/tools/r8/graph/DexItemFactory.java b/src/main/java/com/android/tools/r8/graph/DexItemFactory.java index 153c2e651..a7d44ba31 100644 --- a/src/main/java/com/android/tools/r8/graph/DexItemFactory.java +++ b/src/main/java/com/android/tools/r8/graph/DexItemFactory.java @@ -346,23 +346,19 @@ public class DexItemFactory { return createField(clazz, type, createString(name)); } - public DexProto createProto(DexString shorty, DexType returnType, DexTypeList parameters) { + public DexProto createProto(DexType returnType, DexString shorty, DexTypeList parameters) { assert !sorted; DexProto proto = new DexProto(shorty, returnType, parameters); return canonicalize(protos, proto); } - public DexProto createProto(DexString shorty, DexType returnType, DexType[] parameters) { + public DexProto createProto(DexType returnType, DexType... parameters) { assert !sorted; - return createProto(shorty, returnType, + return createProto(returnType, createShorty(returnType, parameters), parameters.length == 0 ? DexTypeList.empty() : new DexTypeList(parameters)); } - public DexProto createProto(DexType returnType, DexType... parameters) { - return createProto(createShorty(returnType, parameters), returnType, parameters); - } - - public DexString createShorty(DexType returnType, DexType[] argumentTypes) { + private DexString createShorty(DexType returnType, DexType[] argumentTypes) { StringBuilder shortyBuilder = new StringBuilder(); shortyBuilder.append(returnType.toShorty()); for (DexType argumentType : argumentTypes) { @@ -407,7 +403,7 @@ public class DexItemFactory { for (int i = 0; i < parameterDescriptors.length; i++) { parameterTypes[i] = createType(parameterDescriptors[i]); } - DexProto proto = createProto(shorty(returnType, parameterTypes), returnType, parameterTypes); + DexProto proto = createProto(returnType, parameterTypes); return createMethod(clazz, proto, name); } @@ -464,20 +460,6 @@ public class DexItemFactory { return method.name == classConstructorMethodName; } - private DexString shorty(DexType returnType, DexType[] parameters) { - StringBuilder builder = new StringBuilder(); - addToShorty(builder, returnType); - for (DexType parameter : parameters) { - addToShorty(builder, parameter); - } - return createString(builder.toString()); - } - - private void addToShorty(StringBuilder builder, DexType type) { - char first = type.toDescriptorString().charAt(0); - builder.append(first == '[' ? 'L' : first); - } - private static <S extends PresortedComparable<S>> void assignSortedIndices(Collection<S> items, NamingLens namingLens) { List<S> sorted = new ArrayList<>(items); |