« květen 2005 »
PoÚtStČtSoNe
      
     
Today

Navigation

Speaker Profile
Roumen's Weblog
Login
Sun Bloggers
Technorati Profile

Am I popular?

Today's Page Hits: 554

Contacts

Name: Roman Strobl
E-mail: roman dot strobl
at sun dot com

NetBeans

Java Sites

Javalobby
The Server Side
Java Tips
Java Blogs
java.net
java.sun.com
java.cz

Blogs

NetBeans:
Geertjan
Brian Leonard
Gregg Sporar
Lukas Hasik
Ludovic Champenois
Vincent Brabant
Alexis Moussine-Pouchkine
Jullion-Ceccarelli
Tom Ball
Tim Boudreau
Jesse Glick
Petr Blaha
Ruth Kusterer
Jara Uhrik
xzajo
Jan Lahoda
James Branam
nbextras.org

Sun:
Kazem - bug cartoons ;-)
Tor Norbye
Romain Guy
James Gosling
Chief Gaming Officer
Bill Vass
Jim Grisanzio
Jonathan Schwartz

Planets:
Planet Netbeans
Planet Sun
Planet Eclipse

Other:
netbeans-blog.org
Joel Spolsky
Bruce Eckel

License info

Creative Commons License
This work is licensed under a Creative Commons License.

Recent Entries

Map of visits

Locations of visitors to this page
« Previous day (May 6, 2005) | Main | Next day (May 7, 2005) »
20050507 Sobota květen 07, 2005
Resistance Is Futile

We are the Borg. We bring the NetBeans. You will be assimilated. Resistance is futile!

http://www.autexier.de/jmau/blog/2005/05/does-sun-wants-to-assimilate-us.html

This is just very funny :-) Did I reveal I am a Star Trek fan already?
Disobedient Abbreviations in NetBeans

A very strange word may be found in sources created in Netbeans (such as NetBeans itself): we'return. I did a search for this word in the sources at netbeans.org and found it on several places in CVS:




You can even find this strange word being discussed on some web forums, like this one:

http://www.javakb.com/Uwe/Forum.aspx/java-tools/1027/NetBeans-Annoyance

How did it happen? Well, NetBeans has a very useful support for abbrevations. You can type in "sout" and this word is by pressing space expanded into System.out.println("|"). The vertical line denotes the new position of cursor. Works great, except for some rare cases like if you want to write "we're" in a comment. In that case, the "re" string is expanded into "return" and we have the magical "we'return". Tricky, isn't it?

Unfortunately, we will miss this we'return in new sources, because such behaviour is fixed now - abbreviations get no longer expanded in comments and string literals. I wonder if there are any other artificial words like we'return created by this side effect, the list of abbreviations is quite large. You can find it in Help | Keyboard Shortcuts.

Here is my comment to the fix from developers, inspired by Tor's first reply:

I have tested the new build with fixed abbreviations and it works fine, bothrows in javadoc and string literals. I hoprotected we can also change some of the conflicting abbreviations. For sureturn we should replace the "st" and "br" abbreviations as these two areturn often used for StringTokenizer and BufferedReader. The bestatic abbreviations for them areturn sc and bk in my opinion. It's a complextends problem, but at leastatic we'll fix these two cases.

This would not be reproducible even in old NetBeans, because the apostrophe was the reason why it got expanded in we'return - the "re" characters were taken as a new word. I guess this kind of funny issues is one of the reasons why I enjoy working on a software project.


    Disclaimer: The contents of my blog represent my personal opinions which may differ from official views of my employer, Sun Microsystems.