RFR: 8362885: A more formal way to mark javac's Flags that belong to a specific Symbol type only [v2]

Jan Lahoda jlahoda at openjdk.org
Fri Jul 25 13:45:59 UTC 2025


On Thu, 24 Jul 2025 18:15:04 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Fixing toString value for flags that have ACC_ overloaded flags.
>>  - Review feedback: marking ACC flags with the @Use annotation, forces split of the TYPE target into CLASS/MODULE/PACKAGE/TYPE_VARIABLE.
>>  - Reflecting review feedback:
>>    - when conflict is detected, the generator fails
>>    - adding runtime checks
>>    - using constants for number of bits
>
> make/langtools/tools/flagsgenerator/FlagsGenerator.java line 85:
> 
>> 83:             try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(Paths.get(args[1])))) {
>> 84:                 out.println("""
>> 85:                             package com.sun.tools.javac.code;
> 
> Do we need a license header for generated sources?

`CompilerProperties` and other files that are generated using similar means don't have license headers, so I assume we don't need that.

> test/langtools/tools/javac/flags/FlagsTest.java line 102:
> 
>> 100:     private static void printFreeFlags(String comment, long freeFlags) {
>> 101:             System.err.print("free flags for " + comment + ": ");
>> 102:             for (int bit = 16; bit < 64; bit++) { //lowest 16 bits are used in classfiles, never suggest adding anything there
> 
> Replace 16 with Character.SIZE and 64 with Long.SIZE?

I don't think `Character.SIZE` is really appropriate, but I've declared `U2_SIZE` for `16`, and used `Long.SIZE` for `64`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26452#discussion_r2231113665
PR Review Comment: https://git.openjdk.org/jdk/pull/26452#discussion_r2231112402


More information about the compiler-dev mailing list