Annotation processor observes interface private methods as default methods

XMLWordPrintable

        Let's consider interface below:

        interface MyIntf {
            private int foo(int x) { return x+1; }
        }

        When it's compiled and resulted class-file is processed by annotation processor the j.l.m.e.Element instance corresponding to the method foo has 'private' and 'default' modifiers as j.l.m.e.Element.getModifiers() method returns. This looks like a bug.

        The minimized testcase is attached in order to reproduce, please:
        1. Unzip attached archive to some directory on Unix/Linux machine, say A;
        2. Modify A/Test61/test.sh by setting JDK_HOME to your JDK root dir;
        3. Run A/Test61/test.sh;

        This results in following output:
        Enclosed element: foo(int) modifiers [private]
        Enclosed element: foo(int) modifiers [private, default]

        The first line corresponds to annotation processor running against source file.
        The second one corresponds to annotation processor running against class file.

              Assignee:
              Srikanth Adayapalam (Inactive)
              Reporter:
              Georgiy Rakov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: