Mythruna
April 17, 2024, 07:14:31 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: What is Script15?  (Read 5428 times)
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« on: February 16, 2015, 11:29:44 AM »

In errors while programming, you'll run into "Script15"

When you run this code:
Code:
try {
File f = new File("ClassName.TEST");
f.createNewFile();
BufferedWriter writer = new BufferedWriter(new FileWriter(f));
writer.write(getClass().getSimpleName());
writer.close();
} catch (IOException e) {
;
}
The result is "Script15"

In essence, what is "Script15", and what is its purpose?
Logged
pspeed
Administrator
Hero Member
*****
Posts: 5612



View Profile
« Reply #1 on: February 16, 2015, 02:07:48 PM »

Script15 is the class name of the 15th script that was loaded.  I was going to say that I think I keep a mapping of the classes to that actual names for error reporting but I just remember that's only in the new engine.

Because I use jsr223 support in Java to load groovy scripts, groovy doesn't know what the original script file was called and so just generates a name for the compiled class (groovy is Java after all and so must end up as a .class even if only in memory).  In the new engine, I go through some level of pain to keep track of the loaded script name and associate with the compiled script.

Anyway, it makes it harder to debug for sure.
Logged
Michael
Donators
Hero Member
***
Posts: 2166



View Profile
« Reply #2 on: February 16, 2015, 02:13:01 PM »

Ok, thank you.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!