Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Java source code #42

Open
zg opened this issue Apr 28, 2016 · 2 comments
Open

Issue with Java source code #42

zg opened this issue Apr 28, 2016 · 2 comments

Comments

@zg
Copy link

zg commented Apr 28, 2016

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.

@McPringle
Copy link
Contributor

McPringle commented Jan 28, 2018

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants