Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jul 8, 2023
1 parent 34acaf4 commit d810ab8
Show file tree
Hide file tree
Showing 40 changed files with 78 additions and 78 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ public String toString(final Object val) {
}
return dval.toString();
}
return val == null? controlNullOperand(strict, "") : val.toString();
return val == null ? controlNullOperand(strict, "") : val.toString();
}

/**
Expand Down Expand Up @@ -1270,7 +1270,7 @@ public Object add(final Object left, final Object right) {
// ignore and continue in sequence
}
}
return (left == null? "" : toString(left)).concat(right == null ? "" : toString(right));
return (left == null ? "" : toString(left)).concat(right == null ? "" : toString(right));
}

/**
Expand Down Expand Up @@ -1771,7 +1771,7 @@ public Boolean isEmpty(final Object object, final Boolean def) {
* @return the <i>size</i> of object, 0 if null, 1 if there is no <i>better</i> solution
*/
public Integer size(final Object object) {
return size(object, object == null? 0 : 1);
return size(object, object == null ? 0 : 1);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/jexl3/JexlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class JexlBuilder {
* @param permissions the permissions
*/
public static void setDefaultPermissions(final JexlPermissions permissions) {
PERMISSIONS = permissions == null? JexlPermissions.RESTRICTED : permissions;
PERMISSIONS = permissions == null ? JexlPermissions.RESTRICTED : permissions;
}

/** The default maximum expression length to hit the expression cache. */
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/jexl3/JexlException.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public JexlInfo getInfo() {
* @return a string builder
*/
static StringBuilder errorAt(final JexlNode node) {
final JexlInfo info = node != null? detailedInfo(node, node.jexlInfo()) : null;
final JexlInfo info = node != null ? detailedInfo(node, node.jexlInfo()) : null;
final StringBuilder msg = new StringBuilder();
if (info != null) {
msg.append(info.toString());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/jexl3/JexlFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public boolean isReservedName(final String name) {
* @return this features instance
*/
public JexlFeatures namespaceTest(final Predicate<String> names) {
nameSpaces = names == null? TEST_STR_FALSE : names;
nameSpaces = names == null ? TEST_STR_FALSE : names;
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/jexl3/JexlInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected JexlInfo(final JexlInfo copy) {
*/
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(name != null? name : "");
final StringBuilder sb = new StringBuilder(name != null ? name : "");
sb.append("@");
sb.append(line);
sb.append(":");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/commons/jexl3/internal/Closure.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ public Object execute(final JexlContext context) {

@Override
public Object execute(final JexlContext context, final Object... args) {
final Frame local = frame != null? frame.assign(args) : null;
final Frame local = frame != null ? frame.assign(args) : null;
final Interpreter interpreter = createInterpreter(context, local, options);
return interpreter.runClosure(this);
}

@Override
public Callable callable(final JexlContext context, final Object... args) {
final Frame local = frame != null? frame.assign(args) : null;
final Frame local = frame != null ? frame.assign(args) : null;
return new Callable(createInterpreter(context, local, options)) {
@Override
public Object interpret() {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/apache/commons/jexl3/internal/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public Engine(final JexlBuilder conf) {
this.functions = ns == null || ns.isEmpty()? Collections.emptyMap() : ns; // should we make a copy?
this.classNameSolver = new FqcnResolver(uberspect, conf.imports());
// parsing & features:
final JexlFeatures features = conf.features() == null? DEFAULT_FEATURES : conf.features();
final JexlFeatures features = conf.features() == null ? DEFAULT_FEATURES : conf.features();
Predicate<String> nsTest = features.namespaceTest();
final Set<String> nsNames = functions.keySet();
if (!nsNames.isEmpty()) {
Expand Down Expand Up @@ -351,7 +351,7 @@ final Object getNamespace(String name) {
* @return conf or def
*/
private static <T> T option(final T conf, final T def) {
return conf == null? def : conf;
return conf == null ? def : conf;
}

/**
Expand Down Expand Up @@ -613,7 +613,7 @@ public Script createScript(final JexlFeatures features, final JexlInfo info, fin
}
final String source = trimSource(scriptText);
final Scope scope = names == null || names.length == 0? null : new Scope(null, names);
final JexlFeatures ftrs = features == null? scriptFeatures : features;
final JexlFeatures ftrs = features == null ? scriptFeatures : features;
final ASTJexlScript tree = parse(info, ftrs, source, scope);
return new Script(this, source, tree);
}
Expand Down Expand Up @@ -645,7 +645,7 @@ public Object getProperty(final JexlContext context, final Object bean, final St
final ASTJexlScript script = parse(null, PROPERTY_FEATURES, src, scope);
final JexlNode node = script.jjtGetChild(0);
final Frame frame = script.createFrame(bean);
final Interpreter interpreter = createInterpreter(context == null? EMPTY_CONTEXT : context, frame, options);
final Interpreter interpreter = createInterpreter(context == null ? EMPTY_CONTEXT : context, frame, options);
return interpreter.visitLexicalNode(node, null);
} catch (final JexlException xjexl) {
if (silent) {
Expand Down Expand Up @@ -673,7 +673,7 @@ public void setProperty(final JexlContext context, final Object bean, final Stri
final ASTJexlScript script = parse(null, PROPERTY_FEATURES, src, scope);
final JexlNode node = script.jjtGetChild(0);
final Frame frame = script.createFrame(bean, value);
final Interpreter interpreter = createInterpreter(context != null? context : EMPTY_CONTEXT, frame, options);
final Interpreter interpreter = createInterpreter(context != null ? context : EMPTY_CONTEXT, frame, options);
interpreter.visitLexicalNode(node, null);
} catch (final JexlException xjexl) {
if (silent) {
Expand Down Expand Up @@ -986,7 +986,7 @@ protected ASTJexlScript parse(final JexlInfo info, final boolean expr, final Str
*/
protected ASTJexlScript parse(final JexlInfo info, final JexlFeatures parsingf, final String src, final Scope scope) {
final boolean cached = src.length() < cacheThreshold && cache != null;
final JexlFeatures features = parsingf != null? parsingf : DEFAULT_FEATURES;
final JexlFeatures features = parsingf != null ? parsingf : DEFAULT_FEATURES;
// if (features.getNameSpaces().isEmpty() && !functions.isEmpty()) {
// features = new JexlFeatures(features).nameSpaces(functions.keySet());
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected Interpreter(final Engine engine, final JexlOptions opts, final JexlCon
protected Interpreter(final Interpreter ii, final JexlArithmetic jexla) {
super(ii, jexla);
frame = ii.frame;
block = ii.block != null? new LexicalFrame(ii.block) : null;
block = ii.block != null ? new LexicalFrame(ii.block) : null;
}

/**
Expand Down Expand Up @@ -995,7 +995,7 @@ protected Object visit(final ASTNullpNode node, final Object data) {
lhs = null;
}
// null elision as in "x ?? z"
return lhs != null? lhs : node.jjtGetChild(1).jjtAccept(this, data);
return lhs != null ? lhs : node.jjtGetChild(1).jjtAccept(this, data);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected InterpreterBase(final Engine engine, final JexlOptions opts, final Jex
this.context = aContext != null ? aContext : JexlEngine.EMPTY_CONTEXT;
this.cache = engine.cache != null;
final JexlArithmetic jexla = jexl.arithmetic;
this.options = opts == null? engine.evalOptions(aContext) : opts;
this.options = opts == null ? engine.evalOptions(aContext) : opts;
this.arithmetic = jexla.options(options);
if (arithmetic != jexla && !arithmetic.getClass().equals(jexla.getClass()) && logger.isWarnEnabled()) {
logger.warn("expected arithmetic to be " + jexla.getClass().getSimpleName()
Expand All @@ -113,7 +113,7 @@ protected InterpreterBase(final Engine engine, final JexlOptions opts, final Jex
if (this.context instanceof JexlContext.CancellationHandle) {
acancel = ((JexlContext.CancellationHandle) context).getCancellation();
}
this.cancelled = acancel != null? acancel : new AtomicBoolean(false);
this.cancelled = acancel != null ? acancel : new AtomicBoolean(false);
this.functions = options.getNamespaces();
this.functors = null;
this.operators = new Operators(this);
Expand Down Expand Up @@ -315,7 +315,7 @@ protected boolean defineVariable(final ASTVar var, final LexicalFrame frame) {
protected boolean isVariableDefined(final Frame frame, final LexicalScope block, final String name) {
if (frame != null && block != null) {
final Integer ref = frame.getScope().getSymbol(name);
final int symbol = ref != null? ref : -1;
final int symbol = ref != null ? ref : -1;
if (symbol >= 0 && block.hasSymbol(symbol)) {
final Object value = frame.get(symbol);
return value != Scope.UNDEFINED && value != Scope.UNDECLARED;
Expand Down Expand Up @@ -593,7 +593,7 @@ protected String stringifyProperty(final JexlNode node) {
* @return the (pretty) string value
*/
protected static String stringifyPropertyValue(final JexlNode node) {
return node != null? new Debugger().depth(1).data(node) : "???";
return node != null ? new Debugger().depth(1).data(node) : "???";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/jexl3/internal/Scope.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public Integer getCaptured(final int symbol) {
* @return the source symbol index or -1 if the symbol is not captured
*/
public int getCaptureDeclaration(final int symbol) {
Integer declared = capturedVariables != null? capturedVariables.get(symbol) : null;
Integer declared = capturedVariables != null ? capturedVariables.get(symbol) : null;
return declared != null ? declared.intValue() : -1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected Interpreter createInterpreter(final JexlContext context, final Frame f
* @return the interpreter
*/
protected Interpreter createInterpreter(final JexlContext context, final Frame frame, final JexlOptions options) {
return jexl.createInterpreter(context, frame, options != null? options : jexl.evalOptions(script, context));
return jexl.createInterpreter(context, frame, options != null ? options : jexl.evalOptions(script, context));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public boolean debug(final JxltEngine.Template jt) {
}
final TemplateScript ts = (TemplateScript) jt;
// ensure expr is not null for templates
this.exprs = ts.getExpressions() == null? new TemplateExpression[0] : ts.getExpressions();
this.exprs = ts.getExpressions() == null ? new TemplateExpression[0] : ts.getExpressions();
this.script = ts.getScript();
start = 0;
end = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public final TemplateExpression prepare(final JexlContext context) {
*/
protected final TemplateExpression prepare(final JexlContext context, final Frame frame, final JexlOptions opts) {
try {
final JexlOptions interOptions = opts != null? opts : jexl.evalOptions(context);
final JexlOptions interOptions = opts != null ? opts : jexl.evalOptions(context);
final Interpreter interpreter = jexl.createInterpreter(context, frame, interOptions);
return prepare(interpreter);
} catch (final JexlException xjexl) {
Expand Down Expand Up @@ -359,7 +359,7 @@ protected final Object evaluate( final JexlContext context, final Frame frame, f
final TemplateInterpreter.Arguments args = new TemplateInterpreter
.Arguments(jexl)
.context(context)
.options(options != null? options : options(context))
.options(options != null ? options : options(context))
.frame(frame);
final Interpreter interpreter = jexl.createTemplateInterpreter(args);
return evaluate(interpreter);
Expand Down Expand Up @@ -691,7 +691,7 @@ protected Object evaluate(final Interpreter interpreter) {

@Override
public JxltEngine.Expression createExpression(final JexlInfo jexlInfo, final String expression) {
final JexlInfo info = jexlInfo == null? jexl.createInfo() : jexlInfo;
final JexlInfo info = jexlInfo == null ? jexl.createInfo() : jexlInfo;
Exception xuel = null;
TemplateExpression stmt = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public TemplateScript(final TemplateEngine engine,
}
}
// create the script
final JexlInfo info = jexlInfo == null? jxlt.getEngine().createInfo() : jexlInfo;
final JexlInfo info = jexlInfo == null ? jxlt.getEngine().createInfo() : jexlInfo;
// allow lambda defining params
final Scope scope = parms == null ? null : new Scope(null, parms);
script = jxlt.getEngine().parse(info.at(1, 1), false, strb.toString(), scope).script();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static Object[] makeArgs(final Object... args) {
* @return the class
*/
static Class<?> classOf(final Object instance) {
return instance == null? Object.class : instance.getClass();
return instance == null ? Object.class : instance.getClass();
}

/** The class this executor applies to. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Method getMethod(final MethodKey methodKey) throws MethodKey.AmbiguousException
if (methodList != null) {
cacheEntry = methodKey.getMostSpecificMethod(methodList);
}
byKey.put(methodKey, cacheEntry == null? CACHE_MISS : cacheEntry);
byKey.put(methodKey, cacheEntry == null ? CACHE_MISS : cacheEntry);
} catch (final MethodKey.AmbiguousException ae) {
// that's a miss :-)
byKey.put(methodKey, CACHE_MISS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class DuckGetExecutor extends AbstractExecutor.Get {
*/
public static DuckGetExecutor discover(final Introspector is, final Class<?> clazz, final Object identifier) {
final java.lang.reflect.Method method = is.getMethod(clazz, "get", identifier);
return method == null? null : new DuckGetExecutor(clazz, method, identifier);
return method == null ? null : new DuckGetExecutor(clazz, method, identifier);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static DuckSetExecutor discover(final Introspector is, final Class<?> cla
if (method == null) {
method = is.getMethod(clazz, "put", makeArgs(key, value));
}
return method == null? null : new DuckSetExecutor(clazz, method, key, value);
return method == null ? null : new DuckSetExecutor(clazz, method, key, value);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Introspector(final Log log, final ClassLoader cloader) {
public Introspector(final Log log, final ClassLoader cloader, final JexlPermissions perms) {
this.logger = log;
this.loader = cloader;
this.permissions = perms == null? JexlPermissions.RESTRICTED : perms;
this.permissions = perms == null ? JexlPermissions.RESTRICTED : perms;
}

/**
Expand Down Expand Up @@ -333,7 +333,7 @@ private ClassMap getMap(final Class<?> c) {
*/
public void setLoader(final ClassLoader classLoader) {
final ClassLoader previous = loader;
final ClassLoader current = classLoader == null? getClass().getClassLoader() : classLoader;
final ClassLoader current = classLoader == null ? getClass().getClassLoader() : classLoader;
if (!current.equals(loader)) {
lock.writeLock().lock();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static ListSetExecutor discover(final Introspector is,
// we could verify if the call can be performed but it does not change
// the fact we would fail...
// Class<?> formal = clazz.getComponentType();
// Class<?> actual = value == null? Object.class : value.getClass();
// Class<?> actual = value == null ? Object.class : value.getClass();
// if (IntrospectionUtils.isMethodInvocationConvertible(formal, actual, false)) {
return new ListSetExecutor(clazz, ARRAY_SET, index);
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static MethodExecutor discover(final Introspector is, final Object obj, f
if (m == null && obj instanceof Class<?>) {
m = is.getMethod((Class<?>) obj, key);
}
return m == null? null : new MethodExecutor(clazz, m, key);
return m == null ? null : new MethodExecutor(clazz, m, key);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ public Permissions compose(final String... src) {
* @return the packages
*/
Map<String, NoJexlPackage> getPackages() {
return packages == null? Collections.emptyMap() : Collections.unmodifiableMap(packages);
return packages == null ? Collections.emptyMap() : Collections.unmodifiableMap(packages);
}

/**
* @return the wilcards
*/
Set<String> getWildcards() {
return allowed == null? Collections.emptySet() : Collections.unmodifiableSet(allowed);
return allowed == null ? Collections.emptySet() : Collections.unmodifiableSet(allowed);
}

/**
Expand All @@ -260,7 +260,7 @@ Set<String> getWildcards() {
*/
private NoJexlPackage getNoJexlPackage(final String packageName) {
final NoJexlPackage njp = packages.get(packageName);
return njp != null? njp : JEXL_PACKAGE;
return njp != null ? njp : JEXL_PACKAGE;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class PropertyGetExecutor extends AbstractExecutor.Get {
*/
public static PropertyGetExecutor discover(final Introspector is, final Class<?> clazz, final String property) {
final java.lang.reflect.Method method = discoverGet(is, "get", clazz, property);
return method == null? null : new PropertyGetExecutor(clazz, method, property);
return method == null ? null : new PropertyGetExecutor(clazz, method, property);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static PropertySetExecutor discover(final Introspector is,
return null;
}
final java.lang.reflect.Method method = discoverSet(is, clazz, property, value);
return method != null? new PropertySetExecutor(clazz, method, property, value) : null;
return method != null ? new PropertySetExecutor(clazz, method, property, value) : null;
}

/**
Expand Down
Loading

0 comments on commit d810ab8

Please sign in to comment.