Type safety and varargs don't play nicely together. Funny that it only freaks

out when you try to compile code that calls a varargs method with more than one
class. At that point it tries to create an array with a generic element type
which is disallowed.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2036 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2007-01-16 05:33:58 +00:00
parent a63eef36a6
commit be888e5f29
@@ -26,17 +26,30 @@ import java.util.Collection;
import com.samskivert.io.PersistenceException;
import com.samskivert.jdbc.depot.ConstructedQuery;
import com.samskivert.jdbc.depot.PersistentRecord;
import com.samskivert.util.CollectionUtil;
/**
* Completely overrides the FROM clause, if it exists.
*/
public class FromOverride extends QueryClause
{
public FromOverride (Class<? extends PersistentRecord>... fromClasses)
public FromOverride (Class<? extends PersistentRecord> fromClass)
throws PersistenceException
{
CollectionUtil.addAll(_fromClasses, fromClasses);
_fromClasses.add(fromClass);
}
public FromOverride (Class<? extends PersistentRecord> fromClass1,
Class<? extends PersistentRecord> fromClass2)
throws PersistenceException
{
_fromClasses.add(fromClass1);
_fromClasses.add(fromClass2);
}
public FromOverride (Collection<Class<? extends PersistentRecord>> fromClasses)
throws PersistenceException
{
_fromClasses.addAll(fromClasses);
}
// from QueryClause