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

The dynamic proxy feature does not work correct with char types.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • core-libs



      Name: sl110371 Date: 06/30/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


      /*

      The dynamic proxy feature does not work correct with char types.

      See the following program and output:

      java.lang.NoClassDefFoundError: java/lang/Char
      at $Proxy0.<clinit>(Unknown Source)
      at java.lang.reflect.Constructor.newInstance
      (Native Method)
      at java.lang.reflect.Proxy.newProxyInstance
      (Proxy.java:562)
      at Bug.main(Bug.java:34)

      java.lang.NoClassDefFoundError: java/lang/Char
      at $Proxy1.get(Unknown Source)
      at Bug.main(Bug.java:46)

      */


      import java.lang.reflect.*;


      public class Bug
      {


      public interface IPut
      {
      void put(char c);
      }


      public interface IGet
      {
      char get();
      }


      static private final InvocationHandler DummyInvocationHandler =
      new InvocationHandler() {
      public Object invoke(Object proxy, Method method, Object
      [] args)
      throws Throwable
      {
      return null;
      }
      };


      public static void main(String[] args)
      {
      try {

      // instanciation of proxy does not work

      Proxy.newProxyInstance(
      ClassLoader.getSystemClassLoader(),
      new Class[] {IPut.class},
      DummyInvocationHandler
      );

      } catch (Throwable e) {
      e.printStackTrace();
      }

      try {

      // method call of proxy does not work

      (
      (IGet)Proxy.newProxyInstance(
      ClassLoader.getSystemClassLoader(),
      new Class[] {IGet.class},
      DummyInvocationHandler
      )
      ).get();

      } catch (Throwable e) {
      e.printStackTrace();
      }
      }


      }
      (Review ID: 106689)
      ======================================================================

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: