fix_typos (#539)

This commit is contained in:
XenoAmess 2020-06-13 23:11:17 +08:00 committed by GitHub
parent 7f3b3562a7
commit 0e17c1e93c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 22 deletions

View File

@ -31,7 +31,7 @@ public class ClassLoaderUtils {
* Converts the given class loader to a String calling {@link #toString(URLClassLoader)}.
*
* @param classLoader to URLClassLoader to convert.
* @return the formated string.
* @return the formatted string.
*/
public static String toString(final ClassLoader classLoader) {
if (classLoader instanceof URLClassLoader) {
@ -45,7 +45,7 @@ public class ClassLoaderUtils {
* {@code "URLClassLoader.toString() + [URL1, URL2, ...]"}.
*
* @param classLoader to URLClassLoader to convert.
* @return the formated string.
* @return the formatted string.
*/
public static String toString(final URLClassLoader classLoader) {
return classLoader + Arrays.toString(classLoader.getURLs());

View File

@ -37,7 +37,7 @@ import org.apache.commons.lang3.Functions.FailableFunction;
* references to the locked object. Instead, use references to the lock.</li>
* <li>If you want to access the locked object, create a {@link FailableConsumer}. The consumer
* will receive the locked object as a parameter. For convenience, the consumer may be
* implemented as a Lamba. Then invoke {@link Locks.Lock#runReadLocked(FailableConsumer)},
* implemented as a Lambda. Then invoke {@link Locks.Lock#runReadLocked(FailableConsumer)},
* or {@link Locks.Lock#runWriteLocked(FailableConsumer)}, passing the consumer.</li>
* <li>As an alternative, if you need to produce a result object, you may use a
* {@link FailableFunction}. This function may also be implemented as a Lambda. To
@ -51,7 +51,7 @@ import org.apache.commons.lang3.Functions.FailableFunction;
* private final Lock&lt;PrintStream&gt; lock;
*
* public SimpleLogger(OutputStream out) {
* PrintStream ps = new Printstream(out);
* PrintStream ps = new PrintStream(out);
* lock = Locks.lock(ps);
* }
*

View File

@ -162,14 +162,14 @@ abstract class MemberUtils {
// When isVarArgs is true, srcArgs and dstArgs may differ in length.
// There are two special cases to consider:
final boolean noVarArgsPassed = srcArgs.length < destArgs.length;
final boolean explicitArrayForVarags = srcArgs.length == destArgs.length && srcArgs[srcArgs.length-1] != null && srcArgs[srcArgs.length-1].isArray();
final boolean explicitArrayForVarargs = srcArgs.length == destArgs.length && srcArgs[srcArgs.length-1] != null && srcArgs[srcArgs.length-1].isArray();
final float varArgsCost = 0.001f;
final Class<?> destClass = destArgs[destArgs.length-1].getComponentType();
if (noVarArgsPassed) {
// When no varargs passed, the best match is the most generic matching type, not the most specific.
totalCost += getObjectTransformationCost(destClass, Object.class) + varArgsCost;
} else if (explicitArrayForVarags) {
} else if (explicitArrayForVarargs) {
final Class<?> sourceClass = srcArgs[srcArgs.length-1].getComponentType();
totalCost += getObjectTransformationCost(sourceClass, destClass) + varArgsCost;
} else {

View File

@ -352,7 +352,7 @@ public class DateUtils {
* If no parse patterns match, a ParseException is thrown.</p>
*
* @param str the date to parse, not null
* @param locale the locale to use when interpretting the pattern, can be null in which
* @param locale the locale to use when interpreting the pattern, can be null in which
* case the default system locale is used
* @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null
* @param lenient Specify whether or not date/time parsing is to be lenient.
@ -1055,7 +1055,7 @@ public class DateUtils {
if (aField[0] == Calendar.DATE) {
//If we're going to drop the DATE field's value,
// we want to do this our own way.
//We need to subtrace 1 since the date has a minimum of 1
//We need to subtract 1 since the date has a minimum of 1
offset = val.get(Calendar.DATE) - 1;
//If we're above 15 days adjustment, that means we're in the
// bottom half of the month and should stay accordingly.

View File

@ -292,7 +292,7 @@ public class EnumUtilsTest {
assertEquals(6L, EnumUtils.generateBitVector(Traffic.class, EnumSet.of(Traffic.AMBER, Traffic.GREEN)));
assertEquals(7L, EnumUtils.generateBitVector(Traffic.class, EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN)));
// 64 values Enum (to test whether no int<->long jdk convertion issue exists)
// 64 values Enum (to test whether no int<->long jdk conversion issue exists)
assertEquals((1L << 31), EnumUtils.generateBitVector(Enum64.class, EnumSet.of(Enum64.A31)));
assertEquals((1L << 32), EnumUtils.generateBitVector(Enum64.class, EnumSet.of(Enum64.A32)));
assertEquals((1L << 63), EnumUtils.generateBitVector(Enum64.class, EnumSet.of(Enum64.A63)));
@ -310,7 +310,7 @@ public class EnumUtilsTest {
assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class, EnumSet.of(Traffic.AMBER, Traffic.GREEN)), 6L);
assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class, EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN)), 7L);
// 64 values Enum (to test whether no int<->long jdk convertion issue exists)
// 64 values Enum (to test whether no int<->long jdk conversion issue exists)
assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, EnumSet.of(Enum64.A31)), (1L << 31));
assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, EnumSet.of(Enum64.A32)), (1L << 32));
assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, EnumSet.of(Enum64.A63)), (1L << 63));
@ -334,7 +334,7 @@ public class EnumUtilsTest {
//gracefully handles duplicates:
assertEquals(7L, EnumUtils.generateBitVector(Traffic.class, Traffic.RED, Traffic.AMBER, Traffic.GREEN, Traffic.GREEN));
// 64 values Enum (to test whether no int<->long jdk convertion issue exists)
// 64 values Enum (to test whether no int<->long jdk conversion issue exists)
assertEquals((1L << 31), EnumUtils.generateBitVector(Enum64.class, Enum64.A31));
assertEquals((1L << 32), EnumUtils.generateBitVector(Enum64.class, Enum64.A32));
assertEquals((1L << 63), EnumUtils.generateBitVector(Enum64.class, Enum64.A63));
@ -354,7 +354,7 @@ public class EnumUtilsTest {
//gracefully handles duplicates:
assertArrayEquals(EnumUtils.generateBitVectors(Traffic.class, Traffic.RED, Traffic.AMBER, Traffic.GREEN, Traffic.GREEN), 7L);
// 64 values Enum (to test whether no int<->long jdk convertion issue exists)
// 64 values Enum (to test whether no int<->long jdk conversion issue exists)
assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, Enum64.A31), (1L << 31));
assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, Enum64.A32), (1L << 32));
assertArrayEquals(EnumUtils.generateBitVectors(Enum64.class, Enum64.A63), (1L << 63));
@ -393,7 +393,7 @@ public class EnumUtilsTest {
assertEquals(EnumSet.of(Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVector(Traffic.class, 6L));
assertEquals(EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVector(Traffic.class, 7L));
// 64 values Enum (to test whether no int<->long jdk convertion issue exists)
// 64 values Enum (to test whether no int<->long jdk conversion issue exists)
assertEquals(EnumSet.of(Enum64.A31), EnumUtils.processBitVector(Enum64.class, (1L << 31)));
assertEquals(EnumSet.of(Enum64.A32), EnumUtils.processBitVector(Enum64.class, (1L << 32)));
assertEquals(EnumSet.of(Enum64.A63), EnumUtils.processBitVector(Enum64.class, (1L << 63)));
@ -430,7 +430,7 @@ public class EnumUtilsTest {
assertEquals(EnumSet.of(Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVectors(Traffic.class, 666L, 6L));
assertEquals(EnumSet.of(Traffic.RED, Traffic.AMBER, Traffic.GREEN), EnumUtils.processBitVectors(Traffic.class, 666L, 7L));
// 64 values Enum (to test whether no int<->long jdk convertion issue exists)
// 64 values Enum (to test whether no int<->long jdk conversion issue exists)
assertEquals(EnumSet.of(Enum64.A31), EnumUtils.processBitVectors(Enum64.class, (1L << 31)));
assertEquals(EnumSet.of(Enum64.A32), EnumUtils.processBitVectors(Enum64.class, (1L << 32)));
assertEquals(EnumSet.of(Enum64.A63), EnumUtils.processBitVectors(Enum64.class, (1L << 63)));

View File

@ -55,7 +55,7 @@ public class EventUtilsTest {
@Test
public void testAddEventListener() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final EventCountingInvocationHandler handler = new EventCountingInvocationHandler();
final PropertyChangeListener listener = handler.createListener(PropertyChangeListener.class);
assertEquals(0, handler.getEventCount("propertyChange"));
EventUtils.addEventListener(src, PropertyChangeListener.class, listener);
@ -67,7 +67,7 @@ public class EventUtilsTest {
@Test
public void testAddEventListenerWithNoAddMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final EventCountingInvocationHandler handler = new EventCountingInvocationHandler();
final ObjectChangeListener listener = handler.createListener(ObjectChangeListener.class);
final IllegalArgumentException e =
assertThrows(IllegalArgumentException.class, () -> EventUtils.addEventListener(src, ObjectChangeListener.class, listener));
@ -88,7 +88,7 @@ public class EventUtilsTest {
@Test
public void testAddEventListenerWithPrivateAddMethod() {
final PropertyChangeSource src = new PropertyChangeSource();
final EventCountingInvociationHandler handler = new EventCountingInvociationHandler();
final EventCountingInvocationHandler handler = new EventCountingInvocationHandler();
final VetoableChangeListener listener = handler.createListener(VetoableChangeListener.class);
final IllegalArgumentException e =
assertThrows(IllegalArgumentException.class, () -> EventUtils.addEventListener(src, VetoableChangeListener.class, listener));
@ -161,7 +161,7 @@ public class EventUtilsTest {
}
private static class EventCountingInvociationHandler implements InvocationHandler {
private static class EventCountingInvocationHandler implements InvocationHandler {
private final Map<String, Integer> eventCounts = new TreeMap<>();
public <L> L createListener(final Class<L> listenerType) {

View File

@ -291,7 +291,7 @@ public class ExtendedMessageFormatTest {
@Test
public void testEqualsHashcode() {
final Map<String, ? extends FormatFactory> fmtRegistry = Collections.singletonMap("testfmt", new LowerCaseFormatFactory());
final Map<String, ? extends FormatFactory> otherRegitry = Collections.singletonMap("testfmt", new UpperCaseFormatFactory());
final Map<String, ? extends FormatFactory> otherRegistry = Collections.singletonMap("testfmt", new UpperCaseFormatFactory());
final String pattern = "Pattern: {0,testfmt}";
final ExtendedMessageFormat emf = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
@ -318,7 +318,7 @@ public class ExtendedMessageFormatTest {
assertNotEquals(emf.hashCode(), other.hashCode(), "pattern, hashcode()");
// Different registry
other = new ExtendedMessageFormat(pattern, Locale.US, otherRegitry);
other = new ExtendedMessageFormat(pattern, Locale.US, otherRegistry);
assertNotEquals(emf, other, "registry, equals()");
assertNotEquals(emf.hashCode(), other.hashCode(), "registry, hashcode()");
@ -354,7 +354,7 @@ public class ExtendedMessageFormatTest {
/**
* Create an ExtendedMessageFormat for the specified pattern and locale and check the
* formated output matches the expected result for the parameters.
* formatted output matches the expected result for the parameters.
* @param pattern string
* @param registryUnused map (currently unused)
* @param args Object[]

View File

@ -1,7 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional inparserion regarding copyright ownership.
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at