I know this is an old post, but my recent experiment may shed light on this topic for those of you who are interested. This is what you need to know.
Basically, I “broke” some existing code by running Comparable in one of my other classes. Here is a stripped-down version that generates the same "Exception occurred in the compiler ..."
If the nested conditional expression has less than 5 expressions, or if the USDollars class does not implement Comparable, this code compiles.
public class TestHit { protected final String fSymbol; protected final long fTime; protected final USDollars fBasePrice; public TestHit(String aSymbol, long aTime, int aBasePrice) { fSymbol = aSymbol; fTime = aTime; fBasePrice = new USDollars(aBasePrice); } public Object field(int aIndex) { return (aIndex == 0)? fSymbol : (aIndex == 1)? fTime : (aIndex == 2)? fBasePrice : (aIndex == 3)? new Integer(4)
By the way, a quick fix was to change the code as follows (ugly, but it works):
public Object field(int aIndex) { if (aIndex == 2) return fBasePrice; return (aIndex == 0)? fSymbol : (aIndex == 1)? fTime : (aIndex == 3)? new Integer(4)
source share