_professorj_

ProfessorJ is a compiler for Java and related languages. The languages
include three teaching languages, Java 1.1 (with some incomplete
features, see below), and an experimental language supporting
interoperability between Java and Scheme. For details about the
teaching languages, please see the language manuals.

In all of the ProfessorJ language levels, the interactions window
accepts variable declaration, statements and expressions legal for the
language level. If the text is not sending, type Alt+Enter to force
the text to send.

The definitions window expects class and interface definitions, Java
examples boxes, and test suite boxes. (i.e. what would be given to
javac plus two graphical boxes). Descriptions of these boxes can be
found in the DrScheme manual.

_Testing in Java language levels:

The ProfessorJ language levels support a language extension to support
testing endeavors. This extension can be turned off with a language
configuration option in ProfessorJ Full and Java + dynamic, and the 
teaching levels support a restricted set of operators. 

Within the language levels Beginner, Intermediate, and Advanced the
extension adds two _check_ ... _expect_ expression forms to Java:

check EXPR expect EXPR
check EXPR expect EXPR within EXPR

To include these expressions in any larger expression (i.e. EXPR ||
EXPR), the check expression must be within parentheses. The resulting
type of both expressions is a boolean. The check expression compares
the two subexpressions for equality (without using .equals). When the
two subexpressions are floats or doubles, the check-within expression
must be used. The within subexpression must be a number; non-doubles
can be compared with the check ... within expression. The within
subexpression specifies how precise different floats or doubles must
be.

Within the Full and Java + dynamic levels, three additional expression
forms are supported:

check EXPR expect EXPR by NAME
check EXPR catch NAME
EXPR -> EXPR

The first expression compares the two values using the named method,
that must be within the class of the first expression. In this form,
== may be used instead of NAME. The second expression anticipates that
the EXPR throws the named exception, NAME must refer to a subclass of
Throwable. The -> operator suggests a logical relationship between
the two expressions, throws away the first value, and returns a boolean.

Additionally, the ProfessorJ languages support automatic execution of
tests, which can also be turned off with a language configuration
option. 

Within the three teaching levels, any class with the word 'Example' in 
the name (i.e. CarExample, Examples, MyExamples) whose constructor does not
require any arguments is instantiated on Run. Any method within this
class that begins with the word 'test' (i.e. testAccelerate, test1)
that does not require any arguments is called; a boolean return is
expected. The test methods are run in the order in which they appear
within the class, top to bottom.

Within the Full and Java + dynamic levels, two additional forms are 
supported, test and testcase. A test specifies a class-like entity that
will include tests and behaves like an Example class on Run. A testcase
specifies a method-like entity containing a set of checks for a specific
circumstance. A testcase must return a boolean and accept no arguments.
Operational inheritance is available in tests and testcases, access modifiers
are not supported for these forms.

A dockable window opens on Run reporting the result of executing all
checks within each Example class or test and the result of executing each test
method or testcase. Failed checks (i.e.  returning false) provide source
information. Coverage information is also available for each Example
class and each testMethod. The collection of coverage information does
slow execution and can be turned off with a language configuration;
coverage information is not collected when test on Run has been
disabled. Colors for the coverage information can be set in the Java
color preference window.

Note: Coverage collection is not space preserving. If your program consumes 
an excessive amount of memory or executes very slowly, try turning off
coverage collection during execution.

_ProfessorJ Beginner_
 In Version 371, the if statement now requires { } around both branches.
 In Version 300, the Beginner language level has undergone significant
 changes.  Largest among these is that interfaces are supported within
 the language, but abstract classes are no longer allowed. Further,
 interface implementation is supported but class extension is not. For
 further details please see the language manual. 

_ProfessorJ Intermediate_
 In Version 371, the if statement now requires { } around both branches.
 In Version 300, instanceof is now allowed. For further language
 details please see the language manual.

_ProfessorJ Intermediate + access_
 New to version 371, augments the Intermediate language with access
 modifiers and overloading. For further details, please see the 
 language manual.
 
_ProfessorJ Advanced_
 In Version 371, the various statements including if, for, and while
 require { }.
 For details, please see the language manual.
 
_ProfessorJ Full
 Supports Java 1.1, no 1.5 features have been included. Few libraries
 are available.  Where the libraries are supported, they are from
 version 1.4 (there are no language differences between 1.1 and
 1.4). Please see the list of unsupported features to see what
 constructs are not available within this language level.

_Java + dynamic_ language level
 Version 299.200 +
 This language level allows programs to contain a value that will be 
 checked dynamically rather than statically.
 
 The following code presents the use of a dynamically typed value, that
 will be checked during execution.
 
 class RuntimeCheck {
  int checkForNumber( dynamic var ) {
     return var;
  }
 }
 In RuntimeCheck, var will be checked to be an integer when
 checkForNumber is executed. Values declared with type 'dynamic' can
 also be used as any primitive or object value in Java. In addition,
 values with type 'dynamic' can also be used as methods: var() is a
 legal use.
 
 In general, variables declared with type 'dynamic' will generate a contract
 check with coercians at each usage to ensure consistency with the Java type
 system.
 
 A Java String will be converted to a Scheme string, and vice-versa.
 
 Within the Java + dynamic language level, Scheme libraries may be 
 imported and used within the Java program.
 
 The import form is either:
   import scheme.lib.$PATH$;
   import scheme.$PATH$;
 where $PATH$ is the set of directories that leads to the Scheme
 module, ending with the modules name. The lib form is used to access
 Scheme modules within the collects hierarchy.
 The Scheme require statement (require (lib "compile.ss" "profj"))
 would be written
   import scheme.lib.profj.compile;
 within Java + dynamic
 
 Values provided by the scheme libraries may be used within a Java
 program, with access to them treated as though the Scheme module were
 a class and the provided value a static member. If the compile module
 mentioned above provides a types function, this would be accessed
 with the following code:
   ... compile.types() ...
 This value has type dynamic within the Java program, and will be
 dynamically checked based on use.
 
 As many Scheme names are not valid Java names, the following
 automatic name translations will be used:
 JName = [a-zA-Z0-9_]
   Scheme name        <->   Java name
   JName.*[-][a-zA-Z0-9] <-> JName.*[A-Z0-9]     i.e. make-foo      <->   makeFoo
   JName.*[?]            <-> JName.*[P]          i.e. foo?          <->   fooP
   JName.*[->][a-zA-Z0-9]<-> JName.*[To][A-Z0-9] i.e. foo->string   <->   fooToString
   JName.*[!]            <-> JName.*[Set]        i.e. set-foo-baz!  <->   setFooBazSet
   JName.*[%]            <-> Jname.*[Obj]        i.e. object%       <->   objectObj
   
 
Known bugs for dynamic:
  Some casts will fail and instanceof's return false that aught to succeed:
    interface I { }
    class C implements I { }
    I ic = new C();
    dynamic x = ic;
    C c = (C) x; 
  In this program, the cast of x to C will fail, even though the value
  is an intstanceof C.
  These issues will be addressed in future versions. 
  Some assignments (with implicit downcasts) will also fail.
 
_Libraries available to ProfessorJ:

  java.lang.Object
  java.lang.String (see exceptions)
  java.lang.Throwable
  java.lang.*Exception
  java.lang.System (only currentTimeMillis, gc, and identityHashCode)
  java.lang.Comparable
  java.lang.Number
  java.lang.Double (see exceptions) 
  java.lang.Float (see exceptions) 
  java.lang.Boolean (see exceptions)
  java.lang.Integer (see exceptions)
  java.lang.Byte (see exceptions)
  java.lang.Character (see exceptions)
  java.lang.Short (see exceptions)
  java.lang.Long (see exceptions)
  java.lang.Math
  java.lang.Util (see explanation)
  
  java.io.Serializable
  java.util.Random

  Teachpacks (PLT/collects/htdch) -- Documentation for libraries can be found in draw and idraw
  draw.*
  colors.*
  geometry.*
  idraw.*

  exceptions:
   String: String(byte[],int,int,String) -- incorrect
           String(byte[],int,int,int) -- incorrect
           getBytes() -- partially incorrect
           replaceAll(String,String) -- not implemented
           replaceFirst(String,String) -- not implemented
           matches(String) -- not implemented
           split(String,int) -- not implemented
           split(String) -- not implemented
           trim -- not implemented
   Double: doubleToLongBits -- not implemented
           doubleToRawBits -- not implemented
           longBitsToDouble -- not implemented
   Float:  floatToIntBits, floatToRawBits, longBitsToFloat -- not implemented
   Boolean: getBoolean(String) not implemented
   Integer: May not correctly parse strings into integers in all cases
   Short, Long, Byte: See Integer
   Character: Does not supported nested Character classes, nor any unicode operations
              isDefined -- unimplemented
              isJavaIdentifierStart -- unimplemented
              isJavaLetterOrDigit -- unimplemented
              isJavaLetter -- unimplemented
              isJavaIdentifierPart -- unimplemented
              isUnicodeIdentifierStart -- unimplemented
              isUnicodeIdentifierPart -- unimplemented
              isIdentifierIgnorable -- unimplemented
              getNumericValue -- unimplemented
              getType -- unimplemented
              getDirectionality -- unimplemented
              isMirrored -- unimplemented
              
   explanations:
    java.lang.Util is a class added to java.lang for pedagogic use
      contains one method: error( String message ) -> dynamic
       error can be used to signal a runtime error in a program, displaying the string value as
       the error message              


_Capabilities registerd by ProfJ
profj:special:java-comment-box        -- Tied to the Java comment box : default #f
profj:special:java-interactions-box   -- Tied to the Java Interactions box : default #t
profj:special:java-examples-box       -- Tied to the Java Examples box : default #f

_Unfinished constructs:
  static nested classes
  switch
  labeled statements (compiles but does not work correctly)
  reflection
  unicode
  synchronized (compiles but is ignored)
  strictfp (compiles but is ignored)

