Request for guidance on using possible future sets of javac options

joe darcy joe.darcy at oracle.com
Sat Feb 7 00:44:32 UTC 2015


Hi Magnus,

On 2/6/2015 3:45 PM, Magnus Ihse Bursie wrote:
> On 2015-02-06 23:43, joe darcy wrote:
>> Hi Erik,
>>
>> On 2/6/2015 12:03 AM, Erik Joelsson wrote:
>>> Hello Joe,
>>>
>>> The simplest way of accomplishing this currently would be to add 
>>> lines like this to make/CompileJavaModules.gmk:
>>>
>>> java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected 
>>> "-XdoclintPackage:java.*;javax.*"
>>> java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all,-missing/protected 
>>> "-XdoclintPackage:java.*;javax.*"
>>>
>>> This assuming those modules are already setup to using -Xlint:all 
>>> -Werror in make/common/SetupJavacompilers.gmk, which should be true 
>>> for at least those two.
>>>
>>> Is the separator ';' actually a path separator or always semi colon? 
>>> If so, please use $(PATH_SEP). Also, a line containing a potential 
>>> semi colon must always be quoted before given to the shell.
>>
>> That particular idiom didn't seem to work. I also tried
>
> It seems the value was not propagated correctly. Try adding this patch:
> diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk
> --- a/make/CompileJavaModules.gmk
> +++ b/make/CompileJavaModules.gmk
> @@ -481,7 +481,7 @@
>      $1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix 
> $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
>    endif
>    $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
> -  $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)"
> +  $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)" 
> $$($1_ADD_JAVAC_FLAGS)
>
>    $$(eval $$(call SetupJavaCompilation,$1, \
>        SETUP := $$(if $$($1_SETUP), $$($1_SETUP), 
> GENERATE_JDKBYTECODE), \
>
>
> Now Erik's suggestion should work.
>
> Also, if the syntax is still in flux, I'd like to recommend a solution 
> without semicolon, since that is interpreted as a command line 
> separator in the unix shell world, and it's always a lot of hassle if 
> you need to propagate those. Commas are much simpler. :)
>

The following change to CompileJavaModules.gmk did the trick:

diff -r d91ed1951b94 make/CompileJavaModules.gmk
--- a/make/CompileJavaModules.gmk    Thu Jan 29 15:34:46 2015 -0800
+++ b/make/CompileJavaModules.gmk    Fri Feb 06 16:41:41 2015 -0800
@@ -42,6 +42,7 @@

  ################################################################################

+java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected 
'-Xdoclint/package:java.*,javax.*'
  java.base_COPY := .icu .dat .spp content-types.properties 
hijrah-config-islamic-umalqura.properties
  java.base_CLEAN := intrinsic.properties

@@ -481,7 +482,7 @@
      $1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix 
$(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
    endif
    $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
-  $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)"
+  $1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)" 
$$($1_ADD_JAVAC_FLAGS)

    $$(eval $$(call SetupJavaCompilation,$1, \
        SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \

In particular, using single quotes (') instead of double quotes (") 
seems to be necessary to get the wildcard syntax passed down to javac 
correctly. (Layers of quoting and globbing, always a minefield!)

With the above change, the field properly fields on doclint problems in 
the base module.

And the candidate syntax for the doclint option does use comma rather 
than semicolon as a delimiter :-)

Thanks,

-Joe






More information about the build-dev mailing list