This is my understanding, based on what's in the quote above.You want to run Main.class [Assume that it belongs to the default package.] from the command line. It uses two packages good.* and bad.*. You want to disable assertions for all classes of bad.* as well as good.* but at the same time want to enable them for Main.class.
Main.class belongs to the default package means that we DON'T need to include a
package <some_folder>;
as the 1st line in Main.java file.
That's all that is.
"It [Main.class] uses two packages good.* and bad.*."
That means that we have
import good.*;
import bad.*;
inside Main.java file.
So far so good.
"You want to disable assertions for all classes of bad.* as well as good.*"
That means some or all of those classes inside the good or the bad folders contain assert statements in them.
"You want to disable assertions for all classes of bad.* as well as good.* but at the same time want to enable them for Main.class."
That simply means all classes inside the good and the bad folders are disabled as far as the assertions go. At the same time, we want to enable all classes inside those two folders JUST FOR Main.class.
I hope we are on the same page so far. This is what I understood from the above quote on the very top of this post.
To achieve enabling the classes inside the good and the bad folders JUST FOR Main.class, your answer was:
java -ea:... -da:good... -da:bad... Main
-da:good and -da:bad simply tell me that good folder, bad folder, Main.java and Main.class are inside the default package. If not, you would have used something like -da:some_folder.good... and -da:some_folder.bad....
Is that correct?
Having -ea:... enables everything, i.e. enabling Main, everything (sub-folders included) inside both good and bad folders.
Then having -da:good... -da:bad... in that bold command line above EXPLICITLY disables everything (sub-folders included) inside both good and bad folders. In other words, this action "overrides" -ea:....
Therefore, we would end up with everything (sub-folders included) inside both good and bad folders being disabled for Main.
In other words, I'm having a tough time reconciling
and what your answer choice offers.You want to disable assertions for all classes of bad.* as well as good.* but at the same time want to enable them for Main.class.
What am I missing here? Thanks a lot.
Sorry about the long winded question.
Schmichael