6 Replies Latest reply: Oct 8, 2010 2:06 PM by 801264 RSS

    type erasure for doubly bounded type parameter

    801262
      what will be the type erasure for a doubly bounded type parameter like

      SomeClass < T extends SomeClass_A , super SomeClass_B >
        • 1. Re: type erasure for doubly bounded type parameter
          802316
          Am I missing something, but the type erasure class will be just.

          SomeClass
          • 2. Re: type erasure for doubly bounded type parameter
            801264
            The example isn't valid. You can't do what you're trying to do.

            If you can give a valid example, we can help you figure out the erasure.
            • 3. Re: type erasure for doubly bounded type parameter
              Mohan
              srinivas.a wrote:
              what will be the type erasure for a doubly bounded type parameter like

              SomeClass < T extends SomeClass_A , super SomeClass_B >
              Type variables have an optional bound, T & I1 ... In. The bound consists of either a type variable, or a class or interface type T possibly followed by further interface types I1 , ..., In. If no bound is given for a type variable, Object is assumed. It is a compile-time error if any of the types I1 ... In is a class type or type variable. The erasures (§4.6) of all constituent types of a bound must be pairwise different, or a compile-time error occurs. The order of types in a bound is only significant in that the erasure of a type variable is determined by the first type in its bound, and that a class type or type variable may only appear in the first position.
              • 4. Re: type erasure for doubly bounded type parameter
                801264
                user876092 wrote:
                srinivas.a wrote:
                what will be the type erasure for a doubly bounded type parameter like

                SomeClass < T extends SomeClass_A , super SomeClass_B >
                Type variables have an optional bound, T & I1 ... In. The bound consists of either a type variable, or a class or interface type T possibly followed by further interface types I1 , ..., In. If no bound is given for a type variable, Object is assumed. It is a compile-time error if any of the types I1 ... In is a class type or type variable. The erasures (§4.6) of all constituent types of a bound must be pairwise different, or a compile-time error occurs. The order of types in a bound is only significant in that the erasure of a type variable is determined by the first type in its bound, and that a class type or type variable may only appear in the first position.
                If you're going to copy verbatim from another source, it would be nice to cite it and give a link. In this case, I'll do it for you. This is from the JLS, Section 4.4: http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#108850

                Link markup broken?
                • 5. Re: type erasure for doubly bounded type parameter
                  Darryl Burke
                  Mark Peters wrote:
                  Link markup broken?
                  See the [url http://forums.oracle.com/forums/help.jspa]FAQ.

                  db
                  • 6. Re: type erasure for doubly bounded type parameter
                    801264
                    Darryl Burke wrote:
                    Mark Peters wrote:
                    Link markup broken?
                    See the [url http://forums.oracle.com/forums/help.jspa]FAQ.
                    db Fair enough, I see the syntax has changed, but the FAQ doesn't seem to address the "Insert a link" button in the post editor not working properly. That feature uses the old markup so it should probably be fixed or removed.