Published vs. Public

I’m really like the idea of separating published interfaces from public interfaces. Apparently, a JSR has been started to add an idea like this to Java. In this case, the idea is to provide superpackage, and the initially proposed syntax (taken from that site) is something like:

super package com.sun.myModule { export com.sun.myModule.myStuff.*; export com.sun.myModule.yourStuff.Interface; com.sun.myModule.myStuff; com.sun.myModule.yourStuff; com.sun.SomeOtherModule.theirStuff; org.someOpenSource.someCoolStuff; }

Despite the author’s numerous warnings that this syntax is arbitrary and just for exemplifying the general idea, I have to say this syntax sucks. How about we just reuse the recently introduced support for annotations and add a Published attribute to Java. No need to change the language, no need to add another arbitrary source file. No mess, no fuss.

(via LtU)