Getting an error in the code below relating to the line with selectedFileHolder. The code has to do with adding a PropertyChangeListener for a swing worker which will copy a converted File to selectedFileHolder when it detects the conversion job is done.


Code:
import java.util.Vector;

class X
{

public void actionPerformed(ActionEvent e)
{
File selectedFileHolder;


task.addPropertyChangeListener(

    new PropertyChangeListener() {

        @Override
            public void propertyChange(PropertyChangeEvent evt) {

           if (task.getState() == StateValue.DONE) {

                   try {
                   selectedFileHolder = task.get();//error line
                   } catch (InterruptedException exp) {
                   exp.printStackTrace();
                } catch (ExecutionException exp) {
                   exp.printStackTrace();
                   }
           }
            }
    }

}

}
it says

Cannot refer to a non-final variable selectedFileHolder inside an inner class defined in a different method.

When I made selectedFileHolder final it switched to

The final local variable selectedFileHolder cannot be assigned, since it is defined in an enclosing type

For some reason another error just popped up near the top at

import java.util.Vector;


Internal compiler error java.lang.IllegalArgumentException: info cannot be null at org.eclipse.jdt.internal.compiler.codegen.StackMapFrame.addStackItem(StackMapFrame.java:81)


Maybe this is a deprecated import?