Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1490

Gson as an OSGi bundle is not working on JDK 11.

    XMLWordPrintableJSON

Details

    Description

      As requested here:

      https://github.com/apache/incubator-netbeans/pull/629#commitcomment-30459921

      Gson included in NetBeans is used as an OSGi bundle. But doing "new Gson()" from another module on JDK 11 crashes:

      java.lang.NoClassDefFoundError: java/sql/Time
          at com.google.gson.Gson.<init>(Gson.java:240)
          at com.google.gson.Gson.<init>(Gson.java:174)
          at test.ExpTest.testTest(ExpTest.java:33)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:77)
          at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:460)
          at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:386)
          at java.base/java.lang.Thread.run(Thread.java:835)
      Caused by: java.lang.ClassNotFoundException: java.sql.Time
          at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:718)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
          at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:420)
          at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
          at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
          at org.netbeans.modules.netbinox.NetbinoxLoader.loadClass(NetbinoxLoader.java:58)
          at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

      To reproduce, please download the attached gson-osgi.zip, unpack, open in NetBeans, and run tests - make sure the tests are running on JDK 11.

       

      Attachments

        1. gson-osgi.zip
          6 kB
          Jan Lahoda

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h