Repository: alibaba/fastjson2
Pull request #3562 (2025-05-16 18:57:59)

fix ignore method whose return type is OutputStream, for issue #3559
### What this PR does / why we need it?

fix ignore method whose return type is OutputStream

### Summary of your change



#### Please indicate you've done the following:

- [ ] Made sure tests are passing and test coverage is added if needed.
- [ ] Made sure commit message follow the rule of [Conventional Commits specification](https://www.conventionalcommits.org/).
- [ ] Considered the docs impact and opened a new docs issue or PR with docs changes if needed.



Patch:
diff --git a/core/src/main/java/com/alibaba/fastjson2/util/BeanUtils.java b/core/src/main/java/com/alibaba/fastjson2/util/BeanUtils.java
index 40e6be854..9ef870cdc 100644
--- a/core/src/main/java/com/alibaba/fastjson2/util/BeanUtils.java
+++ b/core/src/main/java/com/alibaba/fastjson2/util/BeanUtils.java
@@ -65,6 +65,7 @@ public abstract class BeanUtils {
             3724195282986200606L,
             3742915795806478647L,
             3977020351318456359L,
+            4775491097662790952L,
             4882459834864833642L,
             6033839080488254886L,
             7981148566008458638L,


Test patch:
diff --git a/core/src/test/java/com/alibaba/fastjson2/issues_3500/Issue3559.java b/core/src/test/java/com/alibaba/fastjson2/issues_3500/Issue3559.java
new file mode 100644
index 000000000..43c158f69
--- /dev/null
+++ b/core/src/test/java/com/alibaba/fastjson2/issues_3500/Issue3559.java
@@ -0,0 +1,21 @@
+package com.alibaba.fastjson2.issues_3500;
+
+import com.alibaba.fastjson2.JSON;
+import org.junit.jupiter.api.Test;
+import org.springframework.core.io.FileSystemResource;
+
+import java.io.IOException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class Issue3559 {
+    @Test
+    public void test() throws IOException {
+        FileSystemResource resource = new FileSystemResource(this.getClass().getClassLoader().getResource("issues/issue3559.json").getPath());
+        long length = resource.contentLength();
+        long modified = resource.lastModified();
+        JSON.toJSONString(resource);
+        assertEquals(length, resource.contentLength());
+        assertEquals(modified, resource.lastModified());
+    }
+}
diff --git a/core/src/test/java/com/alibaba/fastjson2/util/BeanUtilsTest.java b/core/src/test/java/com/alibaba/fastjson2/util/BeanUtilsTest.java
index 19b7c7324..e5d602cde 100644
--- a/core/src/test/java/com/alibaba/fastjson2/util/BeanUtilsTest.java
+++ b/core/src/test/java/com/alibaba/fastjson2/util/BeanUtilsTest.java
@@ -307,7 +307,8 @@ public class BeanUtilsTest {
                 "java.util.concurrent.locks.Lock",
                 "java.util.concurrent.locks.ReentrantLock",
                 "java.security.ProtectionDomain",
-                "java.lang.ref.ReferenceQueue"
+                "java.lang.ref.ReferenceQueue",
+                "java.io.OutputStream"
         };
 
         long[] hashCodes = new long[names.length];
diff --git a/core/src/test/resources/issues/issue3559.json b/core/src/test/resources/issues/issue3559.json
new file mode 100644
index 000000000..2c63c0851
--- /dev/null
+++ b/core/src/test/resources/issues/issue3559.json
@@ -0,0 +1,2 @@
+{
+}