- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
public class FristDescriptor extends XMLEntity { public static final String frist = "snecond";
}
Edit Admin
What's the deal with (non-Javadoc)?
Admin
Should have been called the Highlander pattern imo.
Edit Admin
My guess is that they added that note because the comment there begins with
/*
instead of/**
, so it's not parsed as Javadoc by the Javadoc tooling. But as for why they did that, ¯_(ツ)_/¯Edit Admin
Java has a much cleaner way to execute a block of code that initializes static data: a static initializer block. The ugly private singleton is unnecessary.
Addendum 2025-07-15 12:51: Also, TRWTF is that failing to parse the XML from the classpath resource just logs the exception and merrily carries on. So if the classpath resource is missing or corrupted, the map will not be populated and this will be discovered much later at runtime, rather than at startup time. It's better for a faulty application to fail at startup than to start but work incorrectly.
Edit Admin
It's a comment generated by an IDE. It's not a documentation comment, so it won't get included in generated documentation, but it includes a link to the superclass declaration of the method, which is then displayed (I think) in the popup you get by hovering over the method in the IDE. It's for easy navigation from the subclass to the superclass.
Admin
This class is a real WTF. Both BatchManager and BatchDescriptor extend XMLEntity which apparently makes them implement org.xml.sax.ContentHandler indirectly, because the singleton BatchManager instance is used as one in the constructor. For the BatchManager that's probably not that bad because there's no possibility to get an instance (other than using reflection), but BatchDescriptor instances are exposed to the outside world. That means they can be used has ContentHandler for any random XML document. That in turns allows anyone to update their internals, because that's what the content-handling part does.
A properly written class would have created (package) private ContentHandler implementations instead so the parsing logic doesn't escape the class.