Buggy code:
public class ArrayFieldVectorTest { protected Fraction [ ] [ ] ma1 = new Fraction [ ] [ ] { new Fraction [ ] { new Fraction ( 1 ) , new Fraction ( 2 ) , new Fraction ( 3 ) } , new Fraction [ ] { new Fraction ( 4 ) , new Fraction ( 5 ) , new Fraction ( 6 ) } , new Fraction [ ] { new Fraction ( 7 ) , new Fraction ( 8 ) , new Fraction ( 9 ) } } ; protected Fraction [ ] vec1 = new Fraction [ ] { new Fraction ( 1 ) , new Fraction ( 2 ) , new Fraction ( 3 ) } ; protected Fraction [ ] vec2 = new Fraction [ ] { new Fraction ( 4 ) , new Fraction ( 5 ) , new Fraction ( 6 ) } ; protected Fraction [ ] vec3 = new Fraction [ ] { new Fraction ( 7 ) , new Fraction ( 8 ) , new Fraction ( 9 ) } ; protected Fraction [ ] vec4 = new Fraction [ ] { new Fraction ( 1 ) , new Fraction ( 2 ) , new Fraction ( 3 ) , new Fraction ( 4 ) , new Fraction ( 5 ) , new Fraction ( 6 ) , new Fraction ( 7 ) , new Fraction ( 8 ) , new Fraction ( 9 ) } ; protected Fraction [ ] vec_null = new Fraction [ ] { new Fraction ( 0 ) , new Fraction ( 0 ) , new Fraction ( 0 ) } ; protected Fraction [ ] dvec1 = new Fraction [ ] { new Fraction ( 1 ) , new Fraction ( 2 ) , new Fraction ( 3 ) , new Fraction ( 4 ) , new Fraction ( 5 ) , new Fraction ( 6 ) , new Fraction ( 7 ) , new Fraction ( 8 ) , new Fraction ( 9 ) } ; protected Fraction [ ] [ ] mat1 = new Fraction [ ] [ ] { new Fraction [ ] { new Fraction ( 1 ) , new Fraction ( 2 ) , new Fraction ( 3 ) } , new Fraction [ ] { new Fraction ( 4 ) , new Fraction ( 5 ) , new Fraction ( 6 ) } , new Fraction [ ] { new Fraction ( 7 ) , new Fraction ( 8 ) , new Fraction ( 9 ) } } ; public static class FieldVectorTestImpl < T extends FieldElement < T > > implements Serializable , FieldVector < T > { private static final long serialVersionUID = 3970959016014158539L ; private final Field < T > field ; protected T [ ] data ; @ SuppressWarnings ( "unchecked" ) private T [ ] buildArray ( final int length ) { <START_BUG> return ( ( T [ ] ) ( Array . newInstance ( field . getZero ( ) . getClass ( ) , length ) ) ) ; <END_BUG> } public FieldVectorTestImpl ( T [ ] d ) { } public Field < T > getField ( ) { } private UnsupportedOperationException unsupported ( ) { } public FieldVector < T > copy ( ) { } public FieldVector < T > add ( FieldVector < T > v ) { } public FieldVector < T > add ( T [ ] v ) { } public FieldVector < T > subtract ( FieldVector < T > v ) { } public FieldVector < T > subtract ( T [ ] v ) { } public FieldVector < T > mapAdd ( T d ) { } public FieldVector < T > mapAddToSelf ( T d ) { } public FieldVector < T > mapSubtract ( T d ) { } public FieldVector < T > mapSubtractToSelf ( T d ) { } public FieldVector < T > mapMultiply ( T d ) { } public FieldVector < T > mapMultiplyToSelf ( T d ) { } public FieldVector < T > mapDivide ( T d ) { } public FieldVector < T > mapDivideToSelf ( T d ) { } public FieldVector < T > mapInv ( ) { } public FieldVector < T > mapInvToSelf ( ) { } public FieldVector < T > ebeMultiply ( FieldVector < T > v ) { } public FieldVector < T > ebeMultiply ( T [ ] v ) { } public FieldVector < T > ebeDivide ( FieldVector < T > v ) { } public FieldVector < T > ebeDivide ( T [ ] v ) { } public T [ ] getData ( ) { } public T dotProduct ( FieldVector < T > v ) { } public T dotProduct ( T [ ] v ) { } public FieldVector < T > projection ( FieldVector < T > v ) { } public FieldVector < T > projection ( T [ ] v ) { } public FieldMatrix < T > outerProduct ( FieldVector < T > v ) { } public FieldMatrix < T > outerProduct ( T [ ] v ) { } public T getEntry ( int index ) { } public int getDimension ( ) { } public FieldVector < T > append ( FieldVector < T > v ) { } public FieldVector < T > append ( T d ) { } public FieldVector < T > append ( T [ ] a ) { } public FieldVector < T > getSubVector ( int index , int n ) { } public void setEntry ( int index , T value ) { } public void setSubVector ( int index , FieldVector < T > v ) { } public void setSubVector ( int index , T [ ] v ) { }

Fix:
return ( ( T [ ] ) ( Array . newInstance ( field . getRuntimeClass ( ) , length ) ) ) ;