mirror of
https://github.com/revanced/smali.git
synced 2025-04-30 14:44:26 +02:00
Add additional exception info if StringReference doesn't resolve to a String
This commit is contained in:
parent
8f7d1a897d
commit
7a95aa296f
@ -32,6 +32,8 @@
|
|||||||
package org.jf.smalidea.debugging.value;
|
package org.jf.smalidea.debugging.value;
|
||||||
|
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
|
import com.intellij.psi.PsiSubstitutor;
|
||||||
|
import com.sun.jdi.ObjectReference;
|
||||||
import com.sun.jdi.StringReference;
|
import com.sun.jdi.StringReference;
|
||||||
import org.jf.smalidea.psi.impl.SmaliMethod;
|
import org.jf.smalidea.psi.impl.SmaliMethod;
|
||||||
|
|
||||||
@ -41,6 +43,11 @@ public class LazyStringReference extends LazyObjectReference<StringReference> im
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String value() {
|
public String value() {
|
||||||
|
ObjectReference objectReference = getValue();
|
||||||
|
if (!(objectReference instanceof StringReference)) {
|
||||||
|
throw new IllegalStateException(String.format("Expecting type String, but got %s. method=%s, register=%d",
|
||||||
|
objectReference.type().name(), this.method.getSignature(PsiSubstitutor.EMPTY), registerNumber));
|
||||||
|
}
|
||||||
return getValue().value();
|
return getValue().value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,10 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class LazyValue<T extends Value> implements Value {
|
public class LazyValue<T extends Value> implements Value {
|
||||||
private final int registerNumber;
|
protected final int registerNumber;
|
||||||
private final Project project;
|
protected final Project project;
|
||||||
private final SmaliMethod method;
|
protected final SmaliMethod method;
|
||||||
private final String type;
|
protected final String type;
|
||||||
|
|
||||||
private EvaluationContext evaluationContext;
|
private EvaluationContext evaluationContext;
|
||||||
private Value value;
|
private Value value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user