4

There are certain classes, such as Closeable, File and Container, that have doppelgänger classes in obscure packages that I am extremely unlikely to ever use. Normally, that wouldn't be an issue, but when I Organize Imports I have to manually select the correct type to import. Is there any way to exclude specific packages from the Organize Imports tool?

Eclipse Version:
Version: 3.7.1
Build id: M20110909-1335

Jeffrey
  • 44,417
  • 8
  • 90
  • 141

1 Answers1

8

I don't see, for example, the com.sun.*.Closeable in your example when I use ContentAssist or Organize Imports. I think where you want to configure it is in Preferences > Java > Appearance > Type Filters. However, I don't have com.sun.* listed in my filter list. Maybe it's the "Hide forbidden references" option.

enter image description here

E-Riz
  • 31,431
  • 9
  • 97
  • 134
  • 1
    Weird, my Hide forbidden references was checked too. But this is indeed what I was looking for. Thanks! – Jeffrey Apr 04 '12 at 22:04
  • What crappy feature is this??? My collegue had "auto organise imports on save" configured, in combination with this damn thing, removing some java.util imports on save. Of course, the jenkins build broke. But when you see "cannot find symbol ... List" then you think of auto updated bad java versions, not existing rt.jar and whatever, but not on auto-removed imports made by eclipse. It took us a while to find out. – Thomas Schütt Aug 14 '19 at 12:11