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

java.lang.instrument tests: asserts in transformers ignored; class loads pollute results; no tracing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 5.0u22, 6
    • core-svc
    • None
    • b65
    • generic
    • generic

      The eight java.lang.instrument regression tests which subclass off of ATransformerManagementTestCase have the following problems --

      Asserts are being called inside of a transformer, an assert (which throws an exception) should not be used since it effectively cancels the transformation (with ramifications on the tests) and is otherwise ignored.

      Transformer calling order is being determined by redefining a class and checking the transformations called. But class loads are not filtered out (system classes get loaded) making the results wrong and unprodictable.

      When problems occur, there is no tracing capability. This was needed to uncover the above problems and diagnose future problems.

      There are a bunch of dead variables.
      Here are the eight tests alluded to in the previous note:

          java/lang/instrument/AddTransformerTest.java
          java/lang/instrument/AddTransformerTest.java
          java/lang/instrument/NoTransformerAddedTest.java
          java/lang/instrument/NullTransformerAddTest.java
          java/lang/instrument/NullTransformerRemoveTest.java
          java/lang/instrument/RemoveAbsentTransformerTest.java
          java/lang/instrument/RemoveTransformerTest.java
          java/lang/instrument/SingleTransformerTest.java
          java/lang/instrument/TransformMethodTest.java

      I have observed TransformMethodTest.java failing due to the
      issues in my HSX-16 in JDK5 project testing. That failure mode
      looks like:

      ----------System.err:(23/1568)----------
      java version "1.5.0_22"
      Java(TM) Platform, Standard Edition for Business (build 1.5.0_22-b03)
      Java HotSpot(TM) Client VM (build 16.0-b13-internal, compiled mode)

      ATestCaseScaffold$TestCaseScaffoldException: The number of transformers that wer
      e run does not match the expected number added to manager
              at ATestCaseScaffold.assertEquals(ATestCaseScaffold.java:107)
              at ATestCaseScaffold.assertEquals(ATestCaseScaffold.java:118)
              at ATransformerManagementTestCase.verifyTransformers(ATransformerManagem
      entTestCase.java:170)
              at TransformMethodTest.testTransform(TransformMethodTest.java:50)
              at TransformMethodTest.doRunTest(TransformMethodTest.java:37)
              at ATestCaseScaffold.runTest(ATestCaseScaffold.java:35)
              at TransformMethodTest.main(TransformMethodTest.java:31)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:592)
              at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:
      94)
              at java.lang.Thread.run(Thread.java:595)

      JavaTest Message: Test threw exception: ATestCaseScaffold$TestCaseScaffoldExcept
      ion: The number of transformers that were run does not match the expected number
       added to manager
      JavaTest Message: shutting down test

      STATUS:Failed.`main' threw exception: ATestCaseScaffold$TestCaseScaffoldExceptio
      n: The number of transformers that were run does not match the expected number a
      dded to manager
      result: Failed. Execution failed: `main' threw exception: ATestCaseScaffold$Test
      CaseScaffoldException: The number of transformers that were run does not match t
      he expected number added to manager

            rfield Robert Field (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: