3 Replies Latest reply: Feb 6, 2012 4:40 PM by 263312 RSS

    ObjectStreamClass.lookup()

    263312
      This program seems to return incorrect results for ObjectStreamClass.lookup(Class c)

      public class OSCLookup {

      public static void main(String[] args) {
      ObjectStreamClass lookup = ObjectStreamClass.lookup(Object.class);
      System.err.println(lookup);
      lookup = ObjectStreamClass.lookupAny(Object.class);
      System.err.println(lookup);
      lookup = ObjectStreamClass.lookup(Object.class);
      System.err.println(lookup);
      }
      }

      The second call to lookup() should return null but instead returns a cached result from lookupAny(). This behavior difference seems to contradict the javadoc for lookup(), is inconsistent with hotspot and causes the serialized forms of other class descriptors to vary I think.

      Thoughts?
        • 1. Re: ObjectStreamClass.lookup()
          263312
          Forget to mention, this is my jrockit version:

          java version "1.6.0_26"
          Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
          Oracle JRockit(R) (build R28.1.4-7-144370-1.6.0_26-20110617-2130-windows-x86_64, compiled mode)
          • 2. Re: ObjectStreamClass.lookup()
            Mattis Castegren-Oracle
            Hi. I have verified the reproducer, and that HotSpot produces the expected behavior. Since this is not a regression (I see the same behavior in R27), this will not have enough priority to be fixed, especially since JRockit is in sustaining mode and no new feature releases are planned. If this is a problem for you though, please open a support ticket and we can look at it then.
            • 3. Re: ObjectStreamClass.lookup()
              263312
              I'll leave it to our customers that might have support contracts to open a support ticket. We've worked around the issue internally hacking up these ObjectStreamClass instances with reflection and logging a warning in our logs indicating this is a known jrockit bug

              We're an ISV (terracotta.org) so we don't have any means for opening a support ticket with oracle.