This has started to accrete things like Ant, as well.
These notes were jotted down as we came across problems during our software development efforts. They may be out of date with respect to the latest version of Java (e.g.: sorting issues). A lot of the problems are really just due to very bad documentation.
See also A Critique of Java.
Misc tools: Javadoc, JSwat debugger, JUnit unit testing framework, TestNG expanded unit testing framework, Testing with Hibernate, Java PathFinder, PMD (Java 'lint'), Automatic bug finder, Code coverage, Modeling / Design by contract, Profiling, Logging.
public void add( String reference )
{
if( this.countMap.containsKey( reference ) )
{
Integer count = (Integer)this.countMap.get(reference);
this.countMap.put( reference, new Integer( count.intValue()+1 ) );
}
}
| Relation | Return Value | Rationale |
|---|---|---|
| this < other | negative | this - other < 0 |
| this == other | zero | this - other = 0 |
| this > other | positive | this - other > 0 |
java.util.AbstractList.removeRange() is protected. I
guess it's just so useful that it's dangerous to let
mere programmers at it! So I end up having to subclass ArrayList and
adding public void removeRangePublic().Arrays.asList() doesn't return an ArrayList, just a
List interface. Why didn't they return an ArrayList? I mean, it might even
be an ArrayList, but the spec doesn't guarantee that so I have to
do new ArrayList( Arrays.asList( foo ) ) which seems like
overkill. PENDING(jeff) - need to provide a
specification for how Mac/OS2/BeOS/etc file systems can modify
FileSystemView to handle their particular type of file system. As if
I know or care who the hell "jeff" is? If you go and look at the
docs for the JFileChooser, you see that nobody even bothered to
proof-read them: they forgot the <pre> or <tt> or <code>
tags in the example code at the top! Then, there are
articles in The Swing Connection that aren't even grammatically
correct. What. Ever.ifdef is ugly, but there are times
when I'd really appreciate having it. Well, I guess I can
insert a pre-processor of my own (hell, I could use cpp)
into the make process...javax.servlet
stuff, and then there's quite often some dependency upon
sun.servlet stuff, which doesn't seem to come bundled with any
standard install. Of course, if you go to the JavaSoft web site and search
for sun.servlet.http the hits aren't answers to the question,
merely posts of the same question to a discussion list. (Discussion lists
are what let the support folks head off to the beach four days a week.) If
you end up in the Developer Connection via Sun's web site (and the DC
looks exactly like the JavaSoft web site - I've never understood their
screwy division), you can finally find useful information (you'd think it
would be in a FAQ already)? [Of course, the link I had is now broken.
I guess that information was too useful to let live!]public Thing foo() "Returns a foo." No mention of things
like side effects (in situations where you could reasonably suspect that
they would happen, like removing things from lists). The docs for
SwingUtilities.findFocusOwner() do not say whether it recurses. The 1.1
File docs, especially about the path separator, are wrong. More often than
not, docs fail to tell you if the index starts at 1 or 0. That would be
helpful in classes with mixed modes of indexing (e.g.: Strings).
String.getChars() vs.
String.getBytes(), having to know what your 'default platform
encoding' is, yadda yadda yadda. E.g.: you can initialize a String with a
byte array and then ask for it back from the String and it's different!