Tapestry
  1. Tapestry
  2. TAPESTRY-1816

Some tapestry-ioc tests fail on IBM JDK due to subtle differences in JDK implementations

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0.7
    • Component/s: tapestry-ioc
    • Labels:
      None
    • Environment:

      Description

      I'm tried to build tapestry5-ioc with ibm jdk

      There is 3 failed test:
      src/test/java/org/apache/tapestry/ioc/internal/services/ClassFabImplTest.java:
      ======================================================================================
      public void attempt_to_subclass_from_final_class() throws Exception
      {
      ClassFab cf = newClassFab("StringSubclass", String.class);
      try

      { cf.createClass(); }

      catch (RuntimeException ex)

      { assertExceptionRegexp( ex, "Unable to create class StringSubclass\\: .*"); }

      }
      ======================================================================================
      but on ibm jdk it's "Unable to create class StringSubclass: by java.lang.VerifyError: java.lang.String"

      src/test/java/org/apache/tapestry/ioc/services/MethodIteratorTest.java:
      ======================================================================================
      public void inherited_methods_from_super_interface() {
      MethodIterator mi = new MethodIterator(Play.class);
      assertTrue(mi.hasNext());

      // Problematic because the order in which they are returned is
      // JDK specific and not defined! Perhaps we should sort by alpha?
      MethodSignature actual = mi.next();

      assertEquals(new MethodSignature(void.class, "jump", null, null), actual);
      assertTrue(mi.hasNext());
      actual = mi.next();
      assertEquals(new MethodSignature(void.class, "run", null, null), actual);
      assertFalse(mi.hasNext());
      assertEquals(false, mi.getToString());
      }
      ======================================================================================
      the problem is already described on ibm jdk i get other order
      the solution may be to check in order neutral way here or fix MethodIterator to iterate over ordered list (i personally prefer this way)

      and the last one:
      src/test/java/org/apache/tapestry/ioc/services/MethodSignatureTest.java:
      ======================================================================================
      public void to_string() {
      MethodSignature m = find(String.class, "getChars");
      assertEquals(m.toString(), "void getChars(int, int, char[], int)");
      m = find(Class.class, "newInstance");
      assertEquals(
      m.toString(),
      "java.lang.Object newInstance() throws java.lang.IllegalAccessException, java.lang.InstantiationException");
      }
      ======================================================================================
      the problem is that i get "java.lang.Object newInstance() throws java.lang.InstantiationException, java.lang.IllegalAccessException" with jdk
      (ie wrong order of exceptions)
      also it can be fixed here or (what i likes more) to_string may return ordered list of exceptions

      i tried to fix these errors, trivial patches in attachment
      please, review and apply/comment

      1. ClassFabImplTest.patch
        0.6 kB
        Pavel Volkovitskiy
      2. MethodIterator.patch
        2 kB
        Pavel Volkovitskiy
      3. MethodSignature.patch
        1 kB
        Pavel Volkovitskiy
      4. MethodSignatureTest.patch
        0.7 kB
        Pavel Volkovitskiy

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        Thanks for the patch. I don't have access to an IBM JDK (or maybe I'm just lazy) so re-open the bug if there's a problem.

        Show
        Howard M. Lewis Ship added a comment - Thanks for the patch. I don't have access to an IBM JDK (or maybe I'm just lazy) so re-open the bug if there's a problem.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Pavel Volkovitskiy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development