Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
7eb05e16
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看板
提交
7eb05e16
编写于
8月 09, 2013
作者:
K
ksrini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8022161: javac Null Pointer Exception in Enter.visitTopLevel
Reviewed-by: jjg, vromero, jlahoda
上级
54a54904
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
9 deletion
+40
-9
src/share/classes/com/sun/tools/javac/comp/Enter.java
src/share/classes/com/sun/tools/javac/comp/Enter.java
+1
-1
test/tools/javac/TestPkgInfo.java
test/tools/javac/TestPkgInfo.java
+39
-8
未找到文件。
src/share/classes/com/sun/tools/javac/comp/Enter.java
浏览文件 @
7eb05e16
...
...
@@ -291,7 +291,7 @@ public class Enter extends JCTree.Visitor {
if
(
tree
.
packageAnnotations
.
nonEmpty
()
||
pkginfoOpt
==
PkgInfo
.
ALWAYS
)
{
if
(
isPkgInfo
)
{
addEnv
=
true
;
}
else
{
}
else
if
(
tree
.
packageAnnotations
.
nonEmpty
())
{
log
.
error
(
tree
.
packageAnnotations
.
head
.
pos
(),
"pkg.annotations.sb.in.package-info.java"
);
}
...
...
test/tools/javac/TestPkgInfo.java
浏览文件 @
7eb05e16
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2013,
Oracle and/or its affiliates. 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
...
...
@@ -23,8 +23,10 @@
/*
* @test
* @bug 6960424
* @summary new option -Xpkginfo for better control of when package-info.class is generated
* @bug 6960424 8022161
* @summary new option -Xpkginfo for better control of when package-info.class
* is generated, also ensures no failures if package-info.java is
* not available.
*/
import
java.io.*
;
...
...
@@ -43,8 +45,11 @@ public class TestPkgInfo {
public
static
void
main
(
String
...
args
)
throws
Exception
{
new
TestPkgInfo
().
run
(
args
);
}
public
void
run
(
String
...
args
)
throws
Exception
{
testPositive
();
testNoExceptions
();
}
public
void
testPositive
(
String
...
args
)
throws
Exception
{
boolean
[]
booleanValues
=
{
false
,
true
};
for
(
OptKind
ok:
OptKind
.
values
())
{
for
(
boolean
sr:
booleanValues
)
{
...
...
@@ -65,6 +70,32 @@ public class TestPkgInfo {
throw
new
Exception
(
errors
+
" errors occurred"
);
}
/** this should throw no exceptions **/
void
testNoExceptions
()
throws
Exception
{
count
++;
System
.
err
.
println
(
"Test "
+
count
+
": ALWAYS nofile"
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"package test; class Hello{}"
);
// test specific tmp directory
File
tmpDir
=
new
File
(
"tmp.test"
+
count
);
File
classesDir
=
new
File
(
tmpDir
,
"classes"
);
classesDir
.
mkdirs
();
File
javafile
=
new
File
(
new
File
(
tmpDir
,
"src"
),
"Hello.java"
);
writeFile
(
javafile
,
sb
.
toString
());
// build up list of options and files to be compiled
List
<
String
>
opts
=
new
ArrayList
<>();
List
<
File
>
files
=
new
ArrayList
<>();
opts
.
add
(
"-d"
);
opts
.
add
(
classesDir
.
getPath
());
opts
.
add
(
"-Xpkginfo:always"
);
files
.
add
(
javafile
);
compile
(
opts
,
files
);
}
void
test
(
OptKind
ok
,
boolean
sr
,
boolean
cr
,
boolean
rr
)
throws
Exception
{
count
++;
System
.
err
.
println
(
"Test "
+
count
+
": ok:"
+
ok
+
" sr:"
+
sr
+
" cr:"
+
cr
+
" rr:"
+
rr
);
...
...
@@ -91,15 +122,15 @@ public class TestPkgInfo {
writeFile
(
pkginfo_java
,
sb
.
toString
());
// build up list of options and files to be compiled
List
<
String
>
opts
=
new
ArrayList
<
String
>();
List
<
File
>
files
=
new
ArrayList
<
File
>();
List
<
String
>
opts
=
new
ArrayList
<>();
List
<
File
>
files
=
new
ArrayList
<>();
opts
.
add
(
"-d"
);
opts
.
add
(
classesDir
.
getPath
());
if
(
ok
.
opt
!=
null
)
opts
.
add
(
ok
.
opt
);
//opts.add("-verbose");
files
.
add
(
pkginfo_java
);
files
.
add
(
pkginfo_java
);
compile
(
opts
,
files
);
...
...
@@ -134,7 +165,7 @@ public class TestPkgInfo {
/** Compile files with options provided. */
void
compile
(
List
<
String
>
opts
,
List
<
File
>
files
)
throws
Exception
{
System
.
err
.
println
(
"javac: "
+
opts
+
" "
+
files
);
List
<
String
>
args
=
new
ArrayList
<
String
>();
List
<
String
>
args
=
new
ArrayList
<>();
args
.
addAll
(
opts
);
for
(
File
f:
files
)
args
.
add
(
f
.
getPath
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录