1 Reply Latest reply on Jan 18, 2008 12:44 PM by Jessica Kerr

    Linkage Errors: errors in the example

    Jessica Kerr Newbie

      In the Application Reference for v4.0.5, Chapter 1, http://docs.jboss.org/jbossas/guides/j2eeguide/r2/en/html/ch2.chapter.html#d0e577:

      Example 1.5 contains four class definitions. The first one, class <C,L1>, seems to have an error. First, on line 3:

      <Spoofed,L1>L1 x = <Delegated, L2>L2

      should be:

      <Spoofed,L1>L1 x = <Delegated, L2>L2.g()

      The text talks about the class <Spoofed,L2> returned by Delegated.g() on this line, but the method call is missing in the example.

      The second class defined, <Delegated,L2>, seems to have a subtler, but important, error. On line 2:

      static <Spoofed,L2>L3 g() {...}

      should be:

      static <Spoofed,L2>L2 g() {...}

      If I'm understanding the detailed explanation, the point of this example is that on line 3 of class <C,L1>, the VM realizes that <Delegated,L2> is going to return a SpoofedL2, that is, a Spoofed initiated by L2 because L2 is the class loader that defined Delegated. True?

        • 1. Re: Linkage Errors: errors in the example
          Jessica Kerr Newbie

          One more possible error in the same section:

          Java addresses this problem by generating loader constraints to validate type consistency when the types being used are coming from different defining class loaders. For the example, the VM generates a constraint SpoofedL1 = SpoofedL2....

          Wait, isn't this a constraint about types coming from different initiating class loaders?

          This section is extremely detailed and interesting. A little more internal consistency would make it easier to understand.