source("TestHarness.bsh");

class TestInner22 
{
	static int s = 5;
	int i = 4;
	Object t22This = this;
	new MyThread().start();
	assert( TestInner22.this == t22This );

	void go() 
	{
		assert( TestInner22.this == this );
		assert( TestInner22.this == t22This );

		r=new Runnable() { 
			public void run() { 
				assert( this instanceof Runnable );
				assert( TestInner22.this == t22This );
				assert(i==4); 
			} 
		};
		new Thread(r).start();

		new Thread() {
			public void run() { 
				assert( this instanceof Thread );
				assert( TestInner22.this == t22This );
				assert(i==4); 
			}
		}.start();

		new MyThread().start();
	}

	class MyThread extends Thread {
		public void run() { 
			assert( this instanceof Thread );
			assert( TestInner22.this == t22This );
			assert( i == 4 );
		}
	}

	static class MyStaticThread extends Thread {
		public void run() 
		{ 
			assert( this instanceof Thread );
			assert( isEvalError("TestInner22.this") );
			assert( isEvalError("i") );
		}
	}
}

new TestInner22().go();

complete();
