Cannot Cast List ? extends Object as List Object

I apologize if this is a common question but I could not seem to find the proper set of search terms that yielded an answer.
Basically I have an RMI application and on the 'middle-tier' I would like to pass around references to the implementation objects and only convert to the interface type when dealing with them over RMI (I never pass an object back to the middle-tier).
public interface Questionnaire implements Remote {
    public List<? extends Comment> getComments() throws RemoteException;
public class QuestionnaireImpl extends UnicastRemoteObject implements Questionnaire {
    public List<CommentImpl> getComments() {...}
}This works fine, the issue arises when I try to do the following:
public List<Comment> getComments(int questionnaireId) throws RemoteException {
    return classLoader.getQuestionnaire(questionnaireId).getComments();
}The compiler issues a Type mismatch: cannot convert from List<capture#8-of ? extends Comment> to List<Comment> Which I find perplexing as the compiler can assure that at the very least it is a List of Comment objects.

public List<? extends Comment> getComments() throws RemoteException;
public List<Comment> getComments(int questionnaireId) throws RemoteException {
return classLoader.getQuestionnaire(questionnaireId).getComments();
The compiler issues a Type mismatch: cannot convert from List<capture#8-of ? extends Comment> to List<Comment> Which I find perplexing as the compiler can assure that at the very least it is a List of Comment objects.Yes, however Java's generics work correctly to prevent you from shooting yourself in the foot. If you have a List<Superclass> pointing at a List<Subclass>, you would be entirely within your rights to try to store an object that is not castable to Subclass in it, this breaks type safety, so the compiler will not let you do it.
Instead, create a new List<Supertype> and copy over the elements from the list returned by getComments(). There is a constructor that will do this for you.

Similar Messages

  • Microsoft Outlook 2010 The delegates settings were not saved correctly. Cannot activate Send-on-behalf-of list. You do not have sufficient permission to perform this operation on this object.

    I am trying to assign delegation to a user and I receive the following message.
    The delegates settings were not saved correctly.  Cannot activate Send-on-behalf-of list.  You do not have sufficient permission to perform this operation on this object.
    We are using 2010 for the server and client.  There are only specific mailboxes that this is happening for after being migrated from Lotus Notes.  The user can use their mailfile fine however it is just the delegation that appears corrupted somehow. 
    I'm not sure how to fix this.  I have checked the access through the security tab in ad and that looks fine.
    Any help would be appreciated.

    I did some more digging and I solved it.
    This would be the solution:
    In Active Directory Users and Computers
    -Click on VIEW
    -Click on ADVANCE FEATURES  (this is important otherwise you won't see
    the complete list in the next steps)
    -Click on the USERS container
    -Find the problem user's account
    -Right mouse the account and click on PROPERTIES
    -Click on the SECURITY tab
    -In the top box, click on the SELF account
    -In the bottom portion of the screen make sure the READ PERSONAL
    INFORMATION  & WRITE PERSONAL INFORMATION  should both be checked for
    ALLOW
    If you can compare the permissions for 'SELF' with another user you probably should set them accordingly to be safe. I noticed that for the user where setting delegates (SOB) did
    not work, more than those 2 permissions were missing.
    Good luck!
    David

  • Adding objects to list

    Hi,
    I am new java. I have a probelm adding objects to list. This is the following code.
    class Test{
    List <>dataList = new ArrayList<>();
    public List<A> getAList(){
    dataList.add(new A());
    return dataList ;
    public List<B> getBList(){
    dataList.add(new B());
    return dataList;
    }In the above code what I will pass<parameterized data> to the dataList decalred as member variable?

    bhanu wrote:
    nothing common for A and B. Both A and B are different pojos. but we can tell A and B extends from Object.I tried like that
    way. But it is not working. <? extends from Object>.Both two methods have to be in the same classYou do in that case have a bad design. Why is the same list used for both. It can't be type safe so you need to cast and the user of the list might get classcast exceptions during iteration.
    Kaj

  • Object corruption when retrieving object from List

    Hi,
    We have a batch program. There are muliple threads running which read data from database and then processes the data.
    In each thread. there is a call to fetch data from a table, create objects and populate a list and return it.
    This list is then given to another method which processes each item from the list
    This is a simplified version of what the code looks like.
    public class Manager{
         public void run(){
              Reader r = new Reader();
              Processor processor = new Processor();
              List list = reader.getItems();
              processor.processItem(list);
    public class Reader{
         public List getItems(){
              List list = new ArrayList();
              // Resultset rs = execute a query and get
    // a resultset object
              while(rs.next()){
                   Item item = new Item();
                   // set information from rs and set
    //into item
                   list.add(item);
              return list;
    public class Processor {
         public processItem(List list){
              Item item = null;
              while (!list.isEmpty()){
                   item = (Item)list.remove(0);
    In the processItem method of Processor class, when I retrieve item from the List
    it should return me an object of type Item. But very rarely what happens is that
    the object I return is not of type Item, but null or a junk class like [C@1309b55.
    Once this happens, i get a class cast exception when i am trying to cast this to
    Item class.
    Can anyone please tell me if you have encountered such a scenario before?
    The process is running in a 2 processor environment.
    It's mulithreaded, but method calls are done from within a thread.
    The ArrayList is not shared across multiple threads. It's life starts
    and ends within the run method of the thread.

    Item class is made up of three instances of three
    separate classes with corresponding getters and
    setters.
    All these 3 classes, have member variables of String,
    int and double.
    There are getter and setter methods for all of the
    variables as well as overridden equals and hashcode
    methodsYou have to show your code, inside [code] and [/code] tags.

  • Services for Objects Attachement List Display Note not Viewable

    Hi Experts!
    Good day! I'm trying to display a note in FK03 (related to Services for Objects - Attachment List) and I only see white screen pop up window. No message and text information. When I tried to use another PC I can successfully view it.
    Is there's a plugin that I may need to install?
    Your help will be greatly appreciated.

    Hi Marty
    It is my understanding that the IXOS licensing is based on users retrieving of documents not necessarily the viewer so the licensing implications of having non-IXOS viewers accessing documents using the generic archivelink viewer is still likely to result in licensing implications if an audit is conducted at any stage.
    The transaction for specifying the viewer is the OAA3 and OAG4.
    Regards,
    Athol

  • UnsupportedOperationException Error while removing object from List

    Hi,
    I need to remove a set of objects from List if it contains similar objects as the other one.
    Follwing is the code snippet of the above scenario...
    List selectedPaxList = new ArrayList();
    TreeSet seatAssignedPaxlist= new TreeSet();
    selectedPaxList.add("1");
    selectedPaxList.add("2");
    selectedPaxList.add("3");
    seatAssignedPaxlist.add("1");
    seatAssignedPaxlist.add("2");
    if(selectedPaxList.containsAll(seatAssignedPaxlist))
    selectedPaxList.removeAll(seatAssignedPaxlist);
    If i do this in java program it executes fine without any error.But if I do the same in JSP I am getting the following error......
    java.lang.UnsupportedOperationException
    at java.util.AbstractList.remove(AbstractList.java:167)
    at java.util.AbstractList$Itr.remove(AbstractList.java:432)
    at java.util.AbstractCollection.removeAll(AbstractCollection.java:351)
    Plz... help me to resolve the issue

    java.lang.UnsupportedOperationException
    at
    java.util.AbstractList.remove(AbstractList.java:167)
    at
    java.util.AbstractList$Itr.remove(AbstractList.java:43
    2)
    at
    java.util.AbstractCollection.removeAll(AbstractCollect
    ion.java:351)
    That stack trace looks wrong to me.
    ArrayList overrides the remove method, so it
    shouldn't be using the method in AbstractList. That's what I thought, too. There is either something missing or it's not an ArrayList. In fact the javadoc of AbstractList.remove sais:
    "This implementation always throws an UnsupportedOperationException."
    So it really looks like another subclass is used.
    Also
    the object it is trying to remove is a list (from
    your exmaple it should be a String)
    I could be wrong.These are just the code references not the parameters, I think.
    -Puce

  • Is there a way to add new objects to object changeability list?

    My production system is locked and I need to change object type RSFO (formula). I looked at the object changeability list and it does not contain RSFO. Is there a way to add this object to this list so I can change it directly in production? Thanks.

    hi,
    I hope you can create similar formula in the production. as in the production we can change the reports,proces chain,aggregates, infopackages.
    Ramesh

  • Global list of all custom/developed objects

    Hi all!
    We need to get a list of all custom objects of a SAP systems.
    First time we think accessing TADIR to get all repository objects of the system and after this access, get all atributes for any of the retrieved objects.
    Example:
      To a report, access TADIR and TRDIR dictionary tables. in TADIR use class of development custom or in TRDIR any of the user that don't belongs to SAP.
    But this solution to the problem is very effort and we should access so too many tables for the objects to get their attributes.
    Second time, we think filtering the objects using their namespace with FM TR_CHECK_NAME_CLASS, but this option jumps some objects, like VOFM generated objects or customer exits form VA01 transaction.
    Do any of you know the way of extracting a list of all Custom/developed objects for a System?

    Hi,
    Just check if this suffices.
    REPORT  zobjects no standard page heading
    TABLES:TADIR,TSTC,V_USERNAME,VRSD.
    TYPE-POOLS:slis,VRM.
    TYPES: BEGIN OF ittemp,
           object    LIKE tadir-object,
           obj_name  LIKE tadir-obj_name,
           text      LIKE trdirt-text,
           author    LIKE tadir-author,
           devclass  like tadir-devclass,
           name_text LIKE v_username-name_text,
           tcode like tstc-tcode,
           korrnum like vrsd-korrnum,
           END OF ittemp.
    DATA: itfinal TYPE STANDARD TABLE OF ittemp WITH HEADER LINE,
          wafinal   TYPE ittemp.
    DATA : name  TYPE vrm_id,
          list  TYPE vrm_values,
          value LIKE LINE OF list.
    DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA:itrepid TYPE sy-repid.
    itrepid = sy-repid.
    DATA:itevent TYPE slis_t_event.
    DATA:itlistheader TYPE slis_t_listheader.
    DATA:walistheader LIKE LINE OF itlistheader.
    DATA:itlayout TYPE slis_layout_alv.
    DATA:top TYPE slis_formname.
    DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER: PACKAGE LIKE TADIR-DEVCLASS.
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
    PERFORM getdata.
    PERFORM alv.
    *&      Form  GETDATA
          text
    FORM getdata.
    read the repository object table and link with username if found
    SELECT tadir~object
            tadir~obj_name
            trdirt~text
            tadir~author
            tadir~devclass
            v_username~name_text
            INTO TABLE itfinal
            FROM tadir
            LEFT JOIN v_username
            ON tadirauthor = v_usernamebname
            LEFT JOIN trdirt
            ON tadirobj_name = trdirtname
            WHERE tadir~devclass = PACKAGE
            "'$TMP'
            AND ( tadirobj_name LIKE 'Z%' OR tadirobj_name LIKE 'Y%' ).
    CHECK sy-subrc EQ 0.
    loop at itfinal.
    *TCODE FROM TSTC
    select single tcode from tstc into (itfinal-tcode) where pgmna =
    itfinal-obj_name.
    *LATEST TRANSPORT REQUEST NUMBER FROM VRSD
    select single korrnum from vrsd into (itfinal-korrnum) where objname =
    itfinal-obj_name.
    modify itfinal.
    endloop.
    delete itfinal where korrnum is INITIAL.
    SORT itfinal BY author object.
    ENDFORM.                    "GETDATA
    *&      Form  ALV
          text
    FORM alv.
    IF itfinal[] IS INITIAL.
        MESSAGE 'No Values exist for the Selection.' TYPE 'S'.
        STOP.
      ENDIF.
      DEFINE m_fieldcat.
        itfieldcat-fieldname = &1.
        itfieldcat-col_pos = &2.
        itfieldcat-seltext_l = &3.
        itfieldcat-do_sum = &4.
        itfieldcat-outputlen = &5.
        append itfieldcat to itfieldcat.
        clear itfieldcat.
      END-OF-DEFINITION.
      m_fieldcat 'OBJECT' ''   'OBJECT' ''       04  .
      m_fieldcat 'OBJ_NAME' '' 'PROGRAM NAME' '' 40 .
      m_fieldcat 'TCODE' ''    'TCODE' ''        20 .
      m_fieldcat 'TEXT' ''     'DESCRIPTION' ''  70 .
      m_fieldcat 'AUTHOR' ''   'AUTHOR' ''       80 .
      m_fieldcat 'DEVCLASS' '' 'PACKAGE' ''      30 .
      m_fieldcat 'KORRNUM' ''  'LATEST TRANSPORT REQUEST' '' 20 .
    itlayout-zebra = 'X'.
    itlayout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program      = sy-repid
            is_layout               = itlayout
           i_callback_user_command =  'LIST1'
            i_callback_top_of_page  = 'TOP'
            it_fieldcat             = itfieldcat[]
            i_save                  = 'A'
         is_variant              = ITVARIANT
            it_events               = itevent[]
         is_print                = ITPRINTPARAMS
            it_sort                 = itsort[]
          TABLES
            t_outtab                = itfinal
            EXCEPTIONS
            program_error           = 1
            OTHERS                  = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    "ALV
    *&      Form  TOP
        Top of page for ALV Report
    FORM top.
    DATA:STRING1(70),
         STRING2(70),
         title1(100),
         title2(100),
         count(10).
    describe table itfinal lines count.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
         EXPORTING
            i_list_type           = 0
         IMPORTING
            et_events             = itevent
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    string1 = 'List of Objects in Development Class'.
    concatenate string1 ':' itfinal-devclass into title1.
    walistheader-typ = 'H'.
    walistheader-info = title1.
    APPEND walistheader TO itlistheader.
    string2 = 'Total No.of Objects'.
    concatenate string2 ':' count into title2.
    walistheader-typ = 'H'.
    walistheader-info = title2.
    APPEND walistheader TO itlistheader.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary      = itlistheader
        I_LOGO                   = ''.
        I_END_OF_LIST_GRID       =
       ENDIF.
      CLEAR itlistheader.
    ENDIF.
    ENDFORM.                    "TOP
    *&      Form  list1
          ALV Interactive-
         -->R_UCOMM    text
         -->RS_SELFIELDtext
    FORM list1 USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'OBJ_NAME'.
            READ TABLE itfinal INDEX rs_selfield-tabindex.
            SET PARAMETER ID 'RID' FIELD itfinal-OBJ_NAME.
            CALL TRANSACTION 'SE38' AND SKIP FIRST SCREEN.
          ELSEIF rs_selfield-fieldname = 'TCODE'.
            READ TABLE itfinal INDEX rs_selfield-tabindex.
            SET PARAMETER ID 'TCD' FIELD itfinal-TCODE.
            CALL TRANSACTION 'SESSION_MANAGER' AND SKIP FIRST SCREEN.
         ENDIF.
      ENDCASE.
    ENDFORM.
    K.Kiran.

  • How to get List of  all activated Info objects in sap BI production system

    Hi Experts,
             For my requirement  I need list of all activated info objects in sap bi production system.
    Can any body suggest any thing.

    Hi,
    Check in the following table, all the below tables are for InfoObejct related only
    RSDIOBJ -
    Directory of all InfoObjects
    RSDIOBJT------ Texts of InfoObjects
    RSDIOBJ------- Directory of all InfoObjects
    RSDIOBJT----- Texts of InfoObjects
    RSDATRNAV------ Navigation Attributes
    RSDATRNAVT----- Navigation Attributes
    RSDBCHATR------ Master Data Attributes
    RSDCHABAS------- Basic Characteristics (for Characteristics,Time Characteristics, and Units)
    RSDCHA----
    Characteristics Catalog
    RSDDPA -
    Data Package Characteristic
    RSDIOBJCMP----
    Dependencies of InfoObjects
    RSKYF----
    Key Figures
    RSDTIM----
    Time Characteristics
    RSDUNI -
    Units
    Thanks
    Reddy

  • When can we expect a patch for Object Array List Data Provider?

    Hey JSC Team!
    When can we expect maybe, just maybe a minor patch for the Object Array List Data Provider loading class problem? Next Month? This Year? Next Year? Near Future? Long in the future? Sometime in the 22nd century?

    I think one of the problem is
    when u declare the ObjectListDataProvider in ur backing bean
    it doesnt appear in the design time straight away
    u have to clean build close and re open the project
    which is quite time consuming.

  • Function Module which gives complete list of objects that another object to

    Hi All,
    Is there any standard FM that can give us complete list of objects that another object(Order/Cost Center) settles to??
    Thanks in advance,
    Prathima

    Hi,
    Question is not clear.
    Revert back,
    Regards,
    Naveen

  • How to get a list of schemas that contain objects

    Hello,
    Kindly check on how to get a list of schema that contain objects.
    Regards,
    Tarman.

    Here is the oracle version info and it run under HP-UX.
    Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
    With the Partitioning and Real Application Clusters options
    JServer Release 9.2.0.5.0 - Production
    I have problem when run the query,
    SQL> select owner, count(object_name) from dba_objects where owner is not in ('S
    YS','SYSTEM','SYSMAN');
    select owner, count(object_name) from dba_objects where owner is not in ('SYS','
    SYSTEM','SYSMAN')
    ERROR at line 1:
    ORA-00908: missing NULL keyword
    Thanks.

  • Can we create a 2 dimensionnal array (Object[][]) from List.toArray() ?

    I have a List that contains arrays and want to obtain a 2D array from the data stored into the list.
      //Creation of the list
      List list = new ArrayList() ;
      Object anArray = new Object[]{"One", "Two", "Three"} ;
      list.add(anArray) ;
      anArray = new Object[]{"Four", "Five", "Six"} ;
      list.add(anArray) ;
      anArray = new Object[]{"Seven", "Eight", "Nine"} ;
      list.add(anArray) ;
      //Creation of the array
      Object[][] data = (Object[][]) list.toArray() ;
      //We should obtain the same as :
      data = new Object[][]{
        {"One", "Two", "Three"},
        {"Four", "Five", "Six"},
        {"Seven", "Eight", "Nine"}
      } ;How can I, with a single instruction convert my List to an array of arrays (Object[][]) ?

    Object[][] data = (Object[][]) list.toArray(new Object[0][0]);

  • Save tree the lists of which is class' object

    Hi, my question :
    how can i save tree the lists of which is class' object?
    i save tree with the help of ObjectOutputStream class, but when i read tree object from file i have leaf without name(clean leaf)
    how read and save tree in file for normal with it?
    Code of my function for save tree:
    import javax.swing.JTree;
    import java.io.*;
    import java.util.*;
    public class SaveTree {
        public SaveTree(){
        public void saveTree(JTree tree){
            try{
            ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("tree.info"));
            out.writeObject(tree);
            out.close();
            catch(Exception e){
                e.printStackTrace();
        public JTree loadTree(){
            JTree tree = new JTree();
            try{
                ObjectInputStream in = new ObjectInputStream(new FileInputStream("tree.info"));
                tree = (JTree)in.readObject();
                in.close();
            catch(Exception e){
                e.printStackTrace();
            return tree;
    }the code where i create new node as class' object
    public void actionPerformed(ActionEvent e) {
            String command = e.getActionCommand();
            if (ADD_COMMAND.equals(command)) {
                //Add button clicked
                book = new DefaultMutableTreeNode(new BookInfo
                (name.getText(),
                "file:///"+ System.getProperty("user.dir") + "/" + ID.getText() + ".html", Integer.parseInt(ID.getText())));           
                treePanel.addObject(book);
                name.setText("");
                ID.setText("");
    }my class BookInfo
    public class BookInfo {
            public String bookName;
            public String bookURL;
            private int bookID;
            public BookInfo(String book, String filename, int ID) {
                bookID = ID;
                bookName = book;
                bookURL = filename;
                System.out.println(bookURL);
                if (bookURL == null) {
                    System.err.println("Couldn't find file: "
                                       + filename);
            public String toString() {
                return bookName;
            public int getID(){
                return bookID;
            public void setID(int ID){
                bookID = ID;
        }thanks for attention ! :)

    Jos, thanks for answer :)
    Erm, get the TreeModel from the JTree, serialize it and later deserialize it and set it as the TreeModel for your JTree again?
    kind regards,
    JosHm, i save treeModel the same way, but when i (de)serialize treeModel from file i get clean tree
    my function to save treeModel
    class Save{
    public Save(){}
    public DefaultTreeModel loadModel(DefaultTreeModel model){
            try{
                ObjectInputStream in = new ObjectInputStream(new FileInputStream("tree.info"));
                model = (DefaultTreeModel)in.readObject();
                in.close();
            catch(Exception e){
                e.printStackTrace();
            return model;
            public DefaultTreeModel saveModel(DefaultTreeModel model){
            try{
                ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("tree.info"));
                out.writeObject(model);
                out.close();
            catch(Exception e){
                e.printStackTrace();
            //return model;
    }and here i init tree with treeModel
    Save save = new Save();
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(myObject);
    DefaultTreeModel model = new DefaultTreeModel(root);
    JTree tree = new JTree(save.saveModel(model));
    JPanel panel  = new JPanel();
    panel.add(new JScrollPane(tree));
    this.add(panel);Edited by: Tmrs on May 18, 2008 6:00 AM

  • Reference object structure list iam getting only functional location no

    Dears
    There is one query from our client that in reference object structure list he is getting only functional location no and not functional location description.i asked him to go to menu settings field selection -functional location and from the choose list  ask him to select functional location description .But still he couldn't get the required one. Can any body tell me the reason.

    Hi,
    You can achieve it from OIAJ tcode and set the required setting for your field IFLO-PLTXT.
    Regards,
    Keerthi

Maybe you are looking for

  • Query Not reflected with Updated Data

    Dear Experts, I am facing a Problem in query data updation.    Data has been daily updating in infoprovider successfully ,But when user run query through Bex he is always shown old data.  Then I go to RSRT and generate the query and data got updated.

  • Sharing a WiFi Connection in OSX

    Lets say your in a hotel that has wifi and you have to pay $10 a day for the connection.  You don't want to have to pay $10 again for your iPad and iPhone to connect as well. I would like to share the WiFi connection on my MAC with other devices.  I

  • Post-Processing JSP output

    I need to strip out any white space from the JSP�s HTML output, since the 3rd party browser I�m developing for has numerous bugs when it encounters white space between HTML tags� (Especially with nested tables) I�ve prototyped the following code samp

  • BEA Web Service Session Example (Reformatted)

    Hi,<br> <p> Has anyone been able to get access to the HTTP Session functionality from a web service under WebLogic 8.1sp1 (Service Pack 1)? I tried the example as shown at http://e-docs.bea.com/wls/docs81/webserv/api.html#1067906. The relevant code s

  • Recovery Slider: Color Changes with Camera Profiles, not so much with ACR 4.4 Profile?

    I'm sure there's a reason for this, and not necessarily a defect, but I have to ask: The recovery slider: if I use the Recovery Slider on an image set to the ACR 4.4 camera calibration profile, this helps control my highlights without affecting the o