BlueJ with Modified Error Subsystem
Warren Toomey, October 2011
Novice programmers often make simple errors, but they don't receive very good advice on how to fix the errors from the development tools such as the compiler: obscure reports such as "char cannot be dereferenced", for example, give no useful guidance to the student. This is a modified version of BlueJ which has had the error reporting subsystem rewritten to: This is a follow-on to the proof of concept version, Arjen, that Jon Gjengset and I wrote in 2010.



Images/image1.gif   Images/image2.gif
Images/image3.gif   Images/image4.gif
Also see this YouTube video.


Download one of the following installers and follow the BlueJ installation instructions. The modified BlueJ installer also comes with an extension that logs the errors made during compilation. If you don't want this functionality, find and remove the errorlog.jar file which is located in bluej/lib/extensions. Alternatively, download the source code to this extension below and modify it to suit your situation.

Building BlueJ with the Changes

The changes to the BlueJ source code are provided in a Zip file below. To apply the changes, firstly download the original BlueJ source code. Unzip the Zip file. Download the Zip file with the changes and unzip it in the same location to apply the changes. You should then be able to run "ant build" to build the modified BlueJ.

Description of the Changes

This modified version of BlueJ has these new features: There is now a new data file called "errorlist.defs", stored in the per-language folder (e.g. "english/"). At compile time, lines from this file are used to interpret the errors from the parser, the compiler, or from inspection of the source code being compiled.
Each line has three fields, separated by double colons. The first field contains one of four values:
  1. "parsewarn": a message from the parser which is treated as a warning.
  2. "parseerr": a message from the parser which is treated as an error.
  3. "compwarn": a message from the compiler which is treated as a warning.
  4. "comperr": a message from the compiler which is treated as an error.
The second field is the title of the error or warning, written in a human language and which does not have to relate to the message from the compiler or parser.
The third field is a regular expression which recognises the error or warning sent from the parser or compiler.
The new error subsystem applies the lines from "errorlist.defs" in turn. When the first match occurs, the subsystem takes the title (the second field on the line) and looks up the description of the error in the "" file, also in the language-specific folder.
In the regular expression, capture patterns ( ) can collect words or identifiers from the parser/compiler/code input. These will then be passed to the user through the use of %s formatting in both the error title in "errorlist.defs" and the error description in "".
To stop the recognition of specific errors, the matching lines can either be removed from the "errorlist.defs" file, or these lines can be commented out using // Java-style comments.

Example Errors

Above, there is a Zip file with all the known errors. In each text file is the line to put in "errorlist.defs", the description which goes in "", plus a Perl program to create "errorlist.defs" and "" from these files. Some of the text files contain Java source which exhibits the error. You can browse the example Java files on-line.
I would love to collect more example Java files for the known errors, and also textual descriptions for the errors which have no textual descriptions.


At present, only an English version of "errorlist.defs" and "" has been created. I would very much like to get translations of these into other languages.


If you have any questions or comments about the changes I've made, please e-mail them to me at wkt at tuhs dot org, or post your comment/question in this Blueroom forum.

File translated from TEX by TTH, version 3.85.
On 2 Dec 2011, 12:38.