java.tmbundle icon indicating copy to clipboard operation
java.tmbundle copied to clipboard

Issue with Java source code

Open zg opened this issue 9 years ago • 2 comments

https://github.com/zg/pj2/blob/master/lib/edu/rit/util/DList.java

I don't know what's wrong here, but at line 148, the syntax highlighter breaks and everything gets painted blue past that line.

zg avatar Apr 28 '16 18:04 zg

Just to mention: You can see the same happening with the GitHub syntax coloring when you click on your link provided above.

The highlighter gets confused with your coding style (and me too). Your code is hard to read because of your style where you place the parantheses and curly braces and your indentations.

Your code:

	public void copy
		(DList<T> list)
		{
		if (list == null)
			throw new NullPointerException
				("DList.copy(): list is null");
		clear();
		DListEntry<T> p = list.first();
		while (p != null)
			{
			addLast (p.item);
			p = p.succ();
			}
		}

How I would format it:

public void copy(DList<T> list) {
    if (list == null) {
        throw new NullPointerException("DList.copy(): list is null");
    }
    clear();
    DListEntry<T> p = list.first();
    while (p != null) {
        addLast (p.item);
        p = p.succ();
    }
}

Your coding style breaks multiple syntax highlighters. I suggest you to consider rethinking your coding style for better readability and less syntax highlighter problems.

McPringle avatar Jan 28 '18 13:01 McPringle

By the way, this issue is a duplicate of #28

McPringle avatar Jan 28 '18 13:01 McPringle