AlertDialogScene崩溃
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 221
- PR merge metrics
- No merged PRs in 30d
Description
releas包出现异常
```
java.lang.IllegalArgumentException: Scene k8.b must be a public class or public static class, and have only one parameterless constructor to be properly recreated from instance state.
at com.bytedance.scene.navigation.j.c6(NavigationScene.java:119)
at com.bytedance.scene.navigation.j.X5(NavigationScene.java:2)
at com.bytedance.scene.dialog.d.Y4(DialogScene.java:42)
```
代码为
```
private void pushInstance(@NonNull Scene scene, @Nullable PushOptions pushOptions) {
ThreadUtility.checkUIThread();
if (Utility.isActivityStatusValid(this.getActivity())) {
if (!this.isReusing(scene) && scene.getParentScene() != null) {
if (scene.getParentScene() == this) {
throw new IllegalArgumentException("Scene is already pushed");
} else {
throw new IllegalArgumentException("Scene already has a parent, parent " + scene.getParentScene());
}
} else if (this.isSupportRestore() && scene.isSceneRestoreEnabled() && !SceneInstanceUtility.isConstructorMethodSupportRestore(scene)) {
throw new IllegalArgumentException("Scene " + scene.getClass().getName() + " must be a public class or public static class, and have only one parameterless constructor to be properly recreated from instance state.");
} else {
if (pushOptions == null) {
pushOptions = (new PushOptions.Builder()).build();
}
this.hideSoftInputIfNeeded();
this.mNavigationSceneManager.push(scene, pushOptions);
}
}
}
```
发现有个合成的构造函数
```
// access flags 0x1000
synthetic (Lcom/bytedance/scene/dialog/alert/AlertDialogScene$1;)V
L0
LINENUMBER 52 L0
ALOAD 0
INVOKESPECIAL com/bytedance/scene/dialog/alert/AlertDialogScene. ()V
RETURN
L1
LOCALVARIABLE this Lcom/bytedance/scene/dialog/alert/AlertDialogScene; L0 L1 0
LOCALVARIABLE x0 Lcom/bytedance/scene/dialog/alert/AlertDialogScene$1; L0 L1 1
MAXSTACK = 1
MAXLOCALS = 2
```
附件是debug版本的字节码,也有两个构造函数
[alert.zip](https://github.com/user-attachments/files/24860717/alert.zip)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with AlertDialogScene and the pushInstance path shown in NavigationScene.java, then inspect the DialogScene.java stack location and the release bytecode in alert.zip. Compare the constructors produced in debug and release builds and determine why scene restoration rejects the release class. Done means the release AlertDialogScene can be pushed and recreated without the IllegalArgumentException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100