With the refactoring
      "Move inner to upper level" (F6)
we can move an inner interface, to a "solo" interface
 
 
   public class Class2    {

       public interface Constants {
           int K1 = 1000 ;
       }
 
       public static void main ( String[] args )       {
           int i = Constants.K1 ;
           System.out.println ( "i = " + i );
       }      
   }
 
becomes
 
   public class Class2   {
      public static void main ( String[] args )
       {
           int i = Constants.K1 ;
           System.out.println ( "i = " + i );
       }
   }
and
   public interface Constants {
        int K1 = 1000 ;
   }

 
 
 
Request : add an option to have the containing implement the interface;
 
==> you can remove all the implicit references to the interface.
 
 
 
 
   public class Class2  implements Constants {             <== addition here
       public static void main ( String[] args )
       {
           int i = K1 ;                                    <== "substraction" here
           System.out.println ( "i = " + i );
       }
   }
 
Alain Ravet

Reply via email to