Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-19342

Update code to cope with generics added to org.eclipse.core.runtime package API

    XMLWordPrintable

Details

    Description

      We need to detect and address any part of our code affected by generics added to the org.eclipse.core.runtime package API.

      From https://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg11590.html :

      See https://bugs.eclipse.org/bugs/show_bug.cgi?id=442021

      Markus Keller wrote up an nice summary of what consumers should do to fix any warnings that may be caused by this change at https://bugs.eclipse.org/bugs/show_bug.cgi?id=442021#c25

      Here is a copy of the recommendations if you are going to compile against the latest version of org.eclipse.equinox.common:

      1. In MANIFEST.MF, update your Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)", or org.eclipse.equinox.common;bundle-version="[3.7.0,4.0.0)", or update your Import-Package: org.eclipse.core.runtime; version="[3.5,4.0)"

      2. If your bundle re-exports one of these bundles, then you also have to make sure the minor version is incremented.

      3. Remove unnecessary casts (Clean Up, or Problems view > Quick Fix > Select All)

      4. Update implementations of IAdaptable#getAdapter(Class<T>), unless you override another implementation of that method that still uses the old signature.

      Typical change:
      Old:

              public Object getAdapter(Class adapter) {
                      if (ICompilationUnit.class.equals(adapter))
                              return getCompilationUnit();
                      return null;
              }
      

      New:

              public <T> T getAdapter(Class<T> adapter) {
                      if (ICompilationUnit.class.equals(adapter))
                              return adapter.cast(getCompilationUnit());
                      return null;
              }
      

      5. Update implementations of IAdapterFactory

      Hint for 4. & 5.:

      • Open Type Hierarchy on IAdaptable, etc.
      • In the view menu, select a working set that contains your projects
      • In the methods list of the Type Hierarchy view, select the methods, and then click the first toolbar button (Lock View and Show Members in Hierarchy)

      Attachments

        Activity

          People

            jmaury@redhat.com Jeff MAURY
            fbricon@redhat.com Fred Bricon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: