5
I am doing some tests to understand in practice the functioning of the classSwingWorker
in the swing
, and I noticed that the method doInBackground
demands a return null
, even starting the form variable below:
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
return null;
}
};
In declaring SwingWorker<Void, Void>
, the first parameter refers precisely the return of the method cited, but even if it is Void
, he forces to return null
(If you do not provide the null return, the IDE displays a semantic error and does not compile the code). See running on IDEONE.
If the signature is protected Void doInBackground()
, Why does it require feedback anyway? There is some difference between Void
and void
to justify this behaviour?
"it forces to return null" this comes from the compiler or the IDE?
– rray
@rray the IDE accuses a "Missing Return statement" semantic error, and neither compiles.
– user28595