morphia 0.99 / morphia logging 0.99 / morphia validation 0.99
mongo-java-driver-2.7.3 / mongodb-osx-x86_64-2.0.4
When performing a query, morphia fails to match a collection of Enum objects
when the Enum is declared with an abstract method, even when all values in the
Enum provide a concrete implementation of the abstract method.
For instance:
public enum
Foo {
BAR ,
BOO,
BAZ
};
}
works fine for a query like this (FooBar has a field with @Property Foo foo):
List<FooBar> foobars = new ArrayList<FooBar>();
foobars.add(BAR);
foobars.add(BOO);
Query<FooBar> foobarsQuery = ds.createQuery(FooBar.class);
if(!foobars != null && !foobars.isEmpty() {
foobarsQuery.criteria("foo").hasAnyOf(foobars);
}
This will return any documents where foo = FOO or BAR.
But if the Enum definition for Foo is changed to:
public enum
Foo {
BAR {
public void frobnicate() {
// do BAR stuff
}
},
BOO{
public void frobnicate() {
// do BOO stuff
}
},
BAZ {
public void frobnicate() {
// do BAZ stuff
}
}
};
private abstract frobnosticate();
}
The same query no longer matches any documents.
There is no exception stack trace, just an unsuspected behavioral change.
Original issue reported on code.google.com by jaronsampson on 2 May 2012 at 9:03
Original issue reported on code.google.com by
jaronsampson
on 2 May 2012 at 9:03