< prev index next >

test/jdk/jdk/dynalink/TrustedDynamicLinkerFactoryTest.java

Print this page
@@ -175,10 +175,12 @@
          }
  
          Assert.assertEquals(linkerReachCounter[0], 2);
      }
  
+     private static class TestObject {}
+ 
      @Test
      public void prelinkTransformerTest() throws Throwable {
          final DynamicLinkerFactory factory = newDynamicLinkerFactory(true);
          final boolean[] reachedPrelinkTransformer = { false };
  

@@ -191,11 +193,11 @@
          final MethodType mt = MethodType.methodType(Object.class, Object.class, String.class);
          final DynamicLinker linker = factory.createLinker();
          final CallSite cs = linker.link(new SimpleRelinkableCallSite(new CallSiteDescriptor(
                  MethodHandles.publicLookup(), GET_PROPERTY, mt)));
          Assert.assertFalse(reachedPrelinkTransformer[0]);
-         Assert.assertEquals(cs.getTarget().invoke(new Object(), "class"), Object.class);
+         Assert.assertEquals(cs.getTarget().invoke(new TestObject(), "class"), TestObject.class);
          Assert.assertTrue(reachedPrelinkTransformer[0]);
      }
  
      @Test
      public void internalObjectsFilterTest() throws Throwable {

@@ -210,17 +212,17 @@
          final MethodType mt = MethodType.methodType(Object.class, Object.class, String.class);
          final DynamicLinker linker = factory.createLinker();
          final CallSite cs = linker.link(new SimpleRelinkableCallSite(new CallSiteDescriptor(
                  MethodHandles.publicLookup(), GET_PROPERTY, mt)));
          Assert.assertFalse(reachedInternalObjectsFilter[0]);
-         Assert.assertEquals(cs.getTarget().invoke(new Object(), "class"), Object.class);
+         Assert.assertEquals(cs.getTarget().invoke(new TestObject(), "class"), TestObject.class);
          Assert.assertTrue(reachedInternalObjectsFilter[0]);
      }
  
      @Test
      public void autoLoadedLinkerTest() {
-         testAutoLoadedLinkerInvoked(new Object(), "toString");
+         testAutoLoadedLinkerInvoked(new TestObject(), "toString");
      }
  
      @Test
      public void autoLoadedLinkerSeesStaticMethod() {
          testAutoLoadedLinkerInvoked(StaticClass.forClass(System.class), "currentTimeMillis");
< prev index next >