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

No error for ambiguous member of intersection

    XMLWordPrintable

Details

    • b03
    • generic, x86
    • generic, windows_xp
    • Verified

    Backports

      Description

        Name: rmT116609 Date: 06/10/2004


        FULL PRODUCT VERSION :
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        When an ambiguous reference is made to a member of a type variable (either a method or an inner class), no error is reported.

        Also, the acessibility checking for members is incorrect when the type variable has multiple bounds.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        javac Test.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Test.java:7: reference to Inner is ambiguous
        Test.java:9: reference to m1() is ambiguous
        ACTUAL -
        Test.java:8: _field is not public in Base; cannot be accessed from outside package
                t._field = 3; // This should not be an accessibility error
                 ^
        1 error

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.util.*;

        public class Test<T extends Base & Intf> {

            public void foo() {
                T t = null;
                T.Inner inner = null; // This should be an ambiguous error
                t._field = 3; // This should not be an accessibility error
                t.m1(); // This should be an ambiguous error
            }

        }

        class Base {
            static class Inner {}
            int _field;
            int m1(){ return 0;}
        }

        interface Intf {
            static final String C1 = "BLAH";
            static class Inner{}
            void m1();
        }

        ---------- END SOURCE ----------
        (Incident Review ID: 276926)
        ======================================================================

        Attachments

          Issue Links

            Activity

              People

                ahe Peter Ahe
                rmandalasunw Ranjith Mandala (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: