I come with a problem, I'm trying to implement two-level casting.
The following is simplified code to show what I'm trying to do:
public class Array2D<T> { private T[][] _array; .... public T get( int x , int y ) .... public void set( T o , int x , int y ) }
There are no problems before that.
I am trying to extend this class, for example, I could encapsulate the use of SoftReferences in getter and setter:
public class Array2DSoftRefs<T> extends Array2D<SoftReference<T>> { public T get( int x , int y ) { return super.get(x,y).get();
}
In fact, they launch me because the compiler / syntax analyzer skips overwriting generics, then the @Override annotation cannot help me (captain obviously).
I cannot figure out how to return type T from the SoftReference<T> template.
I tried to add two generics T and U for SoftReference<T> , but without success.
source share