RascalTutor
Synopsis

All exceptions and errors a Rascal program can generate during execution (run time).

Description

Rascal can generate various kinds of exceptions and errors during execution (run time):

  • Runtime Exceptions are discovered during execution of the Rascal program and can be caught by the Rascal program. When a runtime exception is not caught in the program, execution is aborted.

  • Other Runtime Errors are discovered during execution of the Rascal program and cannot be caught by the Rascal program. They always lead to abortion of execution.

Pitfalls

The structure and naming of exceptions and error messages is being revised so actual exceptions may differ from what is presented here.

1. Runtime Exceptions

Synopsis

All runtime exceptions that can occur during execution of a Rascal program.

Description

The following exceptions can be trown as the result of a run-time error:

1.1. Ambiguity

Synopsis

Ambiguity found in parsed text.

Description

Rascal supports general context-free grammars and also provides various mechanisms to disambiguate them.

This exception is thrown when, given a grammar and a sentence, an ambiguity is found while parsing the sentence according to that grammar.

Examples

First declare a very simple expression language that should recognize expressions like a, a+a, a+(a+a):

rascal>syntax A = "a";
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4a07bb7f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:738)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4a07bb7f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@4a07bb7f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>syntax E = A | "(" E ")" | E "+" E;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@10ed5f91
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:738)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@10ed5f91
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@10ed5f91
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Next, import the ParseTree module that provides a parse function that we will use:

rascal>import ParseTree;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3b4b407f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3b4b407f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3b4b407f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Entering a first expression goes well:

rascal>parse(#E, "a+a");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4f88558c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4f88558c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@4f88558c
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

However, when becoming more ambitious, we get an exception:

rascal>parse(#E, "a+a+a");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@774e5cf1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@774e5cf1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@774e5cf1
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

The conclusion is that there are two parses here: a+(a+a) and (a+a)+a, because we did forget to define the associativity of the + operator. Let’s fix this:

rascal>syntax A = "a";
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7fb8554b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:738)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7fb8554b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7fb8554b
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>syntax E = A | "(" E ")" | left E "+" E;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@548e472d
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:738)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@548e472d
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@548e472d
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import ParseTree;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@785211aa
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@785211aa
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@785211aa
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>parse(#E, "a+a+a");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@25650542
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@25650542
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@25650542
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Here are some pointers for further disambiguation help:

1.2. Arithmetic Exception

Synopsis

An arithmetic exception occurred.

Types

data RuntimeException = ArithmeticException(str message);

Usage

import Exception; (only needed when ArithmeticException is used in catch)

Description

This error is generated when an illegal arithmetic operation occurs or when a numeric function is called with an out-of-range argument.

Remedies:

  • Check the validity of the argument before you call the function or apply the operator.

  • Catch the ArithmeticException yourself, see try catch statement.

Examples

Division by 0 gives an error:

rascal>3/0;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3005deb6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3005deb6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3005deb6
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Giving an out-of-range argument to a mathematical function also gives an error:

rascal>import util::Math;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@193c2aee
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@193c2aee
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@193c2aee
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>tan(-550000000000000000000000);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2abba52
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2abba52
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2abba52
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the ArithmeticException error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@66823c54
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@66823c54
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@66823c54
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@469f132f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@469f132f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@469f132f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try println(3/0); catch ArithmeticException(msg): println("The message is: <msg>");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@205374df
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@205374df
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@205374df
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.3. Assertion Failed

Synopsis

An assertion in the Rascal code is false.

Function

data RuntimeException = AssertionFailed(str label);

Description

An Assert statement can be used to check assumptions during the execution of a Rascal program. This error is generated if an assertion is not true.

Remedies:

  • Modify your code to make the assertion true.

  • Modify your assertion to reflect the current behaviour of your code.

  • Catch the AssertionFailed yourself, see try catch.

Examples

A false assertion gives an error:

rascal>assert 3 > 4;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3fc68fa1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3fc68fa1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3fc68fa1
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Define a function that only increments positive integers:

rascal>int incrPositive(int n) { assert n > 0: "n should be greater than 0"; return n + 1; }
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@76c6d0ae
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalDeclaration(CommandExecutor.java:696)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:447)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@76c6d0ae
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@76c6d0ae
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Calling it with a positive integer is fine:

rascal>incrPositive(3);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@1354ccf9
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@1354ccf9
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1354ccf9
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

But a negative argument gives an error:

rascal>incrPositive(-3);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5e44e383
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5e44e383
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5e44e383
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the AssertionFailed error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4703f6a6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4703f6a6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@4703f6a6
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5288f502
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5288f502
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5288f502
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try println(incrPositive(-3)); catch AssertionFailed(msg): println("incrPositive: <msg>");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7b9ff18d
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7b9ff18d
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7b9ff18d
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
Benefits
  • Enables the precise expression of assumptions in your code.

  • Asserts are actually executed when the compiler option enableAsserts is set to true (by default set to false).

  • In the RascalShell, enableAsserts is always true.

1.4. Empty List

Synopsis

Illegal operation on an empty list.

Types

data RuntimeException = EmptyList();

Usage

import Exception; (only needed when EmptyList is used in catch)

Description

Rascal provides many operations and functions on lists, see list values and list functions. This error is generated when a function or operation cannot handle the empty list.

Remedies:

  • Guard the function or operation with a test on the empty list (isEmpty) and take alternative action in that case.

  • Catch the EmptyList yourself, see try catch.

Examples

Import the List library and introduce L with an empty list as value:

rascal>import List;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3e844bec
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3e844bec
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3e844bec
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>L = [];
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4cbc0d2d
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4cbc0d2d
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@4cbc0d2d
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Taking the head of an empty list gives an error:

rascal>head(L);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6ee883c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6ee883c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6ee883c
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

This is the case when taking the tail as well:

rascal>tail(L);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7b7a4290
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7b7a4290
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7b7a4290
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the EmptyList error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@29908812
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@29908812
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@29908812
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4c4a1376
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@4c4a1376
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@4c4a1376
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try println(head(L)); catch EmptyList(): println("Cannot take head of empty list");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@75b68b8f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@75b68b8f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@75b68b8f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.5. Empty Map

Synopsis

Illegal operation on an empty set.

Types

data RuntimeException = EmptyMap();

Usage

import Exception; (only needed when EmptyMap is used in catch)

Description

Rascal provides many operations and functions on maps, see map values and map functions. This error is generated when a function or operations cannot handle the empty map.

Remedies:

  • Guard the function or operation with a test on the empty map (isEmpty) and take alternative action in that case.

  • Catch the EmptyMap yourself, see try catch.

Examples

Import the Map library and introduce M with an empty map as value:

rascal>import Map;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3f1ae307
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3f1ae307
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3f1ae307
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>M = ();
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@42f39c49
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@42f39c49
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@42f39c49
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Trying to get an arbitrary value from it gives an error:

rascal>getOneFrom(M);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6558803f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6558803f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6558803f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the EmptyMap error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3ef0e0e3
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3ef0e0e3
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3ef0e0e3
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@58b17a67
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@58b17a67
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@58b17a67
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try println(getOneFrom(M)); catch EmptyMap(): println("Cannot use getOneFrom on empty map");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2239967
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2239967
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2239967
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.6. Empty Set

Synopsis

Illegal operation on an empty set.

Types

data RuntimeException = EmptySet();

Usage

import Exception; (only needed when EmptySet is used in catch)

Description

Rascal provides many operations and functions on sets, see set values and set functions. This error is generated when a function or operations cannot handle the empty set.

Remedies:

  • Guard the function or operation with a test on the empty set (isEmpty) and take alternative action in that case.

  • Catch the EmptySet yourself, see try catch.

Examples

Import the Set library and introduce S with an empty set as value:

rascal>import Set;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7c266454
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7c266454
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7c266454
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>S = {};
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@409ed3fd
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@409ed3fd
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@409ed3fd
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Taking an element from an empty set gives an error:

rascal>getOneFrom(S);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@a861dc7
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@a861dc7
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@a861dc7
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the EmptySet error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2ecde4e5
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2ecde4e5
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2ecde4e5
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@31a2ef9f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@31a2ef9f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@31a2ef9f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try println(getOneFrom(S)); catch EmptySet(): println("Cannot apply getOneFrom to empty set");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@36f49faa
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@36f49faa
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@36f49faa
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.7. IO

Synopsis

An input/output operation caused an error.

Types

data RuntimeException = IO(str message);

Usage

import Exception; (only needed when IO is used in catch)

Description

This error can be generated for many reasons.

First there may be a problem in the location that is used. It maybe that the schemes is not supported. Examples of supported schemes include http, file, home, std, rascal and project. It can also be the case that the host that occurs in the location cannot be found.

Second, while trying to open the file things can go wrong like insufficient access rights

Finally, actual reading or writing can fail (device failure, device full, and the like).

Remedies:

  • Check for any errors in the location you are using.

  • Check that you are allowed to read or write the resource indicated by the location.

  • Catch IO using a try catch.

Examples

Import the IO library and attempt to use a non-existing scheme:

rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@1dfe049c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@1dfe049c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1dfe049c
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>readFile(|myScheme:///example.rsc|);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3a302a80
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3a302a80
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3a302a80
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can catch this IO error. First import the Rascal exceptions (which are also included in Prelude):

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6bfa32c0
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6bfa32c0
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6bfa32c0
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try readFileLines(|myScheme:///example.rsc|); catch IO(msg): println("This did not work: <msg>");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2fb44e9b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2fb44e9b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2fb44e9b
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.8. Index Out Of Bounds

Synopsis

Index is out of bounds.

Types

data RuntimeException = IndexOutOfBounds(int index)

Usage

import Exception; (only needed when IndexOutOfBounds is used in catch)

Description

Subscription is possible on various ordered types, including list, tuple, and node. This error is generated when a subscript is out of bounds for the value that is being subscripted.

Remedies:

  • Guard the subscription with a test that the index is within bounds.

  • Make your code less dependent on index values. Suggestions:

    • Use the index to produce all legal indices of a list. Instead of for(int i ← [0..size(L)]) { …​ } use for(int i ← index(L)) { …​ }.

    • Use a list slice to automate part of the index computation.

  • Catch the IndexOutOfBounds yourself, see try catch.

Examples

Initialize a list L:

rascal>L = [0, 10, 20, 30, 40];
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@48212f8a
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@48212f8a
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@48212f8a
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

The legal indices are 0, 1, 2, 3, 4, so index 5 gives an error:

rascal>L[5];
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@a3227be
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@a3227be
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@a3227be
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can catch the IndexOutOfBounds error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@ddf5037
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@ddf5037
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@ddf5037
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@42ef9403
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@42ef9403
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@42ef9403
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try L[5]; catch IndexOutOfBounds(msg): println("The message is: <msg>");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@57e0b5d8
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@57e0b5d8
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@57e0b5d8
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.9. Invalid Argument

Synopsis

A function or operation is applied to an invalid argument value.

Types

data RuntimeException = InvalidArgument() | InvalidArgument(value v) | InvalidArgument(value v, str message);

Usage

import Exception; (only needed when InvalidArgument is used in catch)

Description

This error is generated when a function or operation is applied to a value that it does not expect.

Remedies:

  • Check the value or values to which you apply the function or operation.

Examples

Changing the month of a DateTime to an illegal month (13):

rascal>NOW = $2013-01-13T22:16:51.740+01:00$;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@741ee89a
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@741ee89a
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@741ee89a
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>NOW.month = 13;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5021ade1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5021ade1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5021ade1
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Setting the offset in a location to a negative value:

rascal>someLoc = |home:///abc.txt|;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2d9aa2c2
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2d9aa2c2
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2d9aa2c2
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>someLoc.offset = -1;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@615c5e54
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@615c5e54
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@615c5e54
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.10. Invalid URI

Synopsis

An invalid URI is created at runtime.

Types

data RuntimeException = InvalidURI(str uri);

Usage

import Exception; (only needed when InvalidURI is used in catch)

Description

Thrown by operations on source locations that would lead to an invalid URI part of a source location value.

Examples
rascal>someLoc = |home:///abc.txt|;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7afb3e27
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7afb3e27
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7afb3e27
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>someLoc.scheme = "a:b";
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@36a05d56
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@36a05d56
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@36a05d56
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Another well-known example is a missing path when using // (wrong) instead of /// (good):

rascal>|home:///|;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@733f4436
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@733f4436
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@733f4436
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>|home://|;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@69b8213
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@69b8213
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@69b8213
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.11. Invalid Use Of Date

Synopsis

Invalid of of a date at runtime

Types

data RuntimeException = InvalidUseOfDate(str message);

Usage

import Exception; (only needed when InvalidUseOfDate is used in catch)

Description

Thrown by operations on date values that try to update unavailable information.

Examples

Setting the hour field on a date value throws an exception:

rascal>NOW = $2016-09-18$;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@68a5a57e
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@68a5a57e
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@68a5a57e
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>NOW.hour = 14;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6595f1bf
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6595f1bf
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6595f1bf
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
Exception is not shown properly

1.12. Invalid Use Of Location

Synopsis

Invalid use of a source location at runtime.

Types

data RuntimeException = InvalidUseOfLocation(str message);

Usage

import Exception; (only needed when InvalidUseOfLocation is used in catch)

Description

Thrown by operations on source locations that would lead to an inconsistent or incomplete location value.

Examples
rascal>someLoc = |home:///abc.txt|;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@41f582ee
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@41f582ee
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@41f582ee
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>someLoc.begin = <1, 2>;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@606420d6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@606420d6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@606420d6
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.13. Invalid Use Of Time

Synopsis

Invalid use of a time value at runtime

Types

data RuntimeException = InvalidUseOfTime(str message);

Usage

import Exception; (only needed when InvalidUseOfTime is used in catch)

Description

Thrown by operations on time values that try to update unavailable information.

Examples

Setting the year field on a time value throws an exception:

rascal>NOW = $T20:11:01.463+00:00$;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@1719f8a8
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@1719f8a8
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1719f8a8
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>NOW.year = 2020;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3ed6aed1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3ed6aed1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3ed6aed1
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
Exception is not shown properly

1.14. Java

Synopsis

Runtime error generated by Java code.

Description

This error is generated when an unexpected Java execption is thrown in the Rascal implementation.

Remedy: Contact the Rascal developers:

If you are an expert developer and have implemented your own extension in Java, please check your own extension code first.

1.15. No Main Function

Synopsis

Rascal program does not provide a main function.

Types

data RuntimeException = NoMainFunction(str message);

Usage

import Exception; (only needed when NoMainFunction is used in catch)

Description

Thrown when executing a Rascal program that does not declare a main function.

1.16. No Parent

Synopsis

Parent directory is missing in source location.

Types

data RuntimeException = NoParent(loc noparentloc);

Usage

import Exception; (only needed when NoParent is used in catch)

1.17. No Such Annotation

Synopsis

Annotation without a value.

Types

data RuntimeException = NoSuchAnnotation(str label);

Usage

import Exception; (only needed when NoSuchAnnotation is used in catch)

Description

An annotation can be associated with any node value (including any algebraic data type). This error is generated when the value of an annotation is requested but has not been defined.

Remedies:

  • Ensure that the annotation value is properly initialized for all relevant parts of the node value.

  • Use the isDefined and ifDefinedElse operators to check whether the annotation value is set and act accordingly.

  • Catch the NoSuchAnnotation yourself, see try catch.

Examples

INFO: Eliminate the double Error: Error:

rascal>data Fruit = apple(int n) | orange(int n);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7c319990
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalDeclaration(CommandExecutor.java:675)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:447)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7c319990
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7c319990
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>anno str Fruit @ quality;
Error: Not supported construct: anno str Fruit @ quality;
rascal>piece = orange(13);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@61ea2440
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@61ea2440
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@61ea2440
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>piece@quality;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2cb983e2
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2cb983e2
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2cb983e2
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Use the unary postfix operator isDefined ? to check whether the quality annotation is set:

rascal>piece@quality?;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6bb873e1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6bb873e1
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6bb873e1
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Use the ternary operator ifDefinedElse ? to compute an alternative value when the quality annotation is not set:

rascal>piece@quality ? "no quality value";
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@328c81d6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@328c81d6
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@328c81d6
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the NoSuchAnnotation error. First import the Rascal exceptions (which are also included in Prelude) and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@59b39e70
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@59b39e70
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@59b39e70
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5106c126
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5106c126
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5106c126
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try piece@quality; catch NoSuchAnnotation(l): println("No such annotation: <l>");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@66bd55bf
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@66bd55bf
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@66bd55bf
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Finally, we can just assign a value to the quality annotation:

rascal>piece@quality = "excellent";
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6ad5048c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:553)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6ad5048c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6ad5048c
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>piece@quality;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@302635c4
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@302635c4
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@302635c4
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
Pitfalls
Using white space around the @ confuses the Rascal parser

1.18. No Such Field

Synopsis

Field of an abstract data type value cannot be found at runtime.

Types

data RuntimeException = NoSuchField(str name);

Usage

import Exception; (only needed when NoSuchField is used in catch)

Description

Selecting a field from an abstract datatype depends on the actual constructor being used at run time. This exception is thrown when a non-existent field is accessed.

Examples

Consider this highly simplified view on persons:

rascal>data Person = man(str name, bool beard) | woman(str name, bool necklace);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2e492a4f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalDeclaration(CommandExecutor.java:675)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:447)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2e492a4f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2e492a4f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>jane = woman("jane", false);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@77413319
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@77413319
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@77413319
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

The field beard is evidently only applicable to a man but not to a woman (didn’t we say "simplified", above):

rascal>jane.beard;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7966de62
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7966de62
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7966de62
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.19. No Such Key

Synopsis

A map does not contain a requested key.

Types

data RuntimeException = NoSuchKey(value v);

Usage

import Exception; (only needed when NoSuchKey is used in catch)

Description

Rascal provides many operations and functions on maps, see map values and map functions. This error is generated when a function or operation cannot find a requested key value in a map.

Remedies:

Examples

Import the Map and IO libraries and introduce map M:

rascal>import Map;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5bb68264
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5bb68264
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5bb68264
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@527ff0dd
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@527ff0dd
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@527ff0dd
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>M = ("a" : 1, "b" : 2);
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@106a770b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@106a770b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@106a770b
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Indexing M with a non-existing key gives an error:

rascal>M["c"]
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@44defd79
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalExpression(CommandExecutor.java:453)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:438)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@44defd79
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@44defd79
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Use the postfix isDefined operator ? to test whether the value is defined:

rascal>if(M["c"]?) println("defined"); else println("not defined");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5e6caac9
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5e6caac9
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5e6caac9
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Or use the binary ifDefinedElse operator ? to return an alternative value when the value of M["c"] is undefined:

rascal>M["c"] ? 3
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2f4ef46f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalExpression(CommandExecutor.java:453)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:438)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2f4ef46f
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2f4ef46f
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Yet another solution is to use try/catch. First we import the Rascal exceptions (which are also included in Prelude):

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6b2b6360
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6b2b6360
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6b2b6360
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try println(M["c"]); catch NoSuchKey(k): println("Key <k> does not exist");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6bcc43b2
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6bcc43b2
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6bcc43b2
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.20. Not Implemented

Synopsis

Attempt to execute an unimplemented feature.

Types

data RuntimeException = NotImplemented(str msg), loc src);

Usage

import Exception; (only needed when NotImplemented is used in catch)

Description

Thrown when a not (yet) implemented feature is executed. This exception is mostly used by the Rascal implementors.

1.21. Parse Error

Synopsis

Parse of a syntactically incorrect string.

Types

data RuntimeException = ParseError(loc parseloc) | ParseError(loc parseloc, str nt, str s);

Usage

import Exception; (only needed when ParseError is used in catch)

Description

This error is generated when during the execution of a Rascal program the parse function is applied to a syntactically incorrect input sentence.

Remedies:

  • Correct the input sentence.

  • Adapt the grammar so that it accepts the input sentence.

  • Catch the ParseError yourself, see try catch.

Examples

Define the non-terminal As that accepts one or more letters a:

rascal>syntax As = "a"+;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@cf800da
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:738)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@cf800da
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@cf800da
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Then import ParseTree so that we can use the parse function:

rascal>import ParseTree;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2456d75b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@2456d75b
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@2456d75b
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

Now we can parse sentences consisting of letters a:

rascal>parse(#As, "aaaaaaaa");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@dbeaac5
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@dbeaac5
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@dbeaac5
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

But we get an error when parsing syntactically incorrect input (i.e., that does not consists of letters a only):

rascal>parse(#As, "aaaabaaa");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@117eb1a7
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@117eb1a7
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@117eb1a7
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

We can also catch the ParseError but first import the Rascal modules Exception and IO:

rascal>import Exception;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5687fda7
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5687fda7
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5687fda7
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>import IO;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6a823b15
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalImport(CommandExecutor.java:720)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:444)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@6a823b15
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@6a823b15
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>try parse(#As, "aaaabaaa"); catch ParseError(e): println("Your input cannot be parsed: <e>");
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@79fee49c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:622)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@79fee49c
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@79fee49c
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.22. RegExp Syntax Error

Synopsis

Syntax error in regular expression at run time

Types

data RuntimeException = RegExpSyntaxError(str message);

Usage

import Exception; (only needed when RegExpSyntaxError is used in catch)

Description

At the moment, the parsing and compilation of regular expression is done at run time. This exception is thrown when a syntactically incorrect regular expression is used.

Examples

The following regular expression /+/ is incorrect (maybe /a+/ was meant?):

rascal>/+/ := "aaaa";
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5ef395c0
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@5ef395c0
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@5ef395c0
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

1.23. Unavailable Information

Synopsis

Requested information is unavailable at runtime

Types

data RuntimeException = UnavailableInformation(str message);

Usage

import Exception; (only needed when UnavailableInformation is used in catch)

Description

Several datetypes may contain optional information that is not always available:

  • In a datetime value the date or the time may be missing.

  • In a location value, various fields are optional, e.g., port, offset, begin and end.

This exception is thrown when optional information is not available.

Examples
rascal>$2016-09-14$.hour;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7f1dd6fd
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@7f1dd6fd
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@7f1dd6fd
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>someLoc = |home:///abc.txt|;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3716d971
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:540)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@3716d971
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@3716d971
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more
rascal>someLoc.offset;
An unexpected internal error occurred:
java.lang.RuntimeException: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@35ba3537
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:193)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMJVM.executeRVMFunction(RVMJVM.java:127)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.executeRVMFunction(RVMCore.java:460)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.java2rascal.RascalFunctionInvocationHandler.invoke(RascalFunctionInvocationHandler.java:85)
	at com.sun.proxy.$Proxy2.compileAndMergeProgramIncremental(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.executeModule(CommandExecutor.java:361)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.evalStatement(CommandExecutor.java:520)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.repl.CommandExecutor.eval(CommandExecutor.java:441)
	at org.rascalmpl.library.experiments.tutor3.TutorCommandExecutor.evalPrint(TutorCommandExecutor.java:75)
	at org.rascalmpl.library.experiments.tutor3.Concept.preprocess(Concept.java:264)
	at org.rascalmpl.library.experiments.tutor3.Onthology.<init>(Onthology.java:131)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.compileCourse(CourseCompiler.java:92)
	at org.rascalmpl.library.experiments.tutor3.CourseCompiler.main(CourseCompiler.java:271)
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: Exception in CALLJAVA: org.rascalmpl.library.PreludeCompiled.remove; message: could not call Java method removejava.lang.IllegalArgumentException: java.lang.ClassCastException@35ba3537
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:454)
	at lang.rascal.boot.Kernel$Compiled.IO\remove(\loc():)#618(Unknown Source)
	at lang.rascal.boot.Kernel$Compiled.experiments::Compiler::Execute\compileAndMergeProgramIncremental(str():bool():adt("PathConfig",()):)#562(Unknown Source)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.executeRVMFunction(RVMonJVM.java:187)
	... 12 more
Caused by: org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.InternalCompilerError: could not call Java method remove
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1126)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMonJVM.insnCALLJAVA(RVMonJVM.java:443)
	... 15 more
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@35ba3537
	at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.rascalmpl.library.experiments.Compiler.RVM.Interpreter.RVMCore.callJavaMethod(RVMCore.java:1122)
	... 16 more

2. Other Runtime Errors

Synopsis

Other runtime errors that cannot be caught as a runtime exception.

Description

Note: Examples will be collected here

2.1. Compiler Error

Synopsis

An internal error in the Rascal compiler

Description

An internal error condition occurred while running the Rascal compiler. This exception may be generated due to:

  • An actual internal inconsistency.

  • Incorrect information as computed by the type checker.

  • Incorrect configuration of paths (PathConfig) when calling the compiler.

  • Causes outside control of the compiler.

Pitfalls

At the moment this error category is too wide and should be narrowed.