Hi there.

Imagine I have a data interface like this:
public interface ImportantData<E> {
 
	public void addObserver(DataObserver<E> obs);
 
	public void removeObserver(DataObserver<E> obs);
 
}

And then I have some class that is listening to changes in my data:
public class DataChangeSignal {
 
	private DataObserver<?> dataObs;
	private ImportantData<?> currentData;
 
	public DataChangeSignal() {
		dataObs = new DataObserver<Object>() {
			public void dataChanged(Object data) {
				sendSignal();
			}
		};
	}
 
	public void setData(ImportantData<?> data) {
		if (currentData != null) {
			currentData.removeObserver(dataObs);
		}
		currentData = data;
		if (currentData != null) {
			currentData.addObserver(dataObs);
		}
	}
 
	public void sendSignal() {
		// do stuff
	}
 
}

As you can see, I dont care what the generic type parameter of my data object is. I just want to send the same kind of signal in any case.
But!
The code does not compile. I can not add or remove my observers to my data because of a mismatch.

What should I do?
It does not make sense to make my DataChangeSignal a generic class. Its supposed to work with different kinds of data throughout.
Does anybody have a good advice?

Thanks in advance.