File 00bsh-jedit.patch of Package jedit

Description: jEdit uses a modified bsh version. This patch to document
 differences between Debian bsh and jEdit bsh.
Author: Gabriele Giacone <1o5g4r8o@gmail.com>

--- a/bsh/src/bsh/BlockNameSpace.java
+++ b/bsh/src/bsh/BlockNameSpace.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package	bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
     A specialized namespace	for Blocks (e.g. the body of a "for" statement).
--- a/bsh/src/bsh/BSHAllocationExpression.java
+++ b/bsh/src/bsh/BSHAllocationExpression.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
--- a/bsh/src/bsh/BSHAmbiguousName.java
+++ b/bsh/src/bsh/BSHAmbiguousName.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHAmbiguousName extends SimpleNode
 {
--- a/bsh/src/bsh/BSHArguments.java
+++ b/bsh/src/bsh/BSHArguments.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHArguments extends SimpleNode
 {
--- a/bsh/src/bsh/BSHArrayDimensions.java
+++ b/bsh/src/bsh/BSHArrayDimensions.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Array;
 
--- a/bsh/src/bsh/BSHArrayInitializer.java
+++ b/bsh/src/bsh/BSHArrayInitializer.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Array;
 
--- a/bsh/src/bsh/BSHAssignment.java
+++ b/bsh/src/bsh/BSHAssignment.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHAssignment extends SimpleNode implements ParserConstants
 {
--- a/bsh/src/bsh/BSHBinaryExpression.java
+++ b/bsh/src/bsh/BSHBinaryExpression.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	Implement binary expressions...
@@ -74,7 +74,7 @@
 				i.e. (5 instanceof bsh.Primitive) will be true
 			*/
 			if ( lhs instanceof Primitive )
-				if ( rhs == bsh.Primitive.class )
+				if ( rhs == org.gjt.sp.jedit.bsh.Primitive.class )
 					return new Primitive(true);
 				else
 					return new Primitive(false);
--- a/bsh/src/bsh/BSHBlock.java
+++ b/bsh/src/bsh/BSHBlock.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHBlock extends SimpleNode
 {
--- a/bsh/src/bsh/BSHCastExpression.java
+++ b/bsh/src/bsh/BSHCastExpression.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	Implement casts.
--- a/bsh/src/bsh/BSHClassDeclaration.java
+++ b/bsh/src/bsh/BSHClassDeclaration.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 */
--- a/bsh/src/bsh/BshClassManager.java
+++ b/bsh/src/bsh/BshClassManager.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.net.*;
 import java.util.*;
@@ -120,8 +120,8 @@
 		Create a new instance of the class manager.  
 		Class manager instnaces are now associated with the interpreter.
 
-		@see bsh.Interpreter.getClassManager()
-		@see bsh.Interpreter.setClassLoader( ClassLoader )
+        @see org.gjt.sp.jedit.bsh.Interpreter#getClassManager() getClassManager
+        @see org.gjt.sp.jedit.bsh.Interpreter#setClassLoader(ClassLoader) setClassLoader
 	*/
 	public static BshClassManager createClassManager( Interpreter interpreter ) 
 	{
@@ -130,12 +130,12 @@
 		// Do we have the necessary jdk1.2 packages and optional package?
 		if ( Capabilities.classExists("java.lang.ref.WeakReference") 
 			&& Capabilities.classExists("java.util.HashMap") 
-			&& Capabilities.classExists("bsh.classpath.ClassManagerImpl") 
+            && Capabilities.classExists("org.gjt.sp.jedit.bsh.classpath.ClassManagerImpl")
 		) 
 			try {
 				// Try to load the module
 				// don't refer to it directly here or we're dependent upon it
-				Class clas = Class.forName( "bsh.classpath.ClassManagerImpl" );
+                Class clas = Class.forName( "org.gjt.sp.jedit.bsh.classpath.ClassManagerImpl" );
 				manager = (BshClassManager)clas.newInstance();
 			} catch ( Exception e ) {
 				throw new InterpreterError("Error loading classmanager: "+e);
@@ -346,7 +346,6 @@
 
 	/**
 		Clear the caches in BshClassManager
-		@see public void #reset() for external usage
 	*/
 	protected void clearCaches() 
 	{
--- a/bsh/src/bsh/BshClass.scripted
+++ b/bsh/src/bsh/BshClass.scripted
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 import java.util.List;
 import java.util.ArrayList;
 
--- a/bsh/src/bsh/BSHEnhancedForStatement.java
+++ b/bsh/src/bsh/BSHEnhancedForStatement.java
@@ -1,7 +1,6 @@
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 // Just testing...
-import java.util.*;
 
 /**
 	 Implementation of the enhanced for(:) statement.  
--- a/bsh/src/bsh/BSHFormalComment.java
+++ b/bsh/src/bsh/BSHFormalComment.java
@@ -1,6 +1,6 @@
 /* Generated By:JJTree: Do not edit this line. BSHFormalComment.java */
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class BSHFormalComment extends SimpleNode 
 {
--- a/bsh/src/bsh/BSHFormalParameter.java
+++ b/bsh/src/bsh/BSHFormalParameter.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	A formal parameter declaration.
--- a/bsh/src/bsh/BSHFormalParameters.java
+++ b/bsh/src/bsh/BSHFormalParameters.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHFormalParameters extends SimpleNode
 {
--- a/bsh/src/bsh/BSHForStatement.java
+++ b/bsh/src/bsh/BSHForStatement.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	Implementation of the for(;;) statement.
--- a/bsh/src/bsh/BSHIfStatement.java
+++ b/bsh/src/bsh/BSHIfStatement.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHIfStatement extends SimpleNode
 {
--- a/bsh/src/bsh/BSHImportDeclaration.java
+++ b/bsh/src/bsh/BSHImportDeclaration.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHImportDeclaration extends SimpleNode
 {
--- a/bsh/src/bsh/BshIterator.java
+++ b/bsh/src/bsh/BshIterator.java
@@ -31,12 +31,12 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	An interface implemented by classes wrapping instances of iterators,
 	enumerations, collections, etc.
-	@see CollectionManager.getBshIterator(Object)
+    @see CollectionManager#getBshIterator(Object) getBshIterator
 */
 public interface BshIterator 
 {
--- a/bsh/src/bsh/bsh.jj
+++ b/bsh/src/bsh/bsh.jj
@@ -57,7 +57,7 @@
 }
 
 PARSER_BEGIN(Parser)
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 import java.util.Vector;
--- a/bsh/src/bsh/bsh.jjt
+++ b/bsh/src/bsh/bsh.jjt
@@ -60,7 +60,7 @@
 }
 
 PARSER_BEGIN(Parser)
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 import java.util.Vector;
--- a/bsh/src/bsh/BSHLiteral.java
+++ b/bsh/src/bsh/BSHLiteral.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHLiteral extends SimpleNode
 {
@@ -102,7 +102,7 @@
 
     void stringSetup(String str)
     {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         for(int i = 0; i < str.length(); i++)
         {
             char ch = str.charAt(i);
--- a/bsh/src/bsh/BSHMethodDeclaration.java
+++ b/bsh/src/bsh/BSHMethodDeclaration.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHMethodDeclaration extends SimpleNode
 {
--- a/bsh/src/bsh/BSHMethodInvocation.java
+++ b/bsh/src/bsh/BSHMethodInvocation.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.InvocationTargetException;
 
--- a/bsh/src/bsh/BshMethod.java
+++ b/bsh/src/bsh/BshMethod.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
--- a/bsh/src/bsh/BSHPackageDeclaration.java
+++ b/bsh/src/bsh/BSHPackageDeclaration.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class BSHPackageDeclaration extends SimpleNode 
 {
--- a/bsh/src/bsh/BSHPrimaryExpression.java
+++ b/bsh/src/bsh/BSHPrimaryExpression.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHPrimaryExpression extends SimpleNode
 {
--- a/bsh/src/bsh/BSHPrimarySuffix.java
+++ b/bsh/src/bsh/BSHPrimarySuffix.java
@@ -32,9 +32,8 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
-import java.util.Hashtable;
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
 
--- a/bsh/src/bsh/BSHPrimitiveType.java
+++ b/bsh/src/bsh/BSHPrimitiveType.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHPrimitiveType extends SimpleNode
 {
--- a/bsh/src/bsh/BSHReturnStatement.java
+++ b/bsh/src/bsh/BSHReturnStatement.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHReturnStatement extends SimpleNode implements ParserConstants
 {
--- a/bsh/src/bsh/BSHReturnType.java
+++ b/bsh/src/bsh/BSHReturnType.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHReturnType extends SimpleNode
 {
--- a/bsh/src/bsh/BSHStatementExpressionList.java
+++ b/bsh/src/bsh/BSHStatementExpressionList.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHStatementExpressionList extends SimpleNode
 {
--- a/bsh/src/bsh/BSHSwitchLabel.java
+++ b/bsh/src/bsh/BSHSwitchLabel.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHSwitchLabel extends SimpleNode {
 	boolean isDefault;
--- a/bsh/src/bsh/BSHSwitchStatement.java
+++ b/bsh/src/bsh/BSHSwitchStatement.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHSwitchStatement 
 	extends SimpleNode 
--- a/bsh/src/bsh/BSHTernaryExpression.java
+++ b/bsh/src/bsh/BSHTernaryExpression.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	This class needs logic to prevent the right hand side of boolean logical
--- a/bsh/src/bsh/BSHThrowStatement.java
+++ b/bsh/src/bsh/BSHThrowStatement.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHThrowStatement extends SimpleNode
 {
--- a/bsh/src/bsh/BSHTryStatement.java
+++ b/bsh/src/bsh/BSHTryStatement.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.Vector;
 
--- a/bsh/src/bsh/BSHTypedVariableDeclaration.java
+++ b/bsh/src/bsh/BSHTypedVariableDeclaration.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHTypedVariableDeclaration extends SimpleNode
 {
--- a/bsh/src/bsh/BSHType.java
+++ b/bsh/src/bsh/BSHType.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Array;
 
--- a/bsh/src/bsh/BSHUnaryExpression.java
+++ b/bsh/src/bsh/BSHUnaryExpression.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class BSHUnaryExpression extends SimpleNode implements ParserConstants
 {
--- a/bsh/src/bsh/BSHVariableDeclarator.java
+++ b/bsh/src/bsh/BSHVariableDeclarator.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	name [ = initializer ]
--- a/bsh/src/bsh/BSHWhileStatement.java
+++ b/bsh/src/bsh/BSHWhileStatement.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	This class handles both while(){} statements and do{}while() statements.
--- a/bsh/src/bsh/CallStack.java
+++ b/bsh/src/bsh/CallStack.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.Vector;
 
@@ -61,7 +61,7 @@
 */
 public class CallStack 
 {
-	private Vector stack = new Vector(2);
+	private Vector<NameSpace> stack = new Vector<NameSpace>(2);
 
 	public CallStack() { }
 
@@ -128,7 +128,7 @@
 	}
 
 	public String toString() {
-		StringBuffer sb = new StringBuffer();
+		StringBuilder sb = new StringBuilder();
 		sb.append("CallStack:\n");
 		NameSpace [] nsa = toArray();
 		for(int i=0; i<nsa.length; i++)
@@ -141,9 +141,10 @@
 		Occasionally we need to freeze the callstack for error reporting
 		purposes, etc.
 	*/
+	@SuppressWarnings("unchecked")
 	public CallStack copy() {
 		CallStack cs = new CallStack();
-		cs.stack = (Vector)this.stack.clone();
+		cs.stack = (Vector<NameSpace>) stack.clone();
 		return cs;
 	}
 }
--- a/bsh/src/bsh/Capabilities.java
+++ b/bsh/src/bsh/Capabilities.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.Hashtable;
 
@@ -67,7 +67,7 @@
 		Note that even if both are true it does not necessarily mean that we 
 		have runtime permission to access the fields... Java security has
 	 	a say in it.
-		@see bsh.ReflectManager
+		@see org.gjt.sp.jedit.bsh.ReflectManager
 	*/
 	public static boolean haveAccessibility() 
 	{
@@ -84,7 +84,7 @@
 		}
 
 		if ( !classExists( "java.lang.reflect.AccessibleObject" )
-			|| !classExists("bsh.reflect.ReflectManagerImpl")  
+			|| !classExists("org.gjt.sp.jedit.bsh.reflect.ReflectManagerImpl")  
 		)
 			throw new Unavailable( "Accessibility unavailable" );
 
--- a/bsh/src/bsh/ClassGeneratorImpl.java
+++ b/bsh/src/bsh/ClassGeneratorImpl.java
@@ -1,4 +1,4 @@
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 import java.util.*;
--- a/bsh/src/bsh/ClassGenerator.java
+++ b/bsh/src/bsh/ClassGenerator.java
@@ -1,6 +1,6 @@
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
-import bsh.Capabilities.Unavailable;
+import org.gjt.sp.jedit.bsh.Capabilities.Unavailable;
 import java.lang.reflect.InvocationTargetException;
 
 public abstract class ClassGenerator
@@ -13,7 +13,7 @@
 		if ( cg == null ) 
 		{
 			try {
-				Class clas = Class.forName( "bsh.ClassGeneratorImpl" );
+				Class clas = Class.forName( "org.gjt.sp.jedit.bsh.ClassGeneratorImpl" );
 				cg = (ClassGenerator)clas.newInstance();
 			} catch ( Exception e ) {
 				throw new Unavailable("ClassGenerator unavailable: "+e);
--- a/bsh/src/bsh/ClassGeneratorUtil.java
+++ b/bsh/src/bsh/ClassGeneratorUtil.java
@@ -31,10 +31,10 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
-import org.objectweb.asm.*;
-import org.objectweb.asm.Type;
+import org.gjt.sp.jedit.bsh.org.objectweb.asm.*;
+import org.gjt.sp.jedit.bsh.org.objectweb.asm.Type;
 
 import java.lang.reflect.*;
 import java.util.ArrayList;
@@ -199,11 +199,11 @@
 		{
 			// Generate the bsh instance 'This' reference holder field
 			generateField( 
-				BSHTHIS+className, "Lbsh/This;", ACC_PUBLIC, cw);
+				BSHTHIS+className, "Lorg/gjt/sp/jedit/bsh/This;", ACC_PUBLIC, cw);
 
 			// Generate the static bsh static reference holder field
 			generateField( 
-				BSHSTATIC+className, "Lbsh/This;", ACC_PUBLIC+ACC_STATIC, cw);
+				BSHSTATIC+className, "Lorg/gjt/sp/jedit/bsh/This;", ACC_PUBLIC+ACC_STATIC, cw);
 		}
 
 		// Generate the fields
@@ -336,7 +336,7 @@
 		if ( isStatic )
 		{
 			cv.visitFieldInsn( 
-				GETSTATIC, fqClassName, BSHSTATIC+className, "Lbsh/This;" );
+				GETSTATIC, fqClassName, BSHSTATIC+className, "Lorg/gjt/sp/jedit/bsh/This;" );
 		}else
 		{
 			// Push 'this'
@@ -344,7 +344,7 @@
 
 			// Get the instance field
 			cv.visitFieldInsn( 
-				GETFIELD, fqClassName, BSHTHIS+className, "Lbsh/This;" );
+				GETFIELD, fqClassName, BSHTHIS+className, "Lorg/gjt/sp/jedit/bsh/This;" );
 		}
 
 		// Push the name of the method as a constant
@@ -363,7 +363,7 @@
 
 		// Invoke the method This.invokeMethod( name, Class [] sig, boolean )
 		cv.visitMethodInsn(
-			INVOKEVIRTUAL, "bsh/This", "invokeMethod", 
+			INVOKEVIRTUAL, "org/gjt/sp/jedit/bsh/This", "invokeMethod",
 			Type.getMethodDescriptor( 
 				Type.getType(Object.class),
 				new Type [] { 
@@ -379,7 +379,7 @@
 
 		// Generate code to unwrap bsh Primitive types
 		cv.visitMethodInsn(
-		  INVOKESTATIC, "bsh/Primitive", "unwrap", 
+		  INVOKESTATIC, "org/gjt/sp/jedit/bsh/Primitive", "unwrap",
 		  "(Ljava/lang/Object;)Ljava/lang/Object;" );
 
 		// Generate code to return the value
@@ -427,7 +427,7 @@
 
 		// invoke the initInstance() method
 		cv.visitMethodInsn(
-			INVOKESTATIC, "bsh/ClassGeneratorUtil", "initInstance",
+			INVOKESTATIC, "org/gjt/sp/jedit/bsh/ClassGeneratorUtil", "initInstance",
 			"(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V");
 
 		cv.visitInsn( RETURN );
@@ -468,7 +468,7 @@
 
 		// push class static This object
 		cv.visitFieldInsn( 
-			GETSTATIC, fqClassName, BSHSTATIC+className, "Lbsh/This;" );
+			GETSTATIC, fqClassName, BSHSTATIC+className, "Lorg/gjt/sp/jedit/bsh/This;" );
 
 		// push args
 		cv.visitVarInsn( ALOAD, argsVar );
@@ -478,9 +478,9 @@
 
 		// invoke the ClassGeneratorUtil getConstructorsArgs() method
 		cv.visitMethodInsn(
-			INVOKESTATIC, "bsh/ClassGeneratorUtil", "getConstructorArgs",
-			"(Ljava/lang/String;Lbsh/This;[Ljava/lang/Object;I)"
-			+"Lbsh/ClassGeneratorUtil$ConstructorArgs;"
+			INVOKESTATIC, "org/gjt/sp/jedit/bsh/ClassGeneratorUtil", "getConstructorArgs",
+			"(Ljava/lang/String;Lorg/gjt/sp/jedit/bsh/This;[Ljava/lang/Object;I)"
+			+"Lorg/gjt/sp/jedit/bsh/ClassGeneratorUtil$ConstructorArgs;"
 		);
 
 		// store ConstructorArgs in consArgsVar
@@ -491,7 +491,7 @@
 		// push ConstructorArgs 
 		cv.visitVarInsn( ALOAD, consArgsVar );
 		cv.visitFieldInsn( 
-			GETFIELD, "bsh/ClassGeneratorUtil$ConstructorArgs", "selector", "I" );
+			GETFIELD, "org/gjt/sp/jedit/bsh/ClassGeneratorUtil$ConstructorArgs", "selector", "I" );
 
 		// start switch
 		cv.visitTableSwitchInsn( 
@@ -559,7 +559,7 @@
 
 			// invoke the iterator method on the ConstructorArgs
 			cv.visitVarInsn( ALOAD, consArgsVar ); // push the ConstructorArgs
-			String className = "bsh/ClassGeneratorUtil$ConstructorArgs";
+			String className = "org/gjt/sp/jedit/bsh/ClassGeneratorUtil$ConstructorArgs";
 			String retType;
 			if ( method.equals("getObject") )
 				retType = OBJECT;
@@ -580,7 +580,7 @@
 	
 	static String getMethodDescriptor( String returnType, String [] paramTypes )
 	{
-		StringBuffer sb = new StringBuffer("(");
+		StringBuilder sb = new StringBuilder("(");
 		for(int i=0; i<paramTypes.length; i++)
 			sb.append(paramTypes[i]);
 		sb.append(")"+returnType);
@@ -723,7 +723,7 @@
                     opcode = ILOAD;
                 }
 
-				String type = "bsh/Primitive";
+				String type = "org/gjt/sp/jedit/bsh/Primitive";
 				cv.visitTypeInsn( NEW, type );
 				cv.visitInsn(DUP);
 				cv.visitVarInsn(opcode, localVarIndex);
--- a/bsh/src/bsh/ClassIdentifier.java
+++ b/bsh/src/bsh/ClassIdentifier.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class ClassIdentifier 
 {
--- a/bsh/src/bsh/classpath/BshClassLoader.java
+++ b/bsh/src/bsh/classpath/BshClassLoader.java
@@ -31,12 +31,11 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.classpath;
+package org.gjt.sp.jedit.bsh.classpath;
 
 import java.net.*;
-import java.util.*;
-import java.io.*;
-import bsh.BshClassManager;
+
+import org.gjt.sp.jedit.bsh.BshClassManager;
 
 /**
 	One of the things BshClassLoader does is to address a deficiency in
@@ -56,7 +55,7 @@
 	}
 
 	/**
-		@param bases URLs JARClassLoader seems to require absolute paths 
+        @param bcp URLs JARClassLoader seems to require absolute paths
 	*/
 	public BshClassLoader( BshClassManager classManager, BshClassPath bcp ) {
 		this( classManager, bcp.getPathComponents() );
@@ -64,7 +63,7 @@
 
 	/**
 		For use by children
-		@param bases URLs JARClassLoader seems to require absolute paths 
+        @param classManager URLs JARClassLoader seems to require absolute paths
 	*/
 	protected BshClassLoader( BshClassManager classManager ) { 
 		this( classManager, new URL [] { } );
@@ -100,7 +99,7 @@
 // We should refactor this somehow if it sticks around
 		if ( name.startsWith( ClassManagerImpl.BSH_PACKAGE ) )
 			try {
-				return bsh.Interpreter.class.getClassLoader().loadClass( name );
+                return org.gjt.sp.jedit.bsh.Interpreter.class.getClassLoader().loadClass( name );
 			} catch ( ClassNotFoundException e ) {}
 
 		/*
--- a/bsh/src/bsh/classpath/BshClassPath.java
+++ b/bsh/src/bsh/classpath/BshClassPath.java
@@ -31,18 +31,18 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.classpath;
+package org.gjt.sp.jedit.bsh.classpath;
 
 import java.util.*;
 import java.util.zip.*;
 import java.io.*;
 import java.net.*;
 import java.io.File;
-import bsh.ConsoleInterface;
-import bsh.StringUtil;
-import bsh.ClassPathException;
+
+import org.gjt.sp.jedit.bsh.StringUtil;
+import org.gjt.sp.jedit.bsh.ClassPathException;
 import java.lang.ref.WeakReference;
-import bsh.NameSource;
+import org.gjt.sp.jedit.bsh.NameSource;
 
 /**
 	A BshClassPath encapsulates knowledge about a class path of URLs.
--- a/bsh/src/bsh/classpath/ClassManagerImpl.java
+++ b/bsh/src/bsh/classpath/ClassManagerImpl.java
@@ -31,20 +31,20 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.classpath;
+package org.gjt.sp.jedit.bsh.classpath;
 
 import java.net.*;
 import java.util.*;
 import java.lang.ref.*;
 import java.io.IOException;
 import java.io.*;
-import bsh.classpath.BshClassPath.ClassSource;
-import bsh.classpath.BshClassPath.JarClassSource;
-import bsh.classpath.BshClassPath.GeneratedClassSource;
-import bsh.BshClassManager;
-import bsh.ClassPathException;
-import bsh.Interpreter;  // for debug()
-import bsh.UtilEvalError; 
+import org.gjt.sp.jedit.bsh.classpath.BshClassPath.ClassSource;
+import org.gjt.sp.jedit.bsh.classpath.BshClassPath.JarClassSource;
+import org.gjt.sp.jedit.bsh.classpath.BshClassPath.GeneratedClassSource;
+import org.gjt.sp.jedit.bsh.BshClassManager;
+import org.gjt.sp.jedit.bsh.ClassPathException;
+import org.gjt.sp.jedit.bsh.Interpreter;  // for debug()
+import org.gjt.sp.jedit.bsh.UtilEvalError;
 
 /**
 	<pre>
@@ -94,7 +94,7 @@
 */
 public class ClassManagerImpl extends BshClassManager
 {
-	static final String BSH_PACKAGE = "bsh";
+	static final String BSH_PACKAGE = "org.gjt.sp.jedit.bsh";
 	/**
 		The classpath of the base loader.  Initially and upon reset() this is
 		an empty instance of BshClassPath.  It grows as paths are added or is
@@ -531,7 +531,7 @@
 		try {
 			reloadClasses( new String [] { name } );
 		} catch ( ClassPathException e ) {
-			throw new bsh.InterpreterError("defineClass: "+e);
+			throw new org.gjt.sp.jedit.bsh.InterpreterError("defineClass: "+e);
 		}
 		return classForName( name );
 	}
--- a/bsh/src/bsh/classpath/ClassPathListener.java
+++ b/bsh/src/bsh/classpath/ClassPathListener.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.classpath;
+package org.gjt.sp.jedit.bsh.classpath;
 
 public interface ClassPathListener {
 	public void classPathChanged();
--- a/bsh/src/bsh/classpath/DiscreteFilesClassLoader.java
+++ b/bsh/src/bsh/classpath/DiscreteFilesClassLoader.java
@@ -31,16 +31,12 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.classpath;
+package org.gjt.sp.jedit.bsh.classpath;
 
-import java.io.*;
-import java.io.File;
 import java.util.*;
-import java.awt.*;
-import bsh.BshClassManager;
-import bsh.classpath.BshClassPath.ClassSource;
-import bsh.classpath.BshClassPath.DirClassSource;
-import bsh.classpath.BshClassPath.GeneratedClassSource;
+
+import org.gjt.sp.jedit.bsh.BshClassManager;
+import org.gjt.sp.jedit.bsh.classpath.BshClassPath.ClassSource;
 
 /**
 	A classloader which can load one or more classes from specified sources.
--- a/bsh/src/bsh/ClassPathException.java
+++ b/bsh/src/bsh/ClassPathException.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class ClassPathException extends UtilEvalError {
 	public ClassPathException( String msg ) { super(msg); }
--- a/bsh/src/bsh/collection/CollectionIterator.java
+++ b/bsh/src/bsh/collection/CollectionIterator.java
@@ -1,12 +1,9 @@
-package bsh.collection;
+package org.gjt.sp.jedit.bsh.collection;
 
 import java.util.Iterator;
 import java.util.Collection;
-import java.util.Enumeration;
 //import java.util.Map;
 
-import java.lang.reflect.Array;
-
 /**
  *	This is the implementation of:
  *	BshIterator - a dynamically loaded extension that supports the collections
@@ -15,14 +12,14 @@
  *	@author Daniel Leuck
  *	@author Pat Niemeyer
  */
-public class CollectionIterator implements bsh.BshIterator
+public class CollectionIterator implements org.gjt.sp.jedit.bsh.BshIterator
 {
 	private Iterator iterator;
 
 	/**
 	 * Construct a basic CollectionIterator
 	 *
-	 * @param The object over which we are iterating
+     * @param iterateOverMe The object over which we are iterating
 	 *
 	 * @throws java.lang.IllegalArgumentException If the argument is not a
 	 * supported (i.e. iterable) type.
--- a/bsh/src/bsh/collection/CollectionManagerImpl.java
+++ b/bsh/src/bsh/collection/CollectionManagerImpl.java
@@ -31,20 +31,19 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.collection;
+package org.gjt.sp.jedit.bsh.collection;
 
 import java.util.Iterator;
 import java.util.Collection;
-import java.util.Enumeration;
 import java.util.Map;
-import java.lang.reflect.Array;
-import bsh.BshIterator;
+
+import org.gjt.sp.jedit.bsh.BshIterator;
 
 /**
 	Dynamically loaded extension supporting post 1.1 collections iterator.
  	@author Pat Niemeyer
  */
-public class CollectionManagerImpl extends bsh.CollectionManager
+public class CollectionManagerImpl extends org.gjt.sp.jedit.bsh.CollectionManager
 {
 	public BshIterator getBshIterator( Object obj ) 
 		throws IllegalArgumentException
@@ -52,7 +51,7 @@
 		if ( obj instanceof Collection || obj instanceof Iterator )
 			return new CollectionIterator( obj ); 
 		else
-			return new bsh.CollectionManager.BasicBshIterator( obj ); 
+			return new org.gjt.sp.jedit.bsh.CollectionManager.BasicBshIterator( obj );
 	}
 
 	public boolean isMap( Object obj ) 
--- a/bsh/src/bsh/CollectionManager.java
+++ b/bsh/src/bsh/CollectionManager.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.Enumeration;
 import java.util.Vector;
@@ -44,8 +44,6 @@
 	Enumeration, Vector, String, StringBuffer and array.
 	The dynamically loaded CollectionManagerImpl supports additional types when
 	it is present.
-
-	@see BshIterable.java
 */
 public class CollectionManager
 {
@@ -58,7 +56,7 @@
 		{
 			Class clas;
 			try {
-				clas = Class.forName( "bsh.collection.CollectionManagerImpl" );
+                clas = Class.forName( "org.gjt.sp.jedit.bsh.collection.CollectionManagerImpl" );
 				manager = (CollectionManager)clas.newInstance();
 			} catch ( Exception e ) {
 				Interpreter.debug("unable to load CollectionManagerImpl: "+e);
@@ -119,7 +117,7 @@
 		/**
 		 * Construct a basic BasicBshIterator
 		 *
-		 * @param The object over which we are iterating
+         * @param iterateOverMe The object over which we are iterating
 		 *
 		 * @throws java.lang.IllegalArgumentException If the argument is not a
 		 * supported (i.e. iterable) type.
@@ -173,6 +171,10 @@
 				return createEnumeration(
 					iterateOverMe.toString().toCharArray());
 
+            if (iterateOverMe instanceof StringBuilder)
+                return createEnumeration(
+                    iterateOverMe.toString().toCharArray());
+
 			throw new IllegalArgumentException(
 				"Cannot enumerate object of type "+iterateOverMe.getClass());
 		}
--- a/bsh/src/bsh/CommandLineReader.java
+++ b/bsh/src/bsh/CommandLineReader.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 
--- a/bsh/src/bsh/commands/addClassPath.bsh
+++ b/bsh/src/bsh/commands/addClassPath.bsh
@@ -16,7 +16,7 @@
 bsh.help.addClassPath= "usage: addClassPath( string | URL )";
 
 import java.net.URL;
-import bsh.BshClassManager;
+import org.gjt.sp.jedit.bsh.BshClassManager;
 
 addClassPath( path ) {
 	URL url;
--- a/bsh/src/bsh/commands/bind.bsh
+++ b/bsh/src/bsh/commands/bind.bsh
@@ -1,10 +1,10 @@
 /**
 	Bind a bsh object into a particular namespace and interpreter
 */
-import bsh.This;
-import bsh.NameSpace;
+import org.gjt.sp.jedit.bsh.This;
+import org.gjt.sp.jedit.bsh.NameSpace;
 
-bind( bsh.This ths, bsh.NameSpace namespace ) {
+bind( org.gjt.sp.jedit.bsh.This ths, bsh.NameSpace namespace ) {
 	This.bind( ths, namespace, this.interpreter );
 }
 
--- a/bsh/src/bsh/commands/browseClass.bsh
+++ b/bsh/src/bsh/commands/browseClass.bsh
@@ -12,7 +12,7 @@
 
 	@method void browseClass( String | Object | Class )
 */
-import bsh.ClassIdentifier;
+import org.gjt.sp.jedit.bsh.ClassIdentifier;
 
 browseClass( Object o ) 
 {
--- a/bsh/src/bsh/commands/classBrowser.bsh
+++ b/bsh/src/bsh/commands/classBrowser.bsh
@@ -1,7 +1,7 @@
 /**
 	Open the class browser.
 */
-import bsh.util.ClassBrowser;
+import org.gjt.sp.jedit.bsh.util.ClassBrowser;
 
 classBrowser() 
 {
--- a/bsh/src/bsh/commands/desktop.bsh
+++ b/bsh/src/bsh/commands/desktop.bsh
@@ -10,11 +10,11 @@
  
 import javax.swing.*;
 import javax.swing.border.*;
-import bsh.util.JConsole;
-import bsh.util.Util;
-import bsh.Interpreter;
+import org.gjt.sp.jedit.bsh.util.JConsole;
+import org.gjt.sp.jedit.bsh.util.Util;
+import org.gjt.sp.jedit.bsh.Interpreter;
 import java.awt.Component;
-import bsh.Capabilities;
+import org.gjt.sp.jedit.bsh.Capabilities;
 
 desktop() 
 {
@@ -199,7 +199,7 @@
 
 	if ( Capabilities.canGenerateInterfaces() ) 
 	{
-		import bsh.classpath.BshClassPath;
+		import org.gjt.sp.jedit.bsh.classpath.BshClassPath;
 		classFeedbackListener = new BshClassPath.MappingFeedback() 
 		{
 			startClassMapping() { }
--- a/bsh/src/bsh/commands/dir.java
+++ b/bsh/src/bsh/commands/dir.java
@@ -5,12 +5,11 @@
 	
 	@method void dir( [ String dirname ] )
 */
-package bsh.commands;
+package org.gjt.sp.jedit.bsh.commands;
 
 import java.io.*;
-import bsh.*;
+import org.gjt.sp.jedit.bsh.*;
 import java.util.Date;
-import java.util.Vector;
 import java.util.GregorianCalendar;
 import java.util.Calendar;
 
@@ -61,7 +60,7 @@
 
 		for( int i=0; i< files.length; i++ ) {
 			File f = new File( path + File.separator + files[i] );
-			StringBuffer sb = new StringBuffer();
+			StringBuilder sb = new StringBuilder();
 			sb.append( f.canRead() ? "r": "-" );
 			sb.append( f.canWrite() ? "w": "-" );
 			sb.append( "_" );
@@ -79,7 +78,7 @@
 
 			// hack to get fixed length 'length' field
 			int fieldlen = 8;
-			StringBuffer len = new StringBuffer();
+			StringBuilder len = new StringBuilder();
 			for(int j=0; j<fieldlen; j++)
 				len.append(" ");
 			len.insert(0, f.length());
--- a/bsh/src/bsh/commands/extend.bsh
+++ b/bsh/src/bsh/commands/extend.bsh
@@ -42,7 +42,7 @@
 	@method This extend( This object )
 */
 bsh.help.extend= "usage: extend( This parent )";
-extend( bsh.This parent ) 
+extend( org.gjt.sp.jedit.bsh.This parent ) 
 {
 	this.namespace.setParent( parent.namespace );
 	return this; 
--- a/bsh/src/bsh/commands/frame.bsh
+++ b/bsh/src/bsh/commands/frame.bsh
@@ -15,7 +15,7 @@
 bsh.help.frame = "usage: frame( Component component )";
  
 import java.awt.*;
-import bsh.Capabilities;
+import org.gjt.sp.jedit.bsh.Capabilities;
 
 frame( Component comp ) 
 {
--- a/bsh/src/bsh/commands/getClassPath.bsh
+++ b/bsh/src/bsh/commands/getClassPath.bsh
@@ -4,7 +4,7 @@
 */
 
 bsh.help.getClassPath= "usage: getClassPath()";
-import bsh.BshClassManager;
+import org.gjt.sp.jedit.bsh.BshClassManager;
 
 URL [] getClassPath() {
 	this.cp = this.caller.namespace.getClassManager().getClassPath();
--- a/bsh/src/bsh/commands/getResource.bsh
+++ b/bsh/src/bsh/commands/getResource.bsh
@@ -6,7 +6,7 @@
 
 bsh.help.getResource = "usage: getResource( String name )";
 
-import bsh.Interpreter;
+import org.gjt.sp.jedit.bsh.Interpreter;
 
 URL getResource( String path ) 
 {
--- a/bsh/src/bsh/commands/getSourceFileInfo.bsh
+++ b/bsh/src/bsh/commands/getSourceFileInfo.bsh
@@ -20,7 +20,7 @@
 
 bsh.help.getSourceFileInfo = "usage: getSourceFileInfo()";
 
-import bsh.Interpreter;
+import org.gjt.sp.jedit.bsh.Interpreter;
 
 getSourceFileInfo() {
 	return this.interpreter.getSourceFileInfo();
--- a/bsh/src/bsh/commands/javap.bsh
+++ b/bsh/src/bsh/commands/javap.bsh
@@ -21,7 +21,7 @@
 
 bsh.help.javap= "usage: javap( value )";
 
-import bsh.ClassIdentifier;
+import org.gjt.sp.jedit.bsh.ClassIdentifier;
 import java.lang.reflect.Modifier;
 
 javap( Object o ) 
--- a/bsh/src/bsh/commands/load.bsh
+++ b/bsh/src/bsh/commands/load.bsh
@@ -6,13 +6,13 @@
 
 setAccessibility(true);
 
-import bsh.BshClassManager;
+import org.gjt.sp.jedit.bsh.BshClassManager;
 import java.io.*;
 import java.lang.reflect.Proxy;
 
-import bsh.Capabilities;
+import org.gjt.sp.jedit.bsh.Capabilities;
 
-if ( Capabilities.classExists("bsh.ClassGeneratorImpl") )
+if ( Capabilities.classExists("org.gjt.sp.jedit.bsh.ClassGeneratorImpl") )
 {
 public class BshObjectInputStream extends ObjectInputStream
 {
@@ -81,7 +81,7 @@
 	oin.close();
 
 	// bind bsh objects into the caller's namespace
-	if ( obj instanceof bsh.This )
+	if ( obj instanceof org.gjt.sp.jedit.bsh.This )
 		bind( obj, this.caller.namespace );
 
 	return obj;
--- a/bsh/src/bsh/commands/makeWorkspace.bsh
+++ b/bsh/src/bsh/commands/makeWorkspace.bsh
@@ -9,11 +9,11 @@
  */
 
 import javax.swing.*;
-import bsh.Interpreter;
-import bsh.BshClassManager;
-import bsh.ClassPathException;
-import bsh.util.JConsole;
-import bsh.util.NameCompletionTable;
+import org.gjt.sp.jedit.bsh.Interpreter;
+import org.gjt.sp.jedit.bsh.BshClassManager;
+import org.gjt.sp.jedit.bsh.ClassPathException;
+import org.gjt.sp.jedit.bsh.util.JConsole;
+import org.gjt.sp.jedit.bsh.util.NameCompletionTable;
 
 makeWorkspace( String name ) 
 {
--- a/bsh/src/bsh/commands/printBanner.bsh
+++ b/bsh/src/bsh/commands/printBanner.bsh
@@ -6,9 +6,9 @@
 
 import javax.swing.ImageIcon;
 import java.awt.*;
-import bsh.Interpreter;
-import bsh.Capabilities;
-import bsh.util.JConsole;
+import org.gjt.sp.jedit.bsh.Interpreter;
+import org.gjt.sp.jedit.bsh.Capabilities;
+import org.gjt.sp.jedit.bsh.util.JConsole;
 
 /*
 	Note: any errors thrown in here will be caught by interpreter and
--- a/bsh/src/bsh/commands/print.bsh
+++ b/bsh/src/bsh/commands/print.bsh
@@ -13,9 +13,9 @@
 	instead of print().
 */
 bsh.help.print = "usage: print( value )";
-import bsh.CollectionManager;
-import bsh.StringUtil;
-import bsh.Primitive;
+import org.gjt.sp.jedit.bsh.CollectionManager;
+import org.gjt.sp.jedit.bsh.StringUtil;
+import org.gjt.sp.jedit.bsh.Primitive;
 
 void print( arg ) 
 {
--- a/bsh/src/bsh/commands/reloadClasses.bsh
+++ b/bsh/src/bsh/commands/reloadClasses.bsh
@@ -19,7 +19,7 @@
 bsh.help.reloadClasses= 
 	"usage: reloadClasses( String class | String package | String [] classes )";
 
-import bsh.ClassPathException;
+import org.gjt.sp.jedit.bsh.ClassPathException;
 
 void reloadClasses( item ) 
 {
--- a/bsh/src/bsh/commands/save.bsh
+++ b/bsh/src/bsh/commands/save.bsh
@@ -15,7 +15,7 @@
 
 	// Detach bsh objects from the caller's namespace during serialization
 	// NOTE: THIS IS NOT THREAD SAFE
-	if ( obj instanceof bsh.This ) {
+	if ( obj instanceof org.gjt.sp.jedit.bsh.This ) {
 		super.parent = obj.namespace.getParent();
 		obj.namespace.prune();
 	}
@@ -27,7 +27,7 @@
 
 	// Reattach bsh objects to the caller's namespace after serialization
 	// NOTE: THIS IS NOT THREAD SAFE
-	if ( obj instanceof bsh.This ) 
+	if ( obj instanceof org.gjt.sp.jedit.bsh.This ) 
 		obj.namespace.setParent( super.parent );
 }
 
--- a/bsh/src/bsh/commands/server.bsh
+++ b/bsh/src/bsh/commands/server.bsh
@@ -2,8 +2,8 @@
 	Create a remote BeanShell listener service attached to 
 	the current interpreter, listening on the specified port.
 */
-import bsh.util.Httpd;
-import bsh.util.Sessiond;
+import org.gjt.sp.jedit.bsh.util.Httpd;
+import org.gjt.sp.jedit.bsh.util.Sessiond;
 
 bsh.help.server = "usage: server(int port)";
 
--- a/bsh/src/bsh/commands/setAccessibility.bsh
+++ b/bsh/src/bsh/commands/setAccessibility.bsh
@@ -2,7 +2,7 @@
 	Setting accessibility on enables to private and other non-public
 	fields and method.
 */
-import bsh.Capabilities;
+import org.gjt.sp.jedit.bsh.Capabilities;
 
 setAccessibility( boolean b ) 
 {
--- a/bsh/src/bsh/commands/which.bsh
+++ b/bsh/src/bsh/commands/which.bsh
@@ -26,7 +26,7 @@
 
 bsh.help.which= "usage: which( classIdentifier | string | class )";
 
-import bsh.ClassIdentifier;
+import org.gjt.sp.jedit.bsh.ClassIdentifier;
 
 which( clas ) 
 {
--- a/bsh/src/bsh/commands/workspaceEditor.bsh
+++ b/bsh/src/bsh/commands/workspaceEditor.bsh
@@ -10,7 +10,7 @@
  */
  
 import java.awt.Insets;
-import bsh.Interpreter;
+import org.gjt.sp.jedit.bsh.Interpreter;
 
 workspaceEditor(Interpreter parent, String name ) 
 {
--- a/bsh/src/bsh/ConsoleInterface.java
+++ b/bsh/src/bsh/ConsoleInterface.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 
@@ -42,7 +42,6 @@
 
 	A simple console may ignore some of these or map them to trivial
 	implementations.  e.g. print() with color can be mapped to plain text.
-	@see bsh.util.GUIConsoleInterface
 */
 public interface ConsoleInterface {
 	public Reader getIn();
--- a/bsh/src/bsh/DelayedEvalBshMethod.java
+++ b/bsh/src/bsh/DelayedEvalBshMethod.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class DelayedEvalBshMethod extends BshMethod
 {
--- a/bsh/src/bsh/EvalError.java
+++ b/bsh/src/bsh/EvalError.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	EvalError indicates that we cannot continue evaluating the script
--- a/bsh/src/bsh/ExternalNameSpace.java
+++ b/bsh/src/bsh/ExternalNameSpace.java
@@ -1,4 +1,4 @@
-package	bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.*;
 
--- a/bsh/src/bsh/InterpreterError.java
+++ b/bsh/src/bsh/InterpreterError.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	An internal error in the interpreter has occurred.
--- a/bsh/src/bsh/Interpreter.java
+++ b/bsh/src/bsh/Interpreter.java
@@ -31,9 +31,8 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
-import java.util.Vector;
 import java.io.*;
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
@@ -197,7 +196,7 @@
 		/* 
 			Create the root "bsh" system object if it doesn't exist.
 		*/
-		if ( ! ( getu("bsh") instanceof bsh.This ) )
+		if ( ! ( getu("bsh") instanceof org.gjt.sp.jedit.bsh.This ) )
 			initRootSystemObject();
 
 		if ( interactive )
@@ -1136,7 +1135,7 @@
 		sourcing and from what file a method was originally parsed.  One
 		file may call a method sourced from another file.  See SimpleNode
 		for origination file info.
-		@see bsh.SimpleNode#getSourceFile()
+		@see org.gjt.sp.jedit.bsh.SimpleNode#getSourceFile()
 	*/
 	public String getSourceFileInfo() { 
 		if ( sourceFileInfo != null )
--- a/bsh/src/bsh/JavaCharStream.java
+++ b/bsh/src/bsh/JavaCharStream.java
@@ -1,5 +1,5 @@
 /* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 3.0 */
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
  * An implementation of interface CharStream, where the stream is assumed to
--- a/bsh/src/bsh/JJTParserState.java
+++ b/bsh/src/bsh/JJTParserState.java
@@ -1,6 +1,6 @@
 /* Generated By:JJTree: Do not edit this line. src/bsh/JJTParserState.java */
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class JJTParserState {
   private java.util.Stack nodes;
--- a/bsh/src/bsh/JThis.java
+++ b/bsh/src/bsh/JThis.java
@@ -32,12 +32,10 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.awt.event.*;
-import javax.swing.*;
 import javax.swing.event.*;
-import java.io.*;
 import java.beans.*;
 
 /**
--- a/bsh/src/bsh/LHS.java
+++ b/bsh/src/bsh/LHS.java
@@ -32,10 +32,9 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Field;
-import java.util.Hashtable;
 
 /**
 	An LHS is a wrapper for an variable, field, or property.  It ordinarily 
--- a/bsh/src/bsh/Modifiers.java
+++ b/bsh/src/bsh/Modifiers.java
@@ -1,4 +1,4 @@
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.Hashtable;
 
--- a/bsh/src/bsh/Name.java
+++ b/bsh/src/bsh/Name.java
@@ -32,13 +32,10 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.Array;
-import java.util.Hashtable;
-import java.io.*;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 
 /**
 	What's in a name?  I'll tell you...
--- a/bsh/src/bsh/NameSource.java
+++ b/bsh/src/bsh/NameSource.java
@@ -31,8 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
-import java.util.*;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	This interface supports name completion, which is used primarily for 
@@ -46,8 +45,6 @@
 	fasion.  However in general name competion is used for human interaction
 	and therefore does not require high performance.
 	<p>
-	@see bsh.util.NameCompletion
-	@see bsh.util.NameCompletionTable
 */
 public interface NameSource 
 {
--- a/bsh/src/bsh/NameSpace.java
+++ b/bsh/src/bsh/NameSpace.java
@@ -32,12 +32,11 @@
  *****************************************************************************/
 
 
-package	bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.*;
 
 import java.io.InputStream;
-import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.IOException;
 
@@ -161,9 +160,10 @@
 	// Begin constructors
 
 	/**
-		@parent the parent namespace of this namespace.  Child namespaces
+        @param parent the parent namespace of this namespace.  Child namespaces
 		inherit all variables and methods of their parent and can (of course)
 		override / shadow them.
+        @param name a name
 	*/
     public NameSpace( NameSpace parent, String name ) 
 	{
@@ -247,7 +247,7 @@
 		Note: this method is primarily intended for use internally.  If you use
 		this method outside of the bsh package and wish to set variables with
 		primitive values you will have to wrap them using bsh.Primitive.
-		@see bsh.Primitive
+        @see org.gjt.sp.jedit.bsh.Primitive
 		<p>
 		Setting a new variable (which didn't exist before) or removing
 		a variable causes a namespace change.
@@ -286,7 +286,7 @@
 		Note: this method is primarily intended for use internally.  If you use
 		this method outside of the bsh package and wish to set variables with
 		primitive values you will have to wrap them using bsh.Primitive.
-		@see bsh.Primitive
+        @see org.gjt.sp.jedit.bsh.Primitive
 		<p>
 		Setting a new variable (which didn't exist before) or removing
 		a variable causes a namespace change.
@@ -303,9 +303,17 @@
 			variables =	new Hashtable();
 
 		// primitives should have been wrapped
-		if ( value == null )
-			throw new InterpreterError("null variable value");
+        // {{{ jEdit change
+        //if ( value == null )
+        //	throw new InterpreterError("null variable value");
+
+        if ( value == null ) {
+            // don't break jEdit core and plugins!
+            unsetVariable(name);
+            return;
+        }
 
+        // }}}
 		// Locate the variable definition if it exists.
 		Variable existing = getVariableImpl( name, recurse );
 
@@ -675,7 +683,7 @@
 		Note: this method is primarily intended for use internally.  If you use
 		this method outside of the bsh package and wish to set variables with
 		primitive values you will have to wrap them using bsh.Primitive.
-		@see bsh.Primitive
+        @see org.gjt.sp.jedit.bsh.Primitive
 
 		@param value If value is null, you'll get the default value for the type
 		@param modifiers may be null
@@ -751,16 +759,56 @@
 
 		Object m = methods.get(name);
 
-		if ( m == null )
+        //{{{ jEdit version: properly handle methods with same signature.
+        if (m == null)
+            methods.put(name, method);
+        else if (m instanceof BshMethod)
+        {
+            // is the new method overriding the old method?
+            if (Arrays.equals(((BshMethod)m).getParameterTypes(),
+                              method.getParameterTypes()))
+            {
 			methods.put(name, method);
+            }
 		else 
-		if ( m instanceof BshMethod ) {
+            {
 			Vector v = new Vector();
 			v.addElement( m );
 			v.addElement( method );
 			methods.put( name, v );
-		} else // Vector
-			((Vector)m).addElement( method );
+            }
+        }
+        else
+        {
+            Vector _methods = (Vector) m;
+            for (int i = 0; i < _methods.size(); i++)
+            {
+                // Check whether the new method overrides some old
+                // method in the list.
+                BshMethod _old_m = (BshMethod) _methods.get(i);
+                if (Arrays.equals(_old_m.getParameterTypes(),
+                                  method.getParameterTypes()))
+                {
+                    _methods.remove(i);
+                    break;
+                }
+            }
+            _methods.addElement( method );
+        }
+        //}}}
+
+        //{{{ Original BeanShell code
+        // if ( m == null )
+        // 	methods.put(name, method);
+        // else
+        // if ( m instanceof BshMethod ) {
+        // 	Vector v = new Vector();
+        // 	v.addElement( m );
+        // 	v.addElement( method );
+        // 	methods.put( name, v );
+        // } else // Vector
+        // 	((Vector)m).addElement( method );
+        //}}}
     }
 
 	/**
@@ -780,7 +828,7 @@
 		Note: this method is primarily intended for use internally.  If you use
 		this method outside of the bsh package you will have to be familiar
 		with BeanShell's use of the Primitive wrapper class.
-		@see bsh.Primitive
+        @see org.gjt.sp.jedit.bsh.Primitive
 		@return the BshMethod or null if not found
 		@param declaredOnly if true then only methods declared directly in this
 			namespace will be found and no inherited or imported methods will
@@ -922,6 +970,39 @@
 		@throws UtilEvalError if loadScriptedCommand throws UtilEvalError
 			i.e. on errors loading a script that was found
 	*/
+    // {{{ jEdit's getCommand
+    public Object getCommand(
+        String name, Class [] argTypes, Interpreter interpreter )
+        throws UtilEvalError
+    {
+        if (Interpreter.DEBUG) Interpreter.debug("getCommand: "+name);
+        BshClassManager bcm = interpreter.getClassManager();
+
+        InputStream in = getCommand( name );
+
+        if ( in != null )
+            return loadScriptedCommand(
+                in, name, argTypes, name, interpreter );
+
+        /* // Chop leading "/" and change "/" to "."
+        String className;
+        if ( path.equals("/") )
+            className = name;
+        else
+            className = path.substring(1).replace('/','.') +"."+name;
+
+        Class clas = bcm.classForName( className );
+        if ( clas != null )
+            return clas; */
+
+        if ( parent != null )
+            return parent.getCommand( name, argTypes, interpreter );
+        else
+            return null;
+    }
+
+
+    /*
 	public Object getCommand( 	
 		String name, Class [] argTypes, Interpreter interpreter ) 
 		throws UtilEvalError
@@ -968,8 +1049,8 @@
 			return parent.getCommand( name, argTypes, interpreter );
 		else
 			return null;
-	}
-
+    }   */
+    // }}}
 	protected BshMethod getImportedMethod( String name, Class [] sig ) 
 		throws UtilEvalError
 	{
@@ -1336,9 +1417,7 @@
 		required.  The method will appear as if called externally from Java.
 		<p>
 
-		@see bsh.This.invokeMethod( 
-			String methodName, Object [] args, Interpreter interpreter, 
-			CallStack callstack, SimpleNode callerInfo, boolean )
+        @see org.gjt.sp.jedit.bsh.This#invokeMethod(String methodName, Object [] args, Interpreter interpreter,	CallStack callstack, SimpleNode callerInfo, boolean ) invokeMethod
 	*/
 	public Object invokeMethod( 
 		String methodName, Object [] args, Interpreter interpreter ) 
@@ -1351,9 +1430,7 @@
 	/**
 		This method simply delegates to This.invokeMethod();
 		<p>
-		@see bsh.This.invokeMethod( 
-			String methodName, Object [] args, Interpreter interpreter, 
-			CallStack callstack, SimpleNode callerInfo )
+        @see org.gjt.sp.jedit.bsh.This#invokeMethod(String methodName, Object [] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean declaredOnly ) invokeMethod
 	*/
 	public Object invokeMethod( 
 		String methodName, Object [] args, Interpreter interpreter, 
@@ -1383,8 +1460,8 @@
 	/**
 		Import standard packages.  Currently:
 		<pre>
-			importClass("bsh.EvalError");
-			importClass("bsh.Interpreter");
+            importClass("org.gjt.sp.jedit.bsh.EvalError");
+            importClass("org.gjt.sp.jedit.bsh.Interpreter");
 			importPackage("javax.swing.event");
 			importPackage("javax.swing");
 			importPackage("java.awt.event");
@@ -1393,7 +1470,7 @@
 			importPackage("java.util");
 			importPackage("java.io");
 			importPackage("java.lang");
-			importCommands("/bsh/commands");
+            addCommandPath("/org/gjt/sp/jedit/bsh/commands",getClass());
 		</pre>
 	*/
     public void loadDefaultImports()
@@ -1403,8 +1480,8 @@
 			precedence rules...  so for max efficiency put the most common
 			ones later.
 		*/
-		importClass("bsh.EvalError");
-		importClass("bsh.Interpreter");
+        importClass("org.gjt.sp.jedit.bsh.EvalError");
+        importClass("org.gjt.sp.jedit.bsh.Interpreter");
 		importPackage("javax.swing.event");
 		importPackage("javax.swing");
 		importPackage("java.awt.event");
@@ -1413,7 +1490,7 @@
 		importPackage("java.util");
 		importPackage("java.io");
 		importPackage("java.lang");
-		importCommands("/bsh/commands");
+        addCommandPath("/org/gjt/sp/jedit/bsh/commands",getClass());
     }
 
 	/**
@@ -1562,5 +1639,82 @@
 		
 		return null;
 	}
+
+    // {{{ jEdit addition
+    public void setVariable(String name, Object value) throws UtilEvalError
+        {
+                setVariable(name,value,false);
+        }
+
+    /**
+        Adds a URL to the command path.
+    */
+    public void addCommandPath(String path, Class clas)
+    {
+        if(importedCommands == null)
+            importedCommands = new Vector();
+
+        if(!path.endsWith("/"))
+            path += '/';
+        importedCommands.addElement(new CommandPathEntry(path,clas));
+    }
+
+    /**
+        Remove a URLfrom the command path.
+    */
+    public void removeCommandPath(String path, Class clas)
+    {
+        if(importedCommands == null)
+            return;
+
+        for(int i = 0; i < importedCommands.size(); i++)
+        {
+            CommandPathEntry entry = (CommandPathEntry)importedCommands
+                .elementAt(i);
+            if(entry.path.equals(path) && entry.clas == clas)
+            {
+                importedCommands.removeElementAt(i);
+                return;
+            }
+        }
+    }
+
+    /**
+        Looks up a command.
+    */
+    public InputStream getCommand(String name)
+    {
+        if(importedCommands != null)
+        {
+            String extName = name + ".bsh";
+            for(int i = importedCommands.size() - 1; i >= 0; i--)
+            {
+                CommandPathEntry entry = (CommandPathEntry)importedCommands
+                    .elementAt(i);
+                InputStream in = entry.clas.getResourceAsStream(entry.path + extName);
+                if(in != null)
+                    return in;
+            }
+        }
+
+        if(parent == null)
+            return null;
+        else
+            return parent.getCommand(name);
+    }
+
+    static class CommandPathEntry
+    {
+        final String path;
+        final Class clas;
+
+        CommandPathEntry(String path, Class clas)
+        {
+            this.path = path;
+            this.clas = clas;
+        }
+    }
+
+    // }}}
 }
 
--- a/bsh/src/bsh/Node.java
+++ b/bsh/src/bsh/Node.java
@@ -34,7 +34,7 @@
 
 /* Generated By:JJTree: Do not edit this line. Node.java */
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /*
 	All BSH nodes must implement this interface.  It provides basic
--- a/bsh/src/bsh/ParseException.java
+++ b/bsh/src/bsh/ParseException.java
@@ -29,7 +29,7 @@
 
 */
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
  * This exception is thrown when parse errors are encountered.
@@ -219,7 +219,7 @@
    * string literal.
    */
   protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
+      StringBuilder retval = new StringBuilder();
       char ch;
       for (int i = 0; i < str.length(); i++) {
         switch (str.charAt(i))
--- a/bsh/src/bsh/ParserConstants.java
+++ b/bsh/src/bsh/ParserConstants.java
@@ -1,5 +1,5 @@
 /* Generated By:JJTree&JavaCC: Do not edit this line. ParserConstants.java */
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public interface ParserConstants {
 
--- a/bsh/src/bsh/Parser.java
+++ b/bsh/src/bsh/Parser.java
@@ -1,5 +1,5 @@
 /* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 import java.util.Vector;
@@ -982,10 +982,10 @@
     boolean jjtc000 = true;
     jjtree.openNodeScope(jjtn000);
     jjtreeOpenNodeScope(jjtn000);Token t;
-    StringBuffer s;
+    StringBuilder s;
     try {
       t = jj_consume_token(IDENTIFIER);
-        s = new StringBuffer(t.image);
+        s = new StringBuilder(t.image);
       label_5:
       while (true) {
         if (jj_2_7(2)) {
--- a/bsh/src/bsh/ParserTokenManager.java
+++ b/bsh/src/bsh/ParserTokenManager.java
@@ -1,5 +1,5 @@
 /* Generated By:JJTree&JavaCC: Do not edit this line. ParserTokenManager.java */
-package bsh;
+package org.gjt.sp.jedit.bsh;
 import java.io.*;
 import java.util.Vector;
 
--- a/bsh/src/bsh/ParserTreeConstants.java
+++ b/bsh/src/bsh/ParserTreeConstants.java
@@ -1,6 +1,6 @@
 /* Generated By:JJTree: Do not edit this line. src/bsh/ParserTreeConstants.java */
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public interface ParserTreeConstants
 {
--- a/bsh/src/bsh/Primitive.java
+++ b/bsh/src/bsh/Primitive.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.Hashtable;
 
--- a/bsh/src/bsh/reflect/ReflectManagerImpl.java
+++ b/bsh/src/bsh/reflect/ReflectManagerImpl.java
@@ -31,9 +31,9 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh.reflect;
+package org.gjt.sp.jedit.bsh.reflect;
 
-import bsh.ReflectManager;
+import org.gjt.sp.jedit.bsh.ReflectManager;
 import java.lang.reflect.AccessibleObject;
 
 /**
--- a/bsh/src/bsh/ReflectError.java
+++ b/bsh/src/bsh/ReflectError.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 class ReflectError extends Exception
 {
--- a/bsh/src/bsh/Reflect.java
+++ b/bsh/src/bsh/Reflect.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.*;
 import java.util.Vector;
@@ -846,7 +846,7 @@
         if ( !type.isArray() )
             return type.getName();
 
-        StringBuffer className = new StringBuffer();
+        StringBuilder className = new StringBuilder();
         try {
             className.append( getArrayBaseType(type).getName() +" ");
             for(int i = 0; i < getArrayDimensions(type); i++)
--- a/bsh/src/bsh/Reflect.last
+++ b/bsh/src/bsh/Reflect.last
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.*;
 import java.io.*;
--- a/bsh/src/bsh/ReflectManager.java
+++ b/bsh/src/bsh/ReflectManager.java
@@ -31,9 +31,9 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
-import bsh.Capabilities.Unavailable;
+import org.gjt.sp.jedit.bsh.Capabilities.Unavailable;
 
 /**
 	ReflectManager is a dynamically loaded extension that supports extended
@@ -57,7 +57,7 @@
 		{
 			Class clas;
 			try {
-				clas = Class.forName( "bsh.reflect.ReflectManagerImpl" );
+				clas = Class.forName( "org.gjt.sp.jedit.bsh.reflect.ReflectManagerImpl" );
 				rfm = (ReflectManager)clas.newInstance();
 			} catch ( Exception e ) {
 				throw new Unavailable("Reflect Manager unavailable: "+e);
--- a/bsh/src/bsh/Remote.java
+++ b/bsh/src/bsh/Remote.java
@@ -31,11 +31,11 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.io.*;
 import java.net.*;
-import java.text.*;
+
 /**
 	Remote executor class. Posts a script from the command line to a BshServlet
  	or embedded  interpreter using (respectively) HTTP or the bsh telnet
@@ -146,7 +146,7 @@
 	static String doHttp( String postURL, String text )
 	{
 		String returnValue = null;
-		StringBuffer sb = new StringBuffer();
+		StringBuilder sb = new StringBuilder();
 		sb.append( "bsh.client=Remote" );
 		sb.append( "&bsh.script=" );
 		sb.append( URLEncoder.encode( text ) );
@@ -204,7 +204,7 @@
 	static String getFile( String name )
 		throws FileNotFoundException, IOException
 	{
-		StringBuffer sb = new StringBuffer();
+		StringBuilder sb = new StringBuilder();
 		BufferedReader bin = new BufferedReader( new FileReader( name ) );
 		String line;
 		while ( (line=bin.readLine()) != null )
--- a/bsh/src/bsh/ReturnControl.java
+++ b/bsh/src/bsh/ReturnControl.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	Represents a Return, Break, or Continue statement
--- a/bsh/src/bsh/SimpleNode.java
+++ b/bsh/src/bsh/SimpleNode.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 /*
 	Note: great care (and lots of typing) were taken to insure that the
 	namespace and interpreter references are passed on the stack and not 
@@ -206,7 +206,7 @@
 	*/
 	public String getText() 
 	{
-		StringBuffer text = new StringBuffer();
+		StringBuilder text = new StringBuilder();
 		Token t = firstToken;
 		while ( t!=null ) {
 			text.append(t.image);
--- a/bsh/src/bsh/StringUtil.java
+++ b/bsh/src/bsh/StringUtil.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.util.*;
 
@@ -81,7 +81,7 @@
 
     public static String methodString(String name, Class[] types)
     {
-        StringBuffer sb = new StringBuffer(name + "(");
+    	StringBuilder sb = new StringBuilder(name + "(");
         if ( types.length > 0 )
 			sb.append(" ");
         for( int i=0; i<types.length; i++ )
--- a/bsh/src/bsh/TargetError.java
+++ b/bsh/src/bsh/TargetError.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.InvocationTargetException;
 
--- a/bsh/src/bsh/This.java
+++ b/bsh/src/bsh/This.java
@@ -32,9 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
-
-import java.io.IOException;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	'This' is the type of bsh scripted objects.
@@ -82,9 +80,9 @@
 		try {
 			Class c;
 			if ( Capabilities.canGenerateInterfaces() )
-				c = Class.forName( "bsh.XThis" );
+                c = Class.forName( "org.gjt.sp.jedit.bsh.XThis" );
 			else if ( Capabilities.haveSwing() )
-				c = Class.forName( "bsh.JThis" );
+                c = Class.forName( "org.gjt.sp.jedit.bsh.JThis" );
 			else
 				return new This( namespace, declaringInterpreter );
 
@@ -165,7 +163,7 @@
 		outside of bsh in native java code.
 		Note: you must still wrap/unwrap args/return values using 
 		Primitive/Primitive.unwrap() for use outside of BeanShell.
-		@see bsh.Primitive
+        @see org.gjt.sp.jedit.bsh.Primitive
 	*/
 	public Object invokeMethod( String name, Object [] args ) 
 		throws EvalError
@@ -197,15 +195,13 @@
 		have to script them directly.
 		<p>
 
-		@see bsh.This.invokeMethod( 
-			String methodName, Object [] args, Interpreter interpreter, 
-			CallStack callstack, SimpleNode callerInfo )
-		@param if callStack is null a new CallStack will be created and
+        @see org.gjt.sp.jedit.bsh.This#invokeMethod(String methodName, Object [] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo, boolean declaredOnly ) invokeMethod
+        @param callstack if callStack is null a new CallStack will be created and
 			initialized with this namespace.
 		@param declaredOnly if true then only methods declared directly in the
 			namespace will be visible - no inherited or imported methods will
 			be visible.
-		@see bsh.Primitive
+        @see org.gjt.sp.jedit.bsh.Primitive Primitive
 	*/
 	/*
 		invokeMethod() here is generally used by outside code to callback
--- a/bsh/src/bsh/Token.java
+++ b/bsh/src/bsh/Token.java
@@ -1,5 +1,5 @@
 /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
-package bsh;
+package org.gjt.sp.jedit.bsh;
 /*
 	This file has been modified for BeanShell to make Token serializable.
 	If this file is regenerated please make this change.
--- a/bsh/src/bsh/TokenMgrError.java
+++ b/bsh/src/bsh/TokenMgrError.java
@@ -1,5 +1,5 @@
 /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class TokenMgrError extends Error
 {
@@ -38,7 +38,7 @@
     * equivalents in the given string
     */
    protected static final String addEscapes(String str) {
-      StringBuffer retval = new StringBuffer();
+	  StringBuilder retval = new StringBuilder();
       char ch;
       for (int i = 0; i < str.length(); i++) {
         switch (str.charAt(i))
--- a/bsh/src/bsh/Types.java
+++ b/bsh/src/bsh/Types.java
@@ -31,7 +31,7 @@
  *                                                                           *
  *****************************************************************************/
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	Static routines supporing type comparison and conversion in BeanShell.
@@ -366,7 +366,7 @@
 
 		@param operation is Types.CAST or Types.ASSIGNMENT
 
-		@see bsh.Primitive.getType()
+		@see org.gjt.sp.jedit.bsh.Primitive.getType()
 	*/
 	/*
 		Notes: This method is currently responsible for auto-boxing/unboxing
@@ -483,11 +483,11 @@
 		// Can we use the proxy mechanism to cast a bsh.This to 
 		// the correct interface?
 		if ( toType.isInterface() 
-			&& bsh.This.class.isAssignableFrom( fromType ) 
+			&& org.gjt.sp.jedit.bsh.This.class.isAssignableFrom( fromType )
 			&& Capabilities.canGenerateInterfaces() 
 		)
 			return checkOnly ? VALID_CAST : 
-				((bsh.This)fromValue).getInterface( toType );
+				((org.gjt.sp.jedit.bsh.This)fromValue).getInterface( toType );
 
 		// Both numeric wrapper types? 
 		// Try numeric style promotion wrapper cast
--- a/bsh/src/bsh/UtilEvalError.java
+++ b/bsh/src/bsh/UtilEvalError.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	UtilEvalError is an error corresponding to an EvalError but thrown by a 
@@ -68,7 +68,6 @@
 	/**
 		Re-throw as an eval error, prefixing msg to the message and specifying
 		the node.  If a node already exists the addNode is ignored.
-		@see #setNode( bsh.SimpleNode )
 		<p>
 		@param msg may be null for no additional message.
 	*/
--- a/bsh/src/bsh/UtilTargetError.java
+++ b/bsh/src/bsh/UtilTargetError.java
@@ -32,7 +32,7 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 /**
 	UtilTargetError is an error corresponding to a TargetError but thrown by a 
--- a/bsh/src/bsh/Variable.java
+++ b/bsh/src/bsh/Variable.java
@@ -1,4 +1,4 @@
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 public class Variable implements java.io.Serializable 
 {
--- a/bsh/src/bsh/XThis.java
+++ b/bsh/src/bsh/XThis.java
@@ -32,11 +32,10 @@
  *****************************************************************************/
 
 
-package bsh;
+package org.gjt.sp.jedit.bsh;
 
 import java.lang.reflect.*;
 import java.lang.reflect.InvocationHandler;
-import java.io.*;
 import java.util.Hashtable;
 
 /**
@@ -54,8 +53,9 @@
 
 	XThis stands for "eXtended This" (I had to call it something).
 	
-	@see JThis	 See also JThis with explicit JFC support for compatability.
-	@see This	
+    @see org.gjt.sp.jedit.bsh.JThis	JThis
+    See also JThis with explicit JFC support for compatability.
+    @see org.gjt.sp.jedit.bsh.This This
 */
 public class XThis extends This 
 	{
@@ -182,7 +182,7 @@
 			{
 				Class [] ints = proxy.getClass().getInterfaces();
 				// XThis.this refers to the enclosing class instance
-				StringBuffer sb = new StringBuffer( 
+                StringBuilder sb = new StringBuilder(
 					XThis.this.toString() + "\nimplements:" );
 				for(int i=0; i<ints.length; i++)
 					sb.append( " "+ ints[i].getName()