Cross Reference: Neg07.java
xref
: /
openjdk7
/
langtools
/
test
/
tools
/
javac
/
multicatch
/
Neg07.java
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
0
N/A
/*
0
N/A
* @test /nodynamiccopyright/
0
N/A
* @bug 7039822
0
N/A
* @summary Verify typing of lub of exception parameter w.r.t getClass
0
N/A
* @author Joseph D. Darcy
0
N/A
* @
compile
/
fail
/
ref
=Neg07.out -XDrawDiagnostics
Neg07.java
0
N/A
*/
0
N/A
0
N/A
public
class
Neg07
{
0
N/A
private
static
void
test
(
int
i) {
0
N/A
try
{
0
N/A
thrower
(i);
0
N/A
}
catch
(
SonException
|
DaughterException
e) {
0
N/A
Class
<?
extends
HasFoo
>
clazz2
= e.
getClass
();
// Rejected!
0
N/A
HasFoo
m = e;
0
N/A
e.
foo
();
0
N/A
}
0
N/A
}
0
N/A
0
N/A
private
static
interface
HasFoo
{
0
N/A
void
foo
();
0
N/A
}
0
N/A
0
N/A
static
void
thrower
(
int
i)
throws
SonException
,
DaughterException
{
0
N/A
if
(i ==
0
)
0
N/A
throw
new
SonException
();
0
N/A
else
0
N/A
throw
new
DaughterException
();
0
N/A
}
0
N/A
0
N/A
private
static
class
ParentException
extends
RuntimeException
{}
0
N/A
0
N/A
private
static
class
SonException
0
N/A
extends
ParentException
0
N/A
implements
HasFoo
{
0
N/A
0
N/A
public
void
foo
() {
0
N/A
System
.
out
.
println
(
"SonException.foo"
);
0
N/A
}
0
N/A
}
0
N/A
0
N/A
private
static
class
DaughterException
0
N/A
extends
ParentException
0
N/A
implements
HasFoo
{
0
N/A
0
N/A
public
void
foo
() {
0
N/A
System
.
out
.
println
(
"DaughterException.foo"
);
0
N/A
}
0
N/A
}
0
N/A
}
0
N/A