Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
1d2c328d
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1d2c328d
编写于
6月 25, 2008
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6507179: javadoc -source 1.3 does not work with jdk6
Reviewed-by: mcimadamore
上级
29e3a932
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
151 addition
and
42 deletion
+151
-42
src/share/classes/com/sun/tools/javac/comp/Check.java
src/share/classes/com/sun/tools/javac/comp/Check.java
+5
-2
src/share/classes/com/sun/tools/javac/util/Log.java
src/share/classes/com/sun/tools/javac/util/Log.java
+33
-35
src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java
...ses/com/sun/tools/javac/util/MandatoryWarningHandler.java
+37
-5
test/tools/javadoc/sourceOption/SourceOption.java
test/tools/javadoc/sourceOption/SourceOption.java
+47
-0
test/tools/javadoc/sourceOption/p/A.java
test/tools/javadoc/sourceOption/p/A.java
+29
-0
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Check.java
浏览文件 @
1d2c328d
...
...
@@ -100,9 +100,12 @@ public class Check {
boolean
verboseDeprecated
=
lint
.
isEnabled
(
LintCategory
.
DEPRECATION
);
boolean
verboseUnchecked
=
lint
.
isEnabled
(
LintCategory
.
UNCHECKED
);
boolean
enforceMandatoryWarnings
=
source
.
enforceMandatoryWarnings
();
deprecationHandler
=
new
MandatoryWarningHandler
(
log
,
verboseDeprecated
,
"deprecated"
);
uncheckedHandler
=
new
MandatoryWarningHandler
(
log
,
verboseUnchecked
,
"unchecked"
);
deprecationHandler
=
new
MandatoryWarningHandler
(
log
,
verboseDeprecated
,
enforceMandatoryWarnings
,
"deprecated"
);
uncheckedHandler
=
new
MandatoryWarningHandler
(
log
,
verboseUnchecked
,
enforceMandatoryWarnings
,
"unchecked"
);
}
/** Switch: generics enabled?
...
...
src/share/classes/com/sun/tools/javac/util/Log.java
浏览文件 @
1d2c328d
...
...
@@ -34,7 +34,6 @@ import java.util.Set;
import
javax.tools.DiagnosticListener
;
import
javax.tools.JavaFileObject
;
import
com.sun.tools.javac.code.Source
;
import
com.sun.tools.javac.file.JavacFileManager
;
import
com.sun.tools.javac.tree.JCTree
;
import
com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
;
...
...
@@ -86,10 +85,6 @@ public class Log {
*/
public
boolean
emitWarnings
;
/** Enforce mandatory warnings.
*/
private
boolean
enforceMandatoryWarnings
;
/** Print stack trace on errors?
*/
public
boolean
dumpOnError
;
...
...
@@ -138,9 +133,6 @@ public class Log {
DiagnosticListener
<?
super
JavaFileObject
>
diagListener
=
context
.
get
(
DiagnosticListener
.
class
);
this
.
diagListener
=
diagListener
;
Source
source
=
Source
.
instance
(
context
);
this
.
enforceMandatoryWarnings
=
source
.
enforceMandatoryWarnings
();
}
// where
private
int
getIntOption
(
Options
options
,
String
optionName
,
int
defaultValue
)
{
...
...
@@ -473,10 +465,7 @@ public class Log {
* @param args Fields of the warning message.
*/
public
void
mandatoryWarning
(
DiagnosticPosition
pos
,
String
key
,
Object
...
args
)
{
if
(
enforceMandatoryWarnings
)
report
(
diags
.
mandatoryWarning
(
source
,
pos
,
key
,
args
));
else
report
(
diags
.
warning
(
source
,
pos
,
key
,
args
));
report
(
diags
.
mandatoryWarning
(
source
,
pos
,
key
,
args
));
}
/** Report a warning that cannot be suppressed.
...
...
@@ -513,35 +502,44 @@ public class Log {
report
(
diags
.
note
(
source
,
wrap
(
pos
),
key
,
args
));
}
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
* @param file The file to which the note applies.
* @param key The key for the localized notification message.
* @param args Fields of the notification message.
*/
public
void
note
(
JavaFileObject
file
,
String
key
,
Object
...
args
)
{
report
(
diags
.
note
(
wrap
(
file
),
null
,
key
,
args
));
}
/** Provide a non-fatal notification, unless suppressed by the -nowarn option.
* @param key The key for the localized notification message.
* @param args Fields of the notification message.
*/
public
void
mandatoryNote
(
final
JavaFileObject
file
,
String
key
,
Object
...
args
)
{
JCDiagnostic
.
DiagnosticSource
wrapper
=
null
;
if
(
file
!=
null
)
{
wrapper
=
new
JCDiagnostic
.
DiagnosticSource
()
{
public
JavaFileObject
getFile
()
{
return
file
;
}
public
CharSequence
getName
()
{
return
JavacFileManager
.
getJavacBaseFileName
(
getFile
());
}
public
int
getLineNumber
(
int
pos
)
{
return
Log
.
this
.
getLineNumber
(
pos
);
}
public
int
getColumnNumber
(
int
pos
)
{
return
Log
.
this
.
getColumnNumber
(
pos
);
}
public
Map
<
JCTree
,
Integer
>
getEndPosTable
()
{
return
(
endPosTables
==
null
?
null
:
endPosTables
.
get
(
file
));
}
};
report
(
diags
.
mandatoryNote
(
wrap
(
file
),
key
,
args
));
}
private
JCDiagnostic
.
DiagnosticSource
wrap
(
final
JavaFileObject
file
)
{
if
(
file
==
null
)
{
return
null
;
}
if
(
enforceMandatoryWarnings
)
report
(
diags
.
mandatoryNote
(
wrapper
,
key
,
args
));
else
report
(
diags
.
note
(
wrapper
,
null
,
key
,
args
));
return
new
JCDiagnostic
.
DiagnosticSource
()
{
public
JavaFileObject
getFile
()
{
return
file
;
}
public
CharSequence
getName
()
{
return
JavacFileManager
.
getJavacBaseFileName
(
getFile
());
}
public
int
getLineNumber
(
int
pos
)
{
return
Log
.
this
.
getLineNumber
(
pos
);
}
public
int
getColumnNumber
(
int
pos
)
{
return
Log
.
this
.
getColumnNumber
(
pos
);
}
public
Map
<
JCTree
,
Integer
>
getEndPosTable
()
{
return
(
endPosTables
==
null
?
null
:
endPosTables
.
get
(
file
));
}
};
}
private
DiagnosticPosition
wrap
(
int
pos
)
{
...
...
src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java
浏览文件 @
1d2c328d
...
...
@@ -101,13 +101,17 @@ public class MandatoryWarningHandler {
* individual instances should be given, or whether an aggregate
* message should be generated at the end of the compilation.
* Typically set via -Xlint:option.
* @param enforceMandatory
* True if mandatory warnings and notes are being enforced.
* @param prefix A common prefix for the set of message keys for
* the messages that may be generated.
*/
public
MandatoryWarningHandler
(
Log
log
,
boolean
verbose
,
String
prefix
)
{
public
MandatoryWarningHandler
(
Log
log
,
boolean
verbose
,
boolean
enforceMandatory
,
String
prefix
)
{
this
.
log
=
log
;
this
.
verbose
=
verbose
;
this
.
prefix
=
prefix
;
this
.
enforceMandatory
=
enforceMandatory
;
}
/**
...
...
@@ -122,7 +126,7 @@ public class MandatoryWarningHandler {
if
(
log
.
nwarnings
<
log
.
MaxWarnings
)
{
// generate message and remember the source file
log
.
m
andatoryWarning
(
pos
,
msg
,
args
);
log
M
andatoryWarning
(
pos
,
msg
,
args
);
sourcesWithReportedWarnings
.
add
(
currentSource
);
}
else
if
(
deferredDiagnosticKind
==
null
)
{
// set up deferred message
...
...
@@ -163,12 +167,12 @@ public class MandatoryWarningHandler {
public
void
reportDeferredDiagnostic
()
{
if
(
deferredDiagnosticKind
!=
null
)
{
if
(
deferredDiagnosticArg
==
null
)
log
.
m
andatoryNote
(
deferredDiagnosticSource
,
deferredDiagnosticKind
.
getKey
(
prefix
));
log
M
andatoryNote
(
deferredDiagnosticSource
,
deferredDiagnosticKind
.
getKey
(
prefix
));
else
log
.
m
andatoryNote
(
deferredDiagnosticSource
,
deferredDiagnosticKind
.
getKey
(
prefix
),
deferredDiagnosticArg
);
log
M
andatoryNote
(
deferredDiagnosticSource
,
deferredDiagnosticKind
.
getKey
(
prefix
),
deferredDiagnosticArg
);
if
(!
verbose
)
log
.
m
andatoryNote
(
deferredDiagnosticSource
,
prefix
+
".recompile"
);
log
M
andatoryNote
(
deferredDiagnosticSource
,
prefix
+
".recompile"
);
}
}
...
...
@@ -224,4 +228,32 @@ public class MandatoryWarningHandler {
* deferredDiagnosticKind is updated.
*/
private
Object
deferredDiagnosticArg
;
/**
* True if mandatory warnings and notes are being enforced.
*/
private
final
boolean
enforceMandatory
;
/**
* Reports a mandatory warning to the log. If mandatory warnings
* are not being enforced, treat this as an ordinary warning.
*/
private
void
logMandatoryWarning
(
DiagnosticPosition
pos
,
String
msg
,
Object
...
args
)
{
if
(
enforceMandatory
)
log
.
mandatoryWarning
(
pos
,
msg
,
args
);
else
log
.
warning
(
pos
,
msg
,
args
);
}
/**
* Reports a mandatory note to the log. If mandatory notes are
* not being enforced, treat this as an ordinary note.
*/
private
void
logMandatoryNote
(
JavaFileObject
file
,
String
msg
,
Object
...
args
)
{
if
(
enforceMandatory
)
log
.
mandatoryNote
(
file
,
msg
,
args
);
else
log
.
note
(
file
,
msg
,
args
);
}
}
test/tools/javadoc/sourceOption/SourceOption.java
0 → 100644
浏览文件 @
1d2c328d
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6507179
* @summary Ensure that "-source" option isn't ignored.
* @author Scott Seligman
*/
import
com.sun.javadoc.*
;
public
class
SourceOption
extends
Doclet
{
public
static
void
main
(
String
[]
args
)
{
if
(
com
.
sun
.
tools
.
javadoc
.
Main
.
execute
(
"javadoc"
,
"SourceOption"
,
new
String
[]
{
"-source"
,
"1.3"
,
"p"
})
!=
0
)
throw
new
Error
(
"Javadoc encountered warnings or errors."
);
}
public
static
boolean
start
(
RootDoc
root
)
{
root
.
classes
();
// force parser into action
return
true
;
}
}
test/tools/javadoc/sourceOption/p/A.java
0 → 100644
浏览文件 @
1d2c328d
/*
* Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
p
;
public
class
A
{
boolean
assert
;
// illegal since 1.4
boolean
enum
;
// illegal since 5
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录