Mismatched class names in code example and compiler output example · Issue #284 · java/devjava-content
Repository navigation
Mismatched class names in code example and compiler output example #284
New issue
New issue
Open
Open
Mismatched class names in code example and compiler output example #284
Description
@authentictech's profile authentictech opened on Oct 17, 2026In Learn Java > Organizing your Application > Modules > Strong Encapsulation (of JDK Internals), Experiments with Strong Encapsulation section, there is a code example which includes the sun.util.BuddhistCalendar class which is different to the sun.util.PreHashedMap class given in the related compiler output, as below:
Code:
// add to `main` method
IO.println(sun.util.BuddhistCalendar.class.getSimpleName());
Compiler output:
Internal.java:8: error: package sun.util is not visible
IO.println(sun.util.PreHashedMap.class.getSimpleName());
^
(package sun.util is declared in module java.base, which does not export it)
1 error
error: compilation failed