mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
the constructor for expressions in the Java runtime now checks for null arguments. This means that a potential problem is detected earlier before we jump into the JNI code.
This commit is contained in:
@@ -23,6 +23,9 @@ public class Expr implements Serializable {
|
||||
|
||||
/** Constructs an expression which represents a string literal */
|
||||
public Expr(String s) {
|
||||
if (s == null)
|
||||
throw new IllegalArgumentException("s == null");
|
||||
|
||||
this.pool = new Pool();
|
||||
this.master = null;
|
||||
this.ref = initStringLit(s, pool.ref);
|
||||
@@ -33,6 +36,13 @@ public class Expr implements Serializable {
|
||||
* @param args the arguments for the function.
|
||||
*/
|
||||
public Expr(String fun, Expr... args) {
|
||||
if (fun == null)
|
||||
throw new IllegalArgumentException("fun == null");
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i] == null)
|
||||
throw new IllegalArgumentException("the "+i+"th argument is null");
|
||||
}
|
||||
|
||||
this.pool = new Pool();
|
||||
this.master = Arrays.copyOf(args, args.length);
|
||||
this.ref = initApp(fun, args, pool.ref);
|
||||
|
||||
Reference in New Issue
Block a user