8035956: javac, incomplete error message
authorkizune
Wed, 26 Mar 2014 10:47:30 -0700
changeset 23796 4c722b177a8f
parent 23795 62509b72088e
child 23797 756821688d0a
8035956: javac, incomplete error message Reviewed-by: vromero
langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
langtools/test/tools/javac/OverrideChecks/IncompleteMessageOverride.java
langtools/test/tools/javac/OverrideChecks/IncompleteMessageOverride.out
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Mar 26 12:18:11 2014 +0100
+++ b/langtools/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/langtools/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/langtools/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