Covariant return types over Generic return types.

Feeling rather slow on the uptake having only just discovered covariant return types (thanks again cowwoc), I've been looking over one of our soon to be released APIs and think using covariants makes muchos sense for it but there's one issue:
public interface Foo {
     Foo get();
public interface Bar {
     Bar get();
public interface FooBar
          extends Foo, Bar {
     FooBar get();
}Which isn't allowed, as the compiler states the return types are incompatible (I think incorrectly as it's been further overridden). Its generic equivalent is:
public interface FooX<T> {
     T get();
public interface BarX<T> {
     T get();
public interface FooBarX
          extends FooX<FooBarX>, BarX<FooBarX> {
     FooBarX get();
}Which works, and well, but the extra hassle of declaring/using generics is turning out to be a pain for our users (this pattern is used extensively). Does anyone have any simple suggestions/recommendations to resolve either the covariant issue or simplify the generics one? Also does anyone have any preferences to which one they prefer (and why)?
Incidentally does anyone know the the rationale behind not allowing the first example, when clearly it can't be abused (can it)?

BobDavies wrote:
. it is because you can not override a method or its definition with the same signatur, which does not include return type.What do you mean "does not include return type"?
method signature does not count the return type. i think java does allow you to repeat definitions in a sub class but when you put up a different retyrn type, it sees it as an attempt to do overriding, so it flags it out.
the fact that it works is becuase you are not extending anything but itsself:I am aware of the reasons for the Generic version working, it achieves our aim, I just don't like it when in use. And was wondering why the joining covariants do not work. I still can't see the reason for the FooBar not being allowed when you are allowed to return subtypes. You cannot break the inheritance/return types expectations like this can you? E.g. if I write a bit of code using Foo, it will still work with FooBar, and the same with Bar using FooBar, no? Can you show me an example of why this isn't allowed?your generic version should NOT work either; it is working becuase you are confused:
public interface FooBarX extends FooX<FooBarX>, BarX<FooBarX> only equals to
public interface FooBarX extends FooBarX, FooBarX

Similar Messages

  • SQL types over PLSQL types while using Oracle Applications adapter in BPEL

    Use SQL types over PL/SQL types while using Oracle Applications adapter
    in BPEL/ ESB
    This document will be focusing on Oracle Applications adapter. However Database adapter is much like OA adapter (even OA adapter uses DB Adapter), so the readers who are interested to explore DB adapters, can relate things with this document and go further as well.
    Some Guidelines for writing PL/SQL APIs for OA Adapter
    As we know when we create a partner link from the OA adapter wizard it sometimes writes some wrapper script supportive to the OA Adapter WSDL which contains below
    * Object type for PL/SQL RECORD
    * Nested table of the given type for PL/SQL TABLE. For example, the nested table of NUMBER.
    * INTEGER substituted for PL/SQL BOOLEAN
    * Wrapper Script for converting above three set of data types . (PLSQL to SQL and SQL to PLSQL conversion functions)
    In runtime this wrapper script for converting PL/SQL to SQL and SQL to PL/SQL is an extra overhead.
    So the first advice would be to avoid the use of the below as parameters of PLSQL API being called by OA Adapter.
    * PL/SQL RECORD
    * PL/SQL TABLE. For example, the nested table of NUMBER.
    * PL/SQL BOOLEAN
    In other way we can say we should try to use only SQL data types in arguments if we are planning to call any PL/SQL API from the OA Adapter.
    If the requirement is to use a table or record uses the Object type. In place of BOOLEAN better to use VARCHAR or INTEGER what ever fulfills your requirement. Following this guideline we can reduce a huge number of Line of codes to be run each time the adapter being called.
    Generally, Oracle E-Biz standard APIs use PL/SQL record types and table types so when there is a requirement to call these API’s from OA Adapter (this is a common requirement in development), and if we directly browse the API in OA Adapter Configuration Wizard and create the partner link, again a huge number of code is written by the wizard in the wrapper script (a number of extra mapping of fields which are not being used in the interface).
    In this case better would be to create an Object type with only the required fields which are being used in that call and use them as parameters for the PLSQL API.

    Find the complete document
    http://www.4shared.com/file/167171882/29525116/Use_SQL_types_over_PLSQL_types.html

  • Unable to load the vertipaq engine because there was a COM exception . Return argument has an invalid type.

    Hi All,
    I have been using powerpivot for months (2010 PowerPivot on Excel 2010, with Sql 2008).  I tried to open powerpivot today and get the following below.  I have already tried uninstalling powerpivot and reinstalling it to no avail.  
    Any suggestions would be appreciated.  Thanks, Ivan
    Unable to load the vertipaq engine because there was a COM exception while loading....
    ============================
    Error Message:
    ============================
    Return argument has an invalid type.
    ============================
    Call Stack:
    ============================
       at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
       at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Microsoft.Office.Interop.Excel.WorkbookConnection.get_OLEDBConnection()
       at Microsoft.AnalysisServices.XLHost.Addin.InProcServer.LoadOLEDBConnection(Boolean raiseCompleteEvent, String errorCache)
    ============================

    Hi All,
    For anyone who this happens to, what ended up fixing it was uninstalling and reinstalling excel.  I was using excel 2010, so I did this 
    Go to add/remove programs 
    Highlight Microsoft Office Professional 2010 
    Click Change
    ensure Add remove features is selected and click continue 
    click on the little arrow beside excel and click on Not Available, click continue
    After it is done, excel will be uninstalled.  
    When this is done, you can do the same process again, but this time chose the other appropriate selection
    instead of not available.  I chose Run All from My Computer.  

  • Delivery type determination in case of returns to vendor without return PO

    Hello Gurus,
    When we create Return PO, and when we want to created delivery for this PO , we assign delivery type RL to the PO in SPRO.
    Now when I return the material thorugh MIGO (without return PO) with delivery check box active, system determines different delivery type than RL. My question is that where do we assign this delivery type and how the system determines this delivery type in case of returns to vendor without return PO.
    Thanks
    Pravin

    Control parameters at movement type level determine the delivery type created. I guess you are using MvT 161. Try configuring delivery category for MvT 161 in OMJJ.
    Hope this helps.
    Rajiv..

  • Return The remote server returned an error: (403) Forbidden error for some file types

    hi
    am using below code to get the byte array 
    byte[] myDataBuffer = client.DownloadData((new Uri(sourceUrl)));
    for source of type .txt/.jpg no problem with accessing.but the file type with .master/.wsp/.cs
    it is returning "The remote server returned an error: (403) Forbidden error for some file types" Error.how can i get rid of this.please help me
    Thanks in Advance

    Hi,
    It seems there is something wrong with your code, from your code the account and key are the same, because their appsetting name are the same.
    string account = ConfigurationManager.AppSettings["StorageAccountName"];
    //string account = CloudConfigurationManager.GetSetting("StorageAccountName");
    //string key = CloudConfigurationManager.GetSetting("StorageAccountAccessKey");
    string key = ConfigurationManager.AppSettings["StorageAccountName"];
    string connectionString = String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", account, key);
    return CloudStorageAccount.Parse(connectionString);
    If you use CloudConfigurationManager.GetSetting, please consider set azure project as the startup project, if not, this value will be null, this resulted in solution being started as a web project that didn't run inside the Azure emulator. Since CloudConfigurationManager.GetSetting
    tries to get setting by contacting Azure (or Azure emulator in this case), and it is not running, it returns null.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Additional Pricing Condition Type Determination in Returns Oder

    Hi Guys
    I am working on Returns Sales Process, but I have stuck in pricing?
    The thing is I have to determine the additional condition type based on transaction type .i.e. returns order when I create the returns order with ref. to sales order the pricing condition types which is present in the sales order has been copied but the additional condition type is not determined automatically?
    I have created the 2 pricing procedure one of sales order and other for returns order.
    Can anybody help me out?
    Thanks advance

    Hi,
    All you have done is right. just assign the other pricing proceduere which you created for the document re.
    To the combination of sales orgdistribution chaneldivision + cpp( in customer master)+ dpp( for the document re )
    So now when you create with the re doument you will automatically get that pricing procedure.
    hope this solves.
    regrds\
    preetham

  • How to make a function return number(10,0) data type (ORACLE 10g)?

    With 10g, how to make a function return number(10,0) data type?
    here is the function, it returns a number type :
    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN v_Id;
    END Get_portfolio_Id3;
    Thanks.
    Message was edited by:
    user631701

    create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
    v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
    BEGIN
    If p_HistObjTable ='amPortfolio'
    then v_Id:=p_LHISTOBJID ;
    elsIf p_HistObjTable = 'amComputer' then
    select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
    else v_Id:=-99;
    End If;
    RETURN round(v_Id);
    END Get_portfolio_Id3;

  • Cancelation of Vendors return delivery document  ( 122 Movment type)

    Dear All,
    We have a case where in all vendor receipts are quality checked and in case a quality lot is rejected a returns delivery is crated to the vendor with SD returns delivery type RLL..
    We want to reverse this returns delivery and accept the the quality rejected lot. Can you please suggest how to do the same.
    We tried to reverse the returns delivery with transaction VL09 we got an error " the vendor rejection returns delivery type RLL cannot be reversed.
    We also tried out transaction  MIGO Cancellation option and got an error "material document cannot be processed"
    Please suuggest the procedure to reverse this material document.
    Deepak.

    H i Deepak!
       We also have the same scenario like yours.But I am struggling to get the pricing details from the purchasing document. I don't know how to control this function.Material price and ED elements to be copied from the reference purchase document.How are you handling this? Kindly reply me soon.
    The following information may be useful to you.
    Posting a Return Delivery with Reference to the Purchase Order
    Choose the Enjoy transaction MIGO for posting goods movements. Enter the purchase order. In goods-receipt-based invoice verification, the system displays all the GR items. Choose the items that you want to return, specify the quantities, and choose movement type 122.
    Posting a New Goods Receipt with Reference to a Return Delivery
    If you receive a substitute delivery after you have returned goods to a vendor, it is advisable to reference the associated return delivery by using a reverse posting when you post the new goods receipt. This enables the system to suggest and update the data for this particular business process. This is particularly important in goods-receipt-based invoice verification, so that the link between the goods receipt, the return delivery, and the invoice remains intact (see also Subsequent Delivery).
    The table below shows which reversal movement types you can use to reference the associated return delivery.
    Goods receipt      Return Delivery              Substitute delivery
    101                         122                                    123
    103                         124                                    125
    105                         122                                    123
    For example, if you posted the goods into goods receipt blocked stock using movement type 103, you return them using movement type 124 (return delivery from goods receipt blocked stock). To post the substitute delivery back into goods receipt blocked stock, you do not use movement type 103, but reverse the material document for the return delivery. The system automatically suggests movement type 125, which maintains the link between the goods receipt, the return delivery, and the invoice.

  • Movement type: moving the returnable package from one customer to another

    Hello,
    I would like to know if there exists any predefined movement type (in transaction MIGO) which would allow to move the stock of the returnable package (material type LEIH, pallets etc.) from one customer to another IN ONE STEP (now we do it in 2 steps: first we return the stock from the customer to the our location and then move it to another customer). When we sell material to the customer, the stock type for the returnable package has the mark for special stock type (''V'').
    I tryed types 301V and 309V, but the customer had to be the same. It only allows to move the pallets between different plants for the same customer.
    Best regards,
    Mojca Kukman

    Hi
    There is no such movement type. Customers always look for one-step transactions and the only way to achieve this is through ABAP!
    Normally I do this:
    Create a Z-txn for customer input and on saving create 2 material documents (as in 2-step process).
    Best regards
    Ramki

  • Get MIME type of file returns application/octet-stream for all but txt

    Eclipse 3.3.1.1, JRE 1.6.0_03, Tomcat 6.0, webwork 2.2.4
    I've created a test upload/view file page. I can successfully upload and return the file to view. However, the content type is always application/octet-stream except for txt.
    String contentType = new MimetypesFileTypeMap().getContentType(filename);
    System.out.println("contenttype for " + filename + ": "+contentType);I created mime.types in my META-INF for tomcat and populated it, but it doesn't change anything. Uploading an mp3 should return the audio/mpeg3 I have in mime.types:
    audio/mpeg3                         mp3
    I verified that it is in /wtpwebapps/MyApp/META-INF/
    My web.xml even has it:
        <mime-mapping>
            <extension>mp3</extension>
            <mime-type>audio/mpeg3</mime-type>
        </mime-mapping>Am I missing something?

    Darn it. The form gobbled up my mimeTypes.rdf code. Here it is again with the GT and LT symbols replaced with '+':
    +RDF:li RDF:resource="urn:mimetype:application/pdf2"/+
    +RDF:Description RDF:about="urn:mimetype:application/pdf2"
    NC:fileExtensions="pdf"
    NC:description="TonyTest PDF document"
    NC:value="application/pdf2"
    NC:editable="true"+
    +NC:handlerProp RDF:resource="urn:mimetype:handler:application/pdf2"/+
    +/RDF:Description+
    +RDF:Description RDF:about="urn:mimetype:handler:application/pdf2"
    NC:alwaysAsk="true"
    NC:saveToDisk="false"
    NC:useSystemDefault="false"
    NC:handleInternal="false"+
    +NC:externalApplication RDF:resource="urn:mimetype:externalApplication:application/pdf2"/+
    +/RDF:Description+
    +RDF:Description RDF:about="urn:mimetype:externalApplication:application/pdf2"
    NC:path="/usr/bin/acroread"
    NC:prettyName="acroread" /+

  • RLFC Excise transaction type during consignment return

    Hi All,
    During consignment return for adjusting JV can we use RLFC transaction type instead of OTHR.
    So far we used only OTHR. What are all the impacts if we move to RLFC all of a sudden.
    Please explain.
    Regards
    Raja Durai

    Dear Friend,
    As per the SAP new package ETT RLFC has been introduced for Excise sales return. New tab   "Return sales Excise" available in J1IH for post Return excise invoice automatically. .
    We added ETT RLFC in table J_1ITRAN and did configuration for account determination for excise, this is helped us to post excise invoice for Sales return.
    Please refer SAP Note: 1907900 - Error 8I-402 for return sales transaction(RLFC)- J1IH
    Regards,
    Pradeep

  • IDoc type for LR Returns delivery

    Hi all,
    I want to use SHP_OBDLV_SAVE_REPLICA02 IDoc type to distribute LR delivery for a return SO to Decentralized WM. With this IDoc type, I get the error "IDoc type SHP_OBDLV_SAVE_REPLICA02 cannot be processed by  IDOC_OUTPUT_DELVRY"
    IDoc type DELVRY05 work fine but I want to used SHP_OBDLV_SAVE_REPLICA02. Is this possible?
    Thanks,
    Nick

    Hi,
    Message type is DESADV
    Basic type is DELVRY01 to 03 (can check the latest version or supported version)
    Function module : BORES_IDOC_INPUT_DESADV1 or IDOC_INPUT_DESADV1
    This is used for creating outbound deliveries, shipping  noticfication etc.
    Regards
    vk

  • CL_ABAP_ELEMDESCR returns incorrect help_id for dobj types

    If runtime type services are used to retrieve the help_id of a dobj type (dbtab-field), the data element type is returned instead of the type dbtab-field. The describe statement provides a work-around since it works correctly, but data objects created from the data descriptor lose the information completely. Also, GET_DDIC_OBJECT seems to return the wrong information in the TABNAME and FIELDNAME fields.
    Can anyone tell me if I am just missing something?
    e.g.
    *Use describe statement to find the help_id.
    data foo like T100-ARBGB.
    data descHelpID type string.
    describe field foo HELP-ID descHelpID.
    *Now we use RTTS to find the help_id.
    data elemDescr type ref to CL_ABAP_ELEMDESCR.
    data rttsHelpID type string.
    data myX031L type standard table of X031L.
    elemDescr ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( foo ).
    rttsHelpID = elemDescr->help_id.
    if elemDescr->IS_DDIC_TYPE( ) = abap_True.
    myX031L = elemDescr->GET_DDIC_OBJECT( ).
    endif.
    write: / `help_id via describe: `, descHelpID.
    write: / `help_id via RTTS: `, rttsHelpID.
    break-point.

    the DESCRIBE statement does not give exactly the help-id, it gives the definition of field in form TABNAME-FIELDNAME
    for class CL_ABAP_ELEMDESCR, I agree to say that HELP-ID attribute is not very useful !
    in fact help-ids can be found in table DD04L for elements and in DD35L for fields of a table - those are the only reliable sources for this piece of information !

  • The returned page had no content type

    I'm trying to install a application OTA but get this error "The returned page had no content type, and therefore cannot be processed" . I get this on the 8900 and 8300, (4.6) the 8100 (4.5) works fine. I tried using different browsers, cleaning up cache and so on but nothing helps.
    Anyone got some idés?
    regards
    jol 

    The app may not be compatible with:
    1. the phone model
    2. the OS
    Check the app website for these before attempting to install them.
    Kijana
    Please remember to:
    1. Mark Accept as Solution on the appropriate post once your issue has been resolved
    2. Give Kudos to helpful posts (click the star next to the post)
    Thanks

  • Error message 81447   Excise Transaction Type during Purchase return

    Dear Freinds,
    I am running an purchase return cycle on non returnable basis (i will not receive the material back from the vendor )through transaction code mmbrl, I create a document and then use J1IS to make an excise invoice , but while making excise invoicing its showing an error message no 81447 "GL account has not been assigned for PLA AT1 in customisation.
    So  I maintain GL accounts for PLA AT1 in Tax Goods Movement  -> Acct Determination-->Specify GL Accounts per Excise Transaction , for Excise Grp /ETT-CEIV/Company code/Sub transaction type (22)
    Still it was giving the same error as mentioned above .
    So I again maintain PLAAT1 for Excise Grp /ETT-OTHERS /Company code/Sub transaction type (22)
    still its giving me the same error .
    Now kindly tell me where I  am going wrong, am i selecting wrong ETT or sub transaction type.
    In my scenario what should be the ETT & Sub transaction type .
    Kindly guide .
    Thanks

    Hi,
    What reference document type you are using in J1IS??
    It should be MATD. MATD ultimately goes to OTHR. So in your configuration check whether G/Ls are assigned properly to OTHR. Subtransaction type depends upon your business requirement. If you want accounting entry in some seperate account say CENVAT CLrg purchase returns, then you have to use subtransaction type & also needs to assign the same with OTHR by maintaining desired G/L in CENVAT sspe column.
    Regards,
    Piyush

Maybe you are looking for