Skip to content

Commit

Permalink
Some Javascript fixes for Java 21 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Feb 9, 2025
1 parent fdc70eb commit 3ca55bb
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 15 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public interface MapBuilder {
/** Marker class for null operand exceptions. */
public static class NullOperand extends ArithmeticException {
private static final long serialVersionUID = 4720876194840764770L;

/** Default constructor */
public NullOperand() {} ; // satisfy Javadoc
}

/**
Expand Down
82 changes: 67 additions & 15 deletions src/main/java/org/apache/commons/jexl3/JexlBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public JexlBuilder() {
this.permissions = PERMISSIONS;
}

/** @return whether antish resolution is enabled */
/**
* Is antish resolution enabled?
* @return whether antish resolution is enabled
*/
public boolean antish() {
return options.isAntish();
}
Expand All @@ -197,7 +200,10 @@ public JexlBuilder antish(final boolean flag) {
return this;
}

/** @return the arithmetic */
/**
* Gets the JexlArithmetic instance the engine will use.
* @return the arithmetic
*/
public JexlArithmetic arithmetic() {
return this.arithmetic;
}
Expand Down Expand Up @@ -227,6 +233,7 @@ public JexlBuilder booleanLogical(final boolean flag) {
}

/**
* Gets the expression cache size the engine will use.
* @return the cache size
*/
public int cache() {
Expand All @@ -247,14 +254,15 @@ public JexlBuilder cache(final int size) {
}

/**
* Gets the expression factory the engine will use.
* @return the cache factory
*/
public IntFunction<JexlCache<?, ?>> cacheFactory() {
return this.cacheFactory;
}

/**
* Sets the expression cache size the engine will use.
* Sets the expression factory the engine will use.
*
* @param factory the function to produce a cache.
* @return this builder
Expand All @@ -265,6 +273,7 @@ public JexlBuilder cacheFactory(final IntFunction<JexlCache<?, ?>> factory) {
}

/**
* Gets the maximum length for an expression to be cached.
* @return the cache threshold
*/
public int cacheThreshold() {
Expand All @@ -287,6 +296,7 @@ public JexlBuilder cacheThreshold(final int length) {
}

/**
* Gets the cancellable information flag
* @return the cancellable information flag
* @since 3.1
*/
Expand All @@ -308,7 +318,10 @@ public JexlBuilder cancellable(final boolean flag) {
return this;
}

/** @return the charset */
/**
* Gets the charset
* @return the charset
*/
public Charset charset() {
return charset;
}
Expand All @@ -326,6 +339,7 @@ public JexlBuilder charset(final Charset arg) {
}

/**
* Does the variable collection follow strict syntactic rule?
* @return true if variable collection follows strict syntactic rule
* @since 3.2
*/
Expand All @@ -345,6 +359,7 @@ public JexlBuilder collectAll(final boolean flag) {
}

/**
* Gets the collection mode.
* @return 0 if variable collection follows strict syntactic rule
* @since 3.2
*/
Expand All @@ -365,13 +380,17 @@ public JexlBuilder collectMode(final int mode) {
}

/**
* Create a new engine
* @return a {@link JexlEngine} instance
*/
public JexlEngine create() {
return new Engine(this);
}

/** @return the debugging information flag */
/**
* Gets the debug flag
* @return the debugging information flag
*/
public Boolean debug() {
return this.debug;
}
Expand All @@ -387,7 +406,10 @@ public JexlBuilder debug(final boolean flag) {
return this;
}

/** @return the features */
/**
* Gets the features the engine will use as a base by default.
* @return the features
*/
public JexlFeatures features() {
return this.features;
}
Expand Down Expand Up @@ -442,6 +464,7 @@ public JexlBuilder imports(final String... imports) {
}

/**
* Is lexical scope enabled?
* @see JexlOptions#isLexical()
* @return whether lexical scope is enabled
* @deprecated 3.4.1
Expand All @@ -464,6 +487,7 @@ public JexlBuilder lexical(final boolean flag) {
}

/**
* Is lexical shading is enabled?
* @see JexlOptions#isLexicalShade()
* @return whether lexical shading is enabled
* @deprecated 3.4.1
Expand All @@ -485,7 +509,10 @@ public JexlBuilder lexicalShade(final boolean flag) {
return this;
}

/** @return the class loader */
/**
* Gets the classloader
* @return the class loader
*/
public ClassLoader loader() {
return loader;
}
Expand Down Expand Up @@ -513,7 +540,10 @@ public JexlBuilder loader(final ClassLoader l) {
return this;
}

/** @return the logger */
/**
* Gets the logger
* @return the logger
*/
public Log logger() {
return this.logger;
}
Expand All @@ -530,6 +560,7 @@ public JexlBuilder logger(final Log log) {
}

/**
* Gets the map of namespaces.
* @return the map of namespaces.
*/
public Map<String, Object> namespaces() {
Expand Down Expand Up @@ -567,13 +598,17 @@ public JexlBuilder namespaces(final Map<String, Object> ns) {
}

/**
* Gets the current set of options
* @return the current set of options
*/
public JexlOptions options() {
return options;
}

/** @return the permissions */
/**
* Gets the permissions
* @return the permissions
*/
public JexlPermissions permissions() {
return this.permissions;
}
Expand All @@ -589,7 +624,10 @@ public JexlBuilder permissions(final JexlPermissions p) {
return this;
}

/** @return true if safe, false otherwise */
/**
* Is it safe to dereference null?
* @return true if safe, false otherwise
*/
public Boolean safe() {
return options.isSafe();
}
Expand All @@ -609,7 +647,10 @@ public JexlBuilder safe(final boolean flag) {
return this;
}

/** @return the sandbox */
/**
* Gets the sandbox
* @return the sandbox
*/
public JexlSandbox sandbox() {
return this.sandbox;
}
Expand All @@ -625,7 +666,10 @@ public JexlBuilder sandbox(final JexlSandbox box) {
return this;
}

/** @return the silent error handling flag */
/**
* Is error handling silent?
* @return the silent error handling flag
*/
public Boolean silent() {
return options.isSilent();
}
Expand All @@ -644,6 +688,7 @@ public JexlBuilder silent(final boolean flag) {
}

/**
* Gets the cache size
* @return the cache size
*/
public int stackOverflow() {
Expand All @@ -660,7 +705,9 @@ public JexlBuilder stackOverflow(final int size) {
return this;
}

/** @return the JexlUberspect strategy */
/**
* Gets the JexlUberspect strategy
* @return the JexlUberspect strategy */
public JexlUberspect.ResolverStrategy strategy() {
return this.strategy;
}
Expand All @@ -677,7 +724,9 @@ public JexlBuilder strategy(final JexlUberspect.ResolverStrategy rs) {
return this;
}

/** @return true if strict, false otherwise */
/**
* Is it strict mode?
* @return true if strict, false otherwise */
public Boolean strict() {
return options.isStrict();
}
Expand All @@ -698,6 +747,7 @@ public JexlBuilder strict(final boolean flag) {
}

/**
* Is interpolation strict?
* @see JexlOptions#setStrictInterpolation(boolean)
* @param flag strict interpolation flag
* @return this builder
Expand All @@ -707,7 +757,9 @@ public JexlBuilder strictInterpolation(final boolean flag) {
return this;
}

/** @return the uberspect */
/**
* Gets the uberspect
* @return the uberspect */
public JexlUberspect uberspect() {
return this.uberspect;
}
Expand Down

0 comments on commit 3ca55bb

Please sign in to comment.