Skip to content

Commit

Permalink
fix checkstyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuven Lax committed Dec 5, 2019
1 parent cf47812 commit 2d1bcc0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ private <ValueT> ValueT fromValue(
}
}

private static <F, T> Collection<T> transformCollection(
Collection<F> collection, Function<F, T> function) {
private static <SourceT, DestT> Collection<DestT> transformCollection(
Collection<SourceT> collection, Function<SourceT, DestT> function) {
if (collection instanceof List) {
// For performance reasons if the input is a list, make sure that we produce a list. Otherwise Row unwrapping
// For performance reasons if the input is a list, make sure that we produce a list. Otherwise
// Row unwrapping
// is forced to physically copy the collection into a new List object.
return Lists.transform((List) collection, function);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,10 @@ private <ElementT> TypeDescriptor<Iterable<ElementT>> createIterableType(

private static final ByteBuddy BYTE_BUDDY = new ByteBuddy();

// When processing a container (e.g. List<T>) we need to recursively process the element type. This function
// generates a subclass of Function that can be used to recursively transform each element of the container.
// When processing a container (e.g. List<T>) we need to recursively process the element type.
// This function
// generates a subclass of Function that can be used to recursively transform each element of the
// container.
static Class createCollectionTransformFunction(
Type fromType, Type toType, Function<StackManipulation, StackManipulation> convertElement) {
// Generate a TypeDescription for the class we want to generate.
Expand Down Expand Up @@ -392,14 +394,15 @@ public InstrumentedType prepare(InstrumentedType instrumentedType) {
.getLoaded();
}

// A function to transform a container, special casing List and Collection types. This is used in byte-buddy
// A function to transform a container, special casing List and Collection types. This is used in
// byte-buddy
// generated code.
public static <F, T> Iterable<T> transformContainer(
Iterable<F> iterable, Function<F, T> function) {
public static <FromT, DestT> Iterable<DestT> transformContainer(
Iterable<FromT> iterable, Function<FromT, DestT> function) {
if (iterable instanceof List) {
return Lists.transform((List<F>) iterable, function);
return Lists.transform((List<FromT>) iterable, function);
} else if (iterable instanceof Collection) {
return Collections2.transform((Collection<F>) iterable, function);
return Collections2.transform((Collection<FromT>) iterable, function);
} else {
return Iterables.transform(iterable, function);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public static List<Method> getMethods(Class clazz) {
clazz,
c -> {
return Arrays.stream(c.getDeclaredMethods())
.filter(m -> !m.isBridge()) // Covariant overloads insert bridge functions, which we must ignore.
.filter(
m -> !m.isBridge()) // Covariant overloads insert bridge functions, which we must
// ignore.
.filter(m -> !Modifier.isPrivate(m.getModifiers()))
.filter(m -> !Modifier.isProtected(m.getModifiers()))
.filter(m -> !Modifier.isStatic(m.getModifiers()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public <T> T getValue(int fieldIdx) {
private Collection getCollectionValue(FieldType elementType, Object fieldValue) {
Collection collection = (Collection) fieldValue;
if (collection instanceof List) {
// For performance reasons if the input is a list, make sure that we produce a list. Otherwise Row forwarding
// For performance reasons if the input is a list, make sure that we produce a list. Otherwise
// Row forwarding
// is forced to physically copy the collection into a new List object.
return Lists.transform((List) collection, v -> getValue(elementType, v, null));
} else {
Expand Down

0 comments on commit 2d1bcc0

Please sign in to comment.