8035956: javac, incomplete error message

Reviewed-by: vromero
This commit is contained in:
Alexander Zuev 2014-03-26 10:47:30 -07:00
parent 24400e1745
commit 3eb793cd06
3 changed files with 19 additions and 1 deletions

View File

@ -1625,7 +1625,7 @@ public class Check {
protection(m.flags()) > protection(other.flags())) {
log.error(TreeInfo.diagnosticPositionFor(m, tree), "override.weaker.access",
cannotOverride(m, other),
other.flags() == 0 ?
(other.flags() & AccessFlags) == 0 ?
"package" :
asFlagSet(other.flags() & AccessFlags));
m.flags_field |= BAD_OVERRIDE;

View File

@ -0,0 +1,16 @@
/*
* @test /nodynamiccopyright/
* @bug 8035956
* @summary javac, incomplete error message
* @author kizune
*
* @run compile/fail/ref=IncompleteMessageOverride.out -XDrawDiagnostics IncompleteMessageOverride.java
*/
class Super {
static void m() {}
}
class Sub extends Super {
private static void m() {}
}

View File

@ -0,0 +1,2 @@
IncompleteMessageOverride.java:15:25: compiler.err.override.weaker.access: (compiler.misc.cant.override: m(), Sub, m(), Super), package
1 error