When people ask, we do our best (which is often not great) to give reasons.
It's an article of faith among HR people and, apparently, employment lawyers that explaining decisions to candidates exposes you to legal risk. There seem to be two broad reasons why:
1. A disgruntled candidate alleging discrimination could litigate the conclusions in the rejection letter, by generating a convincing amount of evidence that (a) you're wrong about the specific points you raise and (b) you didn't expend a good-faith effort to reach your conclusion, which is really a proxy for a discriminatory rejection.
2. That same disgruntled candidate, again alleging discrimination, could compel you to produce the applications for candidates that fared better, and then litigate the distinctions between the candidate; "you rejected me because I only have 1 year of Java, but then hired such-and-such who only has 3 months of it".
To that, several responses:
* A lot of other things that are de rigueur for hiring processes, such as "we'll keep your resume on file", can create other legal exposures --- some of them possibly for things other than discrimination, such as a perceived binding promise to alert the candidate to future openings.
* Presumably, an aggressive lawyer can compel production of competing applications no matter what the rejection letter says. The kind of person who interviews innocuously, gets rejected, and sues for discrimination is very likely to have an aggressive lawyer.
* Sadly, most of the protected classes which are most exposed in the interview process (disfavored race, gender) are not well represented in the candidate pool, and other protected classes (religion, say) don't tend to come up in sane interviews; you may be reasonably well shielded from discrimination claims for most candidates.
* Your lawyer (you're at the point where you're hiring, so you have one, of course) can probably up-armor your rejection letters to blunt the concerns about contractual reliance and comparative evaluation of offers.
To my mind, the bigger reason not to give detailed rejections is that candidates will litigate them informally with you. We're all nerds. Nothing bothers a nerd more than hearing someone else say something wrong. A lot of the time, if you reject a nerd, they're going to assume you're wrong. About them. Angry nerd -> unpleasant conversation -> Twitter rage storm.