Thursday, October 25, 2012

Yesterday Eclipse, Today Eclipse; Extra Character

Just had a weird error, where it looked like Eclipse thought that a Java file was at the source root level, aka default package, and Quick Fix wanted to remove the package declaration. "Oh god, not another one" would be a nice description of the sentiment.

Thought it was another Svn problem, so I opened the Properties dialog, to find out what could be found out. Today is a much better day than yesterday, so it had nothing to do with Svn. The end of the path looked like this:
api/pub/annot%C2%A8/ApiPath.java
So then I looked in the GUI, and sure enough, there is some trema-looking extra character there that I didn't see, that I must've added inadvertently.

But I don't know why it made Eclipse think wrong about the packages.

This might mean that package names aren't allowed to be any unicode? If so, that's an unfortunate irregularity: other Java identifiers can be in unicode. But it's probably just that diacriticals are not allowed as characters in their own, which is very sensible. The Character.isJavaIdentifierPart method tells which characters are allowed, which is what I learned from this incident.

--

Today's UTF-8 character is: http://en.wikipedia.org/wiki/Diaeresis_(diacritic).

And as you can see at  http://www.fileformat.info/info/unicode/char/a8/index.htm, this character cannot be part of a Java identifier; the Character.isJavaIdentifierPart is false.

No comments:

Post a Comment