changeset 3263:e66d02a089ab

8035956: javac, incomplete error message Reviewed-by: vromero
author kizune
date Wed, 26 Mar 2014 10:47:30 -0700
parents 545b66f5c82a
children 9c6a23d6f96c
files src/share/classes/com/sun/tools/javac/comp/Check.java test/tools/javac/OverrideChecks/IncompleteMessageOverride.java test/tools/javac/OverrideChecks/IncompleteMessageOverride.out
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Mar 26 12:18:11 2014 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Mar 26 10:47:30 2014 -0700
@@ -1625,7 +1625,7 @@
                  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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/OverrideChecks/IncompleteMessageOverride.java	Wed Mar 26 10:47:30 2014 -0700
@@ -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() {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/OverrideChecks/IncompleteMessageOverride.out	Wed Mar 26 10:47:30 2014 -0700
@@ -0,0 +1,2 @@
+IncompleteMessageOverride.java:15:25: compiler.err.override.weaker.access: (compiler.misc.cant.override: m(), Sub, m(), Super), package
+1 error