7013272: Automatically generate info about how compiler resource keys are used

Wed, 26 Jan 2011 13:45:25 -0800

author
jjg
date
Wed, 26 Jan 2011 13:45:25 -0800
changeset 842
3da26790ccb7
parent 841
df371fd16386
child 843
92ab09ed59fd

7013272: Automatically generate info about how compiler resource keys are used
Reviewed-by: mcimadamore

make/build.xml file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/code/Printer.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
test/tools/javac/diags/ArgTypeCompilerFactory.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/Example.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/MessageFile.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/MessageInfo.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/RunExamples.java file | annotate | diff | comparison | revisions
     1.1 --- a/make/build.xml	Wed Jan 26 11:20:19 2011 -0800
     1.2 +++ b/make/build.xml	Wed Jan 26 13:45:25 2011 -0800
     1.3 @@ -1,6 +1,6 @@
     1.4  <?xml version="1.0" encoding="UTF-8"?>
     1.5  <!--
     1.6 - Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
     1.7 + Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
     1.8   DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9  
    1.10   This code is free software; you can redistribute it and/or modify it
    1.11 @@ -331,7 +331,7 @@
    1.12              executable="${dist.bin.dir}/javac"
    1.13              srcdir="test/tools/javac/diags"
    1.14              destdir="${build.dir}/diag-examples/classes"
    1.15 -            includes="Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
    1.16 +            includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java"
    1.17              sourcepath=""
    1.18              classpath="${dist.lib.dir}/javac.jar"
    1.19              includeAntRuntime="no"
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Printer.java	Wed Jan 26 11:20:19 2011 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Printer.java	Wed Jan 26 13:45:25 2011 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -106,7 +106,7 @@
    2.11      }
    2.12  
    2.13      /**
    2.14 -     * * Get a localized string represenation for all the symbols in the input list.
    2.15 +     * * Get a localized string representation for all the symbols in the input list.
    2.16       *
    2.17       * @param ts symbols to be displayed
    2.18       * @param locale the locale in which the string is to be rendered
     3.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jan 26 11:20:19 2011 -0800
     3.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jan 26 13:45:25 2011 -0800
     3.3 @@ -23,260 +23,440 @@
     3.4  # questions.
     3.5  #
     3.6  
     3.7 +# Messages in this file which use "placeholders" for values (e.g. {0}, {1})
     3.8 +# are preceded by a stylized comment describing the type of the corresponding
     3.9 +# values.
    3.10 +# The types currently in use are
    3.11 +#
    3.12 +# boolean           true or false
    3.13 +# file name         the name of an input file; e.g.   MyFile.java
    3.14 +# message segment   a sub-message; see compiler.misc.*
    3.15 +# modifier          a Java modifier; e.g. public, private, protected
    3.16 +# name              a name, typically a Java identifier
    3.17 +# number            an integer
    3.18 +# option name       the name of a command line option
    3.19 +# source version    a source version number, such as 1.5, 1.6, 1.7
    3.20 +# string            a general string
    3.21 +# symbol            the name of a declared type
    3.22 +# symbol kind       a description of the kind of a declaration; see compiler.misc.kindname.*
    3.23 +# token             the name of a non-terminal in source code; see compiler.misc.token.*
    3.24 +# type              a Java type; e.g. int, X, X<T>
    3.25 +# unused            the value is not used in this message
    3.26 +#
    3.27 +# list of X         a comma-separated list of items; e.g. list of type
    3.28 +# X or Y            alternation; e.g. message segment or type
    3.29 +# set of X          a comma-separated collection of items; e.g. set of modifier
    3.30 +#
    3.31 +# These may be composed: e.g.   list of type or message segment
    3.32 +#
    3.33 +# These comments are verified by the jtreg test test/tools/javac/diags/MessageInfo,
    3.34 +# using info derived from the collected set of examples in test/tools/javac/diags/examples.
    3.35 +# MessageInfo can also be run as a standalone utility providing more facilities
    3.36 +# for manipulating this file. For more details, see MessageInfo.java.
    3.37 +
    3.38  ##
    3.39  ## errors
    3.40  ##
    3.41  
    3.42 +# 0: symbol
    3.43  compiler.err.abstract.cant.be.instantiated=\
    3.44      {0} is abstract; cannot be instantiated
    3.45 +
    3.46  compiler.err.abstract.meth.cant.have.body=\
    3.47      abstract methods cannot have a body
    3.48 +
    3.49  compiler.err.already.annotated=\
    3.50      {0} {1} has already been annotated
    3.51 +
    3.52 +# 0: symbol, 1: symbol
    3.53  compiler.err.already.defined=\
    3.54      {0} is already defined in {1}
    3.55 +
    3.56 +# 0: string
    3.57  compiler.err.already.defined.single.import=\
    3.58      {0} is already defined in a single-type import
    3.59 +
    3.60 +# 0: string
    3.61  compiler.err.already.defined.static.single.import=\
    3.62      {0} is already defined in a static single-type import
    3.63 +
    3.64  compiler.err.already.defined.this.unit=\
    3.65      {0} is already defined in this compilation unit
    3.66 +
    3.67 +# 0: type, 1: list of name
    3.68  compiler.err.annotation.missing.default.value=\
    3.69      annotation {0} is missing value for the attribute {1}
    3.70 +
    3.71 +# 0: type, 1: list of name
    3.72  compiler.err.annotation.missing.default.value.1=\
    3.73      annotation {0} is missing values for attributes {1}
    3.74 +
    3.75 +# 0: type
    3.76  compiler.err.annotation.not.valid.for.type=\
    3.77      annotation not valid for a value of type {0}
    3.78 +
    3.79  compiler.err.annotation.type.not.applicable=\
    3.80      annotation type not applicable to this kind of declaration
    3.81 +
    3.82  compiler.err.annotation.value.must.be.annotation=\
    3.83      annotation value must be an annotation
    3.84 +
    3.85  compiler.err.annotation.value.must.be.class.literal=\
    3.86      annotation value must be a class literal
    3.87 +
    3.88  compiler.err.annotation.value.must.be.name.value=\
    3.89      annotation values must be of the form ''name=value''
    3.90 +
    3.91  compiler.err.annotation.value.not.allowable.type=\
    3.92      annotation value not of an allowable type
    3.93 +
    3.94  compiler.err.anon.class.impl.intf.no.args=\
    3.95      anonymous class implements interface; cannot have arguments
    3.96 +
    3.97  compiler.err.anon.class.impl.intf.no.typeargs=\
    3.98      anonymous class implements interface; cannot have type arguments
    3.99 +
   3.100  compiler.err.anon.class.impl.intf.no.qual.for.new=\
   3.101      anonymous class implements interface; cannot have qualifier for new
   3.102 +
   3.103 +# 0: symbol, 1: symbol, 2: symbol
   3.104  compiler.err.array.and.varargs=\
   3.105      cannot declare both {0} and {1} in {2}
   3.106 +
   3.107  compiler.err.array.dimension.missing=\
   3.108      array dimension missing
   3.109 +
   3.110 +# 0: type
   3.111  compiler.err.array.req.but.found=\
   3.112      array required, but {0} found
   3.113  
   3.114  compiler.err.assignment.from.super-bound=\
   3.115      assigning from wildcard {0}
   3.116 +
   3.117  compiler.err.assignment.to.extends-bound=\
   3.118      assigning to wildcard {0}
   3.119 +
   3.120  compiler.err.attribute.value.must.be.constant=\
   3.121      attribute value must be constant
   3.122  
   3.123  compiler.err.break.outside.switch.loop=\
   3.124      break outside switch or loop
   3.125  
   3.126 +# 0: name
   3.127  compiler.err.call.must.be.first.stmt.in.ctor=\
   3.128      call to {0} must be first statement in constructor
   3.129 +
   3.130  compiler.err.cant.apply.symbol=\
   3.131      {0} {1} in {4} {5} cannot be applied to given types\n\
   3.132      required: {2}\n\
   3.133      found: {3}
   3.134 +
   3.135 +# 0: symbol kind, 1: name, 2: list of type or message segment, 3: list of type or message segment, 4: symbol kind, 5: type, 6: message segment
   3.136  compiler.err.cant.apply.symbol.1=\
   3.137      {0} {1} in {4} {5} cannot be applied to given types;\n\
   3.138      required: {2}\n\
   3.139      found: {3}\n\
   3.140      reason: {6}
   3.141 +
   3.142 +# 0: symbol kind, 1: name, 2: list of type
   3.143  compiler.err.cant.apply.symbols=\
   3.144      no suitable {0} found for {1}({2})
   3.145 +
   3.146 +# 0: symbol
   3.147  compiler.err.cant.assign.val.to.final.var=\
   3.148      cannot assign a value to final variable {0}
   3.149 +
   3.150 +# 0: type
   3.151  compiler.err.cant.deref=\
   3.152      {0} cannot be dereferenced
   3.153 +
   3.154  compiler.err.cant.extend.intf.annotation=\
   3.155      ''extends'' not allowed for @interfaces
   3.156 +
   3.157 +# 0: symbol
   3.158  compiler.err.cant.inherit.from.final=\
   3.159      cannot inherit from final {0}
   3.160 +
   3.161 +# 0: symbol
   3.162  compiler.err.cant.ref.before.ctor.called=\
   3.163      cannot reference {0} before supertype constructor has been called
   3.164 +
   3.165  compiler.err.cant.ret.val.from.meth.decl.void=\
   3.166      cannot return a value from method whose result type is void
   3.167 +
   3.168  compiler.err.cant.select.static.class.from.param.type=\
   3.169      cannot select a static class from a parameterized type
   3.170 +
   3.171 +# 0: symbol, 1: string, 2: string
   3.172  compiler.err.cant.inherit.diff.arg=\
   3.173      {0} cannot be inherited with different arguments: <{1}> and <{2}>
   3.174 +
   3.175  compiler.err.catch.without.try=\
   3.176      ''catch'' without ''try''
   3.177 +
   3.178 +# 0: symbol kind, 1: symbol
   3.179  compiler.err.clash.with.pkg.of.same.name=\
   3.180      {0} {1} clashes with package of same name
   3.181 +
   3.182  compiler.err.const.expr.req=\
   3.183      constant expression required
   3.184 +
   3.185  compiler.err.cont.outside.loop=\
   3.186      continue outside of loop
   3.187 +
   3.188 +# 0: symbol
   3.189  compiler.err.cyclic.inheritance=\
   3.190      cyclic inheritance involving {0}
   3.191 +
   3.192  compiler.err.cyclic.annotation.element=\
   3.193      cyclic annotation element type
   3.194 +
   3.195 +# 0: unused
   3.196  compiler.err.call.to.super.not.allowed.in.enum.ctor=\
   3.197      call to super not allowed in enum constructor
   3.198 +
   3.199 +# 0: type
   3.200  compiler.err.no.superclass=\
   3.201      {0} has no superclass
   3.202  
   3.203  compiler.err.wrong.target.for.polymorphic.signature.definition=\
   3.204      MethodHandle API building requires -target 7 runtimes or better; current is -target {0}
   3.205  
   3.206 +# 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
   3.207  compiler.err.concrete.inheritance.conflict=\
   3.208      methods {0} from {1} and {2} from {3} are inherited with the same signature
   3.209  
   3.210  compiler.err.default.allowed.in.intf.annotation.member=\
   3.211      default value only allowed in an @interface member
   3.212 +
   3.213 +# 0: symbol
   3.214  compiler.err.doesnt.exist=\
   3.215      package {0} does not exist
   3.216 +
   3.217  compiler.err.duplicate.annotation=\
   3.218      duplicate annotation
   3.219 +
   3.220 +# 0: name, 1: type
   3.221  compiler.err.duplicate.annotation.member.value=\
   3.222      duplicate annotation member value {0} in {1}
   3.223 +
   3.224 +# 0: name
   3.225  compiler.err.duplicate.class=\
   3.226      duplicate class: {0}
   3.227 +
   3.228  compiler.err.duplicate.case.label=\
   3.229      duplicate case label
   3.230 +
   3.231  compiler.err.duplicate.default.label=\
   3.232      duplicate default label
   3.233  
   3.234  compiler.err.else.without.if=\
   3.235      ''else'' without ''if''
   3.236 +
   3.237  compiler.err.empty.char.lit=\
   3.238      empty character literal
   3.239 +
   3.240 +# 0: symbol
   3.241  compiler.err.encl.class.required=\
   3.242      an enclosing instance that contains {0} is required
   3.243 +
   3.244  compiler.err.enum.annotation.must.be.enum.constant=\
   3.245      an enum annotation value must be an enum constant
   3.246  
   3.247  compiler.err.enum.cant.be.instantiated=\
   3.248      enum types may not be instantiated
   3.249 +
   3.250  compiler.err.enum.label.must.be.unqualified.enum=\
   3.251      an enum switch case label must be the unqualified name of an enumeration constant
   3.252 +
   3.253  compiler.err.enum.no.subclassing=\
   3.254      classes cannot directly extend java.lang.Enum
   3.255 +
   3.256  compiler.err.enum.types.not.extensible=\
   3.257      enum types are not extensible
   3.258 +
   3.259  compiler.err.enum.no.finalize=\
   3.260      enums cannot have finalize methods
   3.261 +
   3.262 +# 0: file name, 1: string
   3.263  compiler.err.error.reading.file=\
   3.264      error reading {0}; {1}
   3.265 +
   3.266 +# 0: type
   3.267  compiler.err.except.already.caught=\
   3.268      exception {0} has already been caught
   3.269 +
   3.270 +# 0: type
   3.271  compiler.err.except.never.thrown.in.try=\
   3.272      exception {0} is never thrown in body of corresponding try statement
   3.273  
   3.274 +# 0: symbol
   3.275  compiler.err.final.parameter.may.not.be.assigned=\
   3.276      final parameter {0} may not be assigned
   3.277 +
   3.278 +# 0: symbol
   3.279  compiler.err.try.resource.may.not.be.assigned=\
   3.280      auto-closeable resource {0} may not be assigned
   3.281 +
   3.282  compiler.err.try.resource.trailing.semi=\
   3.283      illegal trailing semicolon in resources declaration
   3.284 +
   3.285 +# 0: symbol
   3.286  compiler.err.multicatch.parameter.may.not.be.assigned=\
   3.287      multi-catch parameter {0} may not be assigned
   3.288 +
   3.289  compiler.err.finally.without.try=\
   3.290      ''finally'' without ''try''
   3.291 +
   3.292 +# 0: type, 1: message segment
   3.293  compiler.err.foreach.not.applicable.to.type=\
   3.294      for-each not applicable to expression type\n\
   3.295      required: {1}\n\
   3.296      found:    {0}
   3.297 +
   3.298  compiler.err.fp.number.too.large=\
   3.299      floating point number too large
   3.300 +
   3.301  compiler.err.fp.number.too.small=\
   3.302      floating point number too small
   3.303  
   3.304  compiler.err.generic.array.creation=\
   3.305      generic array creation
   3.306 +
   3.307  compiler.err.generic.throwable=\
   3.308      a generic class may not extend java.lang.Throwable
   3.309  
   3.310 +# 0: symbol
   3.311  compiler.err.icls.cant.have.static.decl=\
   3.312      Illegal static declaration in inner class {0}\n\
   3.313      modifier \''static\'' is only allowed in constant variable declarations
   3.314 +
   3.315 +# 0: string
   3.316  compiler.err.illegal.char=\
   3.317      illegal character: \\{0}
   3.318 +
   3.319  compiler.err.illegal.char.for.encoding=\
   3.320      unmappable character for encoding {0}
   3.321 +
   3.322 +# 0: set of modifier, 1: set of modifier
   3.323  compiler.err.illegal.combination.of.modifiers=\
   3.324      illegal combination of modifiers: {0} and {1}
   3.325 +
   3.326  compiler.err.illegal.enum.static.ref=\
   3.327      illegal reference to static field from initializer
   3.328 +
   3.329  compiler.err.illegal.esc.char=\
   3.330      illegal escape character
   3.331 +
   3.332  compiler.err.illegal.forward.ref=\
   3.333      illegal forward reference
   3.334 +
   3.335 +# 0: symbol
   3.336  compiler.warn.forward.ref=\
   3.337      reference to variable ''{0}'' before it has been initialized
   3.338 +
   3.339  compiler.err.illegal.self.ref=\
   3.340      self-reference in initializer
   3.341 +
   3.342 +# 0: symbol
   3.343  compiler.warn.self.ref=\
   3.344      self-reference in initializer of variable ''{0}''
   3.345 +
   3.346  compiler.err.illegal.generic.type.for.instof=\
   3.347      illegal generic type for instanceof
   3.348 +
   3.349 +# 0: type
   3.350  compiler.err.illegal.initializer.for.type=\
   3.351      illegal initializer for {0}
   3.352 +
   3.353  compiler.err.illegal.line.end.in.char.lit=\
   3.354      illegal line end in character literal
   3.355 +
   3.356  compiler.err.illegal.nonascii.digit=\
   3.357      illegal non-ASCII digit
   3.358 +
   3.359  compiler.err.illegal.underscore=\
   3.360      illegal underscore
   3.361 +
   3.362 +# 0: symbol
   3.363  compiler.err.illegal.qual.not.icls=\
   3.364      illegal qualifier; {0} is not an inner class
   3.365 +
   3.366  compiler.err.illegal.start.of.expr=\
   3.367      illegal start of expression
   3.368 +
   3.369  compiler.err.illegal.start.of.type=\
   3.370      illegal start of type
   3.371 +
   3.372  compiler.err.illegal.unicode.esc=\
   3.373      illegal unicode escape
   3.374 +
   3.375 +# 0: symbol
   3.376  compiler.err.import.requires.canonical=\
   3.377      import requires canonical name for {0}
   3.378 +
   3.379  compiler.err.improperly.formed.type.param.missing=\
   3.380      improperly formed type, some parameters are missing
   3.381 +
   3.382  compiler.err.improperly.formed.type.inner.raw.param=\
   3.383      improperly formed type, type arguments given on a raw type
   3.384 +
   3.385 +# 0: type, 1: type
   3.386  compiler.err.incomparable.types=\
   3.387      incomparable types: {0} and {1}
   3.388 +
   3.389 +# 0: number
   3.390  compiler.err.int.number.too.large=\
   3.391      integer number too large: {0}
   3.392 +
   3.393  compiler.err.internal.error.cant.instantiate=\
   3.394      internal error; cannot instantiate {0} at {1} to ({2})
   3.395 +
   3.396  compiler.err.intf.annotation.members.cant.have.params=\
   3.397      @interface members may not have parameters
   3.398 +
   3.399  compiler.err.intf.annotation.cant.have.type.params=\
   3.400      @interface may not have type parameters
   3.401 +
   3.402  compiler.err.intf.annotation.members.cant.have.type.params=\
   3.403      @interface members may not have type parameters
   3.404 +
   3.405 +# 0: symbol, 1: type
   3.406  compiler.err.intf.annotation.member.clash=\
   3.407      @interface member clashes with method ''{0}'' in {1}
   3.408 +
   3.409  compiler.err.intf.expected.here=\
   3.410      interface expected here
   3.411 +
   3.412  compiler.err.intf.meth.cant.have.body=\
   3.413      interface methods cannot have body
   3.414 +
   3.415  compiler.err.invalid.annotation.member.type=\
   3.416      invalid type for annotation member
   3.417 +
   3.418  compiler.err.invalid.binary.number=\
   3.419      binary numbers must contain at least one binary digit
   3.420 +
   3.421  compiler.err.invalid.hex.number=\
   3.422      hexadecimal numbers must contain at least one hexadecimal digit
   3.423 +
   3.424  compiler.err.invalid.meth.decl.ret.type.req=\
   3.425      invalid method declaration; return type required
   3.426 +
   3.427  compiler.err.varargs.and.old.array.syntax=\
   3.428      legacy array notation not allowed on variable-arity parameter
   3.429  
   3.430 +# 0: name
   3.431  compiler.err.label.already.in.use=\
   3.432      label {0} already in use
   3.433 +
   3.434 +# 0: symbol
   3.435  compiler.err.local.var.accessed.from.icls.needs.final=\
   3.436      local variable {0} is accessed from within inner class; needs to be declared final
   3.437 +
   3.438  compiler.err.local.enum=\
   3.439      enum types must not be local
   3.440 +
   3.441  compiler.err.cannot.create.array.with.type.arguments=\
   3.442      cannot create array with type arguments
   3.443  
   3.444 @@ -287,79 +467,121 @@
   3.445  #
   3.446  compiler.err.limit.code=\
   3.447      code too large
   3.448 +
   3.449  compiler.err.limit.code.too.large.for.try.stmt=\
   3.450      code too large for try statement
   3.451 +
   3.452  compiler.err.limit.dimensions=\
   3.453      array type has too many dimensions
   3.454 +
   3.455  compiler.err.limit.locals=\
   3.456      too many local variables
   3.457 +
   3.458  compiler.err.limit.parameters=\
   3.459      too many parameters
   3.460 +
   3.461  compiler.err.limit.pool=\
   3.462      too many constants
   3.463 +
   3.464  compiler.err.limit.pool.in.class=\
   3.465      too many constants in class {0}
   3.466 +
   3.467  compiler.err.limit.stack=\
   3.468      code requires too much stack
   3.469 +
   3.470  compiler.err.limit.string=\
   3.471      constant string too long
   3.472 +
   3.473  compiler.err.limit.string.overflow=\
   3.474      UTF8 representation for string \"{0}...\" is too long for the constant pool
   3.475  
   3.476  compiler.err.malformed.fp.lit=\
   3.477      malformed floating point literal
   3.478 +
   3.479  compiler.err.method.does.not.override.superclass=\
   3.480      method does not override or implement a method from a supertype
   3.481 +
   3.482  compiler.err.missing.meth.body.or.decl.abstract=\
   3.483      missing method body, or declare abstract
   3.484 +
   3.485  compiler.err.missing.ret.stmt=\
   3.486      missing return statement
   3.487 +
   3.488  compiler.err.missing.ret.val=\
   3.489      missing return value
   3.490 +
   3.491 +# 0: set of modifier
   3.492  compiler.err.mod.not.allowed.here=\
   3.493      modifier {0} not allowed here
   3.494 +
   3.495  compiler.err.intf.not.allowed.here=\
   3.496      interface not allowed here
   3.497 +
   3.498  compiler.err.enums.must.be.static=\
   3.499      enum declarations allowed only in static contexts
   3.500  
   3.501 +# 0: symbol, 1: symbol
   3.502  compiler.err.name.clash.same.erasure=\
   3.503      name clash: {0} and {1} have the same erasure
   3.504 +
   3.505 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
   3.506  compiler.err.name.clash.same.erasure.no.override=\
   3.507      name clash: {0} in {1} and {2} in {3} have the same erasure, yet neither overrides the other
   3.508 +
   3.509  compiler.err.name.reserved.for.internal.use=\
   3.510      {0} is reserved for internal use
   3.511 +
   3.512  compiler.err.native.meth.cant.have.body=\
   3.513      native methods cannot have a body
   3.514 +
   3.515 +# 0: type, 1: type
   3.516  compiler.err.neither.conditional.subtype=\
   3.517 -incompatible types for ?: neither is a subtype of the other\n\
   3.518 -second operand: {0}\n\
   3.519 -third operand : {1}
   3.520 +    incompatible types for ?: neither is a subtype of the other\n\
   3.521 +    second operand: {0}\n\
   3.522 +    third operand : {1}
   3.523 +
   3.524  compiler.err.new.not.allowed.in.annotation=\
   3.525      ''new'' not allowed in an annotation
   3.526 +
   3.527  compiler.err.no.annotation.member=\
   3.528      no annotation member {0} in {1}
   3.529 +
   3.530  compiler.err.no.encl.instance.of.type.in.scope=\
   3.531      no enclosing instance of type {0} is in scope
   3.532 +
   3.533  compiler.err.no.intf.expected.here=\
   3.534      no interface expected here
   3.535 +
   3.536  compiler.err.no.match.entry=\
   3.537      {0} has no match in entry in {1}; required {2}
   3.538 +
   3.539  compiler.err.not.annotation.type=\
   3.540      {0} is not an annotation type
   3.541 +
   3.542 +# 0: symbol, 1: symbol
   3.543  compiler.err.not.def.access.class.intf.cant.access=\
   3.544      {0} in {1} is defined in an inaccessible class or interface
   3.545 +
   3.546 +# 0: symbol, 1: symbol
   3.547  compiler.err.not.def.public.cant.access=\
   3.548      {0} is not public in {1}; cannot be accessed from outside package
   3.549 +
   3.550 +# 0: name
   3.551  compiler.err.not.loop.label=\
   3.552      not a loop label: {0}
   3.553 +
   3.554  compiler.err.not.stmt=\
   3.555      not a statement
   3.556 +
   3.557 +# 0: symbol
   3.558  compiler.err.not.encl.class=\
   3.559      not an enclosing class: {0}
   3.560  
   3.561 +# 0: name, 1: type, 2: unused
   3.562  compiler.err.operator.cant.be.applied=\
   3.563      bad operand type {1} for unary operator ''{0}''
   3.564 +
   3.565 +# 0: name, 1: type, 2: type
   3.566  compiler.err.operator.cant.be.applied.1=\
   3.567      bad operand types for binary operator ''{0}''\n\
   3.568      first type:  {1}\n\
   3.569 @@ -367,6 +589,8 @@
   3.570  
   3.571  compiler.err.pkg.annotations.sb.in.package-info.java=\
   3.572      package annotations should be in file package-info.java
   3.573 +
   3.574 +# 0: symbol
   3.575  compiler.err.pkg.clashes.with.class.of.same.name=\
   3.576      package {0} clashes with class of same name
   3.577  
   3.578 @@ -376,18 +600,21 @@
   3.579  # Errors related to annotation processing
   3.580  
   3.581  compiler.err.proc.cant.access=\
   3.582 -cannot access {0}\n\
   3.583 -{1}\n\
   3.584 -Consult the following stack trace for details.\n\
   3.585 -{2}
   3.586 +    cannot access {0}\n\
   3.587 +    {1}\n\
   3.588 +    Consult the following stack trace for details.\n\
   3.589 +    {2}
   3.590  
   3.591 +# 0: string
   3.592  compiler.err.proc.cant.find.class=\
   3.593      Could not find class file for ''{0}''.
   3.594  
   3.595  # Print a client-generated error message; assumed to be localized, no translation required
   3.596 +# 0: string
   3.597  compiler.err.proc.messager=\
   3.598      {0}
   3.599  
   3.600 +# 0: list of string
   3.601  compiler.err.proc.no.explicit.annotation.processing.requested=\
   3.602      Class names, ''{0}'', are only accepted if annotation processing is explicitly requested
   3.603  
   3.604 @@ -398,15 +625,18 @@
   3.605  compiler.err.proc.processor.bad.option.name=\
   3.606      Bad option name ''{0}'' provided by processor ''{1}''
   3.607  
   3.608 +# 0: string
   3.609  compiler.err.proc.processor.cant.instantiate=\
   3.610      Could not instantiate an instance of processor ''{0}''
   3.611  
   3.612  compiler.err.proc.processor.constructor.error=\
   3.613      Exception thrown while constructing Processor object: {0}
   3.614  
   3.615 +# 0: string
   3.616  compiler.err.proc.processor.not.found=\
   3.617      Annotation processor ''{0}'' not found
   3.618  
   3.619 +# 0: string
   3.620  compiler.err.proc.processor.wrong.type=\
   3.621      Annotation processor ''{0}'' does not implement javax.annotation.processing.Processor
   3.622  
   3.623 @@ -419,127 +649,197 @@
   3.624  compiler.err.proc.cant.create.loader=\
   3.625      Could not create class loader for annotation processors: {0}
   3.626  
   3.627 +# 0: unused
   3.628  compiler.err.qualified.new.of.static.class=\
   3.629      qualified new of static class
   3.630  
   3.631  compiler.err.recursive.ctor.invocation=\
   3.632      recursive constructor invocation
   3.633 +
   3.634 +# 0: name, 1: symbol kind, 2: symbol, 3: symbol, 4: symbol kind, 5: symbol, 6: symbol
   3.635  compiler.err.ref.ambiguous=\
   3.636      reference to {0} is ambiguous, both {1} {2} in {3} and {4} {5} in {6} match
   3.637 +
   3.638  compiler.err.repeated.annotation.target=\
   3.639      repeated annotation target
   3.640 +
   3.641  compiler.err.repeated.interface=\
   3.642      repeated interface
   3.643 +
   3.644  compiler.err.repeated.modifier=\
   3.645      repeated modifier
   3.646 +
   3.647 +# 0: symbol, 1: set of modifier, 2: symbol
   3.648  compiler.err.report.access=\
   3.649      {0} has {1} access in {2}
   3.650 +
   3.651  compiler.err.ret.outside.meth=\
   3.652      return outside method
   3.653  
   3.654  compiler.err.signature.doesnt.match.supertype=\
   3.655      signature does not match {0}; incompatible supertype
   3.656 +
   3.657  compiler.err.signature.doesnt.match.intf=\
   3.658      signature does not match {0}; incompatible interfaces
   3.659 +
   3.660 +# 0: symbol, 1: symbol, 2: symbol
   3.661  compiler.err.does.not.override.abstract=\
   3.662      {0} is not abstract and does not override abstract method {1} in {2}
   3.663 +
   3.664  compiler.err.source.cant.overwrite.input.file=\
   3.665      error writing source; cannot overwrite input file {0}
   3.666 +
   3.667  compiler.err.stack.sim.error=\
   3.668      Internal error: stack sim error on {0}
   3.669 +
   3.670  compiler.err.static.imp.only.classes.and.interfaces=\
   3.671      static import only from classes and interfaces
   3.672 +
   3.673  compiler.err.string.const.req=\
   3.674      constant string expression required
   3.675 +
   3.676 +# 0: symbol, 1: symbol
   3.677  compiler.err.synthetic.name.conflict=\
   3.678      the symbol {0} conflicts with a compiler-synthesized symbol in {1}
   3.679 +
   3.680 +# 0: symbol, 1: symbol
   3.681  compiler.warn.synthetic.name.conflict=\
   3.682      the symbol {0} conflicts with a compiler-synthesized symbol in {1}
   3.683  
   3.684  compiler.err.throws.not.allowed.in.intf.annotation=\
   3.685      throws clause not allowed in @interface members
   3.686 +
   3.687  compiler.err.try.without.catch.or.finally=\
   3.688      ''try'' without ''catch'' or ''finally''
   3.689 +
   3.690  compiler.err.try.without.catch.finally.or.resource.decls=\
   3.691      ''try'' without ''catch'', ''finally'' or resource declarations
   3.692 +
   3.693 +# 0: symbol
   3.694  compiler.err.type.doesnt.take.params=\
   3.695      type {0} does not take parameters
   3.696 +
   3.697  compiler.err.type.var.cant.be.deref=\
   3.698      cannot select from a type variable
   3.699 +
   3.700  compiler.err.type.var.may.not.be.followed.by.other.bounds=\
   3.701      a type variable may not be followed by other bounds
   3.702 +
   3.703  compiler.err.type.var.more.than.once=\
   3.704      type variable {0} occurs more than once in result type of {1}; cannot be left uninstantiated
   3.705 +
   3.706  compiler.err.type.var.more.than.once.in.result=\
   3.707      type variable {0} occurs more than once in type of {1}; cannot be left uninstantiated
   3.708 +
   3.709 +# 0: type, 1: type, 2: string
   3.710  compiler.err.types.incompatible.diff.ret=\
   3.711      types {0} and {1} are incompatible; both define {2}, but with unrelated return types
   3.712  
   3.713  compiler.err.unclosed.char.lit=\
   3.714      unclosed character literal
   3.715 +
   3.716  compiler.err.unclosed.comment=\
   3.717      unclosed comment
   3.718 +
   3.719  compiler.err.unclosed.str.lit=\
   3.720      unclosed string literal
   3.721 +
   3.722  compiler.err.unknown.enum.constant=\
   3.723      in class file {0}: unknown enum constant {1}.{2}
   3.724 +
   3.725 +# 0: name
   3.726  compiler.err.unsupported.encoding=\
   3.727      unsupported encoding: {0}
   3.728 +
   3.729  compiler.err.io.exception=\
   3.730      error reading source file: {0}
   3.731 +
   3.732 +# 0: name
   3.733  compiler.err.undef.label=\
   3.734      undefined label: {0}
   3.735 +
   3.736  compiler.err.undetermined.type=\
   3.737      cannot infer type arguments for {0}
   3.738 +
   3.739 +# 0: type, 1: message segment
   3.740  compiler.err.undetermined.type.1=\
   3.741      cannot infer type arguments for {0};\n\
   3.742      reason: {1}
   3.743 +
   3.744 +# 0: list of type, 1: message segment
   3.745  compiler.err.invalid.inferred.types=\
   3.746      invalid inferred types for {0}; {1}
   3.747 +
   3.748 +# 0: message segment, 1: unused
   3.749  compiler.err.cant.apply.diamond=\
   3.750      cannot infer type arguments for {0}
   3.751 +
   3.752 +# 0: message segment, 1: message segment
   3.753  compiler.err.cant.apply.diamond.1=\
   3.754      cannot infer type arguments for {0};\n\
   3.755      reason: {1}
   3.756 +
   3.757  compiler.err.unreachable.stmt=\
   3.758      unreachable statement
   3.759 +
   3.760  compiler.err.initializer.must.be.able.to.complete.normally=\
   3.761      initializer must be able to complete normally
   3.762 +
   3.763 +# 0: type
   3.764  compiler.err.unreported.exception.need.to.catch.or.throw=\
   3.765      unreported exception {0}; must be caught or declared to be thrown
   3.766 +
   3.767 +# 0: type
   3.768  compiler.err.unreported.exception.default.constructor=\
   3.769      unreported exception {0} in default constructor
   3.770 +
   3.771  compiler.err.unsupported.cross.fp.lit=\
   3.772      hexadecimal floating-point literals are not supported on this VM
   3.773 +
   3.774  compiler.err.void.not.allowed.here=\
   3.775      ''void'' type not allowed here
   3.776  
   3.777 +# 0: string
   3.778  compiler.err.wrong.number.type.args=\
   3.779      wrong number of type arguments; required {0}
   3.780  
   3.781 +# 0: symbol
   3.782  compiler.err.var.might.already.be.assigned=\
   3.783      variable {0} might already have been assigned
   3.784 +
   3.785 +# 0: symbol
   3.786  compiler.err.var.might.not.have.been.initialized=\
   3.787      variable {0} might not have been initialized
   3.788 +
   3.789 +# 0: symbol
   3.790  compiler.err.var.might.be.assigned.in.loop=\
   3.791      variable {0} might be assigned in loop
   3.792  
   3.793 +# 0: symbol, 1: message segment
   3.794  compiler.err.varargs.invalid.trustme.anno=\
   3.795      Invalid {0} annotation. {1}
   3.796 +
   3.797 +# 0: type
   3.798  compiler.misc.varargs.trustme.on.reifiable.varargs=\
   3.799      Varargs element type {0} is reifiable.
   3.800 +
   3.801 +# 0: symbol
   3.802  compiler.misc.varargs.trustme.on.non.varargs.meth=\
   3.803      Method {0} is not a varargs method.
   3.804 +
   3.805 +# 0: symbol
   3.806  compiler.misc.varargs.trustme.on.virtual.varargs=\
   3.807      Instance method {0} is not final.
   3.808  
   3.809  # In the following string, {1} will always be the detail message from
   3.810  # java.io.IOException.
   3.811 +# 0: symbol, 1: string
   3.812  compiler.err.class.cant.write=\
   3.813      error while writing {0}: {1}
   3.814  
   3.815  # In the following string, {0} is the name of the class in the Java source.
   3.816  # It really should be used two times..
   3.817 +# 0: name
   3.818  compiler.err.class.public.should.be.in.file=\
   3.819      class {0} is public, should be declared in a file named {0}.java
   3.820  
   3.821 @@ -558,12 +858,16 @@
   3.822  
   3.823  compiler.misc.fatal.err.no.java.lang=\
   3.824      Fatal Error: Unable to find package java.lang in classpath or bootclasspath
   3.825 +
   3.826  compiler.misc.fatal.err.cant.locate.meth=\
   3.827      Fatal Error: Unable to find method {0}
   3.828 +
   3.829  compiler.misc.fatal.err.cant.locate.field=\
   3.830      Fatal Error: Unable to find field {0}
   3.831 +
   3.832  compiler.misc.fatal.err.cant.locate.ctor=\
   3.833      Fatal Error: Unable to find constructor for {0}
   3.834 +
   3.835  compiler.misc.fatal.err.cant.close.loader=\
   3.836      Fatal Error: Cannot close class loader for annotation processors
   3.837  
   3.838 @@ -575,10 +879,15 @@
   3.839  
   3.840  compiler.misc.source.unavailable=\
   3.841      (source unavailable)
   3.842 +
   3.843  compiler.misc.base.membership=\
   3.844      all your base class are belong to us
   3.845 +
   3.846 +# 0: string, 1: string, 2: boolean
   3.847  compiler.misc.x.print.processor.info=\
   3.848      Processor {0} matches {1} and returns {2}.
   3.849 +
   3.850 +# 0: number, 1: string, 2: set of symbol, 3: boolean
   3.851  compiler.misc.x.print.rounds=\
   3.852      Round {0}:\n\tinput files: {1}\n\tannotations: {2}\n\tlast round: {3}
   3.853  
   3.854 @@ -589,61 +898,84 @@
   3.855  compiler.note.note=\
   3.856      Note:\u0020
   3.857  
   3.858 +# 0: file name
   3.859  compiler.note.deprecated.filename=\
   3.860      {0} uses or overrides a deprecated API.
   3.861 +
   3.862  compiler.note.deprecated.plural=\
   3.863      Some input files use or override a deprecated API.
   3.864 +
   3.865  # The following string may appear after one of the above deprecation
   3.866  # messages.
   3.867  compiler.note.deprecated.recompile=\
   3.868      Recompile with -Xlint:deprecation for details.
   3.869  
   3.870 +# 0: file name
   3.871  compiler.note.deprecated.filename.additional=\
   3.872      {0} has additional uses or overrides of a deprecated API.
   3.873 +
   3.874  compiler.note.deprecated.plural.additional=\
   3.875      Some input files additionally use or override a deprecated API.
   3.876  
   3.877 +# 0: file name
   3.878  compiler.note.unchecked.filename=\
   3.879      {0} uses unchecked or unsafe operations.
   3.880 +
   3.881  compiler.note.unchecked.plural=\
   3.882      Some input files use unchecked or unsafe operations.
   3.883 +
   3.884  # The following string may appear after one of the above deprecation
   3.885  # messages.
   3.886  compiler.note.unchecked.recompile=\
   3.887      Recompile with -Xlint:unchecked for details.
   3.888  
   3.889 +# 0: file name
   3.890  compiler.note.unchecked.filename.additional=\
   3.891      {0} has additional unchecked or unsafe operations.
   3.892 +
   3.893  compiler.note.unchecked.plural.additional=\
   3.894      Some input files additionally use unchecked or unsafe operations.
   3.895  
   3.896 +# 0: file name
   3.897  compiler.note.sunapi.filename=\
   3.898      {0} uses internal proprietary API that may be removed in a future release.
   3.899 +
   3.900  compiler.note.sunapi.plural=\
   3.901      Some input files use internal proprietary API that may be removed in a future release.
   3.902 +
   3.903  # The following string may appear after one of the above sunapi messages.
   3.904  compiler.note.sunapi.recompile=\
   3.905      Recompile with -Xlint:sunapi for details.
   3.906  
   3.907 +# 0: file name
   3.908  compiler.note.sunapi.filename.additional=\
   3.909      {0} uses additional internal proprietary API that may be removed in a future release.
   3.910 +
   3.911  compiler.note.sunapi.plural.additional=\
   3.912      Some input files additionally use internal proprietary API that may be removed in a future release.
   3.913  
   3.914  # Notes related to annotation processing
   3.915  
   3.916  # Print a client-generated note; assumed to be localized, no translation required
   3.917 +# 0: string
   3.918  compiler.note.proc.messager=\
   3.919      {0}
   3.920  
   3.921  #####
   3.922  
   3.923 +# 0: number
   3.924  compiler.misc.count.error=\
   3.925      {0} error
   3.926 +
   3.927 +# 0: number
   3.928  compiler.misc.count.error.plural=\
   3.929      {0} errors
   3.930 +
   3.931 +# 0: number
   3.932  compiler.misc.count.warn=\
   3.933      {0} warning
   3.934 +
   3.935 +# 0: number
   3.936  compiler.misc.count.warn.plural=\
   3.937      {0} warnings
   3.938  
   3.939 @@ -652,38 +984,53 @@
   3.940  
   3.941  ## extra output when using -verbose (JavaCompiler)
   3.942  
   3.943 +# 0: symbol
   3.944  compiler.misc.verbose.checking.attribution=\
   3.945      [checking {0}]
   3.946 +
   3.947 +# 0: string
   3.948  compiler.misc.verbose.parsing.done=\
   3.949      [parsing completed {0}ms]
   3.950 +
   3.951 +# 0: file name
   3.952  compiler.misc.verbose.parsing.started=\
   3.953      [parsing started {0}]
   3.954 +
   3.955 +# 0: string
   3.956  compiler.misc.verbose.total=\
   3.957      [total {0}ms]
   3.958 +
   3.959 +# 0: file name
   3.960  compiler.misc.verbose.wrote.file=\
   3.961      [wrote {0}]
   3.962  
   3.963  ## extra output when using -verbose (Retro)
   3.964  compiler.misc.verbose.retro=\
   3.965      [retrofitting {0}]
   3.966 +
   3.967  compiler.misc.verbose.retro.with=\
   3.968      \tretrofitting {0} with {1}
   3.969 +
   3.970  compiler.misc.verbose.retro.with.list=\
   3.971      \tretrofitting {0} with type parameters {1}, supertype {2}, interfaces {3}
   3.972  
   3.973  ## extra output when using -verbose (code/ClassReader)
   3.974 +# 0: string
   3.975  compiler.misc.verbose.loading=\
   3.976      [loading {0}]
   3.977  
   3.978 +# 0: string
   3.979  compiler.misc.verbose.sourcepath=\
   3.980      [search path for source files: {0}]
   3.981  
   3.982 +# 0: string
   3.983  compiler.misc.verbose.classpath=\
   3.984      [search path for class files: {0}]
   3.985  
   3.986  ## extra output when using -checkclassfile (code/ClassReader)
   3.987  compiler.misc.ccf.found.later.version=\
   3.988      class file has later version than expected: {0}
   3.989 +
   3.990  compiler.misc.ccf.unrecognized.attribute=\
   3.991      unrecognized attribute: {0}
   3.992  
   3.993 @@ -703,103 +1050,135 @@
   3.994  
   3.995  ## Warning messages may also include the following prefix to identify a
   3.996  ## lint option
   3.997 +# 0: option name
   3.998  compiler.warn.lintOption=\
   3.999      [{0}]\u0020
  3.1000  
  3.1001 +# 0: symbol
  3.1002  compiler.warn.constant.SVUID=\
  3.1003      serialVersionUID must be constant in class {0}
  3.1004  
  3.1005 +# 0: file name
  3.1006  compiler.warn.dir.path.element.not.found=\
  3.1007      bad path element "{0}": no such directory
  3.1008  
  3.1009  compiler.warn.finally.cannot.complete=\
  3.1010      finally clause cannot complete normally
  3.1011  
  3.1012 +# 0: symbol, 1: symbol
  3.1013  compiler.warn.has.been.deprecated=\
  3.1014      {0} in {1} has been deprecated
  3.1015  
  3.1016 +# 0: symbol
  3.1017  compiler.warn.sun.proprietary=\
  3.1018      {0} is internal proprietary API and may be removed in a future release
  3.1019  
  3.1020  compiler.warn.illegal.char.for.encoding=\
  3.1021      unmappable character for encoding {0}
  3.1022  
  3.1023 +# 0: symbol
  3.1024  compiler.warn.improper.SVUID=\
  3.1025      serialVersionUID must be declared static final in class {0}
  3.1026  
  3.1027 +# 0: type, 1: type
  3.1028  compiler.warn.inexact.non-varargs.call=\
  3.1029 -non-varargs call of varargs method with inexact argument type for last parameter;\n\
  3.1030 -cast to {0} for a varargs call\n\
  3.1031 -cast to {1} for a non-varargs call and to suppress this warning
  3.1032 +    non-varargs call of varargs method with inexact argument type for last parameter;\n\
  3.1033 +    cast to {0} for a varargs call\n\
  3.1034 +    cast to {1} for a non-varargs call and to suppress this warning
  3.1035  
  3.1036 +# 0: symbol
  3.1037  compiler.warn.long.SVUID=\
  3.1038      serialVersionUID must be of type long in class {0}
  3.1039  
  3.1040 +# 0: symbol
  3.1041  compiler.warn.missing.SVUID=\
  3.1042      serializable class {0} has no definition of serialVersionUID
  3.1043  
  3.1044 +# 0: message segment
  3.1045  compiler.warn.override.varargs.missing=\
  3.1046      {0}; overridden method has no ''...''
  3.1047 +
  3.1048 +# 0: message segment
  3.1049  compiler.warn.override.varargs.extra=\
  3.1050      {0}; overriding method is missing ''...''
  3.1051 +
  3.1052  compiler.warn.override.bridge=\
  3.1053      {0}; overridden method is a bridge method
  3.1054  
  3.1055 +# 0: symbol
  3.1056  compiler.warn.pkg-info.already.seen=\
  3.1057      a package-info.java file has already been seen for package {0}
  3.1058  
  3.1059 +# 0: file name
  3.1060  compiler.warn.path.element.not.found=\
  3.1061      bad path element "{0}": no such file or directory
  3.1062  
  3.1063  compiler.warn.possible.fall-through.into.case=\
  3.1064      possible fall-through into case
  3.1065  
  3.1066 +# 0: type
  3.1067  compiler.warn.redundant.cast=\
  3.1068      redundant cast to {0}
  3.1069  
  3.1070 +# 0: number
  3.1071  compiler.warn.position.overflow=\
  3.1072      Position encoding overflows at line {0}
  3.1073  
  3.1074 +# 0: file name, 1: number, 2: number
  3.1075  compiler.warn.big.major.version=\
  3.1076      {0}: major version {1} is newer than {2}, the highest major version supported by this compiler.\n\
  3.1077      It is recommended that the compiler be upgraded.
  3.1078  
  3.1079 +# 0: symbol kind, 1: symbol
  3.1080  compiler.warn.static.not.qualified.by.type=\
  3.1081      static {0} should be qualified by type name, {1}, instead of by an expression
  3.1082  
  3.1083 +# 0: string
  3.1084  compiler.warn.source.no.bootclasspath=\
  3.1085      bootstrap class path not set in conjunction with -source {0}
  3.1086  
  3.1087 +# 0: name, 1: number, 2: number, 3: number, 4: number
  3.1088  compiler.warn.future.attr=\
  3.1089      {0} attribute introduced in version {1}.{2} class files is ignored in version {3}.{4} class files
  3.1090  
  3.1091  # Warnings related to annotation processing
  3.1092 +# 0: name
  3.1093  compiler.warn.proc.package.does.not.exist=\
  3.1094      package {0} does not exist
  3.1095 +
  3.1096 +# 0: name
  3.1097  compiler.warn.proc.file.reopening=\
  3.1098      Attempt to create a file for ''{0}'' multiple times
  3.1099  
  3.1100 +# 0: name
  3.1101  compiler.warn.proc.type.already.exists=\
  3.1102      A file for type ''{0}'' already exists on the sourcepath or classpath
  3.1103  
  3.1104 +# 0: name
  3.1105  compiler.warn.proc.type.recreate=\
  3.1106      Attempt to create a file for type ''{0}'' multiple times
  3.1107  
  3.1108 +# 0: string
  3.1109  compiler.warn.proc.illegal.file.name=\
  3.1110      Cannot create file for illegal name ''{0}''.
  3.1111  
  3.1112 +# 0: string, 1: string
  3.1113  compiler.warn.proc.suspicious.class.name=\
  3.1114      Creating file for a type whose name ends in {1}: ''{0}''
  3.1115  
  3.1116 +# 0: name
  3.1117  compiler.warn.proc.file.create.last.round=\
  3.1118      File for type ''{0}'' created in the last round will not be subject to annotation processing.
  3.1119  
  3.1120 +# 0: string, 1: string
  3.1121  compiler.warn.proc.malformed.supported.string=\
  3.1122      Malformed string ''{0}'' for a supported annotation type returned by processor ''{1}''
  3.1123  
  3.1124 +# 0: set of string
  3.1125  compiler.warn.proc.annotations.without.processors=\
  3.1126      No processor claimed any of these annotations: {0}
  3.1127  
  3.1128 +# 0: source version, 1: string, 2: string
  3.1129  compiler.warn.proc.processor.incompatible.source.version=\
  3.1130      Supported source version ''{0}'' from annotation processor ''{1}'' less than -source ''{2}''
  3.1131  
  3.1132 @@ -807,46 +1186,62 @@
  3.1133      Annotation processing without compilation requested but no processors were found.
  3.1134  
  3.1135  compiler.warn.proc.use.implicit=\
  3.1136 -Implicitly compiled files were not subject to annotation processing.\n\
  3.1137 -Use -implicit to specify a policy for implicit compilation.
  3.1138 +    Implicitly compiled files were not subject to annotation processing.\n\
  3.1139 +    Use -implicit to specify a policy for implicit compilation.
  3.1140  
  3.1141  compiler.warn.proc.use.proc.or.implicit=\
  3.1142 -Implicitly compiled files were not subject to annotation processing.\n\
  3.1143 -Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
  3.1144 +    Implicitly compiled files were not subject to annotation processing.\n\
  3.1145 +    Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
  3.1146  
  3.1147  # Print a client-generated warning; assumed to be localized, no translation required
  3.1148 +# 0: string
  3.1149  compiler.warn.proc.messager=\
  3.1150      {0}
  3.1151  
  3.1152 +# 0: set of name
  3.1153  compiler.warn.proc.unclosed.type.files=\
  3.1154      Unclosed files for the types ''{0}''; these types will not undergo annotation processing
  3.1155  
  3.1156 +# 0: string
  3.1157  compiler.warn.proc.unmatched.processor.options=\
  3.1158      The following options were not recognized by any processor: ''{0}''
  3.1159  
  3.1160  compiler.warn.try.explicit.close.call=\
  3.1161      explicit call to close() on an auto-closeable resource
  3.1162 +
  3.1163 +# 0: symbol
  3.1164  compiler.warn.try.resource.not.referenced=\
  3.1165      auto-closeable resource {0} is never referenced in body of corresponding try statement
  3.1166 +
  3.1167  compiler.warn.unchecked.assign=\
  3.1168      unchecked assignment: {0} to {1}
  3.1169 +
  3.1170 +# 0: symbol, 1: type
  3.1171  compiler.warn.unchecked.assign.to.var=\
  3.1172      unchecked assignment to variable {0} as member of raw type {1}
  3.1173 +
  3.1174 +# 0: symbol, 1: type
  3.1175  compiler.warn.unchecked.call.mbr.of.raw.type=\
  3.1176      unchecked call to {0} as a member of the raw type {1}
  3.1177 +
  3.1178  compiler.warn.unchecked.cast.to.type=\
  3.1179      unchecked cast to type {0}
  3.1180 +
  3.1181 +# 0: symbol kind, 1: name, 2: list of type, 3: list of type, 4: symbol kind, 5: symbol
  3.1182  compiler.warn.unchecked.meth.invocation.applied=\
  3.1183      unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
  3.1184      required: {2}\n\
  3.1185      found: {3}
  3.1186  
  3.1187 +# 0: type
  3.1188  compiler.warn.unchecked.generic.array.creation=\
  3.1189      unchecked generic array creation for varargs parameter of type {0}
  3.1190  
  3.1191 +# 0: type
  3.1192  compiler.warn.unchecked.varargs.non.reifiable.type=\
  3.1193      Possible heap pollution from parameterized vararg type {0}
  3.1194  
  3.1195 +# 0: symbol
  3.1196  compiler.warn.varargs.unsafe.use.varargs.param=\
  3.1197      Varargs method could cause heap pollution from non-reifiable varargs parameter {0}
  3.1198  
  3.1199 @@ -871,17 +1266,22 @@
  3.1200  compiler.warn.annotation.method.not.found.reason=\
  3.1201      Cannot find annotation method ''{1}()'' in type ''{0}'': {2}
  3.1202  
  3.1203 +# 0: type, 1: type
  3.1204  compiler.warn.raw.class.use=\
  3.1205      found raw type: {0}\n\
  3.1206      missing type arguments for generic class {1}
  3.1207  
  3.1208 +# 0: unused, 1: unused
  3.1209  compiler.warn.diamond.redundant.args=\
  3.1210      redundant type arguments in new expression (use diamond operator instead).
  3.1211 +
  3.1212 +# 0: type, 1: type
  3.1213  compiler.warn.diamond.redundant.args.1=\
  3.1214      redundant type arguments in new expression (use diamond operator instead).\n\
  3.1215      explicit: {0}\n\
  3.1216      inferred: {1}
  3.1217  
  3.1218 +# 0: symbol, 1: message segment
  3.1219  compiler.warn.varargs.redundant.trustme.anno=\
  3.1220      Redundant {0} annotation. {1}
  3.1221  
  3.1222 @@ -891,20 +1291,28 @@
  3.1223  ## be named as JLS3 calls them when translated to the appropriate language.
  3.1224  compiler.misc.token.identifier=\
  3.1225      <identifier>
  3.1226 +
  3.1227  compiler.misc.token.character=\
  3.1228      <character>
  3.1229 +
  3.1230  compiler.misc.token.string=\
  3.1231      <string>
  3.1232 +
  3.1233  compiler.misc.token.integer=\
  3.1234      <integer>
  3.1235 +
  3.1236  compiler.misc.token.long-integer=\
  3.1237      <long integer>
  3.1238 +
  3.1239  compiler.misc.token.float=\
  3.1240      <float>
  3.1241 +
  3.1242  compiler.misc.token.double=\
  3.1243      <double>
  3.1244 +
  3.1245  compiler.misc.token.bad-symbol=\
  3.1246      <bad symbol>
  3.1247 +
  3.1248  compiler.misc.token.end-of-input=\
  3.1249      <end of input>
  3.1250  
  3.1251 @@ -917,10 +1325,15 @@
  3.1252  ## 6. an operator (JLS3.12)
  3.1253  ##
  3.1254  ## This is the only place these tokens will be used.
  3.1255 +# 0: token
  3.1256  compiler.err.expected=\
  3.1257      {0} expected
  3.1258 +
  3.1259 +# 0: token, 1: token
  3.1260  compiler.err.expected2=\
  3.1261      {0} or {1} expected
  3.1262 +
  3.1263 +# 0: token, 1: token, 2: token
  3.1264  compiler.err.expected3=\
  3.1265      {0}, {1}, or {2} expected
  3.1266  
  3.1267 @@ -932,12 +1345,15 @@
  3.1268      ''.class'' expected
  3.1269  
  3.1270  ## The argument to this string will always be either 'case' or 'default'.
  3.1271 +# 0: token
  3.1272  compiler.err.orphaned=\
  3.1273      orphaned {0}
  3.1274  
  3.1275 +# 0: name
  3.1276  compiler.misc.anonymous.class=\
  3.1277      <anonymous {0}>
  3.1278  
  3.1279 +# 0: name, 1: type
  3.1280  compiler.misc.type.captureof=\
  3.1281      capture#{0} of {1}
  3.1282  
  3.1283 @@ -952,54 +1368,73 @@
  3.1284  
  3.1285  #####
  3.1286  
  3.1287 +# 0: symbol, 1: message segment
  3.1288  compiler.err.cant.access=\
  3.1289 -cannot access {0}\n\
  3.1290 -{1}
  3.1291 +    cannot access {0}\n\
  3.1292 +    {1}
  3.1293  
  3.1294  compiler.misc.bad.class.file.header=\
  3.1295 -bad class file: {0}\n\
  3.1296 -{1}\n\
  3.1297 -Please remove or make sure it appears in the correct subdirectory of the classpath.
  3.1298 +    bad class file: {0}\n\
  3.1299 +    {1}\n\
  3.1300 +    Please remove or make sure it appears in the correct subdirectory of the classpath.
  3.1301 +
  3.1302 +# 0: file name, 1: message segment
  3.1303  compiler.misc.bad.source.file.header=\
  3.1304 -bad source file: {0}\n\
  3.1305 -{1}\n\
  3.1306 -Please remove or make sure it appears in the correct subdirectory of the sourcepath.
  3.1307 +    bad source file: {0}\n\
  3.1308 +    {1}\n\
  3.1309 +    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
  3.1310  
  3.1311  ## The following are all possible strings for the second argument ({1}) of the
  3.1312  ## above strings.
  3.1313  compiler.misc.bad.class.signature=\
  3.1314      bad class signature: {0}
  3.1315 +
  3.1316  compiler.misc.bad.enclosing.method=\
  3.1317      bad enclosing method attribute: {0}
  3.1318 +
  3.1319  compiler.misc.bad.runtime.invisible.param.annotations=\
  3.1320      bad RuntimeInvisibleParameterAnnotations attribute: {0}
  3.1321 +
  3.1322  compiler.misc.bad.const.pool.tag=\
  3.1323      bad constant pool tag: {0}
  3.1324 +
  3.1325  compiler.misc.bad.const.pool.tag.at=\
  3.1326      bad constant pool tag: {0} at {1}
  3.1327 +
  3.1328  compiler.misc.bad.signature=\
  3.1329      bad signature: {0}
  3.1330 +
  3.1331  compiler.misc.class.file.wrong.class=\
  3.1332      class file contains wrong class: {0}
  3.1333 +
  3.1334  compiler.misc.class.file.not.found=\
  3.1335      class file for {0} not found
  3.1336 +
  3.1337 +# 0: name
  3.1338  compiler.misc.file.doesnt.contain.class=\
  3.1339      file does not contain class {0}
  3.1340 +
  3.1341  compiler.misc.file.does.not.contain.package=\
  3.1342      file does not contain package {0}
  3.1343 +
  3.1344  compiler.misc.illegal.start.of.class.file=\
  3.1345      illegal start of class file
  3.1346 +
  3.1347  compiler.misc.unable.to.access.file=\
  3.1348      unable to access file: {0}
  3.1349 +
  3.1350  compiler.misc.unicode.str.not.supported=\
  3.1351      unicode string in class file not supported
  3.1352 +
  3.1353  compiler.misc.undecl.type.var=\
  3.1354      undeclared type variable: {0}
  3.1355 +
  3.1356  compiler.misc.wrong.version=\
  3.1357      class file has wrong version {0}.{1}, should be {2}.{3}
  3.1358  
  3.1359  #####
  3.1360  
  3.1361 +# 0: type, 1: type or symbol
  3.1362  compiler.err.not.within.bounds=\
  3.1363      type argument {0} is not within bounds of type-variable {1}
  3.1364  
  3.1365 @@ -1010,32 +1445,41 @@
  3.1366  
  3.1367  #####
  3.1368  
  3.1369 +# 0: message segment, 1: type, 2: type
  3.1370  compiler.err.prob.found.req=\
  3.1371 -{0}\n\
  3.1372 -required: {2}\n\
  3.1373 -found:    {1}
  3.1374 +    {0}\n\
  3.1375 +    required: {2}\n\
  3.1376 +    found:    {1}
  3.1377 +
  3.1378 +# 0: message segment, 1: type, 2: type
  3.1379  compiler.warn.prob.found.req=\
  3.1380 -{0}\n\
  3.1381 -required: {2}\n\
  3.1382 -found:    {1}
  3.1383 +    {0}\n\
  3.1384 +    required: {2}\n\
  3.1385 +    found:    {1}
  3.1386 +
  3.1387  compiler.err.prob.found.req.1=\
  3.1388 -{0} {3}\n\
  3.1389 -required: {2}\n\
  3.1390 -found:    {1}
  3.1391 +    {0} {3}\n\
  3.1392 +    required: {2}\n\
  3.1393 +    found:    {1}
  3.1394  
  3.1395  ## The following are all possible strings for the first argument ({0}) of the
  3.1396  ## above strings.
  3.1397  compiler.misc.incompatible.types=\
  3.1398      incompatible types
  3.1399 +
  3.1400 +# 0: message segment
  3.1401  compiler.misc.incompatible.types.1=\
  3.1402      incompatible types; {0}
  3.1403 +
  3.1404  compiler.misc.inconvertible.types=\
  3.1405      inconvertible types
  3.1406 +
  3.1407  compiler.misc.possible.loss.of.precision=\
  3.1408      possible loss of precision
  3.1409  
  3.1410  compiler.misc.unchecked.assign=\
  3.1411      unchecked conversion
  3.1412 +
  3.1413  # compiler.misc.storecheck=\
  3.1414  #     assignment might cause later store checks to fail
  3.1415  # compiler.misc.unchecked=\
  3.1416 @@ -1045,8 +1489,10 @@
  3.1417  
  3.1418  compiler.misc.assignment.from.super-bound=\
  3.1419      assignment from super-bound type {0}
  3.1420 +
  3.1421  compiler.misc.assignment.to.extends-bound=\
  3.1422      assignment to extends-bound type {0}
  3.1423 +
  3.1424  # compiler.err.star.expected=\
  3.1425  #     ''*'' expected
  3.1426  # compiler.err.no.elem.type=\
  3.1427 @@ -1057,23 +1503,30 @@
  3.1428  
  3.1429  #####
  3.1430  
  3.1431 +# 0: message segment or type, 1: message segment
  3.1432  compiler.err.type.found.req=\
  3.1433 -unexpected type\n\
  3.1434 -required: {1}\n\
  3.1435 -found:    {0}
  3.1436 +    unexpected type\n\
  3.1437 +    required: {1}\n\
  3.1438 +    found:    {0}
  3.1439  
  3.1440  ## The following are all possible strings for the first argument ({0}) of the
  3.1441  ## above string.
  3.1442  compiler.misc.type.req.class=\
  3.1443      class
  3.1444 +
  3.1445  compiler.misc.type.req.class.array=\
  3.1446      class or array
  3.1447 +
  3.1448  compiler.misc.type.req.array.or.iterable=\
  3.1449      array or java.lang.Iterable
  3.1450 +
  3.1451  compiler.misc.type.req.ref=\
  3.1452      reference
  3.1453 +
  3.1454  compiler.misc.type.req.exact=\
  3.1455      class or interface without bounds
  3.1456 +
  3.1457 +# 0: type
  3.1458  compiler.misc.type.parameter=\
  3.1459      type parameter {0}
  3.1460  
  3.1461 @@ -1083,87 +1536,119 @@
  3.1462  ## diagnostics whose key ends in ".1"
  3.1463  compiler.misc.undetermined.type=\
  3.1464      undetermined type
  3.1465 +
  3.1466  compiler.misc.type.variable.has.undetermined.type=\
  3.1467      type variable {0} has undetermined type
  3.1468 +
  3.1469 +# 0: type, 1: list of type
  3.1470  compiler.misc.no.unique.maximal.instance.exists=\
  3.1471      no unique maximal instance exists for type variable {0} with upper bounds {1}
  3.1472 +
  3.1473  compiler.misc.no.unique.minimal.instance.exists=\
  3.1474      no unique minimal instance exists for type variable {0} with lower bounds {1}
  3.1475 +
  3.1476 +# 0: list of type, 1: type, 2: type
  3.1477  compiler.misc.infer.no.conforming.instance.exists=\
  3.1478      no instance(s) of type variable(s) {0} exist so that {1} conforms to {2}
  3.1479 +
  3.1480 +# 0: list of type, 1: type, 2: type
  3.1481  compiler.misc.infer.no.conforming.assignment.exists=\
  3.1482      no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to formal parameter type {2}
  3.1483 +
  3.1484  compiler.misc.infer.arg.length.mismatch=\
  3.1485      cannot instantiate from arguments because actual and formal argument lists differ in length
  3.1486 +
  3.1487 +# 0: type, 1: list of type
  3.1488  compiler.misc.inferred.do.not.conform.to.bounds=\
  3.1489      inferred type does not conform to declared bound(s)\n\
  3.1490      inferred: {0}\n\
  3.1491      bound(s): {1}
  3.1492 +
  3.1493  compiler.misc.inferred.do.not.conform.to.params=\
  3.1494      actual arguments do not conform to inferred formal arguments\n\
  3.1495      required: {0}\n\
  3.1496      found: {1}
  3.1497 +
  3.1498 +# 0: symbol
  3.1499  compiler.misc.diamond=\
  3.1500      {0}<>
  3.1501 +
  3.1502 +# 0: list of type, 1: message segment
  3.1503  compiler.misc.diamond.invalid.arg=\
  3.1504      type argument {0} inferred for {1} is not allowed in this context
  3.1505 +
  3.1506 +# 0: list of type, 1: message segment
  3.1507  compiler.misc.diamond.invalid.args=\
  3.1508      type arguments {0} inferred for {1} are not allowed in this context
  3.1509  
  3.1510 +# 0: type, 1: list of type
  3.1511  compiler.misc.explicit.param.do.not.conform.to.bounds=\
  3.1512      explicit type argument {0} does not conform to declared bound(s) {1}
  3.1513  
  3.1514  compiler.misc.arg.length.mismatch=\
  3.1515      actual and formal argument lists differ in length
  3.1516 +
  3.1517 +# 0: type, 1: type
  3.1518  compiler.misc.no.conforming.assignment.exists=\
  3.1519      actual argument {0} cannot be converted to {1} by method invocation conversion
  3.1520 +
  3.1521 +# 0: type, 1: type
  3.1522  compiler.misc.varargs.argument.mismatch=\
  3.1523      argument type {0} does not conform to vararg element type {1}
  3.1524 +
  3.1525  #####
  3.1526  
  3.1527  ## The first argument ({0}) is a "kindname".
  3.1528 +# 0: symbol kind, 1: symbol, 2: symbol
  3.1529  compiler.err.abstract.cant.be.accessed.directly=\
  3.1530      abstract {0} {1} in {2} cannot be accessed directly
  3.1531  
  3.1532  ## The first argument ({0}) is a "kindname".
  3.1533 +# 0: symbol kind, 1: symbol
  3.1534  compiler.err.non-static.cant.be.ref=\
  3.1535      non-static {0} {1} cannot be referenced from a static context
  3.1536  
  3.1537  ## Both arguments ({0}, {1}) are "kindname"s.  {0} is a comma-separated list
  3.1538  ## of kindnames (the list should be identical to that provided in source.
  3.1539  compiler.err.unexpected.type=\
  3.1540 -unexpected type\n\
  3.1541 -required: {0}\n\
  3.1542 -found:    {1}
  3.1543 +    unexpected type\n\
  3.1544 +    required: {0}\n\
  3.1545 +    found:    {1}
  3.1546  
  3.1547  ## The first argument {0} is a "kindname" (e.g. 'constructor', 'field', etc.)
  3.1548  ## The second argument {1} is the non-resolved symbol
  3.1549  ## The third argument {2} is a list of type parameters (non-empty if {1} is a method)
  3.1550  ## The fourth argument {3} is a list of argument types (non-empty if {1} is a method)
  3.1551 +# 0: symbol kind, 1: name, 2: unused, 3: unused
  3.1552  compiler.err.cant.resolve=\
  3.1553      cannot find symbol\n\
  3.1554      symbol: {0} {1}
  3.1555  
  3.1556 +# 0: symbol kind, 1: name, 2: unused, 3: list of type
  3.1557  compiler.err.cant.resolve.args=\
  3.1558      cannot find symbol\n\
  3.1559      symbol: {0} {1}({3})
  3.1560  
  3.1561 +# 0: symbol kind, 1: name, 2: list of type, 3: list of type
  3.1562  compiler.err.cant.resolve.args.params=\
  3.1563      cannot find symbol\n\
  3.1564      symbol: {0} <{2}>{1}({3})
  3.1565  
  3.1566  ## arguments from {0} to {3} have the same meaning as above
  3.1567  ## The fifth argument {4} is a location subdiagnostic (see below)
  3.1568 +# 0: symbol kind, 1: name, 2: unused, 3: unused, 4: message segment
  3.1569  compiler.err.cant.resolve.location=\
  3.1570      cannot find symbol\n\
  3.1571      symbol:   {0} {1}\n\
  3.1572      location: {4}
  3.1573  
  3.1574 +# 0: symbol kind, 1: name, 2: unused, 3: list of type, 4: message segment
  3.1575  compiler.err.cant.resolve.location.args=\
  3.1576      cannot find symbol\n\
  3.1577      symbol:   {0} {1}({3})\n\
  3.1578      location: {4}
  3.1579  
  3.1580 +# 0: symbol kind, 1: name, 2: list of type, 3: list, 4: message segment
  3.1581  compiler.err.cant.resolve.location.args.params=\
  3.1582      cannot find symbol\n\
  3.1583      symbol:   {0} <{2}>{1}({3})\n\
  3.1584 @@ -1174,8 +1659,11 @@
  3.1585  ## The second argument {1} is the location name
  3.1586  ## The third argument {2} is the location type (only when {1} is a variable name)
  3.1587  
  3.1588 +# 0: symbol kind, 1: symbol, 2: unused
  3.1589  compiler.misc.location=\
  3.1590      {0} {1}
  3.1591 +
  3.1592 +# 0: symbol kind, 1: symbol, 2: type
  3.1593  compiler.misc.location.1=\
  3.1594      {0} {1} of type {2}
  3.1595  
  3.1596 @@ -1186,85 +1674,124 @@
  3.1597  #     static member
  3.1598  compiler.misc.kindname.annotation=\
  3.1599      @interface
  3.1600 +
  3.1601  compiler.misc.kindname.constructor=\
  3.1602      constructor
  3.1603 +
  3.1604  compiler.misc.kindname.enum=\
  3.1605      enum
  3.1606 +
  3.1607  compiler.misc.kindname.interface=\
  3.1608      interface
  3.1609 +
  3.1610  compiler.misc.kindname.static=\
  3.1611      static
  3.1612 +
  3.1613  compiler.misc.kindname.type.variable=\
  3.1614      type variable
  3.1615 +
  3.1616  compiler.misc.kindname.type.variable.bound=\
  3.1617      bound of type variable
  3.1618 +
  3.1619  compiler.misc.kindname.variable=\
  3.1620      variable
  3.1621 +
  3.1622  compiler.misc.kindname.value=\
  3.1623      value
  3.1624 +
  3.1625  compiler.misc.kindname.method=\
  3.1626      method
  3.1627 +
  3.1628  compiler.misc.kindname.class=\
  3.1629      class
  3.1630 +
  3.1631  compiler.misc.kindname.package=\
  3.1632      package
  3.1633 +
  3.1634  #####
  3.1635  
  3.1636  compiler.misc.no.args=\
  3.1637      no arguments
  3.1638  
  3.1639 +# 0: message segment
  3.1640  compiler.err.override.static=\
  3.1641      {0}\n\
  3.1642      overriding method is static
  3.1643 +
  3.1644 +# 0: message segment, 1: set of modifier
  3.1645  compiler.err.override.meth=\
  3.1646      {0}\n\
  3.1647      overridden method is {1}
  3.1648  
  3.1649 +# 0: message segment, 1: type
  3.1650  compiler.err.override.meth.doesnt.throw=\
  3.1651      {0}\n\
  3.1652      overridden method does not throw {1}
  3.1653  
  3.1654  # In the following string {1} is a space separated list of Java Keywords, as
  3.1655  # they would have been declared in the source code
  3.1656 +# 0: message segment, 1: set of modifier
  3.1657  compiler.err.override.weaker.access=\
  3.1658      {0}\n\
  3.1659      attempting to assign weaker access privileges; was {1}
  3.1660  
  3.1661 +# 0: message segment, 1: type, 2: type
  3.1662  compiler.err.override.incompatible.ret=\
  3.1663      {0}\n\
  3.1664      return type {1} is not compatible with {2}
  3.1665  
  3.1666 +# 0: message segment, 1: type, 2: type
  3.1667  compiler.warn.override.unchecked.ret=\
  3.1668      {0}\n\
  3.1669      return type requires unchecked conversion from {1} to {2}
  3.1670  
  3.1671 +# 0: message segment, 1: type
  3.1672  compiler.warn.override.unchecked.thrown=\
  3.1673      {0}\n\
  3.1674      overridden method does not throw {1}
  3.1675  
  3.1676  ## The following are all possible strings for the first argument ({0}) of the
  3.1677  ## above strings.
  3.1678 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1679  compiler.misc.cant.override=\
  3.1680      {0} in {1} cannot override {2} in {3}
  3.1681 +
  3.1682 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1683  compiler.misc.cant.implement=\
  3.1684      {0} in {1} cannot implement {2} in {3}
  3.1685 +
  3.1686 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1687  compiler.misc.clashes.with=\
  3.1688      {0} in {1} clashes with {2} in {3}
  3.1689 +
  3.1690 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1691  compiler.misc.unchecked.override=\
  3.1692      {0} in {1} overrides {2} in {3}
  3.1693 +
  3.1694 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1695  compiler.misc.unchecked.implement=\
  3.1696      {0} in {1} implements {2} in {3}
  3.1697 +
  3.1698 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1699  compiler.misc.unchecked.clash.with=\
  3.1700      {0} in {1} overrides {2} in {3}
  3.1701 +
  3.1702 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1703  compiler.misc.varargs.override=\
  3.1704      {0} in {1} overrides {2} in {3}
  3.1705 +
  3.1706 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1707  compiler.misc.varargs.implement=\
  3.1708      {0} in {1} implements {2} in {3}
  3.1709 +
  3.1710 +# 0: symbol, 1: symbol, 2: symbol, 3: symbol
  3.1711  compiler.misc.varargs.clash.with=\
  3.1712      {0} in {1} overrides {2} in {3}
  3.1713 +
  3.1714  compiler.misc.non.denotable.type=\
  3.1715      Non-denotable type {0} not allowed here
  3.1716  
  3.1717 +# 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
  3.1718  compiler.misc.inapplicable.method=\
  3.1719      {0} {1}.{2} is not applicable\n\
  3.1720      ({3})
  3.1721 @@ -1272,77 +1799,90 @@
  3.1722  ########################################
  3.1723  # Diagnostics for language feature changes
  3.1724  ########################################
  3.1725 +# 0: string
  3.1726  compiler.err.unsupported.fp.lit=\
  3.1727      hexadecimal floating point literals are not supported in -source {0}\n\
  3.1728 -(use -source 5 or higher to enable hexadecimal floating point literals)
  3.1729 +    (use -source 5 or higher to enable hexadecimal floating point literals)
  3.1730  
  3.1731 +# 0: string
  3.1732  compiler.err.unsupported.binary.lit=\
  3.1733      binary literals are not supported in -source {0}\n\
  3.1734 -(use -source 7 or higher to enable binary literals)
  3.1735 +    (use -source 7 or higher to enable binary literals)
  3.1736  
  3.1737 +# 0: string
  3.1738  compiler.err.unsupported.underscore.lit=\
  3.1739      underscores in literals are not supported in -source {0}\n\
  3.1740 -(use -source 7 or higher to enable underscores in literals)
  3.1741 +    (use -source 7 or higher to enable underscores in literals)
  3.1742  
  3.1743 +# 0: string
  3.1744  compiler.err.try.with.resources.not.supported.in.source=\
  3.1745      try-with-resources is not supported in -source {0}\n\
  3.1746 -(use -source 7 or higher to enable try-with-resources)
  3.1747 +    (use -source 7 or higher to enable try-with-resources)
  3.1748  
  3.1749  compiler.warn.enum.as.identifier=\
  3.1750      as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
  3.1751 -(use -source 5 or higher to use ''enum'' as a keyword)
  3.1752 +    (use -source 5 or higher to use ''enum'' as a keyword)
  3.1753  
  3.1754  compiler.warn.assert.as.identifier=\
  3.1755      as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
  3.1756 -(use -source 1.4 or higher to use ''assert'' as a keyword)
  3.1757 +    (use -source 1.4 or higher to use ''assert'' as a keyword)
  3.1758  
  3.1759  compiler.err.enum.as.identifier=\
  3.1760      as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
  3.1761 -(use -source 1.4 or lower to use ''enum'' as an identifier)
  3.1762 +    (use -source 1.4 or lower to use ''enum'' as an identifier)
  3.1763  
  3.1764  compiler.err.assert.as.identifier=\
  3.1765      as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
  3.1766 -(use -source 1.3 or lower to use ''assert'' as an identifier)
  3.1767 +    (use -source 1.3 or lower to use ''assert'' as an identifier)
  3.1768  
  3.1769 +# 0: string
  3.1770  compiler.err.generics.not.supported.in.source=\
  3.1771      generics are not supported in -source {0}\n\
  3.1772 -(use -source 5 or higher to enable generics)
  3.1773 +    (use -source 5 or higher to enable generics)
  3.1774  
  3.1775 +# 0: string
  3.1776  compiler.err.varargs.not.supported.in.source=\
  3.1777      variable-arity methods are not supported in -source {0}\n\
  3.1778 -(use -source 5 or higher to enable variable-arity methods)
  3.1779 +    (use -source 5 or higher to enable variable-arity methods)
  3.1780  
  3.1781 +# 0: string
  3.1782  compiler.err.annotations.not.supported.in.source=\
  3.1783      annotations are not supported in -source {0}\n\
  3.1784 -(use -source 5 or higher to enable annotations)
  3.1785 +    (use -source 5 or higher to enable annotations)
  3.1786  
  3.1787  #308 compiler.err.type.annotations.not.supported.in.source=\
  3.1788  #308     type annotations are not supported in -source {0}\n\
  3.1789  #308 (use -source 7 or higher to enable type annotations)
  3.1790  
  3.1791 +# 0: string
  3.1792  compiler.err.foreach.not.supported.in.source=\
  3.1793      for-each loops are not supported in -source {0}\n\
  3.1794 -(use -source 5 or higher to enable for-each loops)
  3.1795 +    (use -source 5 or higher to enable for-each loops)
  3.1796  
  3.1797 +# 0: string
  3.1798  compiler.err.static.import.not.supported.in.source=\
  3.1799      static import declarations are not supported in -source {0}\n\
  3.1800 -(use -source 5 or higher to enable static import declarations)
  3.1801 +    (use -source 5 or higher to enable static import declarations)
  3.1802  
  3.1803 +# 0: string
  3.1804  compiler.err.enums.not.supported.in.source=\
  3.1805      enums are not supported in -source {0}\n\
  3.1806 -(use -source 5 or higher to enable enums)
  3.1807 +    (use -source 5 or higher to enable enums)
  3.1808  
  3.1809 +# 0: string
  3.1810  compiler.err.diamond.not.supported.in.source=\
  3.1811      diamond operator is not supported in -source {0}\n\
  3.1812 -(use -source 7 or higher to enable diamond operator)
  3.1813 +    (use -source 7 or higher to enable diamond operator)
  3.1814  
  3.1815 +# 0: string
  3.1816  compiler.err.multicatch.not.supported.in.source=\
  3.1817      multi-catch statement is not supported in -source {0}\n\
  3.1818 -(use -source 7 or higher to enable multi-catch statement)
  3.1819 +    (use -source 7 or higher to enable multi-catch statement)
  3.1820  
  3.1821 +# 0: string
  3.1822  compiler.err.string.switch.not.supported.in.source=\
  3.1823      strings in switch are not supported in -source {0}\n\
  3.1824 -(use -source 7 or higher to enable strings in switch)
  3.1825 +    (use -source 7 or higher to enable strings in switch)
  3.1826  
  3.1827  ########################################
  3.1828  # Diagnostics for where clause implementation
  3.1829 @@ -1353,29 +1893,35 @@
  3.1830      <null>
  3.1831  
  3.1832  # X#n (where n is an int id) is disambiguated tvar name
  3.1833 +# 0: name, 1: number
  3.1834  compiler.misc.type.var=\
  3.1835      {0}#{1}
  3.1836  
  3.1837  # CAP#n (where n is an int id) is an abbreviation for 'captured type'
  3.1838 +# 0: number
  3.1839  compiler.misc.captured.type=\
  3.1840      CAP#{0}
  3.1841  
  3.1842  # <INT#n> (where n is an int id) is an abbreviation for 'intersection type'
  3.1843 +# 0: number
  3.1844  compiler.misc.intersection.type=\
  3.1845      INT#{0}
  3.1846  
  3.1847  # where clause for captured type: contains upper ('extends {1}') and lower
  3.1848  # ('super {2}') bound along with the wildcard that generated this captured type ({3})
  3.1849 +# 0: type, 1: type, 2: type, 3: type
  3.1850  compiler.misc.where.captured=\
  3.1851      {0} extends {1} super: {2} from capture of {3}
  3.1852  
  3.1853  # compact where clause for captured type: contains upper ('extends {1}') along
  3.1854  # with the wildcard that generated this captured type ({3})
  3.1855 +# 0: type, 1: type, 2: unused, 3: type
  3.1856  compiler.misc.where.captured.1=\
  3.1857      {0} extends {1} from capture of {3}
  3.1858  
  3.1859  # where clause for type variable: contains upper bound(s) ('extends {1}') along with
  3.1860  # the kindname ({2}) and location ({3}) in which the typevar has been declared
  3.1861 +# 0: type, 1: list of type, 2: symbol kind, 3: symbol
  3.1862  compiler.misc.where.typevar=\
  3.1863      {0} extends {1} declared in {2} {3}
  3.1864  
  3.1865 @@ -1386,20 +1932,30 @@
  3.1866  
  3.1867  # where clause for type variable: contains all the upper bound(s) ('extends {1}')
  3.1868  # of this intersection type
  3.1869 +# 0: type, 1: list of type
  3.1870  compiler.misc.where.intersection=\
  3.1871      {0} extends {1}
  3.1872  
  3.1873  ### Where clause headers ###
  3.1874  compiler.misc.where.description.captured=\
  3.1875      where {0} is a fresh type-variable:
  3.1876 +
  3.1877 +# 0: set of type
  3.1878  compiler.misc.where.description.typevar=\
  3.1879      where {0} is a type-variable:
  3.1880 +
  3.1881 +# 0: set of type
  3.1882  compiler.misc.where.description.intersection=\
  3.1883      where {0} is an intersection type:
  3.1884 +
  3.1885 +# 0: set of type
  3.1886  compiler.misc.where.description.captured.1=\
  3.1887      where {0} are fresh type-variables:
  3.1888 +
  3.1889 +# 0: set of type
  3.1890  compiler.misc.where.description.typevar.1=\
  3.1891      where {0} are type-variables:
  3.1892 +
  3.1893  compiler.misc.where.description.intersection.1=\
  3.1894      where {0} are intersection types:
  3.1895  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test/tools/javac/diags/ArgTypeCompilerFactory.java	Wed Jan 26 13:45:25 2011 -0800
     4.3 @@ -0,0 +1,346 @@
     4.4 +/*
     4.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.
    4.11 + *
    4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 + * version 2 for more details (a copy is included in the LICENSE file that
    4.16 + * accompanied this code).
    4.17 + *
    4.18 + * You should have received a copy of the GNU General Public License version
    4.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 + *
    4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.23 + * or visit www.oracle.com if you need additional information or have any
    4.24 + * questions.
    4.25 + */
    4.26 +
    4.27 +import java.io.*;
    4.28 +import java.util.*;
    4.29 +import java.util.List;
    4.30 +import javax.tools.*;
    4.31 +
    4.32 +import com.sun.tools.javac.api.*;
    4.33 +import com.sun.tools.javac.api.DiagnosticFormatter.Configuration.DiagnosticPart;
    4.34 +import com.sun.tools.javac.api.Formattable.LocalizedString;
    4.35 +import com.sun.tools.javac.code.Flags.Flag;
    4.36 +import com.sun.tools.javac.code.Kinds.KindName;
    4.37 +import com.sun.tools.javac.code.*;
    4.38 +import com.sun.tools.javac.file.*;
    4.39 +import com.sun.tools.javac.main.Main;
    4.40 +import com.sun.tools.javac.parser.Token;
    4.41 +import com.sun.tools.javac.util.*;
    4.42 +import com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration;
    4.43 +import javax.lang.model.SourceVersion;
    4.44 +
    4.45 +/**
    4.46 + * Compiler factory for instances of Example.Compiler that use custom
    4.47 + * DiagnosticFormatter and Messages objects to track the types of args
    4.48 + * when when localizing diagnostics.
    4.49 + * The compiler objects only support "output" mode, not "check" mode.
    4.50 + */
    4.51 +class ArgTypeCompilerFactory implements Example.Compiler.Factory {
    4.52 +    // Same code as Example.Compiler.DefaultFactory, but the names resolve differently
    4.53 +    public Example.Compiler getCompiler(List<String> opts, boolean verbose) {
    4.54 +        String first;
    4.55 +        String[] rest;
    4.56 +        if (opts == null || opts.isEmpty()) {
    4.57 +            first = null;
    4.58 +            rest = new String[0];
    4.59 +        } else {
    4.60 +            first = opts.get(0);
    4.61 +            rest = opts.subList(1, opts.size()).toArray(new String[opts.size() - 1]);
    4.62 +        }
    4.63 +        if (first == null || first.equals("jsr199"))
    4.64 +            return new Jsr199Compiler(verbose, rest);
    4.65 +        else if (first.equals("simple"))
    4.66 +            return new SimpleCompiler(verbose);
    4.67 +        else if (first.equals("backdoor"))
    4.68 +            return new BackdoorCompiler(verbose);
    4.69 +        else
    4.70 +            throw new IllegalArgumentException(first);
    4.71 +    }
    4.72 +
    4.73 +    /**
    4.74 +     * Compile using the JSR 199 API.  The diagnostics generated are
    4.75 +     * scanned for resource keys.   Not all diagnostic keys are generated
    4.76 +     * via the JSR 199 API -- for example, rich diagnostics are not directly
    4.77 +     * accessible, and some diagnostics generated by the file manager may
    4.78 +     * not be generated (for example, the JSR 199 file manager does not see
    4.79 +     * -Xlint:path).
    4.80 +     */
    4.81 +    static class Jsr199Compiler extends Example.Compiler {
    4.82 +        List<String> fmOpts;
    4.83 +
    4.84 +        Jsr199Compiler(boolean verbose, String... args) {
    4.85 +            super(verbose);
    4.86 +            for (int i = 0; i < args.length; i++) {
    4.87 +                String arg = args[i];
    4.88 +                if (arg.equals("-filemanager") && (i + 1 < args.length)) {
    4.89 +                    fmOpts = Arrays.asList(args[++i].split(","));
    4.90 +                } else
    4.91 +                    throw new IllegalArgumentException(arg);
    4.92 +            }
    4.93 +        }
    4.94 +
    4.95 +        @Override
    4.96 +        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
    4.97 +            assert out != null && keys == null;
    4.98 +
    4.99 +            if (verbose)
   4.100 +                System.err.println("run_jsr199: " + opts + " " + files);
   4.101 +
   4.102 +            JavacTool tool = JavacTool.create();
   4.103 +
   4.104 +            StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
   4.105 +            if (fmOpts != null)
   4.106 +                fm = new FileManager(fm, fmOpts);
   4.107 +
   4.108 +            Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
   4.109 +
   4.110 +            JavacTaskImpl t = (JavacTaskImpl) tool.getTask(out, fm, null, opts, null, fos);
   4.111 +            Context c = t.getContext();
   4.112 +            ArgTypeMessages.preRegister(c);
   4.113 +            Options options = Options.instance(c);
   4.114 +            Log.instance(c).setDiagnosticFormatter(new ArgTypeDiagnosticFormatter(options));
   4.115 +            Boolean ok = t.call();
   4.116 +
   4.117 +            return ok;
   4.118 +        }
   4.119 +    }
   4.120 +
   4.121 +    /**
   4.122 +     * Run the test using the standard simple entry point.
   4.123 +     */
   4.124 +    static class SimpleCompiler extends Example.Compiler {
   4.125 +        SimpleCompiler(boolean verbose) {
   4.126 +            super(verbose);
   4.127 +        }
   4.128 +
   4.129 +        @Override
   4.130 +        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
   4.131 +            assert out != null && keys == null;
   4.132 +
   4.133 +            if (verbose)
   4.134 +                System.err.println("run_simple: " + opts + " " + files);
   4.135 +
   4.136 +            List<String> args = new ArrayList<String>();
   4.137 +
   4.138 +            args.addAll(opts);
   4.139 +            for (File f: files)
   4.140 +                args.add(f.getPath());
   4.141 +
   4.142 +            Main main = new Main("javac", out);
   4.143 +            Context c = new Context() {
   4.144 +                @Override public void clear() {
   4.145 +                    ((JavacFileManager) get(JavaFileManager.class)).close();
   4.146 +                    super.clear();
   4.147 +                }
   4.148 +            };
   4.149 +            JavacFileManager.preRegister(c); // can't create it until Log has been set up
   4.150 +            ArgTypeDiagnosticFormatter.preRegister(c);
   4.151 +            ArgTypeMessages.preRegister(c);
   4.152 +            int result = main.compile(args.toArray(new String[args.size()]), c);
   4.153 +
   4.154 +            return (result == 0);
   4.155 +        }
   4.156 +    }
   4.157 +
   4.158 +    static class BackdoorCompiler extends Example.Compiler {
   4.159 +        BackdoorCompiler(boolean verbose) {
   4.160 +            super(verbose);
   4.161 +        }
   4.162 +
   4.163 +        @Override
   4.164 +        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
   4.165 +            assert out != null && keys == null;
   4.166 +
   4.167 +            if (verbose)
   4.168 +                System.err.println("run_simple: " + opts + " " + files);
   4.169 +
   4.170 +            List<String> args = new ArrayList<String>(opts);
   4.171 +            for (File f: files)
   4.172 +                args.add(f.getPath());
   4.173 +
   4.174 +            Context c = new Context();
   4.175 +            JavacFileManager.preRegister(c); // can't create it until Log has been set up
   4.176 +            ArgTypeDiagnosticFormatter.preRegister(c);
   4.177 +            ArgTypeMessages.preRegister(c);
   4.178 +            com.sun.tools.javac.main.Main m = new com.sun.tools.javac.main.Main("javac", out);
   4.179 +            int rc = m.compile(args.toArray(new String[args.size()]), c);
   4.180 +
   4.181 +            return (rc == 0);
   4.182 +        }
   4.183 +
   4.184 +    }
   4.185 +
   4.186 +
   4.187 +    // <editor-fold defaultstate="collapsed" desc="Custom Javac components">
   4.188 +
   4.189 +    /**
   4.190 +     * Diagnostic formatter which reports formats a diag as a series of lines
   4.191 +     * containing a key, and a possibly empty set of descriptive strings for the
   4.192 +     * arg types.
   4.193 +     */
   4.194 +    static class ArgTypeDiagnosticFormatter extends AbstractDiagnosticFormatter {
   4.195 +        static void preRegister(final Context context) {
   4.196 +            context.put(Log.logKey, new Context.Factory<Log>() {
   4.197 +                public Log make() {
   4.198 +                    Log log = new Log(context) { };
   4.199 +                    Options options = Options.instance(context);
   4.200 +                    log.setDiagnosticFormatter(new ArgTypeDiagnosticFormatter(options));
   4.201 +                    return log;
   4.202 +                }
   4.203 +            });
   4.204 +
   4.205 +        }
   4.206 +
   4.207 +        ArgTypeDiagnosticFormatter(Options options) {
   4.208 +            super(null, new SimpleConfiguration(options,
   4.209 +                    EnumSet.of(DiagnosticPart.SUMMARY,
   4.210 +                    DiagnosticPart.DETAILS,
   4.211 +                    DiagnosticPart.SUBDIAGNOSTICS)));
   4.212 +        }
   4.213 +
   4.214 +        @Override
   4.215 +        protected String formatDiagnostic(JCDiagnostic d, Locale locale) {
   4.216 +            return formatMessage(d, locale);
   4.217 +        }
   4.218 +
   4.219 +        @Override
   4.220 +        public String formatMessage(JCDiagnostic d, Locale l) {
   4.221 +            StringBuilder buf = new StringBuilder();
   4.222 +            formatMessage(d, buf);
   4.223 +            return buf.toString();
   4.224 +        }
   4.225 +
   4.226 +        private void formatMessage(JCDiagnostic d, StringBuilder buf) {
   4.227 +            String key = d.getCode();
   4.228 +            Object[] args = d.getArgs();
   4.229 +            // report the primary arg types, without recursing into diag fragments
   4.230 +            buf.append(getKeyArgsString(key, args));
   4.231 +            // report details for any diagnostic fragments
   4.232 +            for (Object arg: args) {
   4.233 +                if (arg instanceof JCDiagnostic) {
   4.234 +                    buf.append("\n");
   4.235 +                    formatMessage((JCDiagnostic) arg, buf);
   4.236 +                }
   4.237 +            }
   4.238 +            // report details for any subdiagnostics
   4.239 +            for (String s: formatSubdiagnostics(d, null)) {
   4.240 +                buf.append("\n");
   4.241 +                buf.append(s);
   4.242 +            }
   4.243 +        }
   4.244 +
   4.245 +        @Override
   4.246 +        public boolean isRaw() {
   4.247 +            return true;
   4.248 +        }
   4.249 +    }
   4.250 +
   4.251 +    /**
   4.252 +     * Diagnostic formatter which "localizes" a message as a line
   4.253 +     * containing a key, and a possibly empty set of descriptive strings for the
   4.254 +     * arg types.
   4.255 +     */
   4.256 +    static class ArgTypeMessages extends JavacMessages {
   4.257 +        static void preRegister(final Context c) {
   4.258 +            c.put(JavacMessages.messagesKey, new Context.Factory<JavacMessages>() {
   4.259 +                public JavacMessages make() {
   4.260 +                    return new ArgTypeMessages(c) {
   4.261 +                        @Override
   4.262 +                        public String getLocalizedString(Locale l, String key, Object... args) {
   4.263 +                            return getKeyArgsString(key, args);
   4.264 +                        }
   4.265 +                    };
   4.266 +                }
   4.267 +            });
   4.268 +        }
   4.269 +
   4.270 +        ArgTypeMessages(Context context) {
   4.271 +            super(context);
   4.272 +        }
   4.273 +    }
   4.274 +
   4.275 +    /**
   4.276 +     * Utility method to generate a string for key and args
   4.277 +     */
   4.278 +    static String getKeyArgsString(String key, Object... args) {
   4.279 +        StringBuilder buf = new StringBuilder();
   4.280 +        buf.append(key);
   4.281 +        String sep = ": ";
   4.282 +        for (Object o : args) {
   4.283 +            buf.append(sep);
   4.284 +            buf.append(getArgTypeOrStringValue(o));
   4.285 +            sep = ", ";
   4.286 +        }
   4.287 +        return buf.toString();
   4.288 +    }
   4.289 +
   4.290 +    static boolean showStringValues = false;
   4.291 +
   4.292 +    static String getArgTypeOrStringValue(Object o) {
   4.293 +        if (showStringValues && o instanceof String)
   4.294 +            return "\"" + o + "\"";
   4.295 +        return getArgType(o);
   4.296 +    }
   4.297 +
   4.298 +    static String getArgType(Object o) {
   4.299 +        if (o == null)
   4.300 +            return "null";
   4.301 +        if (o instanceof Name)
   4.302 +            return "name";
   4.303 +        if (o instanceof Boolean)
   4.304 +            return "boolean";
   4.305 +        if (o instanceof Integer)
   4.306 +            return "number";
   4.307 +        if (o instanceof String)
   4.308 +            return "string";
   4.309 +        if (o instanceof Flag)
   4.310 +            return "modifier";
   4.311 +        if (o instanceof KindName)
   4.312 +            return "symbol kind";
   4.313 +        if (o instanceof Token)
   4.314 +            return "token";
   4.315 +        if (o instanceof Symbol)
   4.316 +            return "symbol";
   4.317 +        if (o instanceof Type)
   4.318 +            return "type";
   4.319 +        if (o instanceof List) {
   4.320 +            List<?> l = (List<?>) o;
   4.321 +            if (l.isEmpty())
   4.322 +                return "list";
   4.323 +            else
   4.324 +                return "list of " + getArgType(l.get(0));
   4.325 +        }
   4.326 +        if (o instanceof ListBuffer)
   4.327 +            return getArgType(((ListBuffer) o).toList());
   4.328 +        if (o instanceof Set) {
   4.329 +            Set<?> s = (Set<?>) o;
   4.330 +            if (s.isEmpty())
   4.331 +                return "set";
   4.332 +            else
   4.333 +                return "set of " + getArgType(s.iterator().next());
   4.334 +        }
   4.335 +        if (o instanceof SourceVersion)
   4.336 +            return "source version";
   4.337 +        if (o instanceof FileObject || o instanceof File)
   4.338 +            return "file name";
   4.339 +        if (o instanceof JCDiagnostic)
   4.340 +            return "message segment";
   4.341 +        if (o instanceof LocalizedString)
   4.342 +            return "message segment";  // only instance is "no arguments"
   4.343 +        String s = o.getClass().getSimpleName();
   4.344 +        return (s.isEmpty() ? o.getClass().getName() : s);
   4.345 +    }
   4.346 +
   4.347 +    // </editor-fold>
   4.348 +
   4.349 +}
     5.1 --- a/test/tools/javac/diags/Example.java	Wed Jan 26 11:20:19 2011 -0800
     5.2 +++ b/test/tools/javac/diags/Example.java	Wed Jan 26 13:45:25 2011 -0800
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -168,7 +168,7 @@
    5.11          try {
    5.12              run(null, keys, true, verbose);
    5.13          } catch (IOException e) {
    5.14 -            e.printStackTrace();
    5.15 +            e.printStackTrace(System.err);
    5.16          }
    5.17          return keys;
    5.18      }
    5.19 @@ -293,10 +293,15 @@
    5.20      }
    5.21  
    5.22      abstract static class Compiler {
    5.23 -        static Compiler getCompiler(List<String> opts, boolean verbose) {
    5.24 +        interface Factory {
    5.25 +            Compiler getCompiler(List<String> opts, boolean verbose);
    5.26 +        }
    5.27 +
    5.28 +        static class DefaultFactory implements Factory {
    5.29 +            public Compiler getCompiler(List<String> opts, boolean verbose) {
    5.30              String first;
    5.31              String[] rest;
    5.32 -            if (opts == null || opts.size() == 0) {
    5.33 +                if (opts == null || opts.isEmpty()) {
    5.34                  first = null;
    5.35                  rest = new String[0];
    5.36              } else {
    5.37 @@ -311,6 +316,16 @@
    5.38                  return new BackdoorCompiler(verbose);
    5.39              else
    5.40                  throw new IllegalArgumentException(first);
    5.41 +                }
    5.42 +        }
    5.43 +
    5.44 +        static Factory factory;
    5.45 +
    5.46 +        static Compiler getCompiler(List<String> opts, boolean verbose) {
    5.47 +            if (factory == null)
    5.48 +                factory = new DefaultFactory();
    5.49 +
    5.50 +            return factory.getCompiler(opts, verbose);
    5.51          }
    5.52  
    5.53          protected Compiler(boolean verbose) {
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/test/tools/javac/diags/MessageFile.java	Wed Jan 26 13:45:25 2011 -0800
     6.3 @@ -0,0 +1,463 @@
     6.4 +/*
     6.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 + *
     6.8 + * This code is free software; you can redistribute it and/or modify it
     6.9 + * under the terms of the GNU General Public License version 2 only, as
    6.10 + * published by the Free Software Foundation.
    6.11 + *
    6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.15 + * version 2 for more details (a copy is included in the LICENSE file that
    6.16 + * accompanied this code).
    6.17 + *
    6.18 + * You should have received a copy of the GNU General Public License version
    6.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.21 + *
    6.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.23 + * or visit www.oracle.com if you need additional information or have any
    6.24 + * questions.
    6.25 + */
    6.26 +
    6.27 +import java.io.*;
    6.28 +import java.util.*;
    6.29 +import java.util.regex.Matcher;
    6.30 +import java.util.regex.Pattern;
    6.31 +
    6.32 +/**
    6.33 + * Class to facilitate manipulating compiler.properties.
    6.34 + */
    6.35 +class MessageFile {
    6.36 +    static final Pattern emptyOrCommentPattern = Pattern.compile("( *#.*)?");
    6.37 +    static final Pattern infoPattern = Pattern.compile("# ([0-9]+: [-A-Za-z ]+, )*[0-9]+: [-A-Za-z ]+");
    6.38 +
    6.39 +    /**
    6.40 +     * A line of text within the message file.
    6.41 +     * The lines form a doubly linked list for simple navigation.
    6.42 +     */
    6.43 +    class Line {
    6.44 +        String text;
    6.45 +        Line prev;
    6.46 +        Line next;
    6.47 +
    6.48 +        Line(String text) {
    6.49 +            this.text = text;
    6.50 +        }
    6.51 +
    6.52 +        boolean isEmptyOrComment() {
    6.53 +            return emptyOrCommentPattern.matcher(text).matches();
    6.54 +        }
    6.55 +
    6.56 +        boolean isInfo() {
    6.57 +            return infoPattern.matcher(text).matches();
    6.58 +        }
    6.59 +
    6.60 +        boolean hasContinuation() {
    6.61 +            return (next != null) && text.endsWith("\\");
    6.62 +        }
    6.63 +
    6.64 +        Line insertAfter(String text) {
    6.65 +            Line l = new Line(text);
    6.66 +            insertAfter(l);
    6.67 +            return l;
    6.68 +        }
    6.69 +
    6.70 +        void insertAfter(Line l) {
    6.71 +            assert prev == null && next == null;
    6.72 +            l.prev = this;
    6.73 +            l.next = next;
    6.74 +            if (next == null)
    6.75 +                lastLine = l;
    6.76 +            else
    6.77 +                next.prev = l;
    6.78 +            next = l;
    6.79 +        }
    6.80 +
    6.81 +        Line insertBefore(String text) {
    6.82 +            Line l = new Line(text);
    6.83 +            insertBefore(l);
    6.84 +            return l;
    6.85 +        }
    6.86 +
    6.87 +        void insertBefore(Line l) {
    6.88 +            assert prev == null && next == null;
    6.89 +            l.prev = prev;
    6.90 +            l.next = this;
    6.91 +            if (prev == null)
    6.92 +                firstLine = l;
    6.93 +            else
    6.94 +                prev.next = l;
    6.95 +            prev = l;
    6.96 +        }
    6.97 +
    6.98 +        void remove() {
    6.99 +            if (prev == null)
   6.100 +                firstLine = next;
   6.101 +            else
   6.102 +                prev.next = next;
   6.103 +            if (next == null)
   6.104 +                lastLine = prev;
   6.105 +            else
   6.106 +                next.prev = prev;
   6.107 +            prev = null;
   6.108 +            next = null;
   6.109 +        }
   6.110 +    }
   6.111 +
   6.112 +    /**
   6.113 +     * A message within the message file.
   6.114 +     * A message is a series of lines containing a "name=value" property,
   6.115 +     * optionally preceded by a comment describing the use of placeholders
   6.116 +     * such as {0}, {1}, etc within the property value.
   6.117 +     */
   6.118 +    static final class Message {
   6.119 +        final Line firstLine;
   6.120 +        private Info info;
   6.121 +
   6.122 +        Message(Line l) {
   6.123 +            firstLine = l;
   6.124 +        }
   6.125 +
   6.126 +        boolean needInfo() {
   6.127 +            Line l = firstLine;
   6.128 +            while (true) {
   6.129 +                if (l.text.matches(".*\\{[0-9]+\\}.*"))
   6.130 +                    return true;
   6.131 +                if (!l.hasContinuation())
   6.132 +                    return false;
   6.133 +                l = l.next;
   6.134 +            }
   6.135 +        }
   6.136 +
   6.137 +        Set<Integer> getPlaceholders() {
   6.138 +            Pattern p = Pattern.compile("\\{([0-9]+)\\}");
   6.139 +            Set<Integer> results = new TreeSet<Integer>();
   6.140 +            Line l = firstLine;
   6.141 +            while (true) {
   6.142 +                Matcher m = p.matcher(l.text);
   6.143 +                while (m.find())
   6.144 +                    results.add(Integer.parseInt(m.group(1)));
   6.145 +                if (!l.hasContinuation())
   6.146 +                    return results;
   6.147 +                l = l.next;
   6.148 +            }
   6.149 +        }
   6.150 +
   6.151 +        /**
   6.152 +         * Get the Info object for this message. It may be empty if there
   6.153 +         * if no comment preceding the property specification.
   6.154 +         */
   6.155 +        Info getInfo() {
   6.156 +            if (info == null) {
   6.157 +                Line l = firstLine.prev;
   6.158 +                if (l != null && l.isInfo())
   6.159 +                    info = new Info(l.text);
   6.160 +                else
   6.161 +                    info = new Info();
   6.162 +            }
   6.163 +            return info;
   6.164 +        }
   6.165 +
   6.166 +        /**
   6.167 +         * Set the Info for this message.
   6.168 +         * If there was an info comment preceding the property specification,
   6.169 +         * it will be updated; otherwise, one will be inserted.
   6.170 +         */
   6.171 +        void setInfo(Info info) {
   6.172 +            this.info = info;
   6.173 +            Line l = firstLine.prev;
   6.174 +            if (l != null && l.isInfo())
   6.175 +                l.text = info.toComment();
   6.176 +            else
   6.177 +                firstLine.insertBefore(info.toComment());
   6.178 +        }
   6.179 +
   6.180 +        /**
   6.181 +         * Get all the lines pertaining to this message.
   6.182 +         */
   6.183 +        List<Line> getLines(boolean includeAllPrecedingComments) {
   6.184 +            List<Line> lines = new ArrayList<Line>();
   6.185 +            Line l = firstLine;
   6.186 +            if (includeAllPrecedingComments) {
   6.187 +                // scan back to find end of prev message
   6.188 +                while (l.prev != null && l.prev.isEmptyOrComment())
   6.189 +                    l = l.prev;
   6.190 +                // skip leading blank lines
   6.191 +                while (l.text.isEmpty())
   6.192 +                    l = l.next;
   6.193 +            } else {
   6.194 +                if (l.prev != null && l.prev.isInfo())
   6.195 +                    l = l.prev;
   6.196 +            }
   6.197 +
   6.198 +            // include any preceding lines
   6.199 +            for ( ; l != firstLine; l = l.next)
   6.200 +                lines.add(l);
   6.201 +
   6.202 +            // include message lines
   6.203 +            for (l = firstLine; l != null && l.hasContinuation(); l = l.next)
   6.204 +                lines.add(l);
   6.205 +            lines.add(l);
   6.206 +
   6.207 +            // include trailing blank line if present
   6.208 +            l = l.next;
   6.209 +            if (l != null && l.text.isEmpty())
   6.210 +                lines.add(l);
   6.211 +
   6.212 +            return lines;
   6.213 +        }
   6.214 +    }
   6.215 +
   6.216 +    /**
   6.217 +     * An object to represent the comment that may precede the property
   6.218 +     * specification in a Message.
   6.219 +     * The comment is modelled as a list of fields, where the fields correspond
   6.220 +     * to the placeholder values (e.g. {0}, {1}, etc) within the message value.
   6.221 +     */
   6.222 +    static final class Info {
   6.223 +        /**
   6.224 +         * An ordered set of descriptions for a placeholder value in a
   6.225 +         * message.
   6.226 +         */
   6.227 +        static class Field {
   6.228 +            boolean unused;
   6.229 +            Set<String> values;
   6.230 +            boolean listOfAny = false;
   6.231 +            boolean setOfAny = false;
   6.232 +            Field(String s) {
   6.233 +                s = s.substring(s.indexOf(": ") + 2);
   6.234 +                values = new LinkedHashSet<String>(Arrays.asList(s.split(" or ")));
   6.235 +                for (String v: values) {
   6.236 +                    if (v.startsWith("list of"))
   6.237 +                        listOfAny = true;
   6.238 +                    if (v.startsWith("set of"))
   6.239 +                        setOfAny = true;
   6.240 +                }
   6.241 +            }
   6.242 +
   6.243 +            /**
   6.244 +             * Return true if this field logically contains all the values of
   6.245 +             * another field.
   6.246 +             */
   6.247 +            boolean contains(Field other) {
   6.248 +                if (unused != other.unused)
   6.249 +                    return false;
   6.250 +
   6.251 +                for (String v: other.values) {
   6.252 +                    if (values.contains(v))
   6.253 +                        continue;
   6.254 +                    if (v.equals("null") || v.equals("string"))
   6.255 +                        continue;
   6.256 +                    if (v.equals("list") && listOfAny)
   6.257 +                        continue;
   6.258 +                    if (v.equals("set") && setOfAny)
   6.259 +                        continue;
   6.260 +                    return false;
   6.261 +                }
   6.262 +                return true;
   6.263 +            }
   6.264 +
   6.265 +            /**
   6.266 +             * Merge the values of another field into this field.
   6.267 +             */
   6.268 +            void merge(Field other) {
   6.269 +                unused |= other.unused;
   6.270 +                values.addAll(other.values);
   6.271 +
   6.272 +                // cleanup unnecessary entries
   6.273 +
   6.274 +                if (values.contains("null") && values.size() > 1) {
   6.275 +                    // "null" is superceded by anything else
   6.276 +                    values.remove("null");
   6.277 +                }
   6.278 +
   6.279 +                if (values.contains("string") && values.size() > 1) {
   6.280 +                    // "string" is superceded by anything else
   6.281 +                    values.remove("string");
   6.282 +                }
   6.283 +
   6.284 +                if (values.contains("list")) {
   6.285 +                    // list is superceded by "list of ..."
   6.286 +                    for (String s: values) {
   6.287 +                        if (s.startsWith("list of ")) {
   6.288 +                            values.remove("list");
   6.289 +                            break;
   6.290 +                        }
   6.291 +                    }
   6.292 +                }
   6.293 +
   6.294 +                if (values.contains("set")) {
   6.295 +                    // set is superceded by "set of ..."
   6.296 +                    for (String s: values) {
   6.297 +                        if (s.startsWith("set of ")) {
   6.298 +                            values.remove("set");
   6.299 +                            break;
   6.300 +                        }
   6.301 +                    }
   6.302 +                }
   6.303 +
   6.304 +                if (other.values.contains("unused")) {
   6.305 +                    values.clear();
   6.306 +                    values.add("unused");
   6.307 +                }
   6.308 +            }
   6.309 +
   6.310 +            void markUnused() {
   6.311 +                values = new LinkedHashSet<String>();
   6.312 +                values.add("unused");
   6.313 +                listOfAny = false;
   6.314 +                setOfAny = false;
   6.315 +            }
   6.316 +
   6.317 +            @Override
   6.318 +            public String toString() {
   6.319 +                return values.toString();
   6.320 +            }
   6.321 +        }
   6.322 +
   6.323 +        /** The fields of the Info object. */
   6.324 +        List<Field> fields = new ArrayList<Field>();
   6.325 +
   6.326 +        Info() { }
   6.327 +
   6.328 +        Info(String text) throws IllegalArgumentException {
   6.329 +            if (!text.startsWith("# "))
   6.330 +                throw new IllegalArgumentException();
   6.331 +            String[] segs = text.substring(2).split(", ");
   6.332 +            fields = new ArrayList<Field>();
   6.333 +            for (String seg: segs) {
   6.334 +                fields.add(new Field(seg));
   6.335 +            }
   6.336 +        }
   6.337 +
   6.338 +        Info(Set<String> infos) throws IllegalArgumentException {
   6.339 +            for (String s: infos)
   6.340 +                merge(new Info(s));
   6.341 +        }
   6.342 +
   6.343 +        boolean isEmpty() {
   6.344 +            return fields.isEmpty();
   6.345 +        }
   6.346 +
   6.347 +        boolean contains(Info other) {
   6.348 +            if (other.isEmpty())
   6.349 +                return true;
   6.350 +
   6.351 +            if (fields.size() != other.fields.size())
   6.352 +                return false;
   6.353 +
   6.354 +            Iterator<Field> oIter = other.fields.iterator();
   6.355 +            for (Field values: fields) {
   6.356 +                if (!values.contains(oIter.next()))
   6.357 +                    return false;
   6.358 +            }
   6.359 +
   6.360 +            return true;
   6.361 +        }
   6.362 +
   6.363 +        void merge(Info other) {
   6.364 +            if (fields.isEmpty()) {
   6.365 +                fields.addAll(other.fields);
   6.366 +                return;
   6.367 +            }
   6.368 +
   6.369 +            if (other.fields.size() != fields.size())
   6.370 +                throw new IllegalArgumentException();
   6.371 +
   6.372 +            Iterator<Field> oIter = other.fields.iterator();
   6.373 +            for (Field d: fields) {
   6.374 +                d.merge(oIter.next());
   6.375 +            }
   6.376 +        }
   6.377 +
   6.378 +        void markUnused(Set<Integer> used) {
   6.379 +            for (int i = 0; i < fields.size(); i++) {
   6.380 +                if (!used.contains(i))
   6.381 +                    fields.get(i).markUnused();
   6.382 +            }
   6.383 +        }
   6.384 +
   6.385 +        @Override
   6.386 +        public String toString() {
   6.387 +            return fields.toString();
   6.388 +        }
   6.389 +
   6.390 +        String toComment() {
   6.391 +            StringBuilder sb = new StringBuilder();
   6.392 +            sb.append("# ");
   6.393 +            String sep = "";
   6.394 +            int i = 0;
   6.395 +            for (Field f: fields) {
   6.396 +                sb.append(sep);
   6.397 +                sb.append(i++);
   6.398 +                sb.append(": ");
   6.399 +                sep = "";
   6.400 +                for (String s: f.values) {
   6.401 +                    sb.append(sep);
   6.402 +                    sb.append(s);
   6.403 +                    sep = " or ";
   6.404 +                }
   6.405 +                sep = ", ";
   6.406 +            }
   6.407 +            return sb.toString();
   6.408 +        }
   6.409 +    }
   6.410 +
   6.411 +    Line firstLine;
   6.412 +    Line lastLine;
   6.413 +    Map<String, Message> messages = new TreeMap<String, Message>();
   6.414 +
   6.415 +    MessageFile(File file) throws IOException {
   6.416 +        Reader in = new FileReader(file);
   6.417 +        try {
   6.418 +            read(in);
   6.419 +        } finally {
   6.420 +            in.close();
   6.421 +        }
   6.422 +    }
   6.423 +
   6.424 +    MessageFile(Reader in) throws IOException {
   6.425 +        read(in);
   6.426 +    }
   6.427 +
   6.428 +    final void read(Reader in) throws IOException {
   6.429 +        BufferedReader br = (in instanceof BufferedReader)
   6.430 +                ? (BufferedReader) in
   6.431 +                : new BufferedReader(in);
   6.432 +        String line;
   6.433 +        while ((line = br.readLine()) != null) {
   6.434 +            Line l;
   6.435 +            if (firstLine == null)
   6.436 +                l = firstLine = lastLine = new Line(line);
   6.437 +            else
   6.438 +                l = lastLine.insertAfter(line);
   6.439 +            if (line.startsWith("compiler.")) {
   6.440 +                int eq = line.indexOf("=");
   6.441 +                if (eq > 0)
   6.442 +                    messages.put(line.substring(0, eq), new Message(l));
   6.443 +            }
   6.444 +        }
   6.445 +    }
   6.446 +
   6.447 +    void write(File file) throws IOException {
   6.448 +        Writer out = new FileWriter(file);
   6.449 +        try {
   6.450 +            write(out);
   6.451 +        } finally {
   6.452 +            out.close();
   6.453 +        }
   6.454 +    }
   6.455 +
   6.456 +    void write(Writer out) throws IOException {
   6.457 +        BufferedWriter bw = (out instanceof BufferedWriter)
   6.458 +                ? (BufferedWriter) out
   6.459 +                : new BufferedWriter(out);
   6.460 +        for (Line l = firstLine; l != null; l = l.next) {
   6.461 +            bw.write(l.text);
   6.462 +            bw.write("\n"); // always use Unix line endings
   6.463 +        }
   6.464 +        bw.flush();
   6.465 +    }
   6.466 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/tools/javac/diags/MessageInfo.java	Wed Jan 26 13:45:25 2011 -0800
     7.3 @@ -0,0 +1,406 @@
     7.4 +/*
     7.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 + * or visit www.oracle.com if you need additional information or have any
    7.24 + * questions.
    7.25 + */
    7.26 +
    7.27 +/**
    7.28 + * @test
    7.29 + * @bug 7013272
    7.30 + * @summary Automatically generate info about how compiler resource keys are used
    7.31 + * @build Example ArgTypeCompilerFactory MessageFile MessageInfo
    7.32 + * @run main MessageInfo
    7.33 + */
    7.34 +
    7.35 +import java.io.*;
    7.36 +import java.text.SimpleDateFormat;
    7.37 +import java.util.*;
    7.38 +
    7.39 +/**
    7.40 + * Utility to manipulate compiler.properties, and suggest info comments based
    7.41 + * on information derived from running examples.
    7.42 + *
    7.43 + * Options:
    7.44 + *   -examples dir   location of examples directory
    7.45 + *   -o file         output file
    7.46 + *   -check          just check message file
    7.47 + *   -ensureNewlines ensure newline after each entry
    7.48 + *   -fixIndent      fix indentation of continuation lines
    7.49 + *   -sort           sort messages
    7.50 + *   -verbose        verbose output
    7.51 + *   -replace        replace comments instead of merging comments
    7.52 + *   file            javac compiler.properties file
    7.53 + *
    7.54 + */
    7.55 +public class MessageInfo {
    7.56 +    public static void main(String... args) throws Exception {
    7.57 +        jtreg = (System.getProperty("test.src") != null);
    7.58 +        File tmpDir;
    7.59 +        if (jtreg) {
    7.60 +            // use standard jtreg scratch directory: the current directory
    7.61 +            tmpDir = new File(System.getProperty("user.dir"));
    7.62 +        } else {
    7.63 +            tmpDir = new File(System.getProperty("java.io.tmpdir"),
    7.64 +                    MessageInfo.class.getName()
    7.65 +                    + (new SimpleDateFormat("yyMMddHHmmss")).format(new Date()));
    7.66 +        }
    7.67 +        Example.setTempDir(tmpDir);
    7.68 +        Example.Compiler.factory = new ArgTypeCompilerFactory();
    7.69 +
    7.70 +        MessageInfo mi = new MessageInfo();
    7.71 +
    7.72 +        try {
    7.73 +            if (mi.run(args))
    7.74 +                return;
    7.75 +        } finally {
    7.76 +            /* VERY IMPORTANT NOTE. In jtreg mode, tmpDir is set to the
    7.77 +             * jtreg scratch directory, which is the current directory.
    7.78 +             * In case someone is faking jtreg mode, make sure to only
    7.79 +             * clean tmpDir when it is reasonable to do so.
    7.80 +             */
    7.81 +            if (tmpDir.isDirectory() &&
    7.82 +                    tmpDir.getName().startsWith(MessageInfo.class.getName())) {
    7.83 +                if (clean(tmpDir))
    7.84 +                    tmpDir.delete();
    7.85 +            }
    7.86 +        }
    7.87 +
    7.88 +        if (jtreg)
    7.89 +            throw new Exception(mi.errors + " errors occurred");
    7.90 +        else
    7.91 +            System.exit(1);
    7.92 +    }
    7.93 +
    7.94 +    void usage() {
    7.95 +        System.out.println("Usage:");
    7.96 +        System.out.println("    java MessageInfo [options] [file]");
    7.97 +        System.out.println("where options include");
    7.98 +        System.out.println("    -examples dir   location of examples directory");
    7.99 +        System.out.println("    -o file         output file");
   7.100 +        System.out.println("    -check          just check message file");
   7.101 +        System.out.println("    -ensureNewlines ensure newline after each entry");
   7.102 +        System.out.println("    -fixIndent      fix indentation of continuation lines");
   7.103 +        System.out.println("    -sort           sort messages");
   7.104 +        System.out.println("    -verbose        verbose output");
   7.105 +        System.out.println("    -replace        replace comments instead of merging comments");
   7.106 +        System.out.println("    file            javac compiler.properties file");
   7.107 +    }
   7.108 +
   7.109 +    boolean run(String... args) {
   7.110 +        File testSrc = new File(System.getProperty("test.src", "."));
   7.111 +        File examplesDir = new File(testSrc, "examples");
   7.112 +        File notYetFile = null;
   7.113 +        File msgFile = null;
   7.114 +        File outFile = null;
   7.115 +        boolean verbose = false;
   7.116 +        boolean ensureNewlines = false;
   7.117 +        boolean fixIndent = false;
   7.118 +        boolean sort = false;
   7.119 +        boolean replace = false;
   7.120 +        boolean check = jtreg; // default true in jtreg mode
   7.121 +
   7.122 +        for (int i = 0; i < args.length; i++) {
   7.123 +            String arg = args[i];
   7.124 +            if (arg.equals("-examples") && (i + 1) < args.length)
   7.125 +                examplesDir = new File(args[++i]);
   7.126 +            else if(arg.equals("-notyet") && (i + 1) < args.length)
   7.127 +                notYetFile = new File(args[++i]);
   7.128 +            else if (arg.equals("-ensureNewlines"))
   7.129 +                ensureNewlines = true;
   7.130 +            else if (arg.equals("-fixIndent"))
   7.131 +                fixIndent = true;
   7.132 +            else if (arg.equals("-sort"))
   7.133 +                sort = true;
   7.134 +            else if (arg.equals("-verbose"))
   7.135 +                verbose = true;
   7.136 +            else if (arg.equals("-replace"))
   7.137 +                replace = true;
   7.138 +            else if (arg.equals("-check"))
   7.139 +                check = true;
   7.140 +            else if (arg.equals("-o") && (i + 1) < args.length)
   7.141 +                outFile = new File(args[++i]);
   7.142 +            else if (arg.startsWith("-")) {
   7.143 +                error("unknown option: " + arg);
   7.144 +                return false;
   7.145 +            } else if (i == args.length - 1) {
   7.146 +                msgFile = new File(arg);
   7.147 +            } else {
   7.148 +                error("unknown arg: " + arg);
   7.149 +                return false;
   7.150 +            }
   7.151 +        }
   7.152 +
   7.153 +        if (!check && outFile == null) {
   7.154 +            usage();
   7.155 +            return true;
   7.156 +        }
   7.157 +
   7.158 +        if ((ensureNewlines || fixIndent || sort) && outFile == null) {
   7.159 +            error("must set output file for these options");
   7.160 +            return false;
   7.161 +        }
   7.162 +
   7.163 +        if (notYetFile == null) {
   7.164 +            notYetFile = new File(examplesDir.getParentFile(), "examples.not-yet.txt");
   7.165 +        }
   7.166 +
   7.167 +        if (msgFile == null) {
   7.168 +            for (File d = testSrc; d != null; d = d.getParentFile()) {
   7.169 +                if (new File(d, "TEST.ROOT").exists()) {
   7.170 +                    d = d.getParentFile();
   7.171 +                    File f = new File(d, "src/share/classes/com/sun/tools/javac/resources/compiler.properties");
   7.172 +                    if (f.exists()) {
   7.173 +                        msgFile = f;
   7.174 +                        break;
   7.175 +                    }
   7.176 +                }
   7.177 +            }
   7.178 +            if (msgFile == null) {
   7.179 +                error("no message file available");
   7.180 +                return false;
   7.181 +            }
   7.182 +        }
   7.183 +
   7.184 +        MessageFile mf;
   7.185 +        try {
   7.186 +            mf = new MessageFile(msgFile);
   7.187 +        } catch (IOException e) {
   7.188 +            error("problem reading message file: " + e);
   7.189 +            return false;
   7.190 +        }
   7.191 +
   7.192 +        Map<String, Set<String>> msgInfo = runExamples(examplesDir, verbose);
   7.193 +
   7.194 +        if (ensureNewlines)
   7.195 +            ensureNewlines(mf);
   7.196 +
   7.197 +        if (fixIndent)
   7.198 +            fixIndent(mf);
   7.199 +
   7.200 +        if (sort)
   7.201 +            sort(mf, true);
   7.202 +
   7.203 +        for (Map.Entry<String, Set<String>> e: msgInfo.entrySet()) {
   7.204 +            String k = e.getKey();
   7.205 +            Set<String> suggestions = e.getValue();
   7.206 +            MessageFile.Message m = mf.messages.get(k);
   7.207 +            if (m == null) {
   7.208 +                error("Can't find message for " + k + " in message file");
   7.209 +                continue;
   7.210 +            }
   7.211 +
   7.212 +            MessageFile.Info info = m.getInfo();
   7.213 +            Set<Integer> placeholders = m.getPlaceholders();
   7.214 +            MessageFile.Info suggestedInfo = new MessageFile.Info(suggestions);
   7.215 +            suggestedInfo.markUnused(placeholders);
   7.216 +
   7.217 +            if (!info.isEmpty()) {
   7.218 +                if (info.contains(suggestedInfo))
   7.219 +                    continue;
   7.220 +                if (!replace) {
   7.221 +                    if (info.fields.size() != suggestedInfo.fields.size())
   7.222 +                        error("Cannot merge info for " + k);
   7.223 +                    else
   7.224 +                        suggestedInfo.merge(info);
   7.225 +                }
   7.226 +            }
   7.227 +
   7.228 +            if (outFile == null) {
   7.229 +                System.err.println("suggest for " + k);
   7.230 +                System.err.println(suggestedInfo.toComment());
   7.231 +            }  else
   7.232 +                m.setInfo(suggestedInfo);
   7.233 +        }
   7.234 +
   7.235 +        if (check)
   7.236 +            check(mf, notYetFile);
   7.237 +
   7.238 +        try {
   7.239 +            if (outFile != null)
   7.240 +                mf.write(outFile);
   7.241 +        } catch (IOException e) {
   7.242 +            error("problem writing file: " + e);
   7.243 +            return false;
   7.244 +        }
   7.245 +
   7.246 +        return (errors == 0);
   7.247 +    }
   7.248 +
   7.249 +    void check(MessageFile mf, File notYetFile) {
   7.250 +        Set<String> notYetList = null;
   7.251 +        for (Map.Entry<String, MessageFile.Message> e: mf.messages.entrySet()) {
   7.252 +            String key = e.getKey();
   7.253 +            MessageFile.Message m = e.getValue();
   7.254 +            if (m.needInfo() && m.getInfo().isEmpty()) {
   7.255 +                if (notYetList == null)
   7.256 +                    notYetList = getNotYetList(notYetFile);
   7.257 +                if (notYetList.contains(key))
   7.258 +                    System.err.println("Warning: no info for " + key);
   7.259 +                else
   7.260 +                    error("no info for " + key);
   7.261 +            }
   7.262 +        }
   7.263 +
   7.264 +    }
   7.265 +
   7.266 +    void ensureNewlines(MessageFile mf) {
   7.267 +        for (MessageFile.Message m: mf.messages.values()) {
   7.268 +            MessageFile.Line l = m.firstLine;
   7.269 +            while (l.text.endsWith("\\"))
   7.270 +                l = l.next;
   7.271 +            if (l.next != null && !l.next.text.isEmpty())
   7.272 +                l.insertAfter("");
   7.273 +        }
   7.274 +    }
   7.275 +
   7.276 +    void fixIndent(MessageFile mf) {
   7.277 +        for (MessageFile.Message m: mf.messages.values()) {
   7.278 +            MessageFile.Line l = m.firstLine;
   7.279 +            while (l.text.endsWith("\\") && l.next != null) {
   7.280 +                if (!l.next.text.matches("^    \\S.*"))
   7.281 +                    l.next.text = "    " + l.next.text.trim();
   7.282 +                l = l.next;
   7.283 +            }
   7.284 +        }
   7.285 +    }
   7.286 +
   7.287 +    void sort(MessageFile mf, boolean includePrecedingNewlines) {
   7.288 +        for (MessageFile.Message m: mf.messages.values()) {
   7.289 +            for (MessageFile.Line l: m.getLines(includePrecedingNewlines)) {
   7.290 +                l.remove();
   7.291 +                mf.lastLine.insertAfter(l);
   7.292 +            }
   7.293 +        }
   7.294 +    }
   7.295 +
   7.296 +    Map<String, Set<String>> runExamples(File examplesDir, boolean verbose) {
   7.297 +        Map<String, Set<String>> map = new TreeMap<String, Set<String>>();
   7.298 +        for (Example e: getExamples(examplesDir)) {
   7.299 +            StringWriter sw = new StringWriter();
   7.300 +            PrintWriter pw = new PrintWriter(sw);
   7.301 +            e.run(pw, true, verbose);
   7.302 +            pw.close();
   7.303 +            String[] lines = sw.toString().split("\n");
   7.304 +            for (String line: lines) {
   7.305 +                if (!line.startsWith("compiler."))
   7.306 +                    continue;
   7.307 +                int colon = line.indexOf(":");
   7.308 +                if (colon == -1)
   7.309 +                    continue;
   7.310 +                String key = line.substring(0, colon);
   7.311 +                StringBuilder sb = new StringBuilder();
   7.312 +                sb.append("# ");
   7.313 +                int i = 0;
   7.314 +                String[] descs = line.substring(colon + 1).split(", *");
   7.315 +                for (String desc: descs) {
   7.316 +                    if (i > 0) sb.append(", ");
   7.317 +                    sb.append(i++);
   7.318 +                    sb.append(": ");
   7.319 +                    sb.append(desc.trim());
   7.320 +                }
   7.321 +                Set<String> set = map.get(key);
   7.322 +                if (set == null)
   7.323 +                    map.put(key, set = new TreeSet<String>());
   7.324 +                set.add(sb.toString());
   7.325 +            }
   7.326 +        }
   7.327 +
   7.328 +        return map;
   7.329 +    }
   7.330 +
   7.331 +    /**
   7.332 +     * Get the complete set of examples to be checked.
   7.333 +     */
   7.334 +    Set<Example> getExamples(File examplesDir) {
   7.335 +        Set<Example> results = new TreeSet<Example>();
   7.336 +        for (File f: examplesDir.listFiles()) {
   7.337 +            if (isValidExample(f))
   7.338 +                results.add(new Example(f));
   7.339 +        }
   7.340 +        return results;
   7.341 +    }
   7.342 +
   7.343 +    boolean isValidExample(File f) {
   7.344 +        return (f.isDirectory() && (!jtreg || f.list().length > 0)) ||
   7.345 +                (f.isFile() && f.getName().endsWith(".java"));
   7.346 +    }
   7.347 +
   7.348 +    /**
   7.349 +     * Get the contents of the "not-yet" list.
   7.350 +     */
   7.351 +    Set<String> getNotYetList(File file) {
   7.352 +        Set<String> results = new TreeSet<String>();
   7.353 +        try {
   7.354 +            String[] lines = read(file).split("[\r\n]");
   7.355 +            for (String line: lines) {
   7.356 +                int hash = line.indexOf("#");
   7.357 +                if (hash != -1)
   7.358 +                    line = line.substring(0, hash).trim();
   7.359 +                if (line.matches("[A-Za-z0-9-_.]+"))
   7.360 +                    results.add(line);
   7.361 +            }
   7.362 +        } catch (IOException e) {
   7.363 +            throw new Error(e);
   7.364 +        }
   7.365 +        return results;
   7.366 +    }
   7.367 +
   7.368 +    /**
   7.369 +     * Read the contents of a file.
   7.370 +     */
   7.371 +    String read(File f) throws IOException {
   7.372 +        byte[] bytes = new byte[(int) f.length()];
   7.373 +        DataInputStream in = new DataInputStream(new FileInputStream(f));
   7.374 +        try {
   7.375 +            in.readFully(bytes);
   7.376 +        } finally {
   7.377 +            in.close();
   7.378 +        }
   7.379 +        return new String(bytes);
   7.380 +    }
   7.381 +
   7.382 +    /**
   7.383 +     * Report an error.
   7.384 +     */
   7.385 +    void error(String msg) {
   7.386 +        System.err.println("Error: " + msg);
   7.387 +        errors++;
   7.388 +    }
   7.389 +
   7.390 +    static boolean jtreg;
   7.391 +
   7.392 +    int errors;
   7.393 +
   7.394 +    /**
   7.395 +     * Clean the contents of a directory.
   7.396 +     */
   7.397 +    static boolean clean(File dir) {
   7.398 +        boolean ok = true;
   7.399 +        for (File f: dir.listFiles()) {
   7.400 +            if (f.isDirectory())
   7.401 +                ok &= clean(f);
   7.402 +            ok &= f.delete();
   7.403 +        }
   7.404 +        return ok;
   7.405 +    }
   7.406 +
   7.407 +}
   7.408 +
   7.409 +
     8.1 --- a/test/tools/javac/diags/RunExamples.java	Wed Jan 26 11:20:19 2011 -0800
     8.2 +++ b/test/tools/javac/diags/RunExamples.java	Wed Jan 26 13:45:25 2011 -0800
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -25,7 +25,7 @@
    8.11   * @test
    8.12   * @bug 6968063
    8.13   * @summary provide examples of code that generate diagnostics
    8.14 - * @build Example HTMLWriter RunExamples
    8.15 + * @build ArgTypeCompilerFactory Example HTMLWriter RunExamples
    8.16   * @run main RunExamples
    8.17   */
    8.18  
    8.19 @@ -97,6 +97,7 @@
    8.20          boolean raw = false;
    8.21          boolean showFiles = false;
    8.22          boolean verbose = false;
    8.23 +        boolean argTypes = false;
    8.24          String title = null;
    8.25  
    8.26          for (int i = 0; i < args.length; i++) {
    8.27 @@ -115,6 +116,8 @@
    8.28                  outFile = new File(args[++i]);
    8.29              else if (arg.equals("-title") && (i + 1) < args.length)
    8.30                  title = args[++i];
    8.31 +            else if (arg.equals("-argtypes"))
    8.32 +                argTypes = true;
    8.33              else if (arg.startsWith("-")) {
    8.34                  error("unknown option: " + arg);
    8.35                  return false;
    8.36 @@ -127,6 +130,11 @@
    8.37              }
    8.38          }
    8.39  
    8.40 +        // special mode to show message keys and the types of the args that
    8.41 +        // are used.
    8.42 +        if (argTypes)
    8.43 +            Example.Compiler.factory = new ArgTypeCompilerFactory();
    8.44 +
    8.45          if (selectedKeys.size() > 0) {
    8.46              Set<Example> examples = getExamples(examplesDir);
    8.47          nextKey:
    8.48 @@ -138,7 +146,7 @@
    8.49                  error("Key " + k + ": no examples found");
    8.50              }
    8.51          } else {
    8.52 -            if (selectedExamples.size() == 0)
    8.53 +            if (selectedExamples.isEmpty())
    8.54                  selectedExamples = getExamples(examplesDir);
    8.55          }
    8.56  

mercurial