diff --git a/sootup.interceptors/src/main/java/sootup/interceptors/LocalNameStandardizer.java b/sootup.interceptors/src/main/java/sootup/interceptors/LocalNameStandardizer.java index 7a3b85ea2ab..5650564dfdd 100644 --- a/sootup.interceptors/src/main/java/sootup/interceptors/LocalNameStandardizer.java +++ b/sootup.interceptors/src/main/java/sootup/interceptors/LocalNameStandardizer.java @@ -31,9 +31,6 @@ import sootup.core.transform.BodyInterceptor; import sootup.core.types.Type; import sootup.core.views.View; -import sootup.interceptors.typeresolving.types.BottomType; - -// https://github.com/Sable/soot/blob/master/src/main/java/soot/jimple/toolkits/scalar/LocalNameStandardizer.java /** @author Zun Wang */ public class LocalNameStandardizer implements BodyInterceptor { @@ -67,13 +64,6 @@ public void interceptBody(@Nonnull Body.BodyBuilder builder, @Nonnull View view) Local local = iterator.next(); Local newLocal; Type type = local.getType(); - - if (type instanceof BottomType) { - // TODO: log that likely the jimple is not formed correctly - // TODO: handle module signatures - type = view.getIdentifierFactory().getClassType("java.lang.Object"); - } - newLocal = lgen.generateLocal(type); builder.replaceLocal(local, newLocal); } diff --git a/sootup.interceptors/src/main/java/sootup/interceptors/typeresolving/TypeResolver.java b/sootup.interceptors/src/main/java/sootup/interceptors/typeresolving/TypeResolver.java index 1c73fe0b5ab..274ca9ab8f2 100644 --- a/sootup.interceptors/src/main/java/sootup/interceptors/typeresolving/TypeResolver.java +++ b/sootup.interceptors/src/main/java/sootup/interceptors/typeresolving/TypeResolver.java @@ -81,7 +81,8 @@ public boolean resolve(@Nonnull Body.BodyBuilder builder) { new TypePromotionVisitor(builder, evalFunction, hierarchy); typings = typings.stream().map(promotionVisitor::getPromotedTyping).collect(Collectors.toSet()); - // Promote `null`/`BottomType` types to `Object`. + // Promote `null`/`BottomType`/'TopType' types to `Object`, and other types which have + // UnsupportedOperation in TypePromotionVisitor. for (Typing typing : typings) { for (Local local : locals) { typing.set(local, convertUnderspecifiedType(typing.getType(local))); @@ -353,6 +354,12 @@ private Type convertUnderspecifiedType(@Nonnull Type type) { // It is probably possible to use the debug information to choose a type here, but that // complexity is not worth it for such an edge case. return objectType; + } else if (type instanceof AugmentIntegerTypes.Integer1Type) { + return PrimitiveType.getBoolean(); + } else if (type instanceof AugmentIntegerTypes.Integer127Type) { + return PrimitiveType.getByte(); + } else if (type instanceof AugmentIntegerTypes.Integer32767Type) { + return PrimitiveType.getShort(); } else { return type; }