Community
Participate
Working Groups
In the following snippet, the last line is marked as an error in the IDE even though I can compile it using Ant's build file: File aFile = new File(baseDir + File.pathSeparator + aSelectTemplateForm.getSelectedTemplate()); String[] tmp = {"htm","html"}; ExampleFileFilter anExampleFileFilter = new ExampleFileFilter(tmp,""); File[] templateFiles = aFile.listFiles(anExampleFileFilter); ... ExampleFileFilter is a sample implementation provided by Sun. The system fails to realize that ExampleFileFilter is an extension of FileFilter or fails to allow for arguments to be extended from FileFilter.
I found it in 3.0 M5
Could you please provide a complete test case that reproduces the problem and attach it to this bug report? Thanks.
Created attachment 7047 [details] complete testcase add attached 2 files to a project and open Bug47982.java in Eclipse.
ExampleFileFilter extends the FileFilter from the swing package javax.swing.filechooser, but doesn't implement java.io.FileFilter. The method listFiles expects an object that implements java.io.FileFilter, not a subclass of the Swing class. If you add implements java.io.FileFilter in the declaration of ExampleFileFilter then the compile error is fixed. I would close as INVALID.
Close as INVALID.