Skip to content

Commit

Permalink
fix(license): remove confused comment and remove generics (#1563)
Browse files Browse the repository at this point in the history
## What does this PR do?

This PR removed confused comment and remove generics.

## Related issues
#1560 

## 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.
-->
  • Loading branch information
chaokunyang authored Apr 24, 2024
1 parent 7ada229 commit e469b1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,14 @@ public double[] read(MemoryBuffer buffer) {
public static final class StringArraySerializer extends Serializer<String[]> {
private final StringSerializer stringSerializer;
private final FuryArrayAsListSerializer collectionSerializer;
private final FuryArrayAsListSerializer.ArrayAsList<String> list;
private final FuryArrayAsListSerializer.ArrayAsList list;

public StringArraySerializer(Fury fury) {
super(fury, String[].class);
stringSerializer = new StringSerializer(fury);
collectionSerializer = new FuryArrayAsListSerializer(fury);
collectionSerializer.setElementSerializer(stringSerializer);
list = new FuryArrayAsListSerializer.ArrayAsList<>(0);
list = new FuryArrayAsListSerializer.ArrayAsList(0);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,19 @@ public Collection newCollection(MemoryBuffer buffer) {
}

/**
* A List which wrap a Java array like `java.util.Arrays.ArrayList`, but allow to replace wrapped
* array. Used for serialization only, do not use it in other scenarios.
* A List which wrap a Java array into a list, used for serialization only, do not use it in other
* scenarios.
*/
@Internal
public static class ArrayAsList<E> extends AbstractList<E>
public static class ArrayAsList extends AbstractList<Object>
implements RandomAccess, java.io.Serializable {
private static final Object[] EMPTY = new Object[0];

private E[] array;
private Object[] array;
private int size;

@SuppressWarnings("unchecked")
public ArrayAsList(int size) {
array = (E[]) new Object[size];
array = new Object[size];
}

@Override
Expand All @@ -71,33 +70,32 @@ public int size() {
}

@Override
public boolean add(E e) {
public boolean add(Object e) {
array[size++] = e;
return true;
}

@Override
public E get(int index) {
public Object get(int index) {
return array[index];
}

@SuppressWarnings("unchecked")
public void clearArray() {
size = 0;
array = (E[]) EMPTY;
array = EMPTY;
}

public void setArray(E[] a) {
public void setArray(Object[] a) {
array = a;
size = a.length;
}

public E[] getArray() {
public Object[] getArray() {
return array;
}

@Override
public E set(int index, E element) {
public Object set(int index, Object element) {
throw new UnsupportedOperationException();
}

Expand All @@ -118,8 +116,8 @@ public Object[] toArray() {
}

@Override
public Iterator<E> iterator() {
return new Iterator<E>() {
public Iterator<Object> iterator() {
return new Iterator<Object>() {
private int index;

@Override
Expand All @@ -128,7 +126,7 @@ public boolean hasNext() {
}

@Override
public E next() {
public Object next() {
return array[index++];
}
};
Expand Down

0 comments on commit e469b1a

Please sign in to comment.