russellallen/self — pull request #14 by doublec (2013-09-18 09:36:38+00:00)
Title: Fix bitrot in applications/pep

This fixes some bitrot in applications/pep and adds two simple test Java files, SimpleTest1 and SimpleTest2. The fixes in this commit are enough to be able to load the class files of these two test files, and the JVM class files they depend on.

Unfortunately they don't quite run due to issues with getting java.lang.System to initialize the 'out' field for SimpleTest1. I'm still tracking this down. Other classes that don't rely on java.lang.System may work.

When testing, ensure that before starting Self you have your CLASSPATH environment variable set to the location of the Java class library .class files and the 'objects/applications/pep' directory. Something like:

export CLASSPATH=/home/me/self/objects/applications/pep:/home/me/jvm/classes'

I obtained the Java library classes by extracting the contents of 'rt.jar' from a local java installation.

To test 'SimpleTest1' and 'SimpleTest2' make sure they're compiled:

cd objects/applications/pep
javac SimpleTest1
javac SimpleTest2

To load 'pep' in self:

bootstrap read: 'pep' From: 'applications/pep'

To test SimpleTest1 and SimpleTest2:

pep tests testSimpleTest1
pep tests testSimpleTest1

To test an arbitary Java class file:

pep tests testClassNamed: 'Foo'

To view loaded classes and drill down to see their methods and converted Self code, etc:

pep loadedClasses class_java_lang_System