Community
Participate
Working Groups
When you use a deprecated class, warnings are reported for the import statement and the constructor. Suppressing constructor warning works at that level but does not suppress subsequent reporting of warnings on the import statement. import java.io.StringBufferInputStream; private final InputStream getModifiedInputStream() throws IOException { return new StringBufferInputStream("this is a test"); }
Perhaps you could add a possibility to not show deprecated imports at all? As I get this "is deprecated" message later on anyway, if I'm using this import. And otherwise I get the warning "Unused import". I too would really appreciate such a feature, as this warnings are very irritating.
We made @SuppressWarnings on first type of the unit also perform on leading imports, for this very issue. If you disagree, please reopen.
@SuppressWarnings works for the Constructor in the example. But you can't add an Annotation to imports. So it does not work for the import line. Unfortunately for me, I've found another bug (#103629) which is a duplicate of this one and was already rejected... In my opinion, it would be a useful and convenient feature (and a good solution for this bug), if I could switch off deprecation warnings for (all) import lines in the Errors/Warnings section of the Preferences. Then I would get this warnings only within the class and may suppress them with the annotation.