- Some Strict Java mode bugs fixed. %(Incompatible API Change) Strict Java mode now functions on a per-interpreter basis. The static strictJava variable is gone (it was always labeled as experimental) and is replaced by the instance method Interpreter setStrictJava(). Interpreter set() methods now work (untyped assignments using Interpreter set() is allowed and existing untyped variables can be assigned in scripts in either mode). +Added a test case. Most bsh commands still fail in strict Java mode for simple reasons. These will be cleaned up in a future release. - Added check for return of value from void method. Fixed a couple of places where we made this mistake. - Added dirname() command - Added "test" target to build file (runs tests/RunAllTests.bsh). Modified RunAllTests.bsh to cd() to the directory containing the RunAllTests.bsh script before executing the tests. - Certain return type errors now point to specific locations, rather than the method declaration. - Fixed Interpreter setErr() bug - Exceptions thrown from proxy interfaces are now unwrapped. If your script throws an exception (or causes one to be thrown) that is declared in the throws clause of your interface method then it will be thrown from the method as one would expect.
- Fixed bug where Interepreter was not closing Reader streams after sourcing files. - Updated JConsole to work with Java 1.4.1 (changed getText.length() calls to getDocument().getLength()).
- Made bsh.Parser public and added a main() method allowing users to call the parser on files for simple validity checking. - Made a small addition to grammar to provide an option to retain formal (javadoc style) comments in the parse tree. - Fixed accessibility bug in finding fields - Fixed minor bugs in bsh.servlet.BshServlet - Fixed scoping on catch blocks such that untyped variables in the catch parameter do not leak out of the block. They now act as they would with a declared type in Java (local). - Fixed some thread safety bugs with try/catch blocks. - Fixed Interpreter serialization issue - reset streams - Fixed bug in accessibility affecting access to package hidden superclasses - Added bshdoc.bsh script and bshdoc.xsl stylesheet to the scripts dir. These can be used to support javadoc style documentation of bsh files and commands. - Exposed bsh.BshMethod and added a public invoke() method. - Added getMethod() method to namespace to enumerate methods
- Fixed bug in using loosely typed vars as indexes to arrays.
- Modified Interpreter so that it is serializable. It is now possible to serialize the entire bsh instance. The load() and save() commands however recognize when you are trying to save a bsh object (bsh.This) type and detach it from the parent namespace, so that saving a bsh object in this way doesn't drag along the whole interpreter See This.bind() and This.unbind().
- Fixed bug affecting scoping in blocks. This was breaking the test harness in a way that caused it not to be caught before! - Added a special test for the test harness to catch this sort of thing in the future. - Fixed problem with classloading causing bsh extensions not to be found in some environments.
- The class manager now uses the Thread "context classloader" to factory classes when available. This allows bsh to be instaled in the jre/lib/ext directory (previously user classes wouldn't be seen). Yeah! This may also allow bsh to see user classpath in application servers like Weblogic, which include it in the core classpath. - added the clear() command to clear variables and methods from a namespace. - added setOut() and setErr() methods to Interpreter. - added new bsh.servlet package to the main distribution - added bsh.Remote launcher
- Fixed nasty bug in grammar, added test cases to expression.bsh Note: this bug was preventing the latest version of bsh from being used with Weblogic 6.1 (which uses bsh internally and was failing). - Handled the "single line comment with no terminating linefeed" issue. - Added getInterface() method to Interpreter. - Fixed issue with identity semantics for this in cast case, e.g.: ((ActionListener)this == (ActionListener)this) is now true. - cat() command will now print files, urls, streams, and readers - Exceptions in native (compiled) user classes will now print with both the BeanShell script trace and native Java stack trace. Exceptions generated directly from scripts continue to show only the script trace (as that is all that is meaningful). - ParseException is now a subtype of EvalError... previously these were caught and the contents were moved to an EvalError. This means that now the ParseEx implements the contract as far as getErrorLineNumber(), getErrorText(), and getErrorSourceFile() - In interactive mode, the last uncaught exception is now available in the variable $_e (like the $_ last result). - Improved the way that imported class names are cached in namespaces, reducing the number of caches created and improving performance. - Improved javap() command slightly - Modified This references so that you can invoke the methods: getClass() and invokeMethod() on them.
- Added support for accessibility - Using a dynamically loaded extension (ReflectManager) bsh will use the accessibility API to allow access to private/protected fields, methods and non-public classes. - added the setAccessible() command to turn this behavior on/off (it is *off* by default in this release... we may change that later.) - added the bsh.reflect package and ReflectManager to support the above. - Added support for IBM's Bean Scripting Framework (BSF). - Added a new jar with the BSF adapter class bsh.util.BeanShellBSFEngine. This is also included in the full dist (it's small).
- Added a somewhat experimental "strict java" mode. When activated with setStrictJava(true) BeanShell will: 1) require typed variable declarations, method arguments and return types 2) modify the scoping of variables to look for the variable declaration first in the parent namespace, as in a java method inside a java class. e.g. if you can write a method called incrementFoo() that will do the correct thing without referring to super.foo. -Added another form of the run() command that accepts an argument to be passed to the child context.
- Fixed a bug affecting static field access. - Added a static setClassLoader() method to Interpreter and BshClassManager. This allows an external classloader to be specified.
- Added simple mechanism to allow scripted commands/methods to accept class identifiers as arguments. e.g.: foo( java.lang.String ); see Name.identifierToClass(); - added which() command - shows class source - modified class browser to show class source when class is selected - Changed the type of the (very recently added) this.callstack reference from an array to the actual internal CallStack type. You can use toArray() to get it as an array or get(depth). - added unset() method to interpreter. Fixed bug in set(name, null);
Improved error reporting on errors during method invocation.
- Fixed server mode and re-added demo applets
- Important addition - nodes now remember the source file from which they were parsed... This means that debug messages are much more useful now, especially with errors thrown from multiple files. - Re-worked classpath mapping user feedback mechanism (will support a GUI now). - Fixed general block scoping bugs. Things should act like Java now. typed vars declared within blocks does not leak out. e.g. { int i=2; } - Added getSourceFileInfo() command to return the name of the file or source from which the current interpreter is reading. (uses this.interpreter.getSourceFileInfo()) - Added a parent ref to the interpreter for future use by the child eval interpreters. - Added new form of source() command that takes a URL. - Tenatively added new feature to get the text of a method invocation from within the method body... may be useful along with this.caller. See namespace.getInovcationText() namespace.getInvocationLine().
- Removed core bsh package dependencies on 1.2. bsh will now compile and run under 1.2 with some features limited. - Moved some console related functionality out of the core and into bsh.util. There is a new bsh.util.GUIConsoleInterface. NameCompletion is now in bsh.util and has been replaced with a more primitive supporting interface bsh.NameSource in the core.
- Moved all Name object construction into NameSpace. This will support Name resolvers caching information in the future. e.g. bsh could know that a variable is final and optimize the resolution. Or a long chain of names (java.lang.Integer.MAX_INTEGER) could be optimized. - .class on array types now working. e.g. "int [][].class" - Fixed bugs in grammar which dissallowed certain simple expressions unless they were parenthesized. - Fixed related case relating to expressions with assignment to a throw-away method invocation.
- Added "trace" option. java -Dtrace=true bsh.Interpreter or trace() command. turns on printing of each line before it is executed. Note that this currently prints only top level lines as they are parsed and executed by the interpreter. trace skips over method exectutions (including bsh commands) etc. We may enhance this in the future. - Fixed bugs in primitive handling: primitives smaller than int are now properly assigned in declarations: e.g.: byte b = 5; primitive are internally promoted to the correct type on assignment to a typed variable, e.g.: long l = (byte)5; // l is a long value internally - Cleanup in cast operation.. re-factored the cast code into two types of cast operations. - Tightened up re-declaration of typed variables... You can only redeclare a typed var with the same type, else you can an error. Previously there was odd behavior where you could redeclare with an assignable type. - Fixed bugs in casting - Fixed the remainng known bugs in array initializers. They should now work precisely as they do in Java. See the test case for examples.
- Improved error reporting. There should no longer be any errors that report "unknown location". At minimum, any error should report the source file and line number. Normally errors should report the text of the offending construct. - Cleanup in array handling - fixed bugs with null initializers, loose types, promotion
- Major internal change: added callstack. two new magic references: bsh.This this.caller NameSpace [] this.callstack - Some commands now behave correctly, some slight changes- see notes. - made change to insure that pathToFile always returns canonical path this fixed bug in addClassPath
- Added a very nice ANT build file, yeah! - added a bit more synchronization in console - removed unecessary file/cwd related code - removed unecessary code and lib file supporting old java packages optimization - Redefined scoping behavior in for-init to act like java. See notes elsewhere. - Added switch statement. - made sure Ctrl-d in interctive mode shuts down interpreter. - Fixed cleanup of weak references in bsh class manager
- import changes - - Defined order of precedence - in bsh ambiguous imports are compile time error. In bsh (where imports are allowed at any time) the later import takes precedence. - fixed bug causing stack overflow - Internal restructuring - made Interpreter its own class rather than being auto-generated by javacc. This allows us to generate decent javadoc without hundreds of parser methods. Improved javadoc. - Fixed the precedence of name resolution to be consisten with Java. variables now always trump class name resolution. This simplifies name resolution a bit and also makes things a bit faster. However sometimes you have to use import now to get around a variable name hiding a qualified class name. - Performance improvement: empty loop test case four times faster overall appears as much as 30% faster - Fixed bugs in certain runtime exception handling - Fixed bug in static vs. dynamic overloaded method resolution
- Fixed grammar relating to Expression/BlockStatement parsing... This was causing the bug with declaring a typed var with a fully qualified class name. e.g. java.sql.Date date; - Fixed 'return' control problem... return now works properly for interactive and non-interactive scripts. F- ixed CTRL-D bug - now exits properly in interactive mode.
- Fixed bug causing debug code to call toString() for every method call on an object, whether debug was on or not.
- License change only... Added SPL Sun Public License agreement with dual licensing under the LGPL
- Added .field style properties access in addition to the {} style - Added anonymous inner class style allocation for interfaces - Class browser now reflects changes in class path
- Added namespace based name completion for console and classbrowser completes variables, classes, (coming... bsh methods) - Added import * capability to read full classpath. - Added overloading of bsh scripted methods - Added classpath extension and class reloading reloadClasses() reloadClasses(item) - improved the class browser - now has tree for packages and reflects the extended classpath , other improvements - Loose arguments in catch clauses now work. - deprecated getVariable/setVariable api. Moving to get()/set()/eval(); - internally removed BshVariable - it wasn't doing what it was historically intended for. Replaced with a new bsh.system object which is shared across all interpreter instances - Added bsh.system.shutdownOnExit variable... set to false to prevent exit() command and desktop close from exiting the VM. - Loosened grammar to allow import statments in any block scope. e.g. you can now import within a bsh method and the import will be local to that method -Added javap() command... accepts object, class, or string name and prints public fields, methods -Added -Doutfile=foo capture output to file (for Windows nightmare) - Cleaned up a lot of internal structure in NameSpace, etc. -Interpreter now implements ConsoleInterface
- Modified parse exceptions to print more tersely... Removed the "Was expecting one of..." text *except* when debug is on. - Fixed the for statement forinit scope bug. - Got rid of remaining deprecation (using Readers vs. InputStreams) - Fixed top level expression bug #111342 - Fixed problems with compiling bsh under limited JDK verions (1.1, 1.2). We now have factories insulating the core from all extended version capabilities (e.g. proxy mechanism stuff, accessibility TBD) - Modified browseClass() command to accept string class name, class instance, or arbitrary object - Modified search for constructors to accomodate package and private access. - Added close button to class browser.
java bsh.Interpreter MyClass foo barArgs are accessible through the root bsh object: String [] bsh.args