Davin,
This is the follow up from the old post where I received a project error when loading a project that contained syntax errors. (https://www.greenfoot.org/topics/58201)
I have been using the generic version of the install.
The error may be related to the delay I see when creating a new class from the GF UI, where the class stays "grey" for quite some time.
Here is some sample code to assist with debugging:
The error occurred when typing in the code by hand, when sometimes the BlueJ parser may not be able to keep up with the typer.
You will note the following syntax errors in the file: Line 29 ( the parser does not catch this as the an error ); and Line 38 where the identifier (avenue 2) has a space.
Also note that just following line 37, the editor starts renumbering the lines at 28. (This is may be actual java code line 28 omitting comments).
This version was cut&pasted into the editor. When originally creating the file by hand no errors were detected by the parser, including Line 38.
I have attempted to include an image of the file in the GF editor below:
Editor Image
I hope this helps narrow down the issue for you. Sorry for the delay in getting an example source to you.
Please inform me if you can duplicate (and resolve) the issue.
ADDENDUM:
I have also noticed that the BlueJ can get confused when changing method signatures (say adding a parameter), where the state of the code in not consistent until both Server and Client updates are made. Yet once this is completed the source files remain greyed and further editing does not trigger a compile. The only work around is to close GF and reload the project.
I would consider this fairly important as many beginner students can get frustrated with tracking down their "error". Is there a way to force a recompile without having to close GF?
Mr. Bradley
/**
* Intersection represents the intersection of a street and avenue.
* It can also be referred to as a corner, as in the corner of 3rd street and 2nd avenue.
*
* @author Mr Bradley
* @version 2017-06-28
*
* This is a good example class for students to create.
*/
public class Intersection
{
public int street;
public int avenue;
public Intersection()
{
street = 1;
avenue = 1;
}
public Intersection( int aStreet, int anAvenue )
{
street = aStreet;
avenue = anAvenue;
}
public boolean isInWorld()
{
}
public static final Intersection ORIGIN = new Intersection( 1, 1 );
/**
* calculates the "move" distance between two locations
* street1, avenue1 & street2, avenue2
*/
public static int distance( int street1, int avenue1, int street2, int avenue 2 )
{
int streetDiff = Math.abs( street1 - street2 );
int avenueDiff = Math.abs( avenue1 - avenue2 );
int moveDistance = streetDiff + avenueDiff;
return moveDistance;
}
}

