jdk/src/linux/doc/man/ja/javac.1
author katleman
Thu, 05 Jan 2012 08:42:37 -0800
changeset 11376 075fe3928b7f
parent 9566 d7241af95355
child 23600 d21826f6c789
permissions -rw-r--r--
Added tag jdk8-b20 for changeset 90e14ec89395
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
     1
." Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
." This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
." under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
." published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
." This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
." version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
." accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
." You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
." 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
."
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2692
diff changeset
    18
." Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2692
diff changeset
    19
." or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2692
diff changeset
    20
." questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
."
9566
d7241af95355 7043580: integrate man page translation drop 2 into jdk7
mfang
parents: 9352
diff changeset
    22
.TH javac 1 "07 May 2011"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    25
.SH "名前"
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    26
javac \- Java プログラミング言語コンパイラ
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    28
.RS 3
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    29
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    30
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    31
形式 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    32
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    33
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    34
説明 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    35
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    36
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    37
オプション 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    38
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    39
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    40
コマンド行引数ファイル 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    41
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    42
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    43
注釈処理 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    44
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    45
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    46
型の検索 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    47
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    48
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    49
プログラマティックインタフェース 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    50
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    51
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    52
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    53
.TP 2
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    54
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    55
関連項目 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    56
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    57
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    58
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    59
.SH "形式"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        \fP\f3javac\fP [ options ] [ sourcefiles ] [ classes ] [ @argfiles ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    66
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    72
引数は順不同です。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
options 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    77
コマンド行オプション。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
sourcefiles 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    80
コンパイルされる 1 つ以上のソースファイル (MyClass.java など) 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
classes 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    83
注釈の処理対象となる 1 つ以上のクラス (MyPackage.MyClass など) 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
@argfiles 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    86
オプションとソースファイルを列挙した 1 つ以上のファイル。このファイルの中では \f2\-J\fP オプションは指定できません。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    90
.SH "説明"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    93
\f3javac\fP ツールは、Java プログラミング言語で記述されたクラスとインタフェースの定義を読み取り、バイトコードのクラスファイルにコンパイルします。また、Java ソースファイルおよびクラス内の注釈の処理も行います。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
    96
ソースコードのファイル名を \f3javac\fP に渡すには、次の 2 つの方法があります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   101
ソースファイルの数が少ない場合は、ファイル名をコマンド行で直接指定します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   104
ソースファイルの数が多い場合は、ファイル名を空白または改行で区切って、1 つのファイルに列挙します。次に、このリストファイル名の先頭に \f3@\fP を付けて、\f3javac\fP のコマンド行で指定します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   109
ソースコードのファイル名は \f2.java\fP 拡張子を、クラスのファイル名は \f2.class\fP 拡張子を持っていなければなりません。また、ソースファイルとクラスファイルのどちらも、該当するクラスに対応するルート名を持っていなければなりません。たとえば、 \f2MyClass\fP という名前のクラスは、 \f2MyClass.java\fP という名前のソースファイルに記述します。このソースファイルは、 \f2MyClass.class\fP という名前のバイトコードクラスファイルにコンパイルされます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   112
内部クラスが定義されていると、追加のクラスファイルが生成されます。これらのクラスファイルの名前は、 \f2MyClass$MyInnerClass.class\fP のように、外部クラス名と内部クラス名を組み合わせたものになります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   115
ソースファイルは、パッケージツリーを反映したディレクトリツリーに配置する必要があります。たとえば、すべてのソースファイルを \f3/workspace\fP に置いている場合、 \f2com.mysoft.mypack.MyClass\fP のソースコードは \f3/workspace/com/mysoft/mypack/MyClass.java\fP にある必要があります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   118
デフォルトでは、コンパイラは、各クラスファイルを対応するソースファイルと同じディレクトリに置きます。別の出力先ディレクトリを指定するには、\f3\-d\fP を使用します (このあとのオプションを参照)。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   120
.SH "オプション"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   123
コンパイラには、現在の開発環境でサポートされており、将来のリリースでもサポートされる標準オプションのセットがあります。これ以外の非標準オプションは、現在の仮想マシンおよびコンパイラの実装に固有のオプションで、将来に変更される可能性があります。非標準オプションは、\f3\-X\fP で始まります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   126
標準オプション
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
\-Akey[=value] 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   131
注釈プロセッサに渡されるオプション。これらは、javac によって直接解釈されず、個々のプロセッサによって使用されます。\f2key\fP には、1 つまたは複数の識別子を「.」で区切ったものを指定してください。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   133
\-cp path または \-classpath path 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   134
ユーザーのクラスファイルおよび (場合によっては) 注釈プロセッサやソースファイルの検索場所を指定します。このクラスパスは \f3CLASSPATH\fP 環境変数のユーザークラスパスをオーバーライドします。\f3CLASSPATH\fP、\f3\-cp\fP、\f3\-classpath\fP のいずれも指定されていない場合、ユーザークラスパスは、現在のディレクトリになります。詳細は、「クラスパスの設定」を参照してください。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   136
\f3\-sourcepath\fP オプションが指定されていない場合は、ソースファイルもユーザークラスパスから検索されます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   138
\f3\-processorpath\fP オプションが指定されていない場合は、注釈プロセッサもユーザークラスパスから検索されます。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
\-Djava.ext.dirs=directories 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   141
インストール型拡張機能の位置をオーバーライドします。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
\-Djava.endorsed.dirs=directories 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   144
承認された標準パスの位置をオーバーライドします。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
\-d directory 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   147
クラスファイルの出力先ディレクトリを設定します。そのディレクトリはすでに存在している必要があります。\f3javac\fP は作成しません。クラスがパッケージの一部である場合、\f3javac\fP は、必要に応じてディレクトリを作成し、パッケージ名を反映したサブディレクトリにクラスファイルを置きます。たとえば、\f3\-d /home/myclasses\fP と指定し、クラスの名前が \f2com.mypackage.MyClass\fP である場合、クラスファイルは \f2/home/myclasses/com/mypackage/MyClass.class\fP になります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   149
\f3\-d\fP が指定されなかった場合、\f3javac\fP は各クラスファイルを、その生成元となるソースファイルと同じディレクトリ内に格納します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   151
\f3注:\fP \f3\-d\fP で指定したディレクトリはユーザークラスパスに自動的には追加されません。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
\-deprecation 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   154
推奨されないメンバーやクラスが、使用またはオーバーライドされるたびに説明を表示します。\f3\-deprecation\fP が指定されていない場合、\f3javac\fP は、推奨されないメンバーやクラスを使用またはオーバーライドしているソースファイルの要約を表示します。\f3\-deprecation\fP は \f3\-Xlint:deprecation\fP の省略表記です。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
\-encoding encoding 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   157
ソースファイルのエンコーディング名 ( \f2EUC\-JP や UTF\-8\fP など) を指定します。\f3\-encoding\fP が指定されていない場合は、プラットフォームのデフォルトコンバータが使われます。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   158
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   159
\-endorseddirs directories 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   160
承認された標準パスの位置をオーバーライドします。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   161
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   162
\-extdirs directories 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   163
\f2ext\fP ディレクトリの位置をオーバーライドします。\f2directories\fP 変数には、コロンで区切ったディレクトリのリストを指定します。指定したディレクトリ内の各 JAR アーカイブから、クラスファイルが検索されます。見つかったすべての JAR アーカイブは自動的にクラスパスの一部になります。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   164
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   165
クロスコンパイル (異なる Java プラットフォームに実装されたブートストラップクラスや拡張機能クラスに対してコンパイルを行う) を実行する場合、このオプションには拡張機能クラスを含むディレクトリを指定します。詳細は、「クロスコンパイルオプション」を参照してください。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
\-g 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   168
局所変数を含むすべてのデバッグ情報を生成します。デフォルトでは、行番号およびソースファイル情報だけが生成されます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
\-g:none 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   171
デバッグ情報を生成しません。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
\-g:{keyword list} 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   174
コンマで区切られたキーワードリストにより指定された、特定の種類のデバッグ情報だけを生成します。次のキーワードが有効です。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
source 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   178
ソースファイルのデバッグ情報 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
lines 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   181
行番号のデバッグ情報 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
vars 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   184
局所変数のデバッグ情報 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
\-help 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   188
標準オプションの形式を表示します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
\-implicit:{class,none} 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   191
暗黙的にロードされたソースファイルに対するクラスファイルの生成を制御します。クラスファイルを自動生成するには、\f3\-implicit:class\fP を使用します。クラスファイルの生成を抑制するには、\f3\-implicit:none\fP を使用します。このオプションが指定されなかった場合のデフォルト動作は、クラスファイルの自動生成になります。その場合、そのようなクラスファイルが生成された時に注釈処理も実行されると、コンパイラから警告が発行されます。このオプションが明示的に設定された場合には、警告は発行されません。「型の検索」を参照してください。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   192
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   193
\-Joption 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   194
\f3javac\fP が呼び出す \f3java\fP 起動ツールに、\f2option\fP を渡します。たとえば、\f3\-J\-Xms48m\fP と指定すると、スタートアップメモリーは 48M バイトに設定されます。\f3\-J\fP を使って、Java で記述されたアプリケーションを実行する背後の VM にオプション渡すことは、よく行われています。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   195
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   196
\f3注:\fP \f3CLASSPATH\fP、\f3\-classpath\fP、\f3\-bootclasspath\fP、および \f3\-extdirs\fP は、\f3javac\fP を実行するために使うクラスを指定するものではありません。このような方法でコンパイラの実装を操作することは、通常は無意味であり、常に危険を伴います。このような方法を使う必要がある場合は、\f3\-J\fP オプションを使って、必要なオプションを背後の \f3java\fP 起動ツールに渡してください。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
\-nowarn 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   199
警告メッセージを無効にします。これは \f3\-Xlint:none\fP と同じ意味です。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
\-proc: {none,only} 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   202
注釈処理、コンパイル、その両方、のいずれを実行するかを制御します。\f3\-proc:none\fP は、注釈処理なしでコンパイルが実行されることを意味します。\f3\-proc:only\fP は、注釈処理だけが実行され、後続のコンパイルはまったく実行されないことを意味します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
\-processor class1[,class2,class3...] 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   205
実行する注釈プロセッサの名前。これを指定した場合、デフォルトの検索処理は省略されます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
\-processorpath path 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   208
注釈プロセッサの検索場所を指定します。このオプションを使用しなかった場合、クラスパス内でプロセッサの検索が行われます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
\-s dir 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   211
生成されたソースファイルの格納先となるディレクトリを指定します。そのディレクトリはすでに存在している必要があります。\f3javac\fP は作成しません。クラスがパッケージの一部になっていた場合、コンパイラはそのソースファイルを、パッケージ名を反映したサブディレクトリ内に格納します。その際、必要に応じてディレクトリを作成します。たとえば、ユーザーが \f3\-s /home/mysrc\fP と指定し、クラスの名前が \f2com.mypackage.MyClass\fP であった場合、そのソースファイルは \f2/home/mysrc/com/mypackage/MyClass.java\fP 内に格納されます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
\-source release 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   214
受け付けるソースコードのバージョンを指定します。\f2release\fP には次の値を指定できます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
1.3 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   218
このコンパイラでは、JDK 1.3 以降に導入されたアサーション、総称、または他の言語機能をサポートしません。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
1.4 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   221
JDK 1.4 で導入された、アサーションを含むコードを受け付けます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
1.5 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   224
JDK 5 で導入された総称および他の言語機能を含んだコードを受け付けます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
5 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   227
1.5 と同義です。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
1.6 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   230
これがデフォルト値です。Java SE 6 では言語に対する変更は導入されませんでしたが、ソースファイル内のエンコーディングエラーが、以前のような「警告」ではなく、「エラー」として報告されるようになりました。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
6 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   233
1.6 と同義です。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   234
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   235
1.7 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   236
JDK 7 で導入された機能を含むコードを受け付けます。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   237
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   238
7 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   239
1.7 と同義です。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
\-sourcepath sourcepath 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   243
クラスまたはインタフェースの定義を検索するソースコードパスを指定します。ユーザークラスパスと同様に、ソースパスの複数のエントリはコロン (\f3:\fP) で区切ります。ソースパスのエントリには、ディレクトリ、JAR アーカイブ、または ZIP アーカイブを指定できます。パッケージを使っている場合は、ディレクトリまたはアーカイブ内のローカルパス名がパッケージ名を反映していなければなりません。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   245
\f3注:\fP\ クラスパスからクラスだけでなくそのソースも見つかった場合、そのクラスは自動再コンパイルの対象になることがあります。「型の検索」を参照してください。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
\-verbose 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   248
詳細な出力を表示します。ロードされるクラスおよびコンパイルされるソースファイルごとの情報が出力されます。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   249
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   250
\-version 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   251
バージョン情報を出力します。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   252
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   253
\-Werror 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   254
警告が発生した場合にコンパイルを終了します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
\-X 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   257
非標準オプションに関する情報を表示して終了します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   262
クロスコンパイルオプション
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   265
デフォルトでは、クラスのコンパイルは、\f3javac\fP が添付されているプラットフォームのブートストラップクラスおよび拡張機能クラスに対して行われます。ただし、\f3javac\fP は、異なる Java プラットフォームに実装されたブートストラップクラスおよび拡張機能クラスに対してコンパイルを行う「クロスコンパイル」もサポートしています。クロスコンパイルを行う場合は、\f3\-bootclasspath\fP および \f3\-extdirs\fP を使うことが重要です。このあとの「クロスコンパイルの例」を参照してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
\-target version 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   270
指定されたバージョンの VM をターゲットにしたクラスファイルを生成します。このクラスファイルは、指定されたターゲット以降のバージョンでは動作しますが、それより前のバージョンの VM では動作しません。有効なターゲットは、\f31.1\fP、\f31.2\fP、\f31.3\fP、\f31.4\fP、\f31.5\fP (\f35\fP も可)、\f31.6\fP (\f36\fP も可)、および \f31.7\fP (\f37\fP も可) です。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   272
\f3\-target\fP のデフォルトは、次のように \f3\-source\fP の値によって決まります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   276
\-source が\f3指定されなかった\fP場合、\-target の値は \f31.7\fP になります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   279
\-source が\f31.2\fP の場合、\-target の値は \f31.4\fP になります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   282
\-source が\f31.3\fP の場合、\-target の値は \f31.4\fP になります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   285
\-source が\f3それ以外の値の場合はすべて\fP、\f3\\\-target\fP の値は \f3\-source\fP の値になります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
\-bootclasspath bootclasspath 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   289
指定された一連のブートクラスに対してクロスコンパイルを行います。ユーザークラスパスと同様に、ブートクラスパスの複数のエントリはコロン (\f3:\fP) で区切ります。ブートクラスパスのエントリには、ディレクトリ、JAR アーカイブ、または ZIP アーカイブを指定できます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   294
非標準オプション
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
\-Xbootclasspath/p:path 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   299
ブートストラップクラスパスの前に追加します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
\-Xbootclasspath/a:path 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   302
ブートストラップクラスパスの後ろに追加します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
\-Xbootclasspath/:path 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   305
ブートストラップクラスファイルの位置をオーバーライドします。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
\-Xlint 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   308
推奨されるすべての警告を有効にします。このリリースでは、利用可能なすべての警告を有効にすることが推奨されています。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   309
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   310
\-Xlint:all 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   311
推奨されるすべての警告を有効にします。このリリースでは、利用可能なすべての警告を有効にすることが推奨されています。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
\-Xlint:none 
9566
d7241af95355 7043580: integrate man page translation drop 2 into jdk7
mfang
parents: 9352
diff changeset
   314
すべての警告を無効にします。 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   315
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   316
\-Xlint:name 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   317
警告 \f2name\fP を有効にします。このオプションで有効にできる警告のリストについては、「\-Xlint オプションを使って有効または無効にできる警告」を参照してください。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
\-Xlint:\-name 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   320
警告 \f2name\fP を無効にします。このオプションで無効にできる警告のリストについては、「\-Xlint オプションを使って有効または無効にできる警告」を参照してください。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   321
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   322
\-Xmaxerrs number 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   323
印刷するエラーの最大数を設定します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   325
\-Xmaxwarns number 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   326
印刷する警告の最大数を設定します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   328
\-Xstdout filename 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   329
コンパイラのメッセージを、指定されたファイルに送ります。デフォルトでは、コンパイラのメッセージは \f2System.err\fP に送られます。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   331
\-Xprefer:{newer,source} 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   332
ある型に対してソースファイルとクラスファイルの両方が見つかった場合、そのどちらのファイルを読み取るべきかを指定します (「型の検索」を参照)。\f2\-Xprefer:newer\fP を使用した場合、ある型に対するソースファイルとクラスファイルの新しい方が読み取られます (デフォルト)。\f2\-Xprefer:source\fP オプションを使用した場合、ソースファイルが読み取られます。SOURCE の保存ポリシーを使って宣言された注釈に任意の注釈プロセッサがアクセスできるようにする場合は、\f2\-Xprefer:source\fP \f2を使用してください\fP。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   333
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   334
\-Xpkginfo:{always,legacy,nonempty} 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   335
パッケージ情報ファイルの処理を指定します。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   337
\-Xprint 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   338
指定された型のテキスト表現をデバッグ目的で出力します。注釈処理、コンパイルのどちらも実行しません。出力形式は変更される可能性があります。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   340
\-XprintProcessorInfo 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   341
ある特定のプロセッサが処理を依頼されている注釈に関する情報を出力します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   342
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   343
\-XprintRounds 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   344
初回および後続の注釈処理ラウンドに関する情報を出力します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   345
.RE
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   348
.SS 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   349
\-Xlint オプションを使って有効または無効にできる警告
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   350
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   351
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   352
\f3\-Xlint:\fP\f2name\fP オプションを使って警告 \f2name\fP を有効にします。ただし、\f2name\fP は次の警告名のいずれかになります。同様に、\f3\-Xlint:\-\fP\f2name\fP オプションを使って警告 \f2name\fP を無効にできます。
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   353
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   354
.RS 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   355
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   356
cast 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   357
不要で冗長なキャストについて警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   358
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   359
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   360
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   361
String s = (String)"Hello!"
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   362
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   363
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   364
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   365
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   366
classfile 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   367
クラスファイルの内容に関連した問題について警告します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   368
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   369
deprecation 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   370
非推奨項目の使用について警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   371
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   372
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   373
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   374
    java.util.Date myDate = new java.util.Date();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   375
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   376
    int currentDay = myDate.getDay();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   377
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   378
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   379
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   380
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   381
メソッド \f2java.util.Date.getDay\fP は JDK 1.1 以降は推奨されていません。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   382
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   383
dep\-ann 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   384
\f2@deprecated\fP Javadoc コメントでドキュメント化されているが、 \f2@Deprecated\fP 注釈が付いていない項目について警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   385
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   386
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   387
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   388
  /**
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   389
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   390
   * @deprecated As of Java SE 7, replaced by {@link #newMethod()}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   391
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   392
   */
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   393
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   394
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   395
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   396
  public static void deprecatedMethood() { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   397
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   398
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   399
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   400
  public static void newMethod() { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   401
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   402
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   403
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   404
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   405
divzero 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   406
一定の整数 0 で除算されることについて警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   407
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   408
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   409
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   410
    int divideByZero = 42 / 0;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   411
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   412
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   413
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   414
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   415
empty 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   416
\f2if\fP 文以降が空の文であることについて警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   417
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   418
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   419
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   420
class E {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   421
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   422
    void m() {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   423
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   424
        if (true) ;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   425
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   426
    }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   427
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   428
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   429
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   430
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   431
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   432
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   433
fallthrough 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   434
fall\-through ケースの \f2switch\fP ブロックをチェックし、検出されたものに対して警告メッセージを表示します。Fall\-through ケースは、\f2switch\fP ブロック内の最後のケースを除くケースです。このコードには \f2break\fP 文は含まれません。コードの実行をそのケースから次のケースへ移動します。たとえば、この \f2switch\fP ブロック内の \f2case 1\fP ラベルに続くコードは、\f2break\fP 文で終わっていません。 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
switch (x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
       System.out.println("1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   444
       //  No break statement here.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
       System.out.println("2");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   452
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   453
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   454
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   455
このコードのコンパイル時に \f2\-Xlint:fallthrough\fP フラグが使用されていた場合、コンパイラは 当該ケースの行番号とともに、fall\-through ケースの可能性があることを示す警告を発行します。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   456
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   457
finally 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   458
正常に完了できない \f2finally\fP 節について警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   459
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   460
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   461
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   462
  public static int m() {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   463
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   464
    try {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   465
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   466
      throw new NullPointerException();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   467
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   468
    } catch (NullPointerException e) {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   469
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   470
      System.err.println("Caught NullPointerException.");
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   471
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   472
      return 1;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   473
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   474
    } finally {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   475
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   476
      return 0;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   477
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   478
    }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   479
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   480
  }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   481
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   482
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   483
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   484
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   485
この例では、コンパイラは \f2finally\fP ブロックに関する警告を生成します。このメソッドが呼び出されると、値 1 ではなく \f20\fP が \f2返されます\fP。 \f2finally\fP ブロックは、 \f2try\fP ブロックが終了すると必ず実行されます。この例では、制御が \f2catch\fP に移された場合、メソッドは終了します。ただし、 \f2finally\fP ブロックは実行される必要があるため、制御がすでにこのメソッドの外部に移されていても、このブロックは実行されます。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   486
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   487
options 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   488
コマンド行オプションの使用に関する問題について警告します。この種の警告の例については、「クロスコンパイルの例」を参照してください。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   489
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   490
overrides 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   491
メソッドのオーバーライドに関する問題について警告します。たとえば、次の 2 つのクラスがあるとします。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   492
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   493
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   494
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   495
public class ClassWithVarargsMethod {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   496
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   497
  void varargsMethod(String... s) { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   498
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   499
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   500
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   501
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   502
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   503
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   504
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   505
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   506
public class ClassWithOverridingMethod extends ClassWithVarargsMethod {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   507
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   508
  @Override
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   509
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   510
  void varargsMethod(String[] s) { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   511
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   512
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   513
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   514
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   515
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   516
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   517
コンパイラは次のような警告を生成します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   518
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   519
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   520
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   521
warning: [override] varargsMethod(String[]) in ClassWithOverridingMethod overrides varargsMethod(String...) in ClassWithVarargsMethod; overriding method is missing '...'
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   522
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   523
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   524
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   525
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   526
コンパイラは、varargs メソッドを検出すると、varargs の仮パラメータを配列に変換します。メソッド \f2ClassWithVarargsMethod.varargsMethod\fP では、コンパイラは varargs の仮パラメータ \f2String... s\fP を仮パラメータ \f2String[] s\fP に変換します。String[] s は、メソッド \f2ClassWithOverridingMethod.varargsMethod\fP の仮パラメータに対応する配列です。その結果、この例ではコンパイルが行われます。  
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   527
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   528
path 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   529
コマンド行での無効なパス要素と存在しないパスディレクトリについて警告します (クラスパス、ソースパスなどのパス関連)。このような警告を \f2@SuppressWarnings\fP 注釈で抑制することはできません。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   530
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   531
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   532
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   533
javac \-Xlint:path \-classpath /nonexistentpath Example.java
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   534
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   535
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   536
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   537
.TP 3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   538
processing 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   539
注釈処理に関する問題について警告します。コンパイラがこの警告を生成するのは、注釈を含むクラスがあるときに、使用している注釈プロセッサでその型の例外を処理できない場合です。単純な注釈プロセッサの例を次に示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   540
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   541
\f3ソースファイル \fP\f4AnnoProc.java\fP: 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   542
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   543
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   544
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   545
import java.util.*;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   546
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   547
import javax.annotation.processing.*;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   548
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   549
import javax.lang.model.*;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   550
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   551
import javax.lang.model.element.*;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   552
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   553
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   554
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   555
@SupportedAnnotationTypes("NotAnno")
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   556
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   557
public class AnnoProc extends AbstractProcessor {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   558
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   559
    public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   560
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   561
        return true;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   562
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   563
    }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   564
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   565
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   566
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   567
    public SourceVersion getSupportedSourceVersion() {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   568
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   569
        return SourceVersion.latest();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   570
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   571
    }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   572
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   573
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   574
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   575
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   576
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   577
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   578
\f3ソースファイル \fP\f4AnnosWithoutProcessors.java\fP\f3:\fP 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   579
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   580
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   581
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   582
@interface Anno { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   583
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   584
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   585
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   586
@Anno
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   587
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   588
class AnnosWithoutProcessors { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   589
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   590
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   591
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   592
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   593
次のコマンドは、注釈プロセッサ \f2AnnoProc\fP をコンパイルし、この注釈プロセッサをソースファイル \f2AnnosWithoutProcessors.java\fP に対して実行します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   594
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   595
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   596
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   597
% javac AnnoProc.java
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   598
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   599
% javac \-cp . \-Xlint:processing \-processor AnnoProc \-proc:only AnnosWithoutProcessors.java
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   600
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   601
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   602
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   603
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   604
コンパイラがソースファイル \f2AnnosWithoutProcessors.java\fP に対して注釈プロセッサを実行すると、次の警告が生成されます。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   605
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   606
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   607
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   608
warning: [processing] No processor claimed any of these annotations: Anno
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
.fi
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   612
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   613
この問題を解決するには、クラス \f2AnnosWithoutProcessors\fP で定義および使用される注釈の名前を \f2Anno\fP から \f2NotAnno\fP に変更します。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   615
rawtypes 
9566
d7241af95355 7043580: integrate man page translation drop 2 into jdk7
mfang
parents: 9352
diff changeset
   616
raw 型に対する未検査操作について警告します。次の文では、 \f2rawtypes\fP 警告が生成されます。 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   617
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   618
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   619
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   620
void countElements(List l) { ... }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   621
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   622
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   623
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   624
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   625
次の文では、 \f2rawtypes\fP 警告は生成されません。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   626
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   627
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   628
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   629
void countElements(List<?> l) { ... }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   630
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   631
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   632
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   633
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   634
\f2List\fP は raw 型です。ただし、 \f2List<?>\fP はアンバウンド形式のワイルドカードのパラメータ化された型です。 \f2List\fP はパラメータ化されたインタフェースなので、必ずその型引数を指定する必要があります。この例では、 \f2List\fP の仮引数はアンバウンド形式のワイルドカード (\f2?\fP) を使ってその仮型パラメータとして指定されます。つまり、 \f2countElements\fP メソッドは \f2List\fP インタフェースのどのインスタンス化も受け付けることができます。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   636
serial 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   637
直列化可能クラスに \f2serialVersionUID\fP 定義がないことを警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   638
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   639
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   640
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   641
public class PersistentTime implements Serializable
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   642
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   643
{
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   644
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   645
  private Date time;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   646
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   647
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   648
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   649
   public PersistentTime() {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   650
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   651
     time = Calendar.getInstance().getTime();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   652
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   653
   }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   654
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   655
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   656
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   657
   public Date getTime() {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   658
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   659
     return time;
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   660
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   661
   }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   662
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   663
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   664
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   665
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   666
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   667
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   668
コンパイラは次の警告を生成します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   669
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   670
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   671
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   672
warning: [serial] serializable class PersistentTime has no definition of serialVersionUID
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   673
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   674
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   675
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   676
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   677
直列化可能クラスが \f2serialVersionUID\fP という名前のフィールドを明示的に宣言しない場合、直列化ランタイムは「Java オブジェクト直列化仕様」で説明されているように、クラスのさまざまな側面に基づいて、クラスの \f2serialVersionUID\fP のデフォルト値を計算します。ただし、すべての直列化可能クラスが \f2serialVersionUID\fP 値を明示的に宣言することを強くお勧めします。これは、 \f2serialVersionUID\fP 値を計算するデフォルトのプロセスが、コンパイラの実装によって異なる可能性のあるクラスの詳細にきわめて影響を受けやすく、直列化復元中に予期しない \f2InvalidClassExceptions\fP が発生する可能性があるためです。したがって、Java コンパイラの実装が異なっても \f2serialVersionUID\fP 値の一貫性を確保にするには、直列化可能クラスが \f2serialVersionUID\fP 値を明示的に宣言する必要があります。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   679
static 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   680
static の使用に関する問題について警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   681
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   682
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   683
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   684
class XLintStatic {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   685
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   686
    static void m1() { }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   687
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   688
    void m2() { this.m1(); }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   689
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   690
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   691
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   692
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   693
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   694
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   695
コンパイラは次の警告を生成します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   696
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   697
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   698
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   699
warning: [static] static method should be qualified by type name, XLintStatic, instead of by an expression
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   700
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   701
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   702
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   703
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   704
この問題を解決するために、次のように static メソッド \f2m1\fP を呼び出すことができます。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   705
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   706
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   707
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   708
XLintStatic.m1();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   709
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   710
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   711
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   712
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   713
あるいは、 \f2static\fP キーワードをメソッド \f2m1\fP の宣言から削除することもできます。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   715
try 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   716
try\-with\-resources 文を含む、 \f2try\fP ブロックの使用に関する問題について警告します。たとえば、try 文で宣言されたリソース \f2ac\fP が使用されないために、 \f2次の文に対して警告が\fP 生成されます。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   717
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   718
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   719
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   720
try ( AutoCloseable ac = getResource() ) {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   721
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   722
    // do nothing
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   723
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   724
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   725
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   726
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   727
.fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   729
unchecked 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   730
Java 言語仕様で指定されている未検査変換警告の詳細を示します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   731
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   732
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   733
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   734
    List l = new ArrayList<Number>();
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   735
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   736
    List<String> ls = l;       // unchecked warning
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   737
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   738
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   739
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   740
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   741
型の消去中に、型 \f2ArrayList<Number>\fP および \f2List<String>\fP はそれぞれ \f2ArrayList\fP および \f2List\fP になります。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   742
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   743
変数 \f2ls\fP にはパラメータ化された型 \f2List<String>\fP が指定されています。l によって参照される \f2List\fP \f2が\fP \f2ls\fP に代入されると、コンパイラは未検査警告を生成します。コンパイラは \f2l\fP が \f2List<String>\fP 型を参照するかどうかをコンパイル時に判断できません。また、JVM が実行時にそれを判断できないことも認識しています。l は List<String> 型を参照しません。その結果、ヒープ汚染が発生します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   744
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   745
詳しく説明すると、ヒープ汚染状態が発生するのは、 \f2List\fP オブジェクト \f2l\fP (その static 型は \f2List<Number>\fP) が別の \f2List\fP オブジェクト \f2ls\fP (異なる static 型 \f2List<String>\fP を持つ) に代入される場合です。しかし、コンパイラではこの代入を未だに許可しています。総称をサポートしない Java SE のバージョンとの下位互換性を確保するために、この代入を許可する必要があります。型消去のために、 \f2List<Number>\fP と \f2List<String>\fP は \f2List\fP になります。その結果、コンパイラはオブジェクト \f2l\fP ( \f2List\fP という raw 型を持つ) をオブジェクト \f2ls\fPに代入することを許可します。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
.TP 3
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   747
varargs 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   748
可変引数 (varargs) メソッド、特に非具象化可能引数を含むものの使用が安全でないことを警告します。次に例を示します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   749
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   750
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   751
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   752
public class ArrayBuilder {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   753
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   754
  public static <T> void addToList (List<T> listArg, T... elements) {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   755
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   756
    for (T x : elements) {
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   757
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   758
      listArg.add(x);
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   759
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   760
    }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   761
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   762
  }
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   763
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   764
}
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   765
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   766
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   767
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   768
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   769
コンパイラは、メソッド \f2ArrayBuilder.addToList\fP の定義に関する次の警告を生成します。 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   770
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   771
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   772
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   773
warning: [varargs] Possible heap pollution from parameterized vararg type T
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   774
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   775
\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   776
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   777
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   778
コンパイラは、varargs メソッドを検出すると、varargs の仮パラメータを配列に変換します。しかし、Java プログラミング言語では、パラメータ化された型の配列の作成を許可していません。メソッド \f2ArrayBuilder.addToList\fP では、コンパイラは varargs の仮パラメータ \f2T... elements\fP を仮パラメータ \f2T[] elements\fP(配列) に変換します。しかし、型消去のために、コンパイラは varargs の仮パラメータを \f2Object[] elements\fP に変換します。その結果、ヒープ汚染が発生する可能性があります。  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   782
.SH "コマンド行引数ファイル"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   785
javac のコマンド行を短くしたり簡潔にしたりするために、 \f2javac\fP コマンドに対する引数 ( \f2\-J\fP オプションを除く) を含む 1 つ以上のファイルを指定することができます。この方法を使うと、どのオペレーティングシステム上でも、任意の長さの javac コマンドを作成できます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   788
引数ファイルには、javac のオプションとソースファイル名を自由に組み合わせて記述できます。ファイル内の各引数は、スペースまたは改行で区切ります。ファイル名に空白が含まれている場合は、そのファイル名全体を二重引用符で囲みます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   791
引数ファイル内のファイル名は、現在のディレクトリから見た相対パスになります。引数ファイルの位置から見た相対パスではありません。引数ファイル内のファイル名リストでは、ワイルドカード (*) は使用できません。たとえば、 \f2*.java\fP とは指定できません。引数ファイル内の引数で \f2@\fP 文字を使用して、複数のファイルを再帰的に解釈することはサポートされていません。また、 \f2\-J\fP オプションもサポートされていません。このオプションは起動ツールに渡されますが、起動ツールでは引数ファイルをサポートしていないからです。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   794
javac を実行するときに、各引数ファイルのパスとファイル名の先頭に \f2@\fP 文字を付けて渡します。javac は、\f2@\fP 文字で始まる引数を見つけると、そのファイルの内容を展開して引数リストに挿入します。
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   795
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   796
.SS 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   797
引数ファイルを 1 つ指定する例
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   800
\f2「argfile」という名前の引数ファイルに\fPすべての javac 引数を格納する場合は、次のように指定します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   805
% \fP\f3javac @argfile\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   811
この引数ファイルには、次の例で示されている 2 つのファイルの内容を両方とも入れることができます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   814
引数ファイルを 2 つ指定する例
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   817
たとえば、javac オプション用に 1 ファイル、ソースファイル名用に 1 ファイルというように、2 つの引数ファイルを作成することもできます。なお、このあとのリストでは、行の継続文字を使用していません。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   820
以下の内容を含む \f2options\fP というファイルを作成します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     \-d classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     \-g
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     \-sourcepath /java/pubs/ws/1.3/src/share/classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   831
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   838
以下の内容を含む \f2classes\fP というファイルを作成します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     MyClass1.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     MyClass2.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     MyClass3.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   849
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   856
次のコマンドを使用して \f3javac\fP を実行します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
  % \fP\f3javac @options @classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   863
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   869
パス付きの引数ファイルの例
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   872
引数ファイルには、パスを指定できます。ただし、そのファイル内に指定されたファイル名は、現在の作業ディレクトリから見た相対パスになります。つまり、下の例の場合は、 \f2path1\fP や \f2path2\fP から見た相対パスではありません。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   877
% \fP\f3javac @path1/options @path2/classes\fP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   882
.SH "注釈処理"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   884
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   885
\f3javac\fP が注釈処理を直接サポートしているため、独立した注釈処理ツールである \f3apt\fP を使用する必要がなくなりました。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   888
注釈処理の API は、 \f2javax.annotation.processing\fP および \f2javax.lang.model\fP パッケージとそのサブパッケージ内に定義されています。
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   889
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   890
.SS 
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   891
注釈処理の概要
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   894
\f3\-proc:none\fP オプションによって注釈処理が無効化されないかぎり、コンパイラは使用可能なすべての注釈プロセッサを検索します。検索パスは \f3\-processorpath\fP オプションを使って指定できます。検索パスを指定しなかった場合は、ユーザークラスパスが使用されます。プロセッサの検索は、検索パス上の \f2META\-INF/services/javax.annotation.processing.Processor\fP という名前のサービスプロバイダ構成ファイルに基づいて行われます。このようなファイルには、使用するすべての注釈プロセッサの名前を、1 行に 1 つずつ含めてください。また、別の方法として、\f3\-processor\fP オプションを使ってプロセッサを明示的に指定することもできます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   897
コンパイラは、コマンド行のソースファイルやクラスを走査することで、どのような注釈が存在しているかを確認し終わると、プロセッサに対して問い合わせを行い、それらのプロセッサがどの注釈を処理できるのかを確認します。一致するものが見つかった場合、そのプロセッサが呼び出されます。各プロセッサは、自身が処理する注釈を「要求」できます。その場合、それらの注釈に対する別のプロセッサを見つける試みは行われません。すべての注釈が要求されてしまうと、コンパイラはそれ以上プロセッサの検索を行いません。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   900
いずれかのプロセッサによって新しいソースファイルが生成されると、注釈処理の 2 回目のラウンドが開始されます。新しく生成されたすべてのソースファイルが走査され、前回と同様に注釈が処理されます。以前のラウンドで呼び出されたプロセッサはすべて、後続のどのラウンドでも呼び出されます。これが、新しいソースファイルが生成されなくなるまで続きます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   903
あるラウンドで新しいソースファイルが生成されなかった場合、注釈プロセッサがあと 1 回だけ呼び出され、必要な処理を実行する機会が与えられます。最後に、\f3\-proc:only\fP オプションが使用されないかぎり、コンパイラは、元のソースファイルと生成されたすべてのソースファイルをコンパイルします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   906
暗黙的にロードされたソースファイル
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   909
コンパイラは、一連のソースファイルをコンパイルする際に、別のソースファイルを暗黙的にロードすることが必要な場合があります (「型の検索」を参照)。そのようなファイルは、現時点では注釈処理の対象になりません。デフォルトでは、注釈処理が実行され、かつ暗黙的にロードされたソースファイルが 1 つでもコンパイルされた場合にコンパイラは警告を発行します。この警告を抑制する方法については、\-implicit オプションを参照してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   911
.SH "型の検索"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   914
ソースファイルをコンパイルする場合、コマンド行で指定したソースファイルに型の定義が見つからないとき、コンパイラは通常、その型に関する情報を必要とします。コンパイラは、ソースファイルで使われているクラスまたはインタフェース、拡張されているクラスまたはインタフェース、あるいは実装されているクラスまたはインタフェースすべてについて、型の情報を必要とします。これには、ソースファイルで明示的には言及されていなくても、継承を通じて情報を提供するクラスとインタフェースも含まれます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   917
たとえば、\f3java.applet.Applet\fP をサブクラスにした場合、\f3アプレットの\fP祖先のクラス(\f3java.awt.Panel\fP、\f3java.awt.Container\fP、\f3java.awt.Component\fP、\f3java.lang.Object\fP)を使用していることになります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   920
コンパイラは、型の情報が必要になると、その型を定義しているソースファイルまたはクラスファイルを探します。まず、ブートストラップクラスと拡張機能クラスを検索し、続いてユーザークラスパス (デフォルトではカレントディレクトリ) を検索します。ユーザークラスパスは、\f3CLASSPATH\fP 環境変数を設定して定義するか、または \f3\-classpath\fP コマンド行オプションを使って設定します。詳細は、「クラスパスの設定」を参照してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   923
\-sourcepath オプションが指定されている場合、コンパイラは、指定されたパスからソースファイルを検索します。それ以外の場合は、ユーザークラスパスからクラスファイルとソースファイルの両方を検索します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   926
\f3\-bootclasspath\fP オプションと \f3\-extdirs\fP オプションを使うと、別のブートストラップクラスや拡張機能クラスを指定できます。このあとの「クロスコンパイルオプション」を参照してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   929
型の検索に成功したときに得られる結果は、クラスファイル、ソースファイル、またはその両方である場合があります。両方が見つかった場合、そのどちらを使用すべきかを \-Xprefer オプションでコンパイラに指示できます。\f3newer\fP が指定された場合、コンパイラは 2 つのファイルの新しい方を使用します。\f3source\fP が指定された場合、コンパイラはソースファイルを使用します。デフォルトは \f3newer\fP です。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   932
型の検索自体によって、または \f3\-Xprefer\fP が設定された結果として必要な型のソースファイルが見つかった場合、コンパイラはそのソースファイルを読み取り、必要な情報を取得します。さらに、コンパイラはデフォルトで、そのソースファイルのコンパイルも行います。\-implicit オプションを使えばその動作を指定できます。\f3none\fP を指定した場合、そのソースファイルのクラスファイルは生成されません。\f3class\fP を指定した場合、そのソースファイルのクラスファイルが生成されます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   935
コンパイラは、注釈処理の完了後に、ある型情報の必要性を認識しない場合があります。その型情報があるソースファイル内に見つかり、かつ \f3\-implicit\fP オプションが指定されていない場合は、そのファイルが注釈処理の対象とならずにコンパイルされることを、コンパイラがユーザーに警告します。この警告を無効にするには、(そのファイルが注釈処理の対象となるように) そのファイルをコマンド行に指定するか、あるいはそのようなソースファイルに対してクラスファイルを生成すべきかどうかを \f3\-implicit\fP オプションを使って指定します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   937
.SH "プログラマティックインタフェース"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   940
\f3javac\fP は、 \f2javax.tools\fP パッケージ内のクラスとインタフェースによって定義される新しい Java Compiler API をサポートします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   943
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   946
コマンド行から指定された引数を使ってコンパイルを実行するには、次のようなコードを使用します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
int rc = javac.run(null, null, null, args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   960
この場合、標準出力ストリームにすべての診断メッセージが書き出され、コマンド行から呼び出された \f3javac\fP が返すのと同じ終了コードが返されます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   963
\f2javax.tools.JavaCompiler\fP インタフェース上のほかのメソッドを使えば、診断メッセージの処理やファイルの読み取り元/書き込み先の制御などを行えます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   966
旧式のインタフェース
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   969
\f3注:\fP この API は、下位互換性を確保するためだけに残されています。新しいコードでは、必ず前述の Java Compiler API を使用してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   972
\f2com.sun.tools.javac.Main\fP クラスには、プログラム内からコンパイラを呼び出すための static メソッドが 2 つ用意されています。それらを次に示します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
public static int compile(String[] args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
public static int compile(String[] args, PrintWriter out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   986
\f2args\fP パラメータは、javac プログラムに通常渡される任意のコマンド行引数を表しています。その概要については、前出の「形式」節を参照してください。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   989
\f2out\fP パラメータは、コンパイラの診断メッセージの出力先を示します。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   992
戻り値は、\f3javac\fP の終了値と同じです。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   995
名前が \f2com.sun.tools.javac\fP で始まるパッケージ (非公式には \f2com.sun.tools.javac\fP のサブパッケージとして知られる) に含まれるその他のクラスやメソッドは、どれも完全に内部用であり、いつでも変更される可能性があります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
   997
.SH "例"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1000
簡単なプログラムのコンパイル
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1003
\f2Hello.java\fP というソースファイルで、\f3greetings.Hello\fP という名前のクラスを定義しているとします。 \f2greetings\fP ディレクトリは、ソースファイルとクラスファイルの両方があるパッケージディレクトリで、現在のディレクトリのすぐ下にあります。このため、この例では、デフォルトのユーザークラスパスを使用できます。また、\f3\-d\fP を使って別の出力先ディレクトリを指定する必要もありません。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
% \fP\f3ls\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
greetings/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
Hello.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
% \f3cat greetings/Hello.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
package greetings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
public class Hello {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
        for (int i=0; i < args.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
            System.out.println("Hello " + args[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
% \f3javac greetings/Hello.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
Hello.class   Hello.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
% \f3java greetings.Hello World Universe Everyone\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
Hello World
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
Hello Universe
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
Hello Everyone
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1054
複数のソースファイルのコンパイル
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1057
次の例では、パッケージ \f2greetings\fP 内のすべてのソースファイルをコンパイルします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
% \fP\f3ls\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
greetings/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
Aloha.java         GutenTag.java      Hello.java         Hi.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
% \f3javac greetings/*.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
% \f3ls greetings\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
Aloha.class         GutenTag.class      Hello.class         Hi.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
Aloha.java          GutenTag.java       Hello.java          Hi.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1082
ユーザークラスパスの指定
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1085
上の例のソースファイルのうち 1 つを変更し、変更後のファイルを再コンパイルするとします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
% \fP\f3pwd\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
/examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
% \f3javac greetings/Hi.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1100
\f2greetings.Hi\fP は、 \f2greetings\fP パッケージ内のほかのクラスを参照しているため、コンパイラはこれらのクラスを探す必要があります。上の例では、デフォルトのユーザークラスパスが、パッケージディレクトリを含むディレクトリと同じであるため、コンパイルは正常に実行されます。ただし、現在どのディレクトリにいるかに関係なく、このファイルを再コンパイルする場合は、ユーザークラスパスに \f2/examples\fP を追加する必要があります。ユーザークラスパスにエントリを追加するには、\f3CLASSPATH\fP を設定する方法もありますが、ここでは \f3\-classpath\fP オプションを使うことにします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
% \fP\f3javac \-classpath /examples /examples/greetings/Hi.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1111
再度 \f2greetings.Hi\fP を変更してバナーユーティリティーを使うようにした場合は、このバナーユーティリティーもユーザークラスパスを通じてアクセスできるようになっている必要があります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
% \fP\f3javac \-classpath /examples:/lib/Banners.jar \\ 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
            /examples/greetings/Hi.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1124
\f2greetings\fP 内のクラスを実行するには、 \f2greetings\fP と、それが使うクラスの両方にアクセスできる必要があります。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
% \fP\f3java \-classpath /examples:/lib/Banners.jar greetings.Hi\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1135
ソースファイルとクラスファイルの分離
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1138
特に大規模プロジェクトの場合は、ソースファイルとクラスファイルを別々のディレクトリに置くと便利なことがあります。クラスファイルの出力先を別に指定するには、\f3\-d\fP を使います。ソースファイルはユーザークラスパスにはないので、\f3\-sourcepath\fP を使って、コンパイラがソースファイルを見つけることができるようにします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
% \fP\f3ls\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
classes/  lib/      src/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
% \f3ls src\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
farewells/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
% \f3ls src/farewells\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
Base.java      GoodBye.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
% \f3ls lib\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
Banners.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
% \f3ls classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
% \f3javac \-sourcepath src \-classpath classes:lib/Banners.jar \\ 
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
            src/farewells/GoodBye.java \-d classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
% \f3ls classes\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
farewells/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
% \f3ls classes/farewells\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
Base.class      GoodBye.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1177
\f3注:\fP コマンド行では \f2src/farewells/Base.java\fP を指定していませんが、このファイルもコンパイラによってコンパイルされています。自動コンパイルを監視するには、\f3\-verbose\fP オプションを使います。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
.SS 
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1180
クロスコンパイルの例
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1183
ここでは、\f3javac\fP を使って、1.6 VM 上で実行するコードをコンパイルします。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
.fl
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1188
% \fP\f3javac \-source 1.6 \-target 1.6 \-bootclasspath jdk1.6.0/lib/rt.jar \\ 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
            \-extdirs "" OldCode.java\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1196
\f2\-source 1.6\fP オプションにより、 \f2OldCode.java\fP のコンパイルにはバージョン 1.6 (または 6) の Java プログラミング言語が使用されます。\f3\-target 1.6\fP オプションにより、1.6 VM と互換性のあるクラスファイルが生成されます。ほとんどの場合、\f3\-target\fP オプションの値は \f3\-source\fP オプションの値になります。この例では、\f3\-target\fP オプションを省略できます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1199
\f3\-bootclasspath\fP オプションを使用して、適切なバージョンのブートストラップクラス ( \f2rt.jar\fP ライブラリ) を指定する必要があります。指定しない場合は、コンパイラによって次の警告が生成されます。
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1201
.nf
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1202
\f3
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1203
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1204
% \fP\f3javac \-source 1.6 OldCode.java\fP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1205
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1206
warning: [options] bootstrap class path not set in conjunction with \-source 1.6
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1207
.fl
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1208
.fi
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1209
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
.LP
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1211
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1212
適切なバージョンのブートストラップクラスを指定しない場合、コンパイラは古い言語仕様 (この例では、バージョン 1.6 の Java プログラミング言語) を新しいブートストラップクラスと組み合わせて使用します。その結果、存在しないメソッドへの参照が含まれていることがあるため、クラスファイルが古いプラットフォーム (この場合は Java SE 6) で動作しない可能性があります。
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1213
.LP
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1214
.SH "関連項目"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
.na
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1220
\f2「The javac Guide」\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
  1222
http://java.sun.com/javase/6/docs/technotes/guides/javac/index.html 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1225
「java(1) \- Java アプリケーション起動ツール」 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1228
「jdb(1) \- Java デバッガ」 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1231
「javah(1) \- C ヘッダーとスタブファイルジェネレータ」 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1234
「javap(1) \- クラスファイル逆アセンブラ」 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1237
「javadoc(1) \- Java API ドキュメントジェネレータ」 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
o
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1240
「jar(1) \- JAR アーカイブツール」 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
.TP 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
o
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
.na
9352
cabba0c0f3ee 7025070: man page localization broken in jdk7
ogino
parents: 5865
diff changeset
  1244
\f2「Java 拡張機能フレームワーク」\fP @
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
  1246
http://java.sun.com/javase/6/docs/technotes/guides/extensions/index.html 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250