Return tpe

Hello,
does somebody know why I can't compile this:
public interface SuperInterface{}
public class SubClass implements SuperInterface{}
public class SomeClass{
ArrayList<SubClass> list;
public ArrayList<SuperInterface> someMethod(){
return list;
I get an error "incompatible types"
Thanks
Greetrz vuystie

Let me ask a question from outside the programmer domain: "Is a dog collar an animal collar?"
You might say, "Sure. An animal collar is a collar for some kind of animal. A dog is certainly some kind of animal, so a dog collar is an animal collar."
Suppose I clarified thus: "An animal collar is a collar for any kind of collar. To be called an 'animal collar' It would have to work on a dog, a cat, or a goldfish." Now that's strange definition of "animal collar", but it clearly implies that a dog collar cannot be assumed to be an animal collar.
The world is full of containers and accessories that are associated with broader or narrower categories of objects. There are boxes for household goods and boxes for books. There are brushes for painting walls and brushes for painting unsealed concrete walls. There are jacks that will lift any automobile and jacks that will lift a Mazda Miata.
In Java (remember Java), this distinction (as Szobel pointed out) is expressed like this: Jack<Auto> j ;           // this jack can lift any model of automobile
Jack<? extends Auto> j ; // this jack can lift some model of automobile
Collar<Animal> c ;           // this collar fits any breed of animal
Collar<? extends Animal> c ; // this collar fits some breed of animalAnd the distinction is very important in programming. Your someMethod, is it supposed to return a list that contains only Superinterface objects? Or is is supposed to return a list into which you can put any Superinterface objects you want? You declared the method as the latter and then implemented it as the former.
Does this help at all?

Similar Messages

  • Tpconnect returns 0

    Hi,
    I have written by first conversational client/server today. I am facing a problem with it.
    The tpconnect is returning 0 as the connection descriptor. Is a connection descriptor value of 0 valid? I have made a call to tpsend immediately after this and it is giving me the error " tpsend failed tperrno 4".
    I have mentioned CONV=Y in the ubbconfig file also.
    Can anyone please help me.

    Hi Little,
    This is the client and server program that I have written. Could you please go thru it and let me know where I have gone wrong.
    Client Program:
    #include "signon.h"
    #define LINE 80
    #define RDB_OK 0
    extern int TuxedoSignOn(char username,char password,int dialog,int ErrorCode,char *service);
    #if defined(__STDC__) || defined(__cplusplus)
    main(int argc, char *argv[])
    #else
    main(argc, argv)
    int argc;
    char *argv[];
    #endif
    int cd;
    char reply[LINE+1];
    int ErrorCode;
    char *line;
    int dialog;
    long len;
    int ret;
    long revent;
    char services[32];
    dialog=0;
    ErrorCode=RDB_OK;
    if((ret=TuxedoSignOn("xrs","satyam123",&dialog,&ErrorCode,"TOCONVERT"))==-1)
    fprintf(stderr,"Tuxedo SignOn Failed and %d error occured",tperrno);
    userlog("Tuxedo SignOn Failed and %d error occured", tperrno);
    exit(1);
    if ((line =(char *) tpalloc("STRING","",LINE+1)) == (char *)NULL)
    (void)userlog("In client tpalloc failed tperrno %d", tperrno);tperrno);
    exit(1);
    cd=dialog;
    (void)puts("To convert a string to Upper type 'U'");
    (void)puts("To convert a string to Lower type 'L'and press");
    (void)puts("<return>\n");
    (void)puts("To Exit press q and <return>");
    for(;; )
    (void)gets(reply);
    line=reply;
    printf("%s\n",line);
    len=strlen(reply);
    printf("Len=%d\n",len);
    if(tpsend(cd,line,len,TPRECVONLY,&revent) == -1)
    (void) fprintf(stderr,"In client tpsend failed tperrno %d\n",tpe
    rrno);
    (void) userlog("In client tpsend failed tperrno %d\n",tperrno);
    tpterm();
    exit(1);
    if (tprecv(cd,&line,&len,TPNOCHANGE,&revent) != -1)
    (void)fprintf(stderr,"In client tprecv failed tperrno %d revent %ld\n",
    tperrno,revent);
    (void)userlog("In client tprecv failed tperrno %d revent %ld",tperrno,r
    event);
    (void)tpterm();
    exit(1);
    /* anything other than a send or disconnect event is an error.*/
    if ((tperrno != TPEEVENT) || ((revent != TPEV_SENDONLY) && (revent != TPEV_SVCSUCC)))
    (void)fprintf(stderr,"tprecv failed tperrno %d revent %ld\n",tperrno,rev
    ent);
    (void)userlog("In client tprecv failed tperrno %d revent %ld",tperrno,re
    vent);
    (void)tpterm();
    exit(1);
    if (strcmp(reply, "q") == 0 || revent == TPEV_SVCSUCC)
    break;
    (void) printf("%s\n_________\nanother request ??\n",line);
    if (tpterm() == -1)
    (void)fprintf(stderr,"In client failed to leave application\n\n");
    (void)userlog("failed to leave application\n");
    exit(1);
    return(0);
    This is the server program that I have written:
    #include <Uunix.h> /* TUXEDO */
    #include <ctype.h>
    #include "signon.h"
    #define LINE 80 /* size of balance request line */
    #define NAMELEN 16
    #define STATLEN 80
    static char pgmname[STATLEN]; /* program name = argv[0] */
    int
    #if defined(__STDC__) || defined(__cplusplus)
    tpsvrinit(int argc, char **argv)
    #else
    tpsvrinit(argc,argv)
    int argc;
    char **argv;
    #endif
    (void)strcpy(pgmname, argv[0]); /* program name */
    userlog("%s started", pgmname);
    return(0);
    void
    #if defined(__STDC__) || defined(__cplusplus)
    TOCONVERT(TPSVCINFO *svcinfo)
    #else
    TOCONVERT(svcinfo)
    TPSVCINFO *svcinfo;
    #endif
    char c; /* Option character */
    char str[STATLEN]; /* To hold the string */
    char svc_name[NAMELEN]; /* service name */
    int audrl=0; /* audit return length */
    long revent; /* events for send/recv */
    char *line;
    long len;
    /* allocate buffer to receive balance request. */
    if ((line = tpalloc("STRING","",LINE+1)) == (char *)NULL) {
    (void)userlog("%s: In Server string tpalloc failed tperrno %d",
    pgmname,tperrno);
    (void)tpreturn(TPFAIL,0,NULL,0,0);
    for (;;) {
    /* receive balance request */
    if (tprecv(svcinfo->cd,&line,&len,TPNOCHANGE,&revent) != -1)
    (void)sprintf(line,"%s: In Server Request failed (see ulog)\n",pgmname);
    (void)tpreturn(TPFAIL,0,line,strlen(line),0);
    /* if anything other than an event is received, its an error. */
    switch (tperrno) {
    case TPEEVENT:
    switch ((int)revent) {
    case TPEV_SENDONLY:
    break;
    case TPEV_DISCONIMM: /* disorderly disconnect */
    (void)tpreturn(TPSUCCESS,0,NULL,0,0);
    break;
    default:
    (void)userlog("%s: Request Failed\n", pgmname);
    (void)sprintf(line,"%s Request Failed\n",pgmname);
    (void)tpreturn(TPFAIL,0,line,strlen(line),0);
    (void)sscanf(line,"%c %s",&c,&str);
    switch((int)c) {
    case 'q':
    (void)tpreturn(TPSUCCESS,0,NULL,0,0);
    break;
    case 'U':
    case 'u':
    if(str == NULL)
    sprintf(line, "Usage: U|u <String> ");
    (void)tpreturn(TPFAIL,0,line,strlen(line),0);
    TOUPPER(str,line);
    break;
    case 'l':
    case 'L':
    if(str == NULL)
    sprintf(line, "Usage: L|l <String> ");
    (void)tpreturn(TPFAIL,0,line,strlen(line),0);
    TOLOWER(str,line);
    break;
    default:
    (void)sprintf(line,"Usage U|L [string]\n");
    (void)tpreturn(TPFAIL,0,line,strlen(line),0);
    /* return the Converted String */
    if (tpsend(svcinfo->cd,line,0,TPRECVONLY,&revent) == -1) {
    switch (tperrno)
    case TPEEVENT:
    switch ((int)revent) {
    case TPEV_DISCONIMM:
    (void)tpreturn(TPSUCCESS,0,NULL,0,0);
    default:
    (void)userlog("%s: tpsend failed tperrno %d reve
    nt %ld", pgmname,tperrno,revent);
    (void)sprintf(line,
    "%s: tpsend failed (see ulog)\n",
    pgmname);
    (void)tpreturn(TPFAIL,0,line,strlen(line),0);
    #if defined(__STDC__) || defined(__cplusplus)
    TOUPPER(char str,char line)
    #else
    TOUPPER(str, line)
    char str, line;
    #endif
    char *upper_str;
    upper_str=toupper(str);
    sprintf(line,"String Converted to Upper is %s", upper_str);
    #if defined(__STDC__) || defined(__cplusplus)
    TOLOWER(char str,char line)
    #else
    TOLOWER(str, line)
    char str, line;
    #endif
    char *lower_str;
    lower_str=tolower(str);
    sprintf(line,"String Converted to Lower is %s", lower_str);
    }

  • Can I return my laptop

    I bought my laptop around the beginning of March 2011. I am very dissatisfied with it and was wondering if I could bring it in for a refund.The computer is a Dell Inspiron. 

    I'm sorry, but you only have 14 days to return a laptop. You could send it in for repair if there is an issue with the device.
    I am a Bestbuy employee who volunteers on these boards on my own time. I am not paid for posting here, and you should understand that my opinions are exactly that - opinions. I do not represent Bestbuy in any way.
    : Open Mailbox

  • Return of Free goods item - Problem in item category

    I am trying to create return order of Free sample billing
    (ZFDP). The return order type for the free sample is ZFDR.
    We have specified Item category for the ZFDR is RENN (Free good item) in IMG Activity -> Assign Item categories.
    When I create order and save it, it prompts me to enter G/L Account.
    This material is free. It should not prompt G/L Account for it. There is no revenue recognition specified for the item category. I tried changing item category to ZKLN i.e Free of charge item. This item category does not prompt for G/L Account while creating order. but I can not use this item category because it prompts me for Avialability. I can not remove the Avaialabilty check for it because the same item category is used in the Free sample order where availability check is required
    In ZFDP order type, we are issuing 100% discount by using R100
    discount condition.  Please let me know how can I solve this problem.
    I think there is some problem in my item category itself. .
    My setting for Item category in IMG - Define item category is
    same for both ZKLN and RENN. Only difference is RENN has returns
    tick and pricing field is blank. In ZKLN pricing is defined as B- 100%
    discount. I also tried changing the pricing option of RENN to B.
    But still it is asking for G/L Account.
    I can not use ZKLN instead of RENN because my ZKLN is used in the
    Free item Sales order.
    Please help.
    Regards
    Saurabh Gothivrekar

    Hi
    I got answer to my query. YOu need to specify the bill type while defining sales document type. This bill type should not have account assignment mentioned in it.
    I changed the bill type, which does not have Account assignment procedure attached to it.
    It has solved my problem

  • Query help: query to return column that represents multiple rows

    I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
    I need a query to find all names that occur in both of two separate locations.
    For example,
    bob usa
    bob mexico
    dot mexico
    dot europe
    hal usa
    hal europe
    sal usa
    sal mexico
    The query in question, if given the locations usa and mexico, would return bob and sal.
    Thanks for any help or advice,
    -=beeky

    How about this?
    SELECT  NAME
    FROM    <LOCATIONS_TABLE>
    WHERE   LOCATION IN ('usa','mexico')
    GROUP BY NAME
    HAVING COUNT(DISTINCT LOCATION) >= 2Results:
    SQL> WITH person_locations AS
      2  (
      3          SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      4          SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      5          SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      6          SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      7          SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      8          SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      9          SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
    10          SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
    11  )
    12  SELECT  NAME
    13  FROM    person_locations
    14  WHERE   LOCATION IN ('USA','Mexico')
    15  GROUP BY NAME
    16  HAVING COUNT(DISTINCT LOCATION) >= 2
    17  /
    NAM
    bob
    salHTH!
    Edited by: Centinul on Oct 15, 2009 2:25 PM
    Added sample results.

  • Unable to capture return values in web services api

    At the time of login to web services if my server is down ,
    it returns following error :
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            at java.lang.String.substring(String.java:1438)
            at java.lang.String.substring(String.java:1411)
    I want to capture this error so that i can try another server to login. how do i capture this error
    Another place where i want to capture the return Value is when i look for a report on the server
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
                               "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if the report is not there on the server , it returns a null handler exception.
    but if i try catching it by checking my responsehandler is null  like rh == null  it does not catch it.
    Any help will be appreciated
    thanks
    Rakesh Gupta

    Ted : i have two cases
    1)   server = server_st.nextToken();
        providerURL = "http://"server"/dswsbobje/services";
        sessConnURL = new URL(providerURL + "/session");
       Connection boConnection = new Connection(sessConnURL);
       Session boSession = new Session(boConnection);
      EnterpriseCredential boEnterpriseCredential = new    EnterpriseCredential();
                  boEnterpriseCredential.setLogin(userid);
      boEnterpriseCredential.setPassword(pwd);
      boEnterpriseCredential.setAuthType(auth);
    SessionInfo boSI = boSession.login(boEnterpriseCredential);
    I have got a list of servers running web servcies stored in my tokens. when i pass the first server name say " test:8080" and that server is down , i want to catch somewhere in the code above that it did not get the connection so that i can loop back and try with the second server say test1:8080
    This is for failover purposes.
    at present when i was trying to capture return value of boSI it  breaks giving the error
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1438)
    at java.lang.String.substring(String.java:1411)
    2nd case :
    I am geeting reports from the server and scheduling them:
    i run the following code which works fine if reports is there
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
    "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if  the  report  is not there on the server  then i should be able to catch from the response handle rh that it has got a null value.
    but rh does not return a null value 
    the code ultimately throws a null handle at the following line
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    i am not able to catch the null value there also.
    hope you got my issue.

  • Generate prov.xml for Creative Cloud. Return Code 27

    We're trying to follow this guide (Creative Cloud Help | Using Adobe Provisioning Toolkit Enterprise Edition) to serialize a package (or something). We're stuck on generating prov.xml. My best attempt at an entry is:
    C:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\CCP\utilities\APTEE>adobe_prtk.exe --tool=VolumeSerialize --generate --serial=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx --regsuppress=ss --eulasuppress --locales=en_US --provfilepath=C:\Program Fil
    es (x86)\Common Files\Adobe\OOBE\PDApp\CCP
    It says half of this is optional, but I'm skeptical.
    Anyway, I'm getting return code 27. This indicates that it is unable to edit the prov.xml file specified. I didn't specify a prov.xml file, I'm trying to make one. The syntax I'm using differs from what I found on the page I linked, as that was giving me syntax errors. I lifted this off someone else's code. I've tried just about every variation I can think of. Any help would be appreciated.
    This is on Windows

    One of these links may help
    http://helpx.adobe.com/creative-cloud/packager.html
    http://forums.adobe.com/community/download_install_setup/creative_suite_enterprise_deploym ent

  • Help Needed: Returning Back to Windows 8 after downgrading to Windows 7

    Hi guys, im just new here.
    I have a MSI GE40 gaming laptop which I bought 2 months back.
    Within those 2 months of usage, I always encounter my laptop to be very slow in shutting down. It always take, maybe up to 10 minutes to fully shut down. The screen goes black but the power button stays on orange color, & as I said, it takes a long time  for the power button to be completely unlit. But for start up, its blazing fast.
    Thinking that windows 8 itself is the culprit of super slow shutting down, I searched the net on how to downgrade to windows 7.
    Of course I did make a back up first on a 16gb usb flash drive using the pre-installed recovery software from MSI which was completed successfully.
    Then I made some tweaks on the bios (ie select legacy & disable secure boot) & boot using windows 7 installation DVD, deleted all partitions (since the notebook comes with GPT partition) to be able to install windows 7. I installed all the drivers which I downloaded from MSI website specific to my notebook.
    But the problem is not solved, it is still very slow in shutting down, & now even boot up becomes very slow too.
    So I downloaded & execute the firmware & bios for windows 7 from msi website (again, specific to my model). But still the same, the notebook is still very slow both in shutting down & start up.
    So I decided to go back again to windows 8, I tried to boot from the flash drive (I adjusted from the bios & make the flash drive to be the first priority) but it did not boot from it. I tried F11 on start up & selected to boot from usb flash drive but again, to no avail.
    So the last one I did was downloaded windows 8, make a bootable flash drive out of it, boot from it and luckily, I succeed - I have now again a windows 8 msi ge40 laptop.
    But I wanted my laptop to be reinstated to factory setting, i.e, all preinstalled softwares are there, the bios is default for windows 8. So I tried to update the bios to the one for windows 8 again (since I downgraded the bios to the one for windows 7 when I downgraded the OS to windows 7). But I could not update the bios, the laptop is not booting from usb flash drive containing the bios.
    I tried also to recover using F3 on start up but the system does not recognize the flash drive (with system back up). I tried also on PC settings but to no avail.
    Now guys, I need your help.
    How can I return back my laptop to default factory settings?
    Thank you.
    (sorry for my not so good English)

    Hello:
    I think it's not only about the OS version, you need to return this back to your shop to repair with the slow shot down issue, because the OS should be shot down in 30 seconds, far from your GE40 times.

  • Can I return my Lenovo S 205 ?

    Hi guys, I have had a multitude a problems since owning my Lenovo S 205 some 8 months ago.
    I got the laptop via Laptops Direct, an online laptop store.
    The first problem I experienced was when the laptop kept on shutting down on its own quite a few times. This I later discovered was because the laptop battery had a tendency to become loose sometimes.
    The second problem was when it began to freeze after I installed another version of MS Office.
    The third problem was when  it lost its bluetooth capabilities, although the bluetooth device had been detected as present.
    I managed to get the second and third problems fixed by a friend. However, after two weeks, the two problems have returned...TA-RAAA !
    I can only recommen other people to stay away from Lenovo right now !
    Does anyone know if I can return my Lenovo laptop and get a refund for it, so I can get something else like a Toshiba or an Asus ? Thanks very much !

    hi teresanazir,
    sorry to say that but refund is not possible at this point. have you tried to contact lenovo support line to ship it back to service for your issues?

  • Wifi works poorly on my brandnew ipad2. can some one help me or shall I return it to the store?

    Wifi works poorly to none on my brandnew (three days old) ipad2.
    The same Wifi connection works perfectly with my PC laptop.
    Can some one help me or shall I return it to the store?

    Try here...
    Apple - Support - iPad - Wi-Fi

  • Returning.

    Hi guys.. is it possible for me to return my laptop that i ordered last may 07 2010... can i return it a get a refund???? thanks....

    adamski07 wrote:
    Hi guys.. is it possible for me to return my laptop that i ordered last may 07 2010... can i return it a get a refund???? thanks....
    It's yours. No returns allowed after the return date unless the store management allows it. Since you have had it for over a month, you could have easily decided it wasn't the right one for you and returned it within the acceptable amount of time.

  • Can I return my macbook air that I brought during the holidays (Thanksgiving)

    I was gifted a Macbook air during the thanksgiving season, and since I am a computer science developer ( a student to be precise), I want to return my Mac and opt in for a Windows machine ( so that I can get enough software support if needed, there are several people around me with a pc). I was wondering, how can I return my laptop ? What are the terms and conditions ?
    Thank you in advance.

    I would think you cannot return a product after the return date has passed.
    Call the Apple Store and ask them.

  • Exchange/Return Y50

    I bought a lenovo y50 (8gb ram l, i7 4710, 4Gb nvdia gtx860m)
    18 days ago (15 april,2015) and now i got to know that a new version of y50 is soon releasing with a better graphics card that is nvdia gtx 970m frm the older one which is 860m.
    what i want to know is that can i return my laptop so that i can buy the new one or can i get an exchange offer for that new upcoming laptop ? please help me . its only 18days

    Hi swarandrose,
    Welcome to Lenovo Community Forums!
    I don't think that this is possible,
    Best way to get some information about this is to call Lenovo Post sales team.
    Try calling Lenovo Sales team and ask for options.
    Hope this helps
    Cheers!
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Due to my laptop screen failing i have to return to facory settings, can i reinstall adobe reader and adobe air afterwards?

    Due to my laptop screen failing I have to return it to factory settings, can I reinstall adobe reader and air afterwards?

    I don't see why not. Do you foresee a special difficulty?

  • I have bought a film from itunes and the credit has come out of my account, but i can't find the film anywhere, it said it was downloading, then i left the laptop and on return i couldn't find the film. how do i find the film?

    i have bought a film from itunes and the credit has come out of my account, but i can't find the film anywhere, it said it was downloading, then i left the laptop and on return i couldn't find the film. how do i find the film?

    Maybe it is in the Purchased category of iTunes,
    Try going there

Maybe you are looking for