Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 在Android SDK 34下JSON::toJSONString返回{} #1888

Open
sheng-ri opened this issue Sep 21, 2023 · 8 comments
Open

[BUG] 在Android SDK 34下JSON::toJSONString返回{} #1888

sheng-ri opened this issue Sep 21, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@sheng-ri
Copy link

sheng-ri commented Sep 21, 2023

问题描述

简要描述您碰到的问题。

普通class正常
我定义了这样一个record

public record Device(String username, String deviceName) {

    @Override
    public String toString() {
        return username + "@" + deviceName;
    }
}

使用JSON::toJSONString后返回"{}"

环境信息

请填写以下信息:

  • OS信息: Android 14
  • JDK信息:17
  • 版本信息:Fastjson2 2.0.40

重现步骤

如何操作可以重现该问题:

  1. 定义一个record类
  2. 新建对象
  3. 使用JSON::toJsonString并输出

期待的正确结果

对您期望发生的结果进行清晰简洁的描述。
返回{"deviceName":"2","username":"1"}等结果

相关日志输出

没有看到相关日志

附加信息

@sheng-ri sheng-ri added the bug Something isn't working label Sep 21, 2023
wenshao added a commit that referenced this issue Sep 23, 2023
@sheng-ri
Copy link
Author

在WIndows JDK 21环境下是正常的

@wenshao
Copy link
Member

wenshao commented Oct 5, 2023

能帮忙调试看下这个值么?

package com.alibaba.fastjson2.util;

public class JDKUtils {
      public static final int JVM_VERSION;
}

@wenshao wenshao added this to the 2.0.41 milestone Oct 5, 2023
@wenshao wenshao added the fixed label Oct 5, 2023
@wenshao
Copy link
Member

wenshao commented Oct 6, 2023

https://github.com/alibaba/fastjson2/releases/tag/2.0.41
问题已修复,请用新版本

@wenshao wenshao closed this as completed Oct 6, 2023
@sheng-ri
Copy link
Author

sheng-ri commented Oct 6, 2023

再次测试,问题仍然存在

调试变量数值

JDKUtils.JVM_VERSION = -1
JDKUtils.ANDROID_SDK_INT = 34

构建配置

compileSdk = 34
minSdk = 26
targetSdk = 34

@wenshao wenshao modified the milestones: 2.0.41, 2.0.42 Oct 7, 2023
@wenshao wenshao reopened this Oct 7, 2023
@wenshao wenshao removed the fixed label Oct 7, 2023
@wenshao wenshao modified the milestones: 2.0.42, 2.0.43 Nov 5, 2023
@wenshao wenshao modified the milestones: 2.0.43, 2.0.44 Dec 3, 2023
@wenshao
Copy link
Member

wenshao commented Dec 3, 2023

我目前没有这样的机器,需要晚点时间借机器来测试

@sheng-ri
Copy link
Author

sheng-ri commented Dec 3, 2023

我目前没有这样的机器,需要晚点时间借机器来测试

理解,但是我也没有这样的机器,我只是在模拟器上测试app的时候发现的

@wenshao wenshao modified the milestones: 2.0.44, 2.0.45 Dec 24, 2023
@wenshao wenshao modified the milestones: 2.0.45, 2.0.46 Jan 7, 2024
@wenshao wenshao modified the milestones: 2.0.46, 2.0.47 Jan 27, 2024
@wenshao wenshao modified the milestones: 2.0.47, 2.0.48 Feb 23, 2024
@wenshao wenshao modified the milestones: 2.0.48, 2.0.49 Mar 25, 2024
@wenshao wenshao removed this from the 2.0.49 milestone Apr 13, 2024
@wenshao wenshao added this to the 2.0.50 milestone Apr 13, 2024
@kraity
Copy link
Collaborator

kraity commented May 2, 2024

请问模拟器是AS自带的, 还是mumu6、mumu12、雷电

@sheng-ri
Copy link
Author

sheng-ri commented May 2, 2024

@kraity
确实是在模拟器上跑的
随手测试的项目,已经放了很久了,忘记有没有真机测试了,而且我没有android 14的真机

@wenshao wenshao modified the milestones: 2.0.50, 2.0.51, 2.0.52 May 12, 2024
@wenshao wenshao modified the milestones: 2.0.52, 2.0.53 Jul 7, 2024
@wenshao wenshao removed this from the 2.0.53 milestone Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants