MCPcopy Create free account
hub / github.com/mozilla/rhino / checkInstance

Method checkInstance

examples/src/main/java/File.java:382–387  ·  view source on GitHub ↗

Perform instanceof check and return the downcasted File object. This is necessary since methods may reside in the File.prototype object and scripts can dynamically alter prototype chains. This method ensures type safety by verifying that the object is actually a File instance before casting. <p

(Scriptable obj)

Source from the content-addressed store, hash-verified

380 * @throws RuntimeException if the object is null or not an instance of File
381 */
382 private static File checkInstance(Scriptable obj) {
383 if (obj == null || !(obj instanceof File)) {
384 throw Context.reportRuntimeError("called on incompatible object");
385 }
386 return (File) obj;
387 }
388
389 /**
390 * The filename associated with this File object. May be empty string if using standard

Callers 1

write0Method · 0.95

Calls 1

reportRuntimeErrorMethod · 0.95

Tested by

no test coverage detected