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

6 JCK6a compiler negative tests for cyclic inheritance fail in "AP" version against JDK 7 b09

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 6.0a
    • Fix Version/s: 7
    • Component/s: core-libs
    • Labels:

      Backports

        Description

        JCK: JCK-runtime-6a b07
        J2SE: FAIL - JDK7 b09
        Platform[s]: FAIL - All
        switch/Mode: FAIL - default

        Six tests:
        lang/CLSS/clss049/clss04905/clss04905a.html
        lang/CLSS/clss049/clss04906/clss04906a.html
        lang/ICLS/icls039/icls03904/icls03904a.html
        lang/ICLS/icls039/icls03913/icls03913a.html
        lang/ICLS/icls039/icls03916/icls03916a.html
        lang/INTF/intf009/intf00902/intf00902a.html

        fail against JDK 7 b09 with the message like this:

        Note: Check "TopLevel_14" failed for class javasoft.sqe.tests.lang.intf009.intf00902.intf00902
        Note: TopLevel_14: Failed. List returned by Elements.getAllMembers() method must contain List of elements returned by TypeElement.getEnclosedElements()
        Note: Check "TopLevel_11_1" failed for class javasoft.sqe.tests.lang.intf009.intf00902.intf00902
        Note: TopLevel_11_1: Failed. Constructors must be within all members
        Note: TopLevel_11_2: Passed. OK
        Note: TopLevel_11_3: Passed. OK
        Note: Check "TopLevel_12_1" failed for class javasoft.sqe.tests.lang.intf009.intf00902.intf00902
        Note: TopLevel_12_1: Failed. Methods must be within all members


        All tests are annotation processing test for negative tests on cyclic inheritance.
        JTRs attached.
        There is an inconsistency between
        results of javax.lang.model.util.Elements.getAllMembers(..) and javax.lang.model.util.ElementFilter.constructorsIn(..) for classes that cyclically inherit each other.

        --- CR6534348.java ---------------------------------------
        class CR6534348_1 extends CR6534348_2 {}
        class CR6534348_2 extends CR6534348 {}
        public class CR6534348 extends CR6534348_1 { }
        ----------------------------------------------------------

        --- MyProcessor.java -------------------------------------
        @SupportedAnnotationTypes("*")
        @SupportedSourceVersion(SourceVersion.RELEASE_6)
        public class MyProcessor extends AbstractProcessor {

            public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
                if (roundEnv.getRootElements().size() > 0) { performCheck(roundEnv.getRootElements()); }
                return true;
            }

            private void performCheck(Set<? extends Element> rootElements) {
                for (TypeElement typeElement : ElementFilter.typesIn(rootElements)) {
                    List<? extends Element> allMembers = processingEnv.getElementUtils().getAllMembers(typeElement);
                    List<? extends Element> enclosedElements = typeElement.getEnclosedElements();
                    List<ExecutableElement> constructorsList = ElementFilter.constructorsIn(enclosedElements);
                    assert allMembers.containsAll(constructorsList) :
                           "Constructors must be among all members";
                }
            }
        }
        ----------------------------------------------------------

        For class CR6534348 collection "allMembers" contains zero elements while "constructorsList" contains default constructor.
        The same thing happens with methods obtained using javax.lang.model.util.ElementFilter.methodsIn() - ElementUtils.getAllMembers() is still empty

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  darcy Joe Darcy
                  Reporter:
                  pastepan Pavel Stepanov (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: