6 Replies Latest reply: Mar 11, 2009 3:25 AM by masijade RSS

    The type Comparable is not generic; it cannot be parameterized

    807588
      I´ve some third party sourcecode which i had to customize. I imported the code into eclipse (ganymede). The project is using a 1.5 SDK. There is some source file which shows the following error just in line 0:

      Description     Resource     Path     Location     Type
      The type Comparable is not generic; it cannot be parameterized with arguments <E>     ContentTransferComponent.java     LEMI_WEB/webcomponent/src/com/documentum/webcomponent/library/contenttransfer     line 0     Java Problem

      By copying the methods into a new class, i was able to track down the problem to the inner interface definition. Removing the inner interface removes the error from the class. However as the interface is implemented by two other classes from the same package, this isn´t really a solution.

      Is this some kind of source code error or maybe i would better have reported this issue into some of the eclipse forums?

      ======
      package com.documentum.webcomponent.library.contenttransfer;
      
      import *
      
      /**
       * Class ContentTransferComponent.
       * 
       * @author pawelz
       * @version $Revision: 12$
       */
      public abstract class ContentTransferComponent extends Component
            implements IContentTransferComponent
      {
         /**
          * Component initialisation.
          *
          * @param arg Dictionary of form arguments.
          */
         public void onInit(ArgumentList arg)
         {
            super.onInit(arg);
      
            initControlsFromConfig();
         }
      
         /**
          * Initializes controls from component's config settings.
          */
         protected void initControlsFromConfig()
         {
            try
            {
               IConfigElement initControls = lookupElement("init-controls");
               if (initControls != null)
               {
                  for (Iterator controls = initControls.getChildElements(); controls.hasNext();)
                  {
                     IConfigElement ctrl = (IConfigElement) controls.next();
                     String ctrlName = ctrl.getAttributeValue("name");
                     String ctrlType = ctrl.getAttributeValue("type");
      
                     if ((ctrlName != null && ctrlName.length() > 0)
                           && (ctrlType != null && ctrlType.length() > 0))
                     {
                        Class cl = Class.forName(ctrlType);
                        Control control = getControl(ctrlName, cl);
      
                        for (Iterator props = ctrl.getChildElements(); props.hasNext();)
                        {
                           IConfigElement initProp = (IConfigElement) props.next();
                           String propName = initProp.getChildValue("property-name");
                           IConfigElement valueElem = initProp.getChildElement("property-value");
      
                           if ((propName != null && propName.length() > 0) 
                              && valueElem != null)
                           {
                              String propValue = valueElem.getValue();
                              //BeanUtils.setProperty(control, propName, propValue);
                              HashMap propMap = new HashMap(1);
                              propMap.put(propName, propValue);
                              BeanUtils.populate(control, propMap);
                           }
                        }
                     }
                  }
               }
            }
            catch (ClassNotFoundException e)
            {
               throw new WrapperRuntimeException(e);
            }
            catch (IllegalAccessException e)
            {
               throw new WrapperRuntimeException(e);
            }
            catch (InvocationTargetException e)
            {
               throw new WrapperRuntimeException(e);
            }           
         }
      
         /**
          * Creates an instance of transport used by the service.
          * @return transport instance
          */
         protected IServiceProcessor createServiceProcessor()
         {
            Class processorClass = getProcessorClass();
            if (processorClass == null)
            {
               throw new WrapperRuntimeException("Could not create processor");
            }
            
            IServiceProcessor proc;
            try
            {
               proc = (IServiceProcessor) processorClass.newInstance();
            }
            catch (Exception e)
            {
               throw new WrapperRuntimeException("Could not instantiate processor", e);
            }
            return proc;
         }
         
         // some code removes due to max. length restricton
      
         /**
          * IBocsWriteModeConfigurator Interface
          */
         public interface IBocsWriteModeConfigurator
         {
            /**
             * Gets the Bocs write-mode selection.
             *
             * @return bocs write-mode selected
             */
            BocsWriteMode getMode();
      
            /** BOCS write modes. */
            public enum BocsWriteMode
            {
               /** BOCS write mode not applicable. */
               NOT_APPLICABLE,
               /** BOCS Synchronous write mode. */
               SYNC,
               /** BOCS Asynchronous write mode. */
               ASYNC
            }
         }
      }
        • 1. Re: The type Comparable is not generic; it cannot be parameterized
          807588
          spille2 wrote:
          I imported the code into eclipse (ganymede). The project is using a 1.5 SDK.
          These two statements make me wonder if you understand that Eclipse uses it's own compiler, not the Sun SDK, and that the JRE used to run Eclipse in, the JRE used to launch your projects in, and the version of the compiler, are all separately configurable, sometimes with unusual results. It's possible to set it up so that, for example, it's compiling code for 1.5 against 1.4 class libraries. Of course, I could be barking up the wrong tree, but this is something to check
          • 2. Re: The type Comparable is not generic; it cannot be parameterized
            masijade
            georgemc wrote:
            spille2 wrote:
            I imported the code into eclipse (ganymede). The project is using a 1.5 SDK.
            These two statements make me wonder if you understand that Eclipse uses it's own compiler, not the Sun SDK, and that the JRE used to run Eclipse in, the JRE used to launch your projects in, and the version of the compiler, are all separately configurable, sometimes with unusual results. It's possible to set it up so that, for example, it's compiling code for 1.5 against 1.4 class libraries. Of course, I could be barking up the wrong tree, but this is something to check
            Well, it's possible to do that with javac, too, just, there, it's much easier to notice that you're doing it (since you would have to type it in explicitly). ;-)
            • 3. Re: The type Comparable is not generic; it cannot be parameterized
              807588
              masijade. wrote:
              georgemc wrote:
              spille2 wrote:
              I imported the code into eclipse (ganymede). The project is using a 1.5 SDK.
              These two statements make me wonder if you understand that Eclipse uses it's own compiler, not the Sun SDK, and that the JRE used to run Eclipse in, the JRE used to launch your projects in, and the version of the compiler, are all separately configurable, sometimes with unusual results. It's possible to set it up so that, for example, it's compiling code for 1.5 against 1.4 class libraries. Of course, I could be barking up the wrong tree, but this is something to check
              Well, it's possible to do that with javac, too, just, there, it's much easier to notice that you're doing it (since you would have to type it in explicitly). ;-)
              You can make javac run itself in a different JRE?? :-)
              • 4. Re: The type Comparable is not generic; it cannot be parameterized
                masijade
                javac -bootstrapclasspath. In fact you have to use that option when using a 1.5 or higher JVM and are compiling 1.4, or earlier source, to a 1.4 or earlier target.
                • 5. Re: The type Comparable is not generic; it cannot be parameterized
                  807588
                  masijade. wrote:
                  javac -bootstrapclasspath. In fact you have to use that option when using a 1.5 or higher JVM and are compiling 1.4, or earlier source, to a 1.4 or earlier target.
                  Awesome!
                  • 6. Re: The type Comparable is not generic; it cannot be parameterized
                    masijade
                    And, excuse me, bootclasspath not bootstrapclasspath (and designate extdirs as well). ;-)