Skip to content

Commit

Permalink
J2cl - RuntimeMethods - Change Arrays methods such as stream to s…
Browse files Browse the repository at this point in the history
…tatic import for clarity and to satisfy analyzer warnings.

PiperOrigin-RevId: 584027753
  • Loading branch information
Googler authored and copybara-github committed Nov 20, 2023
1 parent 2ccb84b commit 4ba197e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions transpiler/java/com/google/j2cl/transpiler/ast/RuntimeMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.j2cl.common.StringUtils.capitalize;
import static java.util.Arrays.asList;
import static java.util.Arrays.stream;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.j2cl.common.SourcePosition;
import com.google.j2cl.transpiler.ast.MethodDescriptor.ParameterDescriptor;
import com.google.j2cl.transpiler.ast.TypeDescriptors.BootstrapType;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.OptionalInt;
Expand Down Expand Up @@ -58,7 +59,7 @@ public static MethodCall createKClassCall(Expression expression) {

/** Create a call to an Arrays method. */
public static MethodCall createArraysMethodCall(String methodName, Expression... arguments) {
return createArraysMethodCall(methodName, Arrays.asList(arguments));
return createArraysMethodCall(methodName, asList(arguments));
}

/** Create a call to an Arrays method. */
Expand Down Expand Up @@ -280,7 +281,7 @@ public static Expression createEnumsMethodCall(String unbox, Expression... argum

/** Create a call to an Equality method. */
public static MethodCall createEqualityMethodCall(String methodName, Expression... arguments) {
return createEqualityMethodCall(methodName, Arrays.asList(arguments));
return createEqualityMethodCall(methodName, asList(arguments));
}

/** Create a call to an Equality method. */
Expand All @@ -293,7 +294,7 @@ public static MethodCall createEqualityMethodCall(String methodName, List<Expres
public static MethodCall createExceptionsMethodCall(String methodName, Expression... arguments) {
return MethodCall.Builder.from(
TypeDescriptors.get().javaemulInternalExceptions.getMethodDescriptorByName(methodName))
.setArguments(Arrays.asList(arguments))
.setArguments(asList(arguments))
.build();
}

Expand All @@ -302,7 +303,7 @@ public static MethodCall createThrowableInitMethodCall(
return MethodCall.Builder.from(
TypeDescriptors.get().javaLangThrowable.getMethodDescriptorByName("privateInitError"))
.setQualifier(instance)
.setArguments(Arrays.asList(arguments))
.setArguments(asList(arguments))
.build();
}

Expand Down Expand Up @@ -374,7 +375,7 @@ private static Expression createCheckNotNullBooleanCall(Expression argument) {

/** Create a call to an LongUtils method. */
public static MethodCall createLongUtilsMethodCall(String methodName, Expression... arguments) {
return createLongUtilsMethodCall(methodName, Arrays.asList(arguments));
return createLongUtilsMethodCall(methodName, asList(arguments));
}

/** Create a call to an LongUtils method. */
Expand Down Expand Up @@ -406,7 +407,7 @@ public static Expression createLongUtilsMethodCall(

/** Create a call to a native Long method. */
public static MethodCall createNativeLongMethodCall(String methodName, Expression... arguments) {
return createNativeLongMethodCall(methodName, Arrays.asList(arguments));
return createNativeLongMethodCall(methodName, asList(arguments));
}

/** Create a call to an native Long method. */
Expand Down Expand Up @@ -507,7 +508,7 @@ public static MethodCall createUnboxingMethodCall(

/** Create a call to a Util method. */
public static MethodCall createUtilMethodCall(String methodName, Expression... arguments) {
return createUtilMethodCall(methodName, Arrays.asList(arguments));
return createUtilMethodCall(methodName, asList(arguments));
}

/** Create a call to an Util method. */
Expand Down Expand Up @@ -775,7 +776,7 @@ abstract static class Builder {

public Builder setParameters(TypeDescriptor... parameterTypes) {
return setParameterDescriptors(
Arrays.stream(parameterTypes)
stream(parameterTypes)
.map(p -> ParameterDescriptor.newBuilder().setTypeDescriptor(p).build())
.toArray(ParameterDescriptor[]::new));
}
Expand Down

0 comments on commit 4ba197e

Please sign in to comment.