Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8080726

Redundant error message on private abstract interface method with body

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b67
    • generic
    • generic
    • Verified

        $ catt PrivAndAbstract.java public class PrivAndAbstract {
            interface P {
                private abstract void foo() {};
            }
        }

        $ javac PrivAndAbstract.java
        PrivAndAbstract.java:3: error: illegal combination of modifiers: abstract and private
                private abstract void foo() {};
                                      ^
        PrivAndAbstract.java:3: error: interface abstract methods cannot have body
                private abstract void foo() {};
                                            ^
        2 errors

        First message is correct. Second message shows that javac at this position treats the method as abstract. Choosing one of two modifiers for error analysis is not correct and could confuse the user.

              sadayapalam Srikanth Adayapalam (Inactive)
              spikalev Sergei Pikalev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: