Skip to content

Commit

Permalink
Use preferred spelling for "cannot"
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Nov 5, 2024
1 parent a59fa7b commit d673ed0
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 54 deletions.
20 changes: 10 additions & 10 deletions src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ public Boolean isEmpty(final Object object) {
* Check for emptiness of various types: Number, Collection, Array, Map, String.
*
* @param object the object to check the emptiness of
* @param def the default value if object emptiness can not be determined
* @param def the default value if object emptiness cannot be determined
* @return the boolean or null if there is no arithmetic solution
*/
public Boolean isEmpty(final Object object, final Boolean def) {
Expand Down Expand Up @@ -1453,7 +1453,7 @@ public Number narrowNumber(final Number original, final Class<?> narrow) {
value = big.longValueExact();
// continue in sequence to try and further reduce
} catch (final ArithmeticException xa) {
// if it is bigger than a double, it can not be narrowed
// if it is bigger than a double, it cannot be narrowed
if (big.compareTo(BIGD_DOUBLE_MAX_VALUE) > 0
|| big.compareTo(BIGD_DOUBLE_MIN_VALUE) < 0) {
return original;
Expand All @@ -1472,7 +1472,7 @@ public Number narrowNumber(final Number original, final Class<?> narrow) {
// else it can be represented as a long
} else if (original instanceof BigInteger) {
final BigInteger bigi = (BigInteger) original;
// if it is bigger than a Long, it can not be narrowed
// if it is bigger than a Long, it cannot be narrowed
if (!BigInteger.valueOf(bigi.longValue()).equals(bigi)) {
return original;
}
Expand Down Expand Up @@ -1642,7 +1642,7 @@ public Object or(final Object left, final Object right) {
* <>Empty string is considered as 0.</>
* @param arg the arg
* @return a BigDecimal
* @throws CoercionException if the string can not be coerced into a BigDecimal
* @throws CoercionException if the string cannot be coerced into a BigDecimal
*/
private BigDecimal parseBigDecimal(final String arg) throws ArithmeticException {
try {
Expand All @@ -1659,7 +1659,7 @@ private BigDecimal parseBigDecimal(final String arg) throws ArithmeticException
* <>Empty string is considered as 0.</>
* @param arg the arg
* @return a big integer
* @throws ArithmeticException if the string can not be coerced into a big integer
* @throws ArithmeticException if the string cannot be coerced into a big integer
*/
private BigInteger parseBigInteger(final String arg) throws ArithmeticException {
try {
Expand All @@ -1676,7 +1676,7 @@ private BigInteger parseBigInteger(final String arg) throws ArithmeticException
* <>Empty string is considered as NaN.</>
* @param arg the arg
* @return a double
* @throws ArithmeticException if the string can not be coerced into a double
* @throws ArithmeticException if the string cannot be coerced into a double
*/
private double parseDouble(final String arg) throws ArithmeticException {
try {
Expand All @@ -1693,7 +1693,7 @@ private double parseDouble(final String arg) throws ArithmeticException {
* <p>This ensure the represented number is a natural (not a real).</p>
* @param arg the arg
* @return an int
* @throws ArithmeticException if the string can not be coerced into a long
* @throws ArithmeticException if the string cannot be coerced into a long
*/
private int parseInteger(final String arg) throws ArithmeticException {
final long l = parseLong(arg);
Expand All @@ -1709,7 +1709,7 @@ private int parseInteger(final String arg) throws ArithmeticException {
* <p>This ensure the represented number is a natural (not a real).</p>
* @param arg the arg
* @return a long
* @throws ArithmeticException if the string can not be coerced into a long
* @throws ArithmeticException if the string cannot be coerced into a long
*/
private long parseLong(final String arg) throws ArithmeticException {
final double d = parseDouble(arg);
Expand Down Expand Up @@ -1737,7 +1737,7 @@ public static Integer parseIdentifier(final Object id) {
if (id instanceof CharSequence) {
final CharSequence str = (CharSequence) id;
final int length = str.length();
// can not be empty string and can not be longer than Integer.MAX_VALUE representation
// cannot be empty string and cannot be longer than Integer.MAX_VALUE representation
if (length > 0 && length <= 10) {
int val = 0;
for (int i = 0; i < length; ++i) {
Expand Down Expand Up @@ -1877,7 +1877,7 @@ public Integer size(final Object object) {
* Calculate the {@code size} of various types: Collection, Array, Map, String.
*
* @param object the object to get the size of
* @param def the default value if object size can not be determined
* @param def the default value if object size cannot be determined
* @return the size of object or null if there is no arithmetic solution
*/
public Integer size(final Object object, final Integer def) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/jexl3/JexlFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* are the recommended starting points to selectively enable or disable chosen features.</p>
* <ul>
* <li>Registers: register syntax (#number), used internally for {g,s}etProperty
* <li>Reserved Names: a set of reserved variable names that can not be used as local variable (or parameter) names
* <li>Reserved Names: a set of reserved variable names that cannot be used as local variable (or parameter) names
* <li>Global Side Effect : assigning/modifying values on global variables (=, += , -=, ...)
* <li>Lexical: lexical scope, prevents redefining local variables
* <li>Lexical Shade: local variables shade globals, prevents confusing a global variable with a local one
Expand Down Expand Up @@ -265,7 +265,7 @@ public static String stringify(final int feature) {
/** The feature flags. */
private long flags;

/** The set of reserved names, aka global variables that can not be masked by local variables or parameters. */
/** The set of reserved names, aka global variables that cannot be masked by local variables or parameters. */
private Set<String> reservedNames;

/** The namespace names. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public Engine(final JexlBuilder conf) {
this.cache = (JexlCache<Source, ASTJexlScript>) (conf.cache() > 0 ? factory.apply(conf.cache()) : null);
this.cacheThreshold = conf.cacheThreshold();
if (uberspect == null) {
throw new IllegalArgumentException("uberspect can not be null");
throw new IllegalArgumentException("uberspect cannot be null");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class FqcnResolver implements JexlContext.ClassNameResolver {
*/
FqcnResolver(final FqcnResolver solver) {
if (solver == null) {
throw new NullPointerException("parent solver can not be null");
throw new NullPointerException("parent solver cannot be null");
}
this.parent = solver;
this.uberspect = solver.uberspect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ protected Object executeAssign(final JexlNode node, final JexlOperator assignop,
return actual; // 1
}
object = getVariable(frame, block, variable);
// top level is a symbol, can not be an antish var
// top level is a symbol, cannot be an antish var
antish = false;
} else {
// check we are not assigning direct global
Expand All @@ -582,7 +582,7 @@ protected Object executeAssign(final JexlNode node, final JexlOperator assignop,
return actual; // 2
}
object = context.get(name);
// top level accesses object, can not be an antish var
// top level accesses object, cannot be an antish var
if (object != null) {
antish = false;
}
Expand Down Expand Up @@ -673,7 +673,7 @@ protected Object executeAssign(final JexlNode node, final JexlOperator assignop,
throw new JexlException(objectNode, "illegal assignment form");
}
// we may have a null property as in map[null], no check needed.
// we can not *have* a null object though.
// we cannot *have* a null object though.
if (object == null) {
// no object, we fail
return unsolvableProperty(objectNode, "<null>.<?>", true, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ protected Object undefinedVariable(final JexlNode node, final String variable) {
}

/**
* Triggered when a method can not be resolved.
* Triggered when a method cannot be resolved.
* @param node the node where the error originated from
* @param method the method name
* @return throws JexlException if strict and not silent, null otherwise
Expand All @@ -1051,7 +1051,7 @@ protected Object unsolvableMethod(final JexlNode node, final String method) {
}

/**
* Triggered when a method can not be resolved.
* Triggered when a method cannot be resolved.
* @param node the node where the error originated from
* @param method the method name
* @param args the method arguments
Expand All @@ -1068,7 +1068,7 @@ protected Object unsolvableMethod(final JexlNode node, final String method, fina
}

/**
* Triggered when a property can not be resolved.
* Triggered when a property cannot be resolved.
* @param node the node where the error originated from
* @param property the property node
* @param cause the cause if any
Expand All @@ -1086,7 +1086,7 @@ protected Object unsolvableProperty(final JexlNode node, final String property,
}

/**
* Triggered when a variable can not be resolved.
* Triggered when a variable cannot be resolved.
* @param node the node where the error originated from
* @param variable the variable name
* @param undef whether the variable is undefined or null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ final class ConstantExpression extends TemplateExpression {
ConstantExpression(final Object val, final TemplateExpression source) {
super(source);
if (val == null) {
throw new NullPointerException("constant can not be null");
throw new NullPointerException("constant cannot be null");
}
this.value = val instanceof String
? StringParser.buildTemplate((String) val, false)
Expand Down Expand Up @@ -487,7 +487,7 @@ final class NestedExpression extends JexlBasedExpression {
NestedExpression(final CharSequence expr, final JexlNode node, final TemplateExpression source) {
super(expr, node, source);
if (this.source != this) {
throw new IllegalArgumentException("Nested TemplateExpression can not have a source");
throw new IllegalArgumentException("Nested TemplateExpression cannot have a source");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static Scope scopeOf(final JexlNode.Info info) {
* Creates a new template from an character input.
* @param engine the template engine
* @param jexlInfo the source info
* @param directive the prefix for lines of code; can not be "$", "${", "#" or "#{"
* @param directive the prefix for lines of code; cannot be "$", "${", "#" or "#{"
since this would preclude being able to differentiate directives and jxlt expressions
* @param reader the input reader
* @param parms the parameter names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ private static boolean eq(final Object lhs, final Object rhs) {
*/
public SandboxUberspect(final JexlUberspect theUberspect, final JexlSandbox theSandbox) {
if (theSandbox == null) {
throw new NullPointerException("sandbox can not be null");
throw new NullPointerException("sandbox cannot be null");
}
if (theUberspect == null) {
throw new NullPointerException("uberspect can not be null");
throw new NullPointerException("uberspect cannot be null");
}
this.uberspect = theUberspect;
this.sandbox = theSandbox.copy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public JexlPropertyGet getPropertyGet(
}
break;
case FIELD:
// a field may be? (can not be a number)
// a field may be? (cannot be a number)
executor = FieldGetExecutor.discover(is, clazz, property);
// static class fields (enums included)
if (obj instanceof Class<?>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,15 @@ public JexlPermissions compose(final String... src) {
* class0 {
* class1 {} # the whole class1 is hidden
* class2 {
* class2(); # class2 constructors can not be invoked
* class2(); # class2 constructors cannot be invoked
* class3 {
* aMethod(); # aMethod can not be called
* aField; # aField can not be accessed
* aMethod(); # aMethod cannot be called
* aField; # aField cannot be accessed
* }
* } # end of class2
* class0(); # class0 constructors can not be invoked
* method(); # method can not be called
* field; # field can not be accessed
* class0(); # class0 constructors cannot be invoked
* method(); # method cannot be called
* field; # field cannot be accessed
* } # end class0
* } # end package my.package
* </pre>
Expand All @@ -323,7 +323,7 @@ static JexlPermissions parse(final String... src) {
/**
* Checks whether a class allows JEXL introspection.
* <p>If the class disallows JEXL introspection, none of its constructors, methods or fields
* as well as derived classes are visible to JEXL and can not be used in scripts or expressions.
* as well as derived classes are visible to JEXL and cannot be used in scripts or expressions.
* If one of its super-classes is not allowed, tbe class is not allowed either.</p>
* <p>For interfaces, only methods and fields are disallowed in derived interfaces or implementing classes.</p>
* @param clazz the class to check
Expand All @@ -334,7 +334,7 @@ static JexlPermissions parse(final String... src) {

/**
* Checks whether a constructor allows JEXL introspection.
* <p>If a constructor is not allowed, the new operator can not be used to instantiate its declared class
* <p>If a constructor is not allowed, the new operator cannot be used to instantiate its declared class
* in scripts or expressions.</p>
* @param ctor the constructor to check
* @return true if JEXL is allowed to introspect, false otherwise
Expand All @@ -344,15 +344,15 @@ static JexlPermissions parse(final String... src) {

/**
* Checks whether a field explicitly disallows JEXL introspection.
* <p>If a field is not allowed, it can not resolved and accessed in scripts or expressions.</p>
* <p>If a field is not allowed, it cannot resolved and accessed in scripts or expressions.</p>
* @param field the field to check
* @return true if JEXL is allowed to introspect, false otherwise
* @since 3.3
*/
boolean allow(final Field field);
/**
* Checks whether a method allows JEXL introspection.
* <p>If a method is not allowed, it can not resolved and called in scripts or expressions.</p>
* <p>If a method is not allowed, it cannot resolved and called in scripts or expressions.</p>
* <p>Since methods can be overridden and overloaded, this also checks that no superclass or interface
* explicitly disallows this methods.</p>
* @param method the method to check
Expand All @@ -364,7 +364,7 @@ static JexlPermissions parse(final String... src) {
/**
* Checks whether a package allows JEXL introspection.
* <p>If the package disallows JEXL introspection, none of its classes or interfaces are visible
* to JEXL and can not be used in scripts or expression.</p>
* to JEXL and cannot be used in scripts or expression.</p>
* @param pack the package
* @return true if JEXL is allowed to introspect, false otherwise
* @since 3.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public Permissions get(final String clazz) {
*/
@SuppressWarnings("null")
public Permissions get(final Class<?> clazz) {
// argument clazz can not be null since permissions would be not null and block:
// argument clazz cannot be null since permissions would be not null and block:
// we only store the result for classes we actively seek permissions for.
return compute(clazz, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ interface ResolverStrategy {
* Applies this strategy to a list of resolver types.
*
* @param operator the property access operator, may be null
* @param obj the instance we seek to obtain a property setter/getter from, can not be null
* @param obj the instance we seek to obtain a property setter/getter from, cannot be null
* @return the ordered list of resolvers types, must not be null
*/
List<PropertyResolver> apply(JexlOperator operator, Object obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public int getLine() {

/**
* Whether this node is a constant node.
* <p>Its value can not change after the first evaluation and can be cached
* <p>Its value cannot change after the first evaluation and can be cached
* indefinitely.</p>
*
* @return true if constant, false otherwise
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/jexl3/parser/JexlParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ protected String checkVariable(final ASTIdentifier identifier, final String name
identifier.setSymbol(symbol, name);
if (!declared) {
if (getFeatures().isLexicalShade()) {
// can not reuse a local as a global
// cannot reuse a local as a global
throw new JexlException.Parsing(info, name + ": variable is not declared").clean();
}
identifier.setShaded(true);
Expand Down Expand Up @@ -836,7 +836,7 @@ protected void throwFeatureException(final int feature, final JexlInfo info) {
* Throws a feature exception.
* @param feature the feature code
* @param trigger the token that triggered it
* @throws JexlException.Parsing if actual error token can not be found
* @throws JexlException.Parsing if actual error token cannot be found
* @throws JexlException.Feature in all other cases
*/
protected void throwFeatureException(final int feature, final Token trigger) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/apache/commons/jexl3/ClassCreatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public void testFunctorThree() throws Exception {

@Test
public void testMany() throws Exception {
// abort test if class creator can not run
// abort test if class creator cannot run
if (!ClassCreator.canRun) {
return;
}
Expand Down Expand Up @@ -407,7 +407,7 @@ public void testMany() throws Exception {

@Test
public void testOne() throws Exception {
// abort test if class creator can not run
// abort test if class creator cannot run
if (!ClassCreator.canRun) {
logger.warn("unable to create classes");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/apache/commons/jexl3/Issues200Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public boolean has(final String name) {
@Override
public void set(final String name, final Object value) {
if ("java".equals(name)) {
throw new JexlException(null, "can not set " + name);
throw new JexlException(null, "cannot set " + name);
}
super.set(name, value);
}
Expand Down
Loading

0 comments on commit d673ed0

Please sign in to comment.