mirror of
https://github.com/revanced/smali.git
synced 2025-04-30 06:34:25 +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;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.StringReference;
|
||||
import org.jf.smalidea.psi.impl.SmaliMethod;
|
||||
|
||||
@ -41,6 +43,11 @@ public class LazyStringReference extends LazyObjectReference<StringReference> im
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -48,10 +48,10 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class LazyValue<T extends Value> implements Value {
|
||||
private final int registerNumber;
|
||||
private final Project project;
|
||||
private final SmaliMethod method;
|
||||
private final String type;
|
||||
protected final int registerNumber;
|
||||
protected final Project project;
|
||||
protected final SmaliMethod method;
|
||||
protected final String type;
|
||||
|
||||
private EvaluationContext evaluationContext;
|
||||
private Value value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user