<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1208311469880248033</id><updated>2011-04-22T02:38:21.750-03:00</updated><title type='text'>JAVA FAIL</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javafail.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-2708178770527374770</id><published>2008-12-18T11:19:00.010-04:00</published><updated>2008-12-18T12:12:15.344-04:00</updated><title type='text'>IS-A FAIL</title><content type='html'>I knew this was wrong the first time I saw it.  After having the chance to work with the &lt;tt&gt;&lt;a href="http://java.sun.com/javase/6/docs/api/java/sql/Timestamp.html"&gt;java.sql.Timestamp&lt;/a&gt;&lt;/tt&gt; class for a while, I'm just left shaking my head.  You can probably figure out what's wrong just by reading the class documentation, but here's a synopsis.&lt;br /&gt;&lt;br /&gt;The &lt;tt&gt;java.util.Date&lt;/tt&gt; class is the "normal" timestamp class in the Java standard library.  It's basically a wrapped up POSIX timestamp, except that 64-bit signed value is an expression of the number of milliseconds since the epoch instead of the usual seconds.  A strange choice to begin with, but not really unreasonable.&lt;br /&gt;&lt;br /&gt;Databases may represent timestamps to a higher resolution than milliseconds, in the general case.  When interacting with a database with JDBC, one doesn't want to lose precision on timestamp values merely because of &lt;tt&gt;Date&lt;/tt&gt;'s chosen resolution.  JDBC chose to address this by introducing the &lt;tt&gt;Timestamp&lt;/tt&gt; class, which records times to nanosecond resolution.  Presumably since most of the behaviour and and interface on &lt;tt&gt;Date&lt;/tt&gt; also make sense for &lt;tt&gt;Timestamp&lt;/tt&gt;, &lt;tt&gt;Timestamp&lt;/tt&gt; derives from &lt;tt&gt;Date&lt;/tt&gt;.  But hold on, take a look at that note on &lt;tt&gt;Timestamp&lt;/tt&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;B&gt;Note:&lt;/B&gt; This type is a composite of a &lt;code&gt;java.util.Date&lt;/code&gt; and a separate nanoseconds value. Only integral seconds are stored in the &lt;code&gt;java.util.Date&lt;/code&gt; component. The fractional seconds - the nanos - are separate.  The &lt;code&gt;Timestamp.equals(Object)&lt;/code&gt; method never returns &lt;code&gt;true&lt;/code&gt; when passed an object that isn't an instance of &lt;code&gt;java.sql.Timestamp&lt;/code&gt;, because the nanos component of a date is unknown. As a result, the &lt;code&gt;Timestamp.equals(Object)&lt;/code&gt; method is not symmetric with respect to the &lt;code&gt;java.util.Date.equals(Object)&lt;/code&gt; method.  Also, the &lt;code&gt;hashcode&lt;/code&gt; method uses the underlying  &lt;code&gt;java.util.Date&lt;/code&gt; implementation and therefore does not include nanos in its computation.  &lt;br /&gt;&lt;br /&gt; Due to the differences between the &lt;code&gt;Timestamp&lt;/code&gt; class and the &lt;code&gt;java.util.Date&lt;/code&gt; class mentioned above, it is recommended that code not view &lt;code&gt;Timestamp&lt;/code&gt; values generically as an instance of &lt;code&gt;java.util.Date&lt;/code&gt;.  The inheritance relationship between &lt;code&gt;Timestamp&lt;/code&gt; and &lt;code&gt;java.util.Date&lt;/code&gt; really  denotes implementation inheritance, and not type inheritance.&lt;/blockquote&gt;&lt;br /&gt;Woah!  So, &lt;tt&gt;Timestamp&lt;/tt&gt; is-not-a &lt;tt&gt;Date&lt;/tt&gt;!  This note is essentially a warning to not treat a &lt;tt&gt;Timestamp&lt;/tt&gt; polymorphically as if it were a &lt;tt&gt;Date&lt;/tt&gt;.  Now this isn't in itself always necessarily evil.  Although, in C++, you might think about using private or protected inheritance with some using declarations, or aggregation.  In Java, you're stuck with the choice of aggregation and re-offering a semantically-different-but-syntactically-the-same interface on &lt;tt&gt;Timestamp&lt;/tt&gt;.  If a &lt;tt&gt;Timestamp&lt;/tt&gt; is not usable as a &lt;tt&gt;Date&lt;/tt&gt;, then aggregation seems like the right choice here.&lt;br /&gt;&lt;br /&gt;But wait a minute.  Is there really a &lt;em&gt;need&lt;/em&gt; for &lt;tt&gt;Timestamp&lt;/tt&gt; to be unusable as a &lt;tt&gt;Date&lt;/tt&gt;?  Why did they chose to stop storing the milliseconds of the timestamp value in the &lt;tt&gt;Date&lt;/tt&gt; part of the object?  That decision doesn't really make any sense.  Why wouldn't you just leave the &lt;tt&gt;Date&lt;/tt&gt; part of the class as-is and allow it to store whole milliseconds, and then have an additional field that stores the fractional milliseconds (down to the resolution of nanoseconds)?  &lt;br /&gt;&lt;br /&gt;This wouldn't require any changes in the &lt;tt&gt;Timestamp&lt;/tt&gt; interface at all.  The class could still offer &lt;tt&gt;getTime()&lt;/tt&gt; and &lt;tt&gt;getNanos()&lt;/tt&gt; methods and so on cheaply, and, critically, &lt;em&gt;it would then be true that a &lt;tt&gt;Timestamp&lt;/tt&gt; is-a &lt;tt&gt;Date&lt;/tt&gt;!&lt;/em&gt;  You could compare two &lt;tt&gt;Timestamp&lt;/tt&gt; values through their &lt;tt&gt;Date.equals()&lt;/tt&gt; interface (since the &lt;tt&gt;Timestamp&lt;/tt&gt; version would be called).  You could even compare &lt;tt&gt;Date&lt;/tt&gt; values to &lt;tt&gt;Timestamp&lt;/tt&gt; values with reasonably semantics: if you use the &lt;tt&gt;Date.equals(Timestamp)&lt;/tt&gt; interface, you just ignore the fractional part, which is presumably what you meant, since you used an interface that has nothing to do with fractional parts; if you use the &lt;tt&gt;Timestamp.equals(Date)&lt;/tt&gt; interface, it can only be true if the &lt;tt&gt;Timestamp&lt;/tt&gt; has zero fractional milliseconds.&lt;br /&gt;&lt;br /&gt;Alas, this is not the case, which makes the &lt;tt&gt;Timestamp&lt;/tt&gt; class far less useful&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;import java.util.Date;&lt;br /&gt;import java.sql.Timestamp;&lt;br /&gt;&lt;br /&gt;public class Foo&lt;br /&gt;{&lt;br /&gt;    public static void main(final String[] args)&lt;br /&gt;    {&lt;br /&gt;        System.out.println("D == T: "&lt;br /&gt;                           + (new Date(1000)).equals(new Timestamp(1000)));&lt;br /&gt;        System.out.println("T == D: "&lt;br /&gt;                           + (new Timestamp(1000)).equals(new Date(1000)));&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ java Foo&lt;br /&gt;D == T: true&lt;br /&gt;T == D: false&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;And, in case you're not yet convinced that this is complete madness, check out the &lt;tt&gt;&lt;a href="http://java.sun.com/javase/6/docs/api/java/sql/Timestamp.html#compareTo(java.util.Date)"&gt;compareTo(Date)&lt;/a&gt;&lt;/tt&gt; method, which states:&lt;br /&gt;&lt;blockquote&gt;Compares this &lt;code&gt;Timestamp&lt;/code&gt; object to the given  &lt;code&gt;Date&lt;/code&gt;, which must be a &lt;code&gt;Timestamp&lt;/code&gt; object. If the argument is not a &lt;code&gt;Timestamp&lt;/code&gt; object, this method throws a &lt;code&gt;ClassCastException&lt;/code&gt; object. (&lt;code&gt;Timestamp&lt;/code&gt; objects are  comparable only to other &lt;code&gt;Timestamp&lt;/code&gt; objects.)&lt;/blockquote&gt;&lt;br /&gt;So if you pass a &lt;tt&gt;Date&lt;/tt&gt; to the &lt;tt&gt;compareTo(Date)&lt;/tt&gt; method, it throws.  Madness.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-2708178770527374770?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/2708178770527374770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/2708178770527374770'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/12/is-fail.html' title='IS-A FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-2046811203123584473</id><published>2008-11-21T15:23:00.002-04:00</published><updated>2008-11-21T15:26:23.373-04:00</updated><title type='text'>SWITCH FAIL</title><content type='html'>&lt;blockquote&gt;&lt;pre&gt;public class Foo&lt;br /&gt;{&lt;br /&gt;    public void foo(final long value)&lt;br /&gt;    {&lt;br /&gt;        switch(value) {&lt;br /&gt;        case 0:&lt;br /&gt;            break;&lt;br /&gt;        default:&lt;br /&gt;            break;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ javac -Xlint:all Foo.java&lt;br /&gt;Foo.java:5: possible loss of precision&lt;br /&gt;found   : long&lt;br /&gt;required: int&lt;br /&gt;        switch(value) {&lt;br /&gt;               ^&lt;br /&gt;1 error&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;The argument to &lt;tt&gt;switch()&lt;/tt&gt; &lt;em&gt;must&lt;/em&gt; be an &lt;tt&gt;int&lt;/tt&gt;, promotable to &lt;tt&gt;int&lt;/tt&gt;, or an enumeration.  So &lt;tt&gt;long&lt;/tt&gt; can't be used.  Good thing Java doesn't have to worry about things like handling 64-bit values or anything.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-2046811203123584473?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/2046811203123584473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/2046811203123584473'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/switch-fail.html' title='SWITCH FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-6648345763825323694</id><published>2008-11-13T14:01:00.002-04:00</published><updated>2008-11-13T14:04:57.750-04:00</updated><title type='text'>JUNIT FAIL</title><content type='html'>&lt;blockquote&gt;&lt;pre&gt;JUnit version 4.1&lt;br /&gt;Could not find class: TestX&lt;br /&gt;&lt;br /&gt;Time: 0.001&lt;br /&gt;&lt;br /&gt;OK (0 tests)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Maybe, just maybe, if there is an error starting the test, that should be considered a failed test?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-6648345763825323694?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/6648345763825323694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/6648345763825323694'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/junit-fail.html' title='JUNIT FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-3983527998757199303</id><published>2008-11-06T16:43:00.000-04:00</published><updated>2008-11-06T17:03:07.609-04:00</updated><title type='text'>INTERFACE ENCAPSULATION FAIL</title><content type='html'>Let's say we have some existing useful library classes:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;class LowLevelException extends Exception&lt;br /&gt;{&lt;br /&gt;    private static final long serialVersionUID = 1L;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Base&lt;br /&gt;{&lt;br /&gt;    // Connect to the resource or throw if we can't&lt;br /&gt;    public Base(final String resourceName)&lt;br /&gt;        throws LowLevelException&lt;br /&gt;    { /*...*/ }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Now, let's use that nice code to build some higher-level library&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;class Foo extends Base&lt;br /&gt;{&lt;br /&gt;    // A higher-level API that can work with a preferred resource, but if it&lt;br /&gt;    // can't get it, will take a lesser-quality resource.&lt;br /&gt;    public Foo()&lt;br /&gt;        throws LowLevelException&lt;br /&gt;    {&lt;br /&gt;        try {&lt;br /&gt;            // Try to get the good stuff&lt;br /&gt;            super("Preferred Resource");&lt;br /&gt;&lt;br /&gt;        } catch(final LowLevelException ex) {&lt;br /&gt;            // Get by with this&lt;br /&gt;            super("Fall-back Resource");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;But we can't do that:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ javac -Xlint:all Foo.java&lt;br /&gt;Foo.java:18: cannot find symbol&lt;br /&gt;symbol  : constructor Base()&lt;br /&gt;location: class Base&lt;br /&gt;    {&lt;br /&gt;    ^&lt;br /&gt;Foo.java:21: call to super must be first statement in constructor&lt;br /&gt;            super("Preferred Resource");&lt;br /&gt;                 ^&lt;br /&gt;Foo.java:25: call to super must be first statement in constructor&lt;br /&gt;            super("Fall-back Resource");&lt;br /&gt;                 ^&lt;br /&gt;3 errors&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Zomg!  So this means you can't catch exceptions from your base class constructor(s) and deal with them locally?  &lt;br /&gt;&lt;br /&gt;It would seem that it also prevents you from translating an exception from a base class constructor in your derived class constructor.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;class HighLevelException extends Exception&lt;br /&gt;{&lt;br /&gt;    private static final long serialVersionUID = 1L;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Foo2 extends Base&lt;br /&gt;{&lt;br /&gt;    // A higher-level API that has some better way to represent the low-level&lt;br /&gt;    // exception, perhaps simply by adding more detail about the failure.&lt;br /&gt;    public Foo2()&lt;br /&gt;        throws HighLevelException&lt;br /&gt;    {&lt;br /&gt;        try {&lt;br /&gt;            super("Something");&lt;br /&gt;&lt;br /&gt;        } catch(final LowLevelException ex) {&lt;br /&gt;            throw new HighLevelException("More detail", ex);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ javac -Xlint:all Foo.java&lt;br /&gt;Foo.java:43: cannot find symbol&lt;br /&gt;symbol  : constructor Base()&lt;br /&gt;location: class Base&lt;br /&gt;    {&lt;br /&gt;    ^&lt;br /&gt;Foo.java:45: call to super must be first statement in constructor&lt;br /&gt;            super("Something");&lt;br /&gt;                 ^&lt;br /&gt;Foo.java:48: cannot find symbol&lt;br /&gt;symbol  : constructor HighLevelException(java.lang.String,LowLevelException)&lt;br /&gt;location: class HighLevelException&lt;br /&gt;            throw new HighLevelException("More detail", ex);&lt;br /&gt;                  ^&lt;br /&gt;3 errors&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Yeah, cause why would I ever want to do that?  I dunno, perhaps to make a clean API encapsulates its dependencies?  *sigh*&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-3983527998757199303?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/3983527998757199303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/3983527998757199303'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/interface-encapsulation-fail.html' title='INTERFACE ENCAPSULATION FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-1581310800569558571</id><published>2008-11-06T16:40:00.001-04:00</published><updated>2008-11-06T17:26:36.925-04:00</updated><title type='text'>ORTHOGONALITY FAIL</title><content type='html'>&lt;blockquote&gt;&lt;pre&gt;class Foo extends String&lt;br /&gt;{&lt;br /&gt;    // This avoids a warning&lt;br /&gt;    private static final long serialVersionUID = 1L;&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;$ javac -Xlint:all Foo.java&lt;br /&gt;Foo.java:1: cannot inherit from final java.lang.String&lt;br /&gt;class Foo extends String&lt;br /&gt;                  ^&lt;br /&gt;1 error&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I know what final classes are.  I think they're the wrong solution to any problem, but I know what they are.&lt;br /&gt;&lt;br /&gt;But what is the argument for making String a final class?  And if the reason is "because String is special and the compiler knows about it and blah blah", it shouldn't be.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-1581310800569558571?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/1581310800569558571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/1581310800569558571'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/orthogonality-fail.html' title='ORTHOGONALITY FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-4170114177454606042</id><published>2008-11-04T16:28:00.000-04:00</published><updated>2008-11-04T16:32:40.160-04:00</updated><title type='text'>ENCAPSULATION FAIL</title><content type='html'>Nope, can't do this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;import java.util.regex.Pattern;&lt;br /&gt;class foo&lt;br /&gt;{&lt;br /&gt;    public static void main(String[] args)&lt;br /&gt;    {&lt;br /&gt;        static final Pattern regex = Pattern.compile("abc");&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now I have to go put it somewhere and document it in more detail instead of just keeping it by its only point of use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-4170114177454606042?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/4170114177454606042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/4170114177454606042'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/encapsulation-fail.html' title='ENCAPSULATION FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-9120935313113930271</id><published>2008-11-04T16:16:00.000-04:00</published><updated>2008-11-04T16:20:58.019-04:00</updated><title type='text'>LEXER FAIL</title><content type='html'>&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;class foo&lt;br /&gt;{&lt;br /&gt;   public static void main(String[] args)&lt;br /&gt;   {&lt;br /&gt;       // This prints: \uXXXX&lt;br /&gt;       System.out.println("\\uXXXX");&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;pre&gt;$ javac -Xlint:all foo.java&lt;br /&gt;foo.java:5: illegal unicode escape&lt;br /&gt;       // This prints: \uXXXX&lt;br /&gt;                         ^&lt;br /&gt;1 error&lt;/pre&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;No, Java.  You shouldn't look for escape sequences in comments.  Why are you processing string literal escapes there?  Why are you even doing it at that stage of processing?  C'mon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-9120935313113930271?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/9120935313113930271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/9120935313113930271'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/lexer-fail.html' title='LEXER FAIL'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-1208311469880248033.post-7614810531771031698</id><published>2008-11-04T16:15:00.000-04:00</published><updated>2008-11-04T16:16:25.962-04:00</updated><title type='text'>What is this nonsense?</title><content type='html'>The compilations of a frustrated programmer skilled in modern C++ trying to get Java to do something useful.  The real problem?  Java.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1208311469880248033-7614810531771031698?l=javafail.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/7614810531771031698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1208311469880248033/posts/default/7614810531771031698'/><link rel='alternate' type='text/html' href='http://javafail.blogspot.com/2008/11/what-is-this-nonsense.html' title='What is this nonsense?'/><author><name>Brad Spencer</name><uri>http://www.blogger.com/profile/02473272149542025136</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
