jdk/src/bsd/doc/man/javac.1
author dsamersoff
Thu, 15 Jan 2015 12:02:55 +0000
changeset 28620 0e23eb51d29e
parent 21743 3d979da7bdf0
child 31876 91b22707521a
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     1
'\" t
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     2
.\"  Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     3
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     4
.\" DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     5
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     6
.\" This code is free software; you can redistribute it and/or modify it
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     7
.\" under the terms of the GNU General Public License version 2 only, as
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     8
.\" published by the Free Software Foundation.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
     9
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    10
.\" This code is distributed in the hope that it will be useful, but WITHOUT
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    11
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    12
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    13
.\" version 2 for more details (a copy is included in the LICENSE file that
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    14
.\" accompanied this code).
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    15
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    16
.\" You should have received a copy of the GNU General Public License version
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    17
.\" 2 along with this work; if not, write to the Free Software Foundation,
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    18
.\" Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    19
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    20
.\" Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    21
.\" or visit www.oracle.com if you need additional information or have any
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    22
.\" questions.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    23
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    24
.\"     Arch: generic
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    25
.\"     Software: JDK 8
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    26
.\"     Date: 21 November 2013
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    27
.\"     SectDesc: Basic Tools
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    28
.\"     Title: javac.1
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    29
.\"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    30
.if n .pl 99999
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    31
.TH javac 1 "21 November 2013" "JDK 8" "Basic Tools"
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    32
.\" -----------------------------------------------------------------
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    33
.\" * Define some portability stuff
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    34
.\" -----------------------------------------------------------------
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    35
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    36
.\" http://bugs.debian.org/507673
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    37
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    38
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    39
.ie \n(.g .ds Aq \(aq
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    40
.el       .ds Aq '
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    41
.\" -----------------------------------------------------------------
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    42
.\" * set default formatting
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    43
.\" -----------------------------------------------------------------
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    44
.\" disable hyphenation
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    45
.nh
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    46
.\" disable justification (adjust text to left margin only)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    47
.ad l
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    48
.\" -----------------------------------------------------------------
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    49
.\" * MAIN CONTENT STARTS HERE *
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    50
.\" -----------------------------------------------------------------
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    51
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    52
.SH NAME    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    53
javac \- Reads Java class and interface definitions and compiles them into bytecode and class files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    54
.SH SYNOPSIS    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    55
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    56
.nf     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
    57
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    58
\fBjavac\fR [ \fIoptions\fR ] [ \fIsourcefiles\fR ] [ \fIclasses\fR] [ \fI@argfiles\fR ]
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    59
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    60
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    61
Arguments can be in any order:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    62
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    63
\fIoptions\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    64
Command-line options\&. See Options\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    65
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    66
\fIsourcefiles\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    67
One or more source files to be compiled (such as \f3MyClass\&.java\fR)\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    68
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    69
\fIclasses\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    70
One or more classes to be processed for annotations (such as \f3MyPackage\&.MyClass\fR)\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    71
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    72
\fI@argfiles\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    73
One or more files that list options and source files\&. The \f3-J\fR options are not allowed in these files\&. See Command-Line Argument Files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    74
.SH DESCRIPTION    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    75
The \f3javac\fR command reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files\&. The \f3javac\fR command can also process annotations in Java source files and classes\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    76
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    77
There are two ways to pass source code file names to \f3javac\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    78
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    79
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    80
For a small number of source files, list the file names on the command line\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    81
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    82
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    83
For a large number of source files, list the file names in a file that is separated by blanks or line breaks\&. Use the list file name preceded by an at sign (@) with the \f3javac\fR command\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    84
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    85
Source code file names must have \&.java suffixes, class file names must have \&.class suffixes, and both source and class files must have root names that identify the class\&. For example, a class called \f3MyClass\fR would be written in a source file called \f3MyClass\&.java\fR and compiled into a bytecode class file called \f3MyClass\&.class\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    86
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    87
Inner class definitions produce additional class files\&. These class files have names that combine the inner and outer class names, such as \f3MyClass$MyInnerClass\&.class\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    88
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    89
Arrange source files in a directory tree that reflects their package tree\&. For example, if all of your source files are in \f3/workspace\fR, then put the source code for \f3com\&.mysoft\&.mypack\&.MyClass\fR in \f3/workspace/com/mysoft/mypack/MyClass\&.java\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    90
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    91
By default, the compiler puts each class file in the same directory as its source file\&. You can specify a separate destination directory with the \f3-d\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    92
.SH OPTIONS    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    93
The compiler has a set of standard options that are supported on the current development environment\&. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations and are subject to change in the future\&. Nonstandard options begin with the \f3-X\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    94
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    95
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    96
See also Cross-Compilation Options
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    97
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    98
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
    99
See also Nonstandard Options
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   100
.SS STANDARD\ OPTIONS    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   101
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   102
-A\fIkey\fR[\fI=value\fR]
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   103
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   104
Specifies options to pass to annotation processors\&. These options are not interpreted by \f3javac\fR directly, but are made available for use by individual processors\&. The \f3key\fR value should be one or more identifiers separated by a dot (\&.)\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   105
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   106
-cp \fIpath\fR or -classpath \fIpath\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   107
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   108
Specifies where to find user class files, and (optionally) annotation processors and source files\&. This class path overrides the user class path in the \f3CLASSPATH\fR environment variable\&. If neither \f3CLASSPATH\fR, \f3-cp\fR nor \f3-classpath\fR is specified, then the user \fIclass path\fR is the current directory\&. See Setting the Class Path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   109
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   110
If the \f3-sourcepath\fR option is not specified, then the user class path is also searched for source files\&.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   111
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   112
If the \f3-processorpath\fR option is not specified, then the class path is also searched for annotation processors\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   113
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   114
-Djava\&.ext\&.dirs=\fIdirectories\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   115
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   116
Overrides the location of installed extensions\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   117
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   118
-Djava\&.endorsed\&.dirs=\fIdirectories\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   119
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   120
Overrides the location of the endorsed standards path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   121
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   122
-d \fIdirectory\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   123
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   124
Sets the destination directory for class files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then \f3javac\fR puts the class file in a subdirectory that reflects the package name and creates directories as needed\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   125
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   126
If you specify \f3-d\fR\f3/home/myclasses\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the class file is \f3/home/myclasses/com/mypackage/MyClass\&.class\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   127
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   128
If the \fI-d\fR option is not specified, then \f3javac\fR puts each class file in the same directory as the source file from which it was generated\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   129
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   130
\fINote:\fR The directory specified by the \fI-d\fR option is not automatically added to your user class path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   131
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   132
-deprecation
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   133
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   134
Shows a description of each use or override of a deprecated member or class\&. Without the \f3-deprecation\fR option, \f3javac\fR shows a summary of the source files that use or override deprecated members or classes\&. The \f3-deprecation\fR option is shorthand for \f3-Xlint:deprecation\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   135
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   136
-encoding \fIencoding\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   137
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   138
Sets the source file encoding name, such as EUC-JP and UTF-8\&. If the \f3-encoding\fR option is not specified, then the platform default converter is used\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   139
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   140
-endorseddirs \fIdirectories\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   141
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   142
Overrides the location of the endorsed standards path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   143
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   144
-extdirs \fIdirectories\fR
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   145
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   146
Overrides the location of the \f3ext\fR directory\&. The directories variable is a colon-separated list of directories\&. Each JAR file in the specified directories is searched for class files\&. All JAR files found become part of the class path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   147
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   148
If you are cross-compiling (compiling classes against bootstrap and extension classes of a different Java platform implementation), then this option specifies the directories that contain the extension classes\&. See Cross-Compilation Options for more information\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   149
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   150
-g
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   151
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   152
Generates all debugging information, including local variables\&. By default, only line number and source file information is generated\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   153
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   154
-g:none
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   155
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   156
Does not generate any debugging information\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   157
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   158
-g:[\fIkeyword list\fR]
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   159
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   160
Generates only some kinds of debugging information, specified by a comma separated list of keywords\&. Valid keywords are:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   161
.RS     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   162
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   163
source
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   164
Source file debugging information\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   165
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   166
lines
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   167
Line number debugging information\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   168
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   169
vars
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   170
Local variable debugging information\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   171
.RE     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   172
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   173
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   174
-help
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   175
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   176
Prints a synopsis of standard options\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   177
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   178
-implicit:[\fIclass, none\fR]
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   179
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   180
Controls the generation of class files for implicitly loaded source files\&. To automatically generate class files, use \f3-implicit:class\fR\&. To suppress class file generation, use \f3-implicit:none\fR\&. If this option is not specified, then the default is to automatically generate class files\&. In this case, the compiler issues a warning if any such class files are generated when also doing annotation processing\&. The warning is not issued when the \f3-implicit\fR option is set explicitly\&. See Searching for Types\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   181
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   182
-J\fIoption\fR
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   183
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   184
Passes \f3option\fR to the Java Virtual Machine (JVM), where option is one of the options described on the reference page for the Java launcher\&. For example, \f3-J-Xms48m\fR sets the startup memory to 48 MB\&. See java(1)\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   185
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   186
\fINote:\fR The \fICLASSPATH\fR, \f3-classpath\fR, \f3-bootclasspath\fR, and \f3-extdirs\fR options do not specify the classes used to run \f3javac\fR\&. Trying to customize the compiler implementation with these options and variables is risky and often does not accomplish what you want\&. If you must customize the complier implementation, then use the \f3-J\fR option to pass options through to the underlying \f3\fRJava launcher\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   187
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   188
-nowarn
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   189
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   190
Disables warning messages\&. This option operates the same as the \f3-Xlint:none\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   191
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   192
-parameters
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   193
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   194
Stores formal parameter names of constructors and methods in the generated class file so that the method \f3java\&.lang\&.reflect\&.Executable\&.getParameters\fR from the Reflection API can retrieve them\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   195
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   196
-proc: [\fInone\fR, \fIonly\fR]
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   197
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   198
Controls whether annotation processing and compilation are done\&. \f3-proc:none\fR means that compilation takes place without annotation processing\&. \f3-proc:only\fR means that only annotation processing is done, without any subsequent compilation\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   199
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   200
-processor \fIclass1\fR [,\fIclass2\fR,\fIclass3\fR\&.\&.\&.]
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   201
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   202
Names of the annotation processors to run\&. This bypasses the default discovery process\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   203
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   204
-processorpath \fIpath\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   205
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   206
Specifies where to find annotation processors\&. If this option is not used, then the class path is searched for processors\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   207
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   208
-s \fIdir\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   209
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   210
Specifies the directory where to place the generated source files\&. The directory must already exist because \f3javac\fR does not create it\&. If a class is part of a package, then the compiler puts the source file in a subdirectory that reflects the package name and creates directories as needed\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   211
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   212
If you specify \f3-s /home/mysrc\fR and the class is called \f3com\&.mypackage\&.MyClass\fR, then the source file is put in \f3/home/mysrc/com/mypackage/MyClass\&.java\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   213
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   214
-source \fIrelease\fR
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   215
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   216
Specifies the version of source code accepted\&. The following values for \f3release\fR are allowed:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   217
.RS     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   218
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   219
1\&.3
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   220
The compiler does not support assertions, generics, or other language features introduced after Java SE 1\&.3\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   221
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   222
1\&.4
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   223
The compiler accepts code containing assertions, which were introduced in Java SE 1\&.4\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   224
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   225
1\&.5
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   226
The compiler accepts code containing generics and other language features introduced in Java SE 5\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   227
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   228
5
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   229
Synonym for 1\&.5\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   230
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   231
1\&.6
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   232
No language changes were introduced in Java SE 6\&. However, encoding errors in source files are now reported as errors instead of warnings as in earlier releases of Java Platform, Standard Edition\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   233
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   234
6
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   235
Synonym for 1\&.6\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   236
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   237
1\&.7
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   238
This is the default value\&. The compiler accepts code with features introduced in Java SE 7\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   239
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   240
7
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   241
Synonym for 1\&.7\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   242
.RE     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   243
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   244
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   245
-sourcepath \fIsourcepath\fR
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   246
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   247
Specifies the source code path to search for class or interface definitions\&. As with the user class path, source path entries are separated by colons (:) on Oracle Solaris and semicolons on Windows and can be directories, JAR archives, or ZIP archives\&. If packages are used, then the local path name within the directory or archive must reflect the package name\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   248
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   249
\fINote:\fR Classes found through the class path might be recompiled when their source files are also found\&. See Searching for Types\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   250
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   251
-verbose
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   252
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   253
Uses verbose output, which includes information about each class loaded and each source file compiled\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   254
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   255
-version
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   256
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   257
Prints release information\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   258
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   259
-werror
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   260
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   261
Terminates compilation when warnings occur\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   262
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   263
-X
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   264
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   265
Displays information about nonstandard options and exits\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   266
.SS CROSS-COMPILATION\ OPTIONS    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   267
By default, classes are compiled against the bootstrap and extension classes of the platform that \f3javac\fR shipped with\&. But \f3javac\fR also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation\&. It is important to use the \f3-bootclasspath\fR and \f3-extdirs\fR options when cross-compiling\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   268
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   269
-target \fIversion\fR
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   270
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   271
Generates class files that target a specified release of the virtual machine\&. Class files will run on the specified target and on later releases, but not on earlier releases of the JVM\&. Valid targets are 1\&.1, 1\&.2, 1\&.3, 1\&.4, 1\&.5 (also 5), 1\&.6 (also 6), and 1\&.7 (also 7)\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   272
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   273
The default for the \f3-target\fR option depends on the value of the \f3-source\fR option:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   274
.RS     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   275
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   276
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   277
If the \f3-source\fR option is not specified, then the value of the \f3-target\fR option is 1\&.7
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   278
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   279
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   280
If the \f3-source\fR option is 1\&.2, then the value of the \f3-target\fR option is 1\&.4
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   281
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   282
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   283
If the \f3-source\fR option is 1\&.3, then the value of the \f3-target\fR option is 1\&.4
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   284
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   285
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   286
If the \f3-source\fR option is 1\&.5, then the value of the \f3-target\fR option is 1\&.7
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   287
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   288
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   289
If the \f3-source\fR option is 1\&.6, then the value of the \f3-target\fR is option 1\&.7
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   290
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   291
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   292
For all other values of the \f3-source\fR option, the value of the \f3-target\fR option is the value of the \f3-source\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   293
.RE     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   294
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   295
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   296
-bootclasspath \fIbootclasspath\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   297
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   298
Cross-compiles against the specified set of boot classes\&. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   299
.SS COMPACT\ PROFILE\ OPTION    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   300
Beginning with JDK 8, the \f3javac\fR compiler supports compact profiles\&. With compact profiles, applications that do not require the entire Java platform can be deployed and run with a smaller footprint\&. The compact profiles feature could be used to shorten the download time for applications from app stores\&. This feature makes for more compact deployment of Java applications that bundle the JRE\&. This feature is also useful in small devices\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   301
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   302
The supported profile values are \f3compact1\fR, \f3compact2\fR, and \f3compact3\fR\&. These are additive layers\&. Each higher-numbered compact profile contains all of the APIs in profiles with smaller number names\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   303
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   304
-profile
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   305
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   306
When using compact profiles, this option specifies the profile name when compiling\&. For example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   307
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   308
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   309
\f3javac \-profile compact1 Hello\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   310
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   311
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   312
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   313
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   314
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   315
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   316
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   317
javac does not compile source code that uses any Java SE APIs that is not in the specified profile\&. Here is an example of the error message that results from attempting to compile such source code:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   318
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   319
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   320
\f3cd jdk1\&.8\&.0/bin\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   321
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   322
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   323
\f3\&./javac \-profile compact1 Paint\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   324
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   325
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   326
\f3Paint\&.java:5: error: Applet is not available in profile \&'compact1\&'\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   327
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   328
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   329
\f3import java\&.applet\&.Applet;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   330
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   331
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   332
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   333
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   334
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   335
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   336
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   337
In this example, you can correct the error by modifying the source to not use the \f3Applet\fR class\&. You could also correct the error by compiling without the -profile option\&. Then the compilation would be run against the full set of Java SE APIs\&. (None of the compact profiles include the \f3Applet\fR class\&.)
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   338
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   339
An alternative way to compile with compact profiles is to use the \f3-bootclasspath\fR option to specify a path to an \f3rt\&.jar\fR file that specifies a profile\&'s image\&. Using the \f3-profile\fR option instead does not require a profile image to be present on the system at compile time\&. This is useful when cross-compiling\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   340
.SS NONSTANDARD\ OPTIONS    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   341
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   342
-Xbootclasspath/p:\fIpath\fR
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   343
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   344
Adds a suffix to the bootstrap class path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   345
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   346
-Xbootclasspath/a:\fIpath\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   347
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   348
Adds a prefix to the bootstrap class path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   349
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   350
-Xbootclasspath/:\fIpath\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   351
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   352
Overrides the location of the bootstrap class files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   353
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   354
-Xdoclint:[-]\fIgroup\fR [\fI/access\fR]
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   355
.br
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   356
Enables or disables specific groups of checks, where \fIgroup\fR is one of the following values: \f3accessibility\fR, \f3syntax\fR, \f3reference\fR, \f3html\fR or \f3missing\fR\&. For more information about these groups of checks see the \f3-Xdoclint\fR option of the \f3javadoc\fR command\&. The \f3-Xdoclint\fR option is disabled by default in the \f3javac\fR command\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   357
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   358
The variable \fIaccess\fR specifies the minimum visibility level of classes and members that the \f3-Xdoclint\fR option checks\&. It can have one of the following values (in order of most to least visible) : \f3public\fR, \f3protected\fR, \f3package\fR and \f3private\fR\&. For example, the following option checks classes and members (with all groups of checks) that have the access level protected and higher (which includes protected, package and public):
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   359
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   360
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   361
\f3\-Xdoclint:all/protected\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   362
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   363
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   364
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   365
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   366
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   367
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   368
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   369
The following option enables all groups of checks for all access levels, except it will not check for HTML errors for classes and members that have access level package and higher (which includes package and public):
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   370
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   371
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   372
\f3\-Xdoclint:all,\-html/package\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   373
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   374
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   375
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   376
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   377
.sp     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   378
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   379
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   380
-Xdoclint:none
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   381
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   382
Disables all groups of checks\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   383
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   384
-Xdoclint:all[\fI/access\fR]
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   385
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   386
Enables all groups of checks\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   387
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   388
-Xlint
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   389
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   390
\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   391
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   392
-Xlint:all
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   393
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   394
\fI\fREnables all recommended warnings\&. In this release, enabling all available warnings is recommended\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   395
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   396
-Xlint:none
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   397
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   398
Disables all warnings\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   399
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   400
-Xlint:\fIname\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   401
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   402
Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option for a list of warnings you can disable with this option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   403
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   404
-Xlint:\fI-name\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   405
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   406
Disables warning name\&. See Enable or Disable Warnings with the -Xlint Option with the \f3-Xlint\fR option to get a list of warnings that you can disable with this option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   407
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   408
-Xmaxerrs \fInumber\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   409
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   410
Sets the maximum number of errors to print\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   411
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   412
-Xmaxwarns \fInumber\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   413
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   414
Sets the maximum number of warnings to print\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   415
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   416
-Xstdout \fIfilename\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   417
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   418
Sends compiler messages to the named file\&. By default, compiler messages go to \f3System\&.err\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   419
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   420
-Xprefer:[\fInewer,source\fR]
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   421
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   422
Specifies which file to read when both a source file and class file are found for a type\&. (See Searching for Types)\&. If the \f3-Xprefer:newer\fR option is used, then it reads the newer of the source or class file for a type (default)\&. If the \f3-Xprefer:source\fR option is used, then it reads the source file\&. Use -\f3Xprefer:source\fR when you want to be sure that any annotation processors can access annotations declared with a retention policy of \f3SOURCE\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   423
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   424
-Xpkginfo:[\fIalways\fR,\fIlegacy\fR,\fInonempty\fR]
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   425
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   426
Control whether javac generates \f3package-info\&.class\fR files from package-info\&.java files\&. Possible mode arguments for this option include the following\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   427
.RS     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   428
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   429
always
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   430
Always generate a \f3package-info\&.class\fR file for every \f3package-info\&.java\fR file\&. This option may be useful if you use a build system such as Ant, which checks that each \f3\&.java\fR file has a corresponding \f3\&.class\fR file\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   431
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   432
legacy
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   433
Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations\&. Don\&'t generate a \f3package-info\&.class\fR file if package-info\&.java only contains comments\&.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   434
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   435
\fINote:\fR A \f3package-info\&.class\fR file might be generated but be empty if all the annotations in the package-info\&.java file have \f3RetentionPolicy\&.SOURCE\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   436
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   437
nonempty
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   438
Generate a \f3package-info\&.class\fR file only if package-info\&.java contains annotations with \f3RetentionPolicy\&.CLASS\fR or \f3RetentionPolicy\&.RUNTIME\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   439
.RE     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   440
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   441
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   442
-Xprint
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   443
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   444
Prints a textual representation of specified types for debugging purposes\&. Perform neither annotation processing nor compilation\&. The format of the output could change\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   445
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   446
-XprintProcessorInfo
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   447
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   448
Prints information about which annotations a processor is asked to process\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   449
.TP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   450
-XprintRounds
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   451
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   452
Prints information about initial and subsequent annotation processing rounds\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   453
.SH ENABLE\ OR\ DISABLE\ WARNINGS\ WITH\ THE\ -XLINT\ OPTION    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   454
Enable warning \fIname\fR with the \f3-Xlint:name\fR option, where \f3name\fR is one of the following warning names\&. Note that you can disable a warning with the \f3-Xlint:-name:\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   455
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   456
cast
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   457
Warns about unnecessary and redundant casts, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   458
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   459
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   460
\f3String s = (String) "Hello!"\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   461
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   462
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   463
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   464
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   465
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   466
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   467
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   468
classfile
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   469
Warns about issues related to class file contents\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   470
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   471
deprecation
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   472
Warns about the use of deprecated items, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   473
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   474
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   475
\f3java\&.util\&.Date myDate = new java\&.util\&.Date();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   476
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   477
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   478
\f3int currentDay = myDate\&.getDay();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   479
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   480
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   481
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   482
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   483
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   484
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   485
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   486
The method \f3java\&.util\&.Date\&.getDay\fR has been deprecated since JDK 1\&.1
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   487
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   488
dep-ann
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   489
Warns about items that are documented with an \f3@deprecated\fR Javadoc comment, but do not have a \f3@Deprecated\fR annotation, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   490
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   491
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   492
\f3/**\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   493
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   494
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   495
\f3  * @deprecated As of Java SE 7, replaced by {@link #newMethod()}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   496
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   497
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   498
\f3  */\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   499
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   500
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   501
\f3public static void deprecatedMethood() { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   502
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   503
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   504
\f3public static void newMethod() { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   505
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   506
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   507
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   508
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   509
.sp     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   510
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   511
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   512
divzero
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   513
Warns about division by the constant integer 0, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   514
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   515
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   516
\f3int divideByZero = 42 / 0;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   517
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   518
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   519
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   520
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   521
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   522
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   523
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   524
empty
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   525
Warns about empty statements after \f3if\fRstatements, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   526
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   527
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   528
\f3class E {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   529
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   530
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   531
\f3    void m() {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   532
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   533
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   534
\f3         if (true) ;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   535
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   536
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   537
\f3    }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   538
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   539
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   540
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   541
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   542
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   543
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   544
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   545
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   546
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   547
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   548
fallthrough
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   549
Checks the switch blocks for fall-through cases and provides a warning message for any that are found\&. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to fall through from that case to the next case\&. For example, the code following the case 1 label in this switch block does not end with a break statement:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   550
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   551
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   552
\f3switch (x) {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   553
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   554
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   555
\f3case 1:\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   556
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   557
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   558
\f3  System\&.out\&.println("1");\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   559
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   560
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   561
\f3  // No break statement here\&.\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   562
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   563
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   564
\f3case 2:\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   565
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   566
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   567
\f3  System\&.out\&.println("2");\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   568
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   569
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   570
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   571
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   572
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   573
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   574
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   575
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   576
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   577
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   578
If the \f3-Xlint:fallthrough\fR option was used when compiling this code, then the compiler emits a warning about possible fall-through into case, with the line number of the case in question\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   579
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   580
finally
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   581
Warns about \f3finally\fR clauses that cannot complete normally, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   582
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   583
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   584
\f3public static int m() {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   585
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   586
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   587
\f3  try {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   588
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   589
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   590
\f3     throw new NullPointerException();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   591
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   592
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   593
\f3  }  catch (NullPointerException(); {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   594
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   595
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   596
\f3     System\&.err\&.println("Caught NullPointerException\&.");\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   597
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   598
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   599
\f3     return 1;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   600
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   601
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   602
\f3   } finally {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   603
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   604
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   605
\f3     return 0;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   606
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   607
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   608
\f3   }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   609
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   610
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   611
\f3  }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   612
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   613
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   614
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   615
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   616
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   617
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   618
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   619
The compiler generates a warning for the \f3finally\fR block in this example\&. When the \f3int\fR method is called, it returns a value of 0\&. A \f3finally\fR block executes when the \f3try\fR block exits\&. In this example, when control is transferred to the \f3catch\fR block, the \f3int\fR method exits\&. However, the \f3finally\fR block must execute, so it is executed, even though control was transferred outside the method\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   620
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   621
options
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   622
Warns about issues that related to the use of command-line options\&. See Cross-Compilation Options\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   623
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   624
overrides
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   625
Warns about issues regarding method overrides\&. For example, consider the following two classes:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   626
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   627
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   628
\f3public class ClassWithVarargsMethod {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   629
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   630
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   631
\f3  void varargsMethod(String\&.\&.\&. s) { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   632
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   633
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   634
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   635
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   636
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   637
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   638
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   639
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   640
\f3public class ClassWithOverridingMethod extends ClassWithVarargsMethod {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   641
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   642
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   643
\f3   @Override\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   644
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   645
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   646
\f3   void varargsMethod(String[] s) { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   647
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   648
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   649
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   650
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   651
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   652
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   653
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   654
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   655
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   656
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   657
The compiler generates a warning similar to the following:\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   658
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   659
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   660
\f3warning: [override] varargsMethod(String[]) in ClassWithOverridingMethod \fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   661
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   662
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   663
\f3overrides varargsMethod(String\&.\&.\&.) in ClassWithVarargsMethod; overriding\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   664
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   665
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   666
\f3method is missing \&'\&.\&.\&.\&'\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   667
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   668
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   669
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   670
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   671
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   672
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   673
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   674
When the compiler encounters a \f3varargs\fR method, it translates the \f3varargs\fR formal parameter into an array\&. In the method \f3ClassWithVarargsMethod\&.varargsMethod\fR, the compiler translates the \f3varargs\fR formal parameter \f3String\&.\&.\&. s\fR to the formal parameter \f3String[] s\fR, an array, which matches the formal parameter of the method \f3ClassWithOverridingMethod\&.varargsMethod\fR\&. Consequently, this example compiles\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   675
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   676
path
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   677
Warns about invalid path elements and nonexistent path directories on the command line (with regard to the class path, the source path, and other paths)\&. Such warnings cannot be suppressed with the \f3@SuppressWarnings\fR annotation, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   678
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   679
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   680
\f3javac \-Xlint:path \-classpath /nonexistentpath Example\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   681
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   682
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   683
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   684
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   685
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   686
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   687
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   688
processing
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   689
Warn about issues regarding annotation processing\&. The compiler generates this warning when you have a class that has an annotation, and you use an annotation processor that cannot handle that type of exception\&. For example, the following is a simple annotation processor:
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   690
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   691
\fISource file AnnocProc\&.java\fR:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   692
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   693
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   694
\f3import java\&.util\&.*;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   695
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   696
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   697
\f3import javax\&.annotation\&.processing\&.*;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   698
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   699
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   700
\f3import javax\&.lang\&.model\&.*;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   701
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   702
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   703
\f3import\&.javaz\&.lang\&.model\&.element\&.*;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   704
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   705
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   706
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   707
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   708
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   709
\f3@SupportedAnnotationTypes("NotAnno")\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   710
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   711
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   712
\f3public class AnnoProc extends AbstractProcessor {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   713
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   714
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   715
\f3  public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv){\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   716
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   717
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   718
\f3     return true;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   719
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   720
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   721
\f3  }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   722
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   723
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   724
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   725
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   726
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   727
\f3  public SourceVersion getSupportedSourceVersion() {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   728
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   729
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   730
\f3     return SourceVersion\&.latest();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   731
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   732
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   733
\f3   }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   734
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   735
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   736
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   737
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   738
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   739
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   740
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   741
.sp     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   742
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   744
\fISource file AnnosWithoutProcessors\&.java\fR:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   745
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   746
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   747
\f3@interface Anno { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   748
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   749
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   750
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   751
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   752
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   753
\f3@Anno\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   754
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   755
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   756
\f3class AnnosWithoutProcessors { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   757
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   758
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   759
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   760
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   761
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   762
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   763
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   764
The following commands compile the annotation processor \f3AnnoProc\fR, then run this annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   765
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   766
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   767
\f3javac AnnoProc\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   768
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   769
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   770
\f3javac \-cp \&. \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   771
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   772
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   773
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   774
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   775
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   776
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   777
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   778
When the compiler runs the annotation processor against the source file \f3AnnosWithoutProcessors\&.java\fR, it generates the following warning:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   779
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   780
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   781
\f3warning: [processing] No processor claimed any of these annotations: Anno\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   782
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   783
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   784
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   785
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   786
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   787
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   788
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   789
To resolve this issue, you can rename the annotation defined and used in the class \f3AnnosWithoutProcessors\fR from \f3Anno\fR to \f3NotAnno\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   790
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   791
rawtypes
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   792
Warns about unchecked operations on raw types\&. The following statement generates a \f3rawtypes\fR warning:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   793
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   794
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   795
\f3void countElements(List l) { \&.\&.\&. }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   796
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   797
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   798
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   799
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   800
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   801
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   802
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   803
The following example does not generate a \f3rawtypes\fR warning
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   804
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   805
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   806
\f3void countElements(List<?> l) { \&.\&.\&. }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   807
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   808
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   809
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   810
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   811
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   812
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   813
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   814
\f3List\fR is a raw type\&. However, \f3List<?>\fR is an unbounded wildcard parameterized type\&. Because \f3List\fR is a parameterized interface, always specify its type argument\&. In this example, the \f3List\fR formal argument is specified with an unbounded wildcard (\f3?\fR) as its formal type parameter, which means that the \f3countElements\fR method can accept any instantiation of the \f3List\fR interface\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   815
.TP     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   816
Serial
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   817
Warns about missing \f3serialVersionUID\fR definitions on serializable classes, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   818
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   819
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   820
\f3public class PersistentTime implements Serializable\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   821
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   822
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   823
\f3{\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   824
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   825
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   826
\f3  private Date time;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   827
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   828
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   829
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   830
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   831
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   832
\f3   public PersistentTime() {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   833
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   834
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   835
\f3     time = Calendar\&.getInstance()\&.getTime();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   836
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   837
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   838
\f3   }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   839
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   840
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   841
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   842
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   843
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   844
\f3   public Date getTime() {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   845
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   846
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   847
\f3     return time;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   848
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   849
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   850
\f3   }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   851
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   852
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   853
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   854
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   855
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   856
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   857
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   858
.sp     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   859
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   860
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   861
The compiler generates the following warning:
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   862
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   863
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   864
\f3warning: [serial] serializable class PersistentTime has no definition of\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   865
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   866
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   867
\f3serialVersionUID\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   868
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   869
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   870
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   871
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   872
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   873
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   874
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   875
If a serializable class does not explicitly declare a field named \f3serialVersionUID\fR, then the serialization runtime environment calculates a default \f3serialVersionUID\fR value for that class based on various aspects of the class, as described in the Java Object Serialization Specification\&. However, it is strongly recommended that all serializable classes explicitly declare \f3serialVersionUID\fR values because the default process of computing \f3serialVersionUID\fR vales is highly sensitive to class details that can vary depending on compiler implementations, and as a result, might cause an unexpected \f3InvalidClassExceptions\fR during deserialization\&. To guarantee a consistent \f3serialVersionUID\fR value across different Java compiler implementations, a serializable class must declare an explicit \f3serialVersionUID\fR value\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   876
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   877
static
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   878
Warns about issues relating to the use of statics, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   879
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   880
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   881
\f3class XLintStatic {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   882
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   883
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   884
\f3    static void m1() { }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   885
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   886
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   887
\f3    void m2() { this\&.m1(); }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   888
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   889
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   890
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   891
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   892
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   893
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   894
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   895
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   896
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   897
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   898
The compiler generates the following warning:
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   899
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   900
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   901
\f3warning: [static] static method should be qualified by type name, \fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   902
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   903
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   904
\f3XLintStatic, instead of by an expression\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   905
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   906
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   907
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   908
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   909
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   910
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   911
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   912
To resolve this issue, you can call the \f3static\fR method \f3m1\fR as follows:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   913
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   914
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   915
\f3XLintStatic\&.m1();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   916
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   917
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   918
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   919
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   920
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   921
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   922
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   923
Alternately, you can remove the \f3static\fR keyword from the declaration of the method \f3m1\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   924
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   925
try
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   926
Warns about issues relating to use of \f3try\fR blocks, including try-with-resources statements\&. For example, a warning is generated for the following statement because the resource \f3ac\fR declared in the \f3try\fR block is not used:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   927
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   928
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   929
\f3try ( AutoCloseable ac = getResource() ) {    // do nothing}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   930
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   931
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   932
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   933
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   934
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   935
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   936
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   937
unchecked
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   938
Gives more detail for unchecked conversion warnings that are mandated by the Java Language Specification, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   939
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   940
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   941
\f3List l = new ArrayList<Number>();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   942
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   943
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   944
\f3List<String> ls = l;       // unchecked warning\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   945
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   946
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   947
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   948
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   949
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   950
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   951
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   952
During type erasure, the types \f3ArrayList<Number>\fR and \f3List<String>\fR become \f3ArrayList\fR and \f3List\fR, respectively\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   953
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   954
The \f3ls\fR command has the parameterized type \f3List<String>\fR\&. When the \f3List\fR referenced by \f3l\fR is assigned to \f3ls\fR, the compiler generates an unchecked warning\&. At compile time, the compiler and JVM cannot determine whether \f3l\fR refers to a \f3List<String>\fR type\&. In this case, \f3l\fR does not refer to a \f3List<String>\fR type\&. As a result, heap pollution occurs\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   955
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   956
A heap pollution situation occurs when the \f3List\fR object \f3l\fR, whose static type is \f3List<Number>\fR, is assigned to another \f3List\fR object, \f3ls\fR, that has a different static type, \f3List<String>\fR\&. However, the compiler still allows this assignment\&. It must allow this assignment to preserve backward compatibility with releases of Java SE that do not support generics\&. Because of type erasure, \f3List<Number>\fR and \f3List<String>\fR both become \f3List\fR\&. Consequently, the compiler allows the assignment of the object \f3l\fR\f3,\fR which has a raw type of \f3List\fR, to the object \f3ls\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   957
.TP     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   958
varargs
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   959
Warns about unsafe usages of variable arguments (\f3varargs\fR) methods, in particular, those that contain non-reifiable arguments, for example:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   960
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   961
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   962
\f3public class ArrayBuilder {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   963
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   964
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   965
\f3  public static <T> void addToList (List<T> listArg, T\&.\&.\&. elements) {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   966
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   967
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   968
\f3    for (T x : elements) {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   969
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   970
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   971
\f3      listArg\&.add(x);\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   972
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   973
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   974
\f3    }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   975
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   976
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   977
\f3  }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   978
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   979
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   980
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   981
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   982
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   983
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   984
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   985
.sp     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   986
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   987
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   988
\fINote:\fR A non-reifiable type is a type whose type information is not fully available at runtime\&.
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   989
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   990
The compiler generates the following warning for the definition of the method \f3ArrayBuilder\&.addToList\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   991
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   992
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   993
\f3warning: [varargs] Possible heap pollution from parameterized vararg type T\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   994
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   995
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   996
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   997
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
   998
.sp     
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
   999
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
diff changeset
  1000
21743
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1001
When the compiler encounters a varargs method, it translates the \f3varargs\fR formal parameter into an array\&. However, the Java programming language does not permit the creation of arrays of parameterized types\&. In the method \f3ArrayBuilder\&.addToList\fR, the compiler translates the \f3varargs\fR formal parameter \f3T\&.\&.\&.\fR elements to the formal parameter \f3T[]\fR elements, an array\&. However, because of type erasure, the compiler converts the \f3varargs\fR formal parameter to \f3Object[]\fR elements\&. Consequently, there is a possibility of heap pollution\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1002
.SH COMMAND-LINE\ ARGUMENT\ FILES    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1003
To shorten or simplify the \f3javac\fR command, you can specify one or more files that contain arguments to the \f3javac\fR command (except \f3-J\fR options)\&. This enables you to create \f3javac\fR commands of any length on any operating system\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1004
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1005
An argument file can include \f3javac\fR options and source file names in any combination\&. The arguments within a file can be separated by spaces or new line characters\&. If a file name contains embedded spaces, then put the whole file name in double quotation marks\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1006
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1007
File Names within an argument file are relative to the current directory, not the location of the argument file\&. Wild cards (*) are not allowed in these lists (such as for specifying \f3*\&.java\fR)\&. Use of the at sign (@) to recursively interpret files is not supported\&. The \f3-J\fR options are not supported because they are passed to the launcher, which does not support argument files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1008
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1009
When executing the \f3javac\fR command, pass in the path and name of each argument file with the at sign (@) leading character\&. When the \f3javac\fR command encounters an argument beginning with the at sign (@), it expands the contents of that file into the argument list\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1010
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1011
\f3Example 1 Single Argument File\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1012
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1013
You could use a single argument file named \f3argfile\fR to hold all \f3javac\fR arguments:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1014
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1015
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1016
\f3javac @argfile\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1017
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1018
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1019
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1020
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1021
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1022
This argument file could contain the contents of both files shown in Example 2
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1023
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1024
\f3Example 2 Two Argument Files\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1025
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1026
You can create two argument files: one for the \f3javac\fR options and the other for the source file names\&. Note that the following lists have no line-continuation characters\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1027
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1028
Create a file named options that contains the following:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1029
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1030
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1031
\f3\-d classes\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1032
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1033
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1034
\f3\-g\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1035
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1036
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1037
\f3\-sourcepath /java/pubs/ws/1\&.3/src/share/classes\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1038
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1039
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1040
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1041
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1042
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1043
Create a file named classes that contains the following:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1044
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1045
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1046
\f3MyClass1\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1047
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1048
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1049
\f3MyClass2\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1050
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1051
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1052
\f3MyClass3\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1053
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1054
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1055
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1056
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1057
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1058
Then, run the \f3javac\fR command as follows:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1059
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1060
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1061
\f3javac @options @classes\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1062
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1063
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1064
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1065
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1066
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1067
\f3Example 3 Argument Files with Paths\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1068
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1069
The argument files can have paths, but any file names inside the files are relative to the current working directory (not \f3path1\fR or \f3path2\fR):
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1070
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1071
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1072
\f3javac @path1/options @path2/classes\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1073
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1074
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1075
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1076
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1077
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1078
.SH ANNOTATION\ PROCESSING    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1079
The \f3javac\fR command provides direct support for annotation processing, superseding the need for the separate annotation processing command, \f3apt\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1080
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1081
The API for annotation processors is defined in the \f3javax\&.annotation\&.processing\fR and j\f3avax\&.lang\&.model\fR packages and subpackages\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1082
.SS HOW\ ANNOTATION\ PROCESSING\ WORKS    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1083
Unless annotation processing is disabled with the \f3-proc:none\fR option, the compiler searches for any annotation processors that are available\&. The search path can be specified with the \f3-processorpath\fR option\&. If no path is specified, then the user class path is used\&. Processors are located by means of service provider-configuration files named \f3META-INF/services/javax\&.annotation\&.processing\fR\&.Processor on the search path\&. Such files should contain the names of any annotation processors to be used, listed one per line\&. Alternatively, processors can be specified explicitly, using the \f3-processor\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1084
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1085
After scanning the source files and classes on the command line to determine what annotations are present, the compiler queries the processors to determine what annotations they process\&. When a match is found, the processor is called\&. A processor can claim the annotations it processes, in which case no further attempt is made to find any processors for those annotations\&. After all of the annotations are claimed, the compiler does not search for additional processors\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1086
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1087
If any processors generate new source files, then another round of annotation processing occurs: Any newly generated source files are scanned, and the annotations processed as before\&. Any processors called on previous rounds are also called on all subsequent rounds\&. This continues until no new source files are generated\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1088
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1089
After a round occurs where no new source files are generated, the annotation processors are called one last time, to give them a chance to complete any remaining work\&. Finally, unless the \f3-proc:only\fR option is used, the compiler compiles the original and all generated source files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1090
.SS IMPLICITLY\ LOADED\ SOURCE\ FILES    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1091
To compile a set of source files, the compiler might need to implicitly load additional source files\&. See Searching for Types\&. Such files are currently not subject to annotation processing\&. By default, the compiler gives a warning when annotation processing occurred and any implicitly loaded source files are compiled\&. The \f3-implicit\fR option provides a way to suppress the warning\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1092
.SH SEARCHING\ FOR\ TYPES    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1093
To compile a source file, the compiler often needs information about a type, but the type definition is not in the source files specified on the command line\&. The compiler needs type information for every class or interface used, extended, or implemented in the source file\&. This includes classes and interfaces not explicitly mentioned in the source file, but that provide information through inheritance\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1094
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1095
For example, when you create a subclass \f3java\&.applet\&.Applet\fR, you are also using the ancestor classes of \f3Applet\fR: \f3java\&.awt\&.Panel\fR, \f3java\&.awt\&.Container\fR, \f3java\&.awt\&.Component\fR, and \f3java\&.lang\&.Object\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1096
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1097
When the compiler needs type information, it searches for a source file or class file that defines the type\&. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory)\&. The user class path is defined by setting the \f3CLASSPATH\fR environment variable or by using the \f3-classpath\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1098
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1099
If you set the \f3-sourcepath\fR option, then the compiler searches the indicated path for source files\&. Otherwise, the compiler searches the user class path for both class files and source files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1100
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1101
You can specify different bootstrap or extension classes with the \f3-bootclasspath\fR and the \f3-extdirs\fR options\&. See Cross-Compilation Options\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1102
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1103
A successful type search may produce a class file, a source file, or both\&. If both are found, then you can use the \f3-Xprefer\fR option to instruct the compiler which to use\&. If \f3newer\fR is specified, then the compiler uses the newer of the two files\&. If \f3source\fR is specified, the compiler uses the source file\&. The default is \f3newer\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1104
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1105
If a type search finds a source file for a required type, either by itself, or as a result of the setting for the \f3-Xprefer\fR option, then the compiler reads the source file to get the information it needs\&. By default the compiler also compiles the source file\&. You can use the \f3-implicit\fR option to specify the behavior\&. If \f3none\fR is specified, then no class files are generated for the source file\&. If \f3class\fR is specified, then class files are generated for the source file\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1106
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1107
The compiler might not discover the need for some type information until after annotation processing completes\&. When the type information is found in a source file and no \f3-implicit\fR option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing\&. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the \f3-implicit\fR option to specify whether or not class files should be generated for such source files\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1108
.SH PROGRAMMATIC\ INTERFACE    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1109
The \f3javac\fR command supports the new Java Compiler API defined by the classes and interfaces in the \f3javax\&.tools\fR package\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1110
.SS EXAMPLE    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1111
To compile as though providing command-line arguments, use the following syntax:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1112
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1113
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1114
\f3JavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1115
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1116
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1117
\f3JavaCompiler javac = ToolProvider\&.getSystemJavaCompiler();\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1118
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1119
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1120
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1121
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1122
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1123
The example writes diagnostics to the standard output stream and returns the exit code that \f3javac\fR would give when called from the command line\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1124
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1125
You can use other methods in the \f3javax\&.tools\&.JavaCompiler\fR interface to handle diagnostics, control where files are read from and written to, and more\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1126
.SS OLD\ INTERFACE    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1127
\fINote:\fR This API is retained for backward compatibility only\&. All new code should use the newer Java Compiler API\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1128
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1129
The \f3com\&.sun\&.tools\&.javac\&.Main\fR class provides two static methods to call the compiler from a program:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1130
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1131
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1132
\f3public static int compile(String[] args);\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1133
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1134
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1135
\f3public static int compile(String[] args, PrintWriter out);\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1136
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1137
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1138
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1139
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1140
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1141
The \f3args\fR parameter represents any of the command-line arguments that would typically be passed to the compiler\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1142
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1143
The \f3out\fR parameter indicates where the compiler diagnostic output is directed\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1144
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1145
The \f3return\fR value is equivalent to the \f3exit\fR value from \f3javac\fR\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1146
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1147
\fINote:\fR All other classes and methods found in a package with names that start with \f3com\&.sun\&.tools\&.javac\fR (subpackages of \f3com\&.sun\&.tools\&.javac\fR) are strictly internal and subject to change at any time\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1148
.SH EXAMPLES    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1149
\f3Example 1 Compile a Simple Program\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1150
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1151
This example shows how to compile the \f3Hello\&.java\fR source file in the greetings directory\&. The class defined in \f3Hello\&.java\fR is called \f3greetings\&.Hello\fR\&. The greetings directory is the package directory both for the source file and the class file and is underneath the current directory\&. This makes it possible to use the default user class path\&. It also makes it unnecessary to specify a separate destination directory with the \f3-d\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1152
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1153
The source code in \f3Hello\&.java\fR:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1154
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1155
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1156
\f3package greetings;\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1157
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1158
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1159
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1160
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1161
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1162
\f3public class Hello {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1163
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1164
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1165
\f3    public static void main(String[] args) {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1166
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1167
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1168
\f3        for (int i=0; i < args\&.length; i++) {\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1169
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1170
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1171
\f3            System\&.out\&.println("Hello " + args[i]);\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1172
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1173
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1174
\f3        }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1175
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1176
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1177
\f3    }\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1178
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1179
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1180
\f3}\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1181
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1182
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1183
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1184
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1185
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1186
Compile greetings\&.Hello:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1187
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1188
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1189
\f3javac greetings/Hello\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1190
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1191
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1192
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1193
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1194
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1195
Run \f3greetings\&.Hello\fR:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1196
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1197
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1198
\f3java greetings\&.Hello World Universe Everyone\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1199
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1200
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1201
\f3Hello World\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1202
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1203
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1204
\f3Hello Universe\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1205
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1206
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1207
\f3Hello Everyone\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1208
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1209
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1210
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1211
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1212
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1213
\f3Example 2 Compile Multiple Source Files\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1214
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1215
This example compiles the \f3Aloha\&.java\fR, \f3GutenTag\&.java\fR, \f3Hello\&.java\fR, and \f3Hi\&.java\fR source files in the \f3greetings\fR package\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1216
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1217
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1218
\f3% javac greetings/*\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1219
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1220
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1221
\f3% ls greetings\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1222
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1223
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1224
\f3Aloha\&.class         GutenTag\&.class      Hello\&.class         Hi\&.class\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1225
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1226
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1227
\f3Aloha\&.java          GutenTag\&.java       Hello\&.java          Hi\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1228
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1229
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1230
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1231
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1232
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1233
\f3Example 3 Specify a User Class Path\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1234
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1235
After changing one of the source files in the previous example, recompile it:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1236
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1237
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1238
\f3pwd\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1239
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1240
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1241
\f3/examples\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1242
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1243
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1244
\f3javac greetings/Hi\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1245
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1246
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1247
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1248
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1249
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1250
Because \f3greetings\&.Hi\fR refers to other classes in the \f3greetings\fR package, the compiler needs to find these other classes\&. The previous example works because the default user class path is the directory that contains the package directory\&. If you want to recompile this file without concern for which directory you are in, then add the examples directory to the user class path by setting \f3CLASSPATH\fR\&. This example uses the \f3-classpath\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1251
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1252
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1253
\f3javac \-classpath /examples /examples/greetings/Hi\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1254
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1255
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1256
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1257
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1258
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1259
If you change \f3greetings\&.Hi\fR to use a banner utility, then that utility also needs to be accessible through the user class path\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1260
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1261
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1262
\f3javac \-classpath /examples:/lib/Banners\&.jar \e\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1263
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1264
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1265
\f3            /examples/greetings/Hi\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1266
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1267
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1268
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1269
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1270
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1271
To execute a class in the \f3greetings\fR package, the program needs access to the \f3greetings\fR package, and to the classes that the \f3greetings\fR classes use\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1272
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1273
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1274
\f3java \-classpath /examples:/lib/Banners\&.jar greetings\&.Hi\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1275
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1276
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1277
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1278
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1279
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1280
\f3Example 4 Separate Source Files and Class Files\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1281
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1282
The following example uses \f3javac\fR to compile code that runs on JVM 1\&.6\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1283
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1284
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1285
\f3javac \-source 1\&.6 \-target 1\&.6 \-bootclasspath jdk1\&.6\&.0/lib/rt\&.jar \e \fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1286
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1287
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1288
\f3\-extdirs "" OldCode\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1289
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1290
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1291
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1292
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1293
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1294
The \f3-source 1\&.6\fR option specifies that release 1\&.6 (or 6) of the Java programming language be used to compile \f3OldCode\&.java\fR\&. The option \f3-target 1\&.6\fR option ensures that the generated class files are compatible with JVM 1\&.6\&. Note that in most cases, the value of the \f3-target\fR option is the value of the \f3-source\fR option; in this example, you can omit the \f3-target\fR option\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1295
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1296
You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1297
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1298
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1299
\f3javac \-source 1\&.6 OldCode\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1300
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1301
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1302
\f3warning: [options] bootstrap class path not set in conjunction with \fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1303
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1304
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1305
\f3\-source 1\&.6\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1306
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1307
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1308
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1309
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1310
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1311
If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules (in this example, it uses version 1\&.6 of the Java programming language) combined with the new bootstrap classes, which can result in class files that do not work on the older platform (in this case, Java SE 6) because reference to nonexistent methods can get included\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1312
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1313
\f3Example 5 Cross Compile\fR
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1314
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1315
This example uses \f3javac\fR to compile code that runs on JVM 1\&.6\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1316
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1317
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1318
\f3javac \-source 1\&.6 \-target 1\&.6 \-bootclasspath jdk1\&.6\&.0/lib/rt\&.jar \e\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1319
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1320
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1321
\f3            \-extdirs "" OldCode\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1322
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1323
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1324
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1325
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1326
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1327
The\f3-source 1\&.6\fR option specifies that release 1\&.6 (or 6) of the Java programming language to be used to compile OldCode\&.java\&. The \f3-target 1\&.6\fR option ensures that the generated class files are compatible with JVM 1\&.6\&. In most cases, the value of the \f3-target\fR is the value of \f3-source\fR\&. In this example, the \f3-target\fR option is omitted\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1328
.PP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1329
You must specify the \f3-bootclasspath\fR option to specify the correct version of the bootstrap classes (the \f3rt\&.jar\fR library)\&. If not, then the compiler generates a warning:
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1330
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1331
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1332
\f3javac \-source 1\&.6 OldCode\&.java\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1333
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1334
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1335
\f3warning: [options] bootstrap class path not set in conjunction with \-source 1\&.6\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1336
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1337
.nf     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1338
\f3\fP
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1339
.fi     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1340
.sp     
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1341
If you do not specify the correct version of bootstrap classes, then the compiler uses the old language rules combined with the new bootstrap classes\&. This combination can result in class files that do not work on the older platform (in this case, Java SE 6) because reference to nonexistent methods can get included\&. In this example, the compiler uses release 1\&.6 of the Java programming language\&.
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1342
.SH SEE\ ALSO    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1343
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1344
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1345
java(1)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1346
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1347
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1348
jdb(1)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1349
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1350
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1351
javah(1)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1352
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1353
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1354
javadoc(1)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1355
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1356
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1357
jar(1)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1358
.TP 0.2i    
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1359
\(bu
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1360
jdb(1)
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1361
.RE
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1362
.br
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1363
'pl 8.5i
3d979da7bdf0 8029043: Update nroff files for JDK 8
rgallard
parents: 14342
diff changeset
  1364
'bp