Skip to content

Commit

Permalink
fix fury
Browse files Browse the repository at this point in the history
  • Loading branch information
chaokunyang committed Nov 3, 2024
1 parent 04dd07f commit ddb5766
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion java/fury-core/src/main/java/org/apache/fury/Fury.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ public void register(Class<?> cls, int id, boolean createSerializer) {
/** register class with given type tag which will be used for cross-language serialization. */
public void register(Class<?> cls, String typeName) {
Preconditions.checkArgument(language != Language.JAVA);
register(cls, "", typeName);
int idx = typeName.lastIndexOf('.');
String namespace = "";
if (idx > 0) {
namespace = typeName.substring(0, idx);
typeName = typeName.substring(idx);
}
register(cls, namespace, typeName);
}

public void register(Class<?> cls, String namespace, String typeName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void register(Class<?> type, int typeId) {
if (serializer == null) {
if (type.isEnum()) {
classResolver.registerSerializer(
type, new EnumSerializer<>(classResolver.getFury(), type.asSubclass(Enum.class)));
type, new EnumSerializer(classResolver.getFury(), (Class<Enum>) type));
} else {
classResolver.registerSerializer(
type, new StructSerializer<>(classResolver.getFury(), type));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/** Scala types utils using reflection without dependency on scala library. */
@SuppressWarnings({"unchecked", "rawtypes"})
public class ScalaTypes {

private static final Class<?> SCALA_MAP_TYPE;
private static final Class<?> SCALA_SEQ_TYPE;
private static final Class<?> SCALA_SET_TYPE;
Expand Down

0 comments on commit ddb5766

Please sign in to comment.