@@ -153,7 +153,7 @@ private void init(Class<?> clazz) {
153153 set ("cast" , new FunctionValue (this ::cast ));
154154 }
155155
156- private Value asSubclass (Value ... args ) {
156+ private Value asSubclass (Value [] args ) {
157157 Arguments .check (1 , args .length );
158158 return new ClassValue (clazz .asSubclass ( ((ClassValue )args [0 ]).clazz ));
159159 }
@@ -208,7 +208,7 @@ public ObjectValue(Object object) {
208208
209209 @ Override
210210 public boolean containsKey (Value key ) {
211- return getValue ( object . getClass (), object , key . asString () ) != null ;
211+ return get ( key ) != null ;
212212 }
213213
214214 @ Override
@@ -228,32 +228,32 @@ public String toString() {
228228 }
229229//</editor-fold>
230230
231- private Value isNull (Value ... args ) {
231+ private Value isNull (Value [] args ) {
232232 Arguments .checkAtLeast (1 , args .length );
233233 for (Value arg : args ) {
234234 if (arg .raw () == null ) return NumberValue .ONE ;
235235 }
236236 return NumberValue .ZERO ;
237237 }
238238
239- private Value newClass (Value ... args ) {
239+ private Value newClass (Value [] args ) {
240240 Arguments .check (1 , args .length );
241241
242242 final String className = args [0 ].asString ();
243243 try {
244244 return new ClassValue (Class .forName (className ));
245245 } catch (ClassNotFoundException ce ) {
246- return NULL ;
246+ throw new RuntimeException ( "Class " + className + " not found." , ce ) ;
247247 }
248248 }
249249
250- private Value toObject (Value ... args ) {
250+ private Value toObject (Value [] args ) {
251251 Arguments .check (1 , args .length );
252252 if (args [0 ] == NULL ) return NULL ;
253253 return new ObjectValue (valueToObject (args [0 ]));
254254 }
255255
256- private Value toValue (Value ... args ) {
256+ private Value toValue (Value [] args ) {
257257 Arguments .check (1 , args .length );
258258 if (args [0 ] instanceof ObjectValue ) {
259259 return objectToValue ( ((ObjectValue ) args [0 ]).object );
@@ -305,7 +305,8 @@ private static Value findConstructorAndInstantiate(Value[] args, Constructor<?>[
305305 // skip
306306 }
307307 }
308- return null ;
308+ throw new RuntimeException ("Constructor for " + args .length + " arguments"
309+ + " not found or non accessible" );
309310 }
310311
311312 private static Function methodsToFunction (Object object , List <Method > methods ) {
@@ -323,7 +324,9 @@ private static Function methodsToFunction(Object object, List<Method> methods) {
323324 // skip
324325 }
325326 }
326- return null ;
327+ final String className = (object == null ? "null" : object .getClass ().getName ());
328+ throw new RuntimeException ("Method for " + args .length + " arguments"
329+ + " not found or non accessible in " + className );
327330 };
328331 }
329332
0 commit comments