RFR: 8301578: Perform output outside synchronization in Module.class [v3]
ExE Boss
duke at openjdk.org
Sun Feb 5 18:48:52 UTC 2023
On Wed, 1 Feb 2023 08:51:16 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposed to reduce contention in synchronized methods mainly by doing I/O operations outside synch blocks.
>
> Per Minborg has updated the pull request incrementally with three additional commits since the last revision:
>
> - Revert benchmark change
> - Fix typo
> - Use another type of comment
src/java.base/share/classes/java/lang/Module.java line 316:
> 314: %n""", cls, mtd, mod, modflag);
> 315: }
> 316: }
The `else` and `if` blocks can be merged:
Suggestion:
} else if (trySetEnableNativeAccess(target)) {
// warn and set flag, so that only one warning is reported per module
String cls = owner.getName();
String mtd = cls + "::" + methodName;
String mod = isNamed() ? "module " + getName() : "the unnamed module";
String modflag = isNamed() ? getName() : "ALL-UNNAMED";
System.err.printf("""
WARNING: A restricted method in %s has been called
WARNING: %s has been called by %s
WARNING: Use --enable-native-access=%s to avoid a warning for this module
%n""", cls, mtd, mod, modflag);
}
-------------
PR: https://git.openjdk.org/jdk/pull/12193
More information about the core-libs-dev
mailing list