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

No type mapping from class java.lang.String to class java.lang.String #1604

Closed
2 tasks done
galaxyxym opened this issue May 6, 2024 · 0 comments · Fixed by #1608
Closed
2 tasks done

No type mapping from class java.lang.String to class java.lang.String #1604

galaxyxym opened this issue May 6, 2024 · 0 comments · Fixed by #1608
Labels
bug Something isn't working

Comments

@galaxyxym
Copy link

galaxyxym commented May 6, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

fury: 0.5.0
os: linux
jdk: openjdk17
fastjson: 1.2.70

Component(s)

Java

Minimal reproduce step

use fury.serialize(output, obj); in dubbo spi

public class TestMain {

    static ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
            .requireClassRegistration(false)
            .withRefTracking(true)
            .registerGuavaTypes(false)
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .buildThreadSafeFury();

    public static void main(String[] args) {
        DemoResponse resp = new DemoResponse();
        byte[] serialize = fury.serialize(resp);
        System.out.println("size:" + serialize.length);
    }
}


import com.alibaba.fastjson.JSONObject;
@Data
public class DemoResponse {
    private JSONObject filterJson;

    public DemoResponse() {

    }
}

What did you expect to see?

serialize successfully

What did you see instead?

at org.apache.fury.serializer.CodegenSerializer.loadCompatibleCodegenSerializer(CodegenSerializer.java:62)
	at org.apache.fury.resolver.ClassResolver.lambda$getObjectSerializerClass$4(ClassResolver.java:967)
	at org.apache.fury.builder.JITContext.registerSerializerJITCallback(JITContext.java:131)
	at org.apache.fury.resolver.ClassResolver.getObjectSerializerClass(ClassResolver.java:962)
	at org.apache.fury.resolver.ClassResolver.getSerializerClass(ClassResolver.java:885)
	at org.apache.fury.resolver.ClassResolver.getSerializerClass(ClassResolver.java:782)
	at org.apache.fury.resolver.ClassResolver.createSerializer(ClassResolver.java:1168)
	at org.apache.fury.resolver.ClassResolver.getOrUpdateClassInfo(ClassResolver.java:1107)
	at org.apache.fury.Fury.write(Fury.java:312)
	at org.apache.fury.Fury.serialize(Fury.java:248)
	at org.apache.fury.Fury.lambda$serialize$0(Fury.java:264)
	at org.apache.fury.Fury.serializeToStream(Fury.java:1236)
	at org.apache.fury.Fury.serialize(Fury.java:264)
Caused by: java.lang.IllegalArgumentException: No type mapping from class java.lang.String to class java.lang.String
	at org.apache.fury.reflect.TypeRef.populateTypeMappings(TypeRef.java:508)
	at org.apache.fury.reflect.TypeRef.populateTypeMappings(TypeRef.java:499)
	at org.apache.fury.reflect.TypeRef.getSubtype(TypeRef.java:458)
	at org.apache.fury.type.TypeUtils.mapOf(TypeUtils.java:513)
	at org.apache.fury.builder.CompatibleCodecBuilder.createDescriptor(CompatibleCodecBuilder.java:149)
	at org.apache.fury.builder.CompatibleCodecBuilder.lambda$buildEncodeExpression$a78febb8$4(CompatibleCodecBuilder.java:265)
	at org.apache.fury.codegen.ExpressionOptimizer.invokeGenerated(ExpressionOptimizer.java:49)
	at org.apache.fury.builder.CompatibleCodecBuilder.lambda$buildEncodeExpression$4(CompatibleCodecBuilder.java:254)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.apache.fury.builder.CompatibleCodecBuilder.buildEncodeExpression(CompatibleCodecBuilder.java:251)
	at org.apache.fury.builder.BaseObjectCodecBuilder.genCode(BaseObjectCodecBuilder.java:205)
	at org.apache.fury.codegen.CompileUnit.getCode(CompileUnit.java:53)
	at org.apache.fury.codegen.JaninoUtils.toBytecode(JaninoUtils.java:81)
	at org.apache.fury.codegen.JaninoUtils.toBytecode(JaninoUtils.java:73)
	at org.apache.fury.codegen.CodeGenerator.compile(CodeGenerator.java:145)
	at org.apache.fury.builder.CodecUtils.loadOrGenCodecClass(CodecUtils.java:110)
	at org.apache.fury.builder.CodecUtils.loadOrGenCompatibleCodecClass(CodecUtils.java:65)
	at org.apache.fury.builder.CodecUtils.loadOrGenCompatibleCodecClass(CodecUtils.java:57)
	at org.apache.fury.serializer.CodegenSerializer.loadCompatibleCodegenSerializer(CodegenSerializer.java:59)
	... 37 more

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@galaxyxym galaxyxym added the bug Something isn't working label May 6, 2024
chaokunyang added a commit that referenced this issue May 6, 2024
## What does this PR do?

 fix TypeRef getSubType

## Related issues

Closes #1604 

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/incubator-fury/issues/new/choose)
describing the need to do so and update the document if necessary.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?


## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.
-->
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

Successfully merging a pull request may close this issue.

1 participant