Eclipse not removing obsolete classes?

Here is a sample code

public class DeprecatedTest {

    private final List<Object> instances;

    public DeprecatedTest(){
         instances = new ArrayList<Object>();
         instances.add(new Depr());
         instances.add(new Depr1());
         instances.add(new Depr2());
         instances.add(new Depr3());

         Depr depr = new Depr();
         Depr2 depr2 = new Depr2();
     }  

    @Deprecated
    public class Depr{}
    @Deprecated
    public class Depr1{}
    @Deprecated
    public class Depr2{}
    @Deprecated
    public class Depr3{}    
}

Eclipse removes the class name before the instance name (last 2 declarations). But if it is an anonymous class, Eclipse does not remove the initialization of the class after the new operand. This is really inconvenient! Is this customizable?


SpringSource Tool Suite Version: 2.5.0.M3 Build code: 201008251000

+3
source share
1 answer

It should be very simple →

  • open Settings
  • type "out of date" in the search field
  • go to Java-> Editor-> Syntax Coloring
  • find Java-> Deprecated items in the tree
  • Check the Enable box and the Strikethroigh box.

tadaa!

+3
source

Source: https://habr.com/ru/post/1786588/


All Articles