<div dir="ltr">The recent thread about "cleaner nesting" reminded me of a related language constraint that has caused me a bit of a headache recently, and I wonder if we can clean it up at the same time.<div><br></div><div>Somewhat recently, interfaces have gained the ability to have private methods, for use as helpers in implementing default methods. However, there is currently no plan for private fields or private nested classes to be allowed in those contexts, even private static final fields. I don't see any particularly compelling reason for this: private fields made no sense for interfaces in Java 1.0, but since interfaces can now have private behavior, it makes sense for them to have private state to support that behavior, or at the very least private constants. </div><div><br></div><div>For example, it seems like it should be totally fine to write:</div><div><br></div><div>interface Actor {</div><div>  private static final Logger logger = new Logger();</div><div>  default void act() {</div><div>  Â  logger.log("act not implemented");</div><div>  }</div><div>}</div><div><br></div><div>But this is illegal because logger is not permitted to have the private modifier. Instead, you have to either make the logger public (polluting the namespace of inheriting classes and breaking encapsulation of your interface), or else invent some public class that's allowed to hold a private method (still polluting the namespace, but keeping the field hidden):</div><div><br></div><div>interface Actor {</div><div>  /** Do not use. */</div><div>  public static final class Private {</div><div>  Â  private static final Logger logger = new Logger();</div><div>  }</div><div>  default void act() {</div><div>  Â  Private.logger.log("act not implemented");</div><div>  }</div><div>}</div><div><br></div><div>Is this something we could include in the overall nesting reform plan?</div></div>