Generics with recursive parameters

Hi all,
I'm developing a class hierarchy using generics for representing graphs in our product. I end up with a lot of types such as:
public interface Node< T extends Node<T> >
  Set< Port<N> > getPorts();
public interface Port< T extends Node<T> >
  etc etc
}which has caused me to run into the following bugs:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6548436
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6507317
When I first started working with the hierarchy, I had a lot of code of the form:
Set< Port< ? extends Node<?> > > = node.getPort();which triggered the above bugs all over the place. I've since found that I can use the shorter form:
Set< Port<?> > = node.getPort();and it seems to just work. My question is: is this the same thing? Is the compiler smart enough to work out that the wildcard in Port<?> is really a T extends Node<T> because it's declared that way in the original class?
Thanks for any help,
Colin

public class Graph implements Map<String, Node>, Map<String, Edge> {The problem is that after compilation, when the object code is produced, any "type parameter" information is erased (you need to read up on Java reflection more closely).
Thus, there is only one Map class in the runtime (not one for every possible combination of type parameters). and any references to, say, Map<String,Node>.put() become, at runtime, just Map.put().
So you can't do what you want, because at compile time, your two parent interfaces are "different", but at runtime, they would be the same. The message could be better, I agree.
To do what you want:
* If your two classes (Edge and Node) have no relationship to each other, then you'll have to implement Map<String,Object>.
* If they do have a common ancestor, you can declare it as extending Map<String,CommonAncestor>.
In both cases, you'll have to, e.g. downcast the result of get() to the right type.

Similar Messages

  • Generic forwarding methods with recursive bounds.

    Hello all,
    I'm attempting to create a forwarding class assoicated with an interface. The interface has a generic method with recursive bounds. The problem relates to ambiguous method calls as the following code segment should demonstrate:
    interface TestInterface
        //generic method with recursive bounds. (use of Comparable<T> is
        // not relevant, any generic class/interface could have been used.)
        <T extends Comparable<T>> T testMethod(T bob);
    //Concrete implementation of the TestInterface.
    class TestClass implements TestInterface
        public <T extends Comparable<T>> T testMethod(T bob)
           return bob;
        public static void main(String[] args)
            TestInterface bob = new TestClass();
            bob.testMethod("blah"); //Works fine.
    class ForwardingClass implements TestInterface
        //Forwarding class composed of a TestClass object. All methods forward calls to this object.
        private final TestClass test;
        public ForwardingClass(TestClass test)
            this.test = test;
        //forwarding method.
        public <T extends Comparable<T>> T testMethod(T bob)
            return test.testMethod(bob);   //Ambiguous testMethod call. Both testMethod (T) in TestClass
                                           //and testMethod (T) in TestInterface match. Very annoying...
        }Therefore, if you could assist with the following issues, it would be greatly appreciated.
    Firstly, I don't think I fully understand why this error is given, so any explanation would be greatly appreciated.
    Secondly, is there any way to get around the problem?
    Thanks in advance,
    Matt.

    My bad. This appears to be an issue with Intellij 8.0M1. I'll create post on the Intellij forums. It compiles absolutely fine from the command line, and using Intellij 7.04. (Probably should have checked that before my initial post...)
    Apologies for wasting your time. Cheers for the replies.
    Matt.

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • How can I install Firefox SILENTLY in a specific installation folder, -ms with which parameters ?

    How can I install Firefox SILENTLY in a specific installation folder, -ms with which parameters ?
    "Firefox.exe_path" -ms OPTIONS ??
    Thanks.

    '''Is there a way to download FF to a USB from another computer and install it from that USB on my PC? '''
    You basically answered your own question. If you have access to another computer just go download the appropriate language and OS version of Firefox 5.0 from http://www.mozilla.com/en-US/firefox/all.html and put it on you usb drive and then go and install it onto you pc.

  • Error when using Analytic view with Input Parameters

    Hi,
    I am trying to create an info space based on my Analytic view which has input parameters. The infospace is validated and indexed without any issue. However when I ran the view, I get an error (50011) as it is unable to fetch any results. I tried using an infospace based on Calculation view with input parameters and the explorer view works without any issue.
    Has anyone faced similar issues?
    We are using HANA SP 6 rev 67 and BI 4.0 SP 4.
    Also is there a way to enable input prompts for the users when they refresh the BO Explorer view? If not currently available is there any work around ?
    Thanks

    Hello George,
    I don't have any personalization set on the info space. Also I am using mapped Account in BI to connect to HANA. The confusing part is that it is able to validate the infospace with the input parameters and index it. However query does not return any results. I even tried running the same query which explorer sends to HANA in the SQL editor and there too the same results,the query does not return anything. The model does return data when I do a data preview and if accessed from other tools like AAO.
    Also when I use SSO connection to HANA, indexing of the infospace fails. Where can I see the error log?
    Thanks,

  • How to schedule a report with dynamic parameters

    We need to schedule a Webi report with dynamic parameters then email the different result to different email groups.  Is it possible to do this in scheduler? Please advise. Thanks.

    there are 2 schedulers
    1st  CMS
    the reports which does not have any input parameters, only then t can be scheduled in CMS
    2nd in Infoview
    if report has input parameters and if you want to schedule it, then you may need to schedule the report from Infoview
    To have a email notification
    configure the SMTP server in report JOB Server
    Thanks,
    Ganesh

  • Calling a Stored Procedure with output parameters from Query Templates

    This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
    We encountered a problem while calling a stored procedure from MII Query Template as follows-
    1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
    a) Input1 - CLOB
    b) Input2 - CLOB
    c) Input3 - CLOB
    d) Output1 - CLOB
    e) Output2 - CLOB
    f) Output3 - Varchar2
    2. There are two ways to get the output back.
    a) Using a Stored Procedure by declaring necessary OUT parameters.
    b) Using a Function which returns a single value.
    3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
    corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
    4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
    5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
    characters)
    6. So the method 2-a is ruled out.
    7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
    Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
    Thanks in Advance.
    Rajesh

    Rajesh,
    please check if this following proposal could serve you.
    Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
    Here is an example how this could be defined.
    Package:
    type return_cur IS ref CURSOR;
    Procedure:
    PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
    OPEN myReturnCur FOR SELECT val1, val2, val3  FROM dual;
    Query:
    DECLARE
      MYRETURNCUR myPackage.return_cur;
    BEGIN
      myPackage.myProc(
        MYRETURNCUR => ?
    END;
    Good luck.
    Michael

  • "Source not found" Error creating URL Data control with query parameters

    Hi,
    I have a restful service for which i want to create a URL data control. I am able to create the URL data control successfully when i am not passing any parameters in the Source field. But if i am specifying the parameters in the source field like this Department=##ParamName##, something weird is happening. After giving the param string in the Source field, it asks for default param value to test the url. It tests the url successfully. After that i select XML as the data format in which i am mentioning the xsd like this . "file:///C:/..../something.xsd" . And this is when i am getting the error. "Invalid Connection. The source is not found". I am giving exactly same path for xsd which i gave while creating URL data control without query parameters. Infact i was able to create the URL data control with query parameters successfully till afternoon. after that it started giving me this error all of a sudden. Infact as soon as i was able to create a URL data contol with query parameter successfully, i took a backup of the application before moving further. But even that backup is not working now.
    As far as i understand, i dont think there will be any change in xsd if query params are passed to a web service. Please correct me if i am wrong.
    Just dont know what could be the issue. Please help
    Thanks

    Hi,
    xsd is used for the URL service to know what the returned data structure is so it can create the ADF DC metadata
    Frank

  • Calling stored procedure with output parameters in a different schema

    I have a simple stored procedure with two parameters:
    PROCEDURE Test1(
    pOutRecords OUT tCursorRef,
    pIdNumber IN NUMBER);
    where tCursorRef is REF CURSOR.
    (This procedure is part of a package with REF CURSOR declared in there)
    And I have two database schemas: AppOwner and AppUser.
    The above stored procedure is owned by AppOwner, but I have to execute this stored procedure from AppUser schema. I have created a private synonym and granted the neccessary privileges for AppUser schema to execute the package in the AppUser schema.
    When I ran the above procedure from VB using ADO and OraOLEDB.Oracle.1 driver, I got the following error when connecting to the AppUser schema:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'TEST1'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    but when I was connecting to the AppOwner schema, everything is running correctly without errors.
    Also, when I switch to the microsoft MSDAORA.1 driver, I can execute the above procedure without any problems even when connecting to the AppUser schema.
    I got this error only when I am trying to execute a stored procedure with an output parameter. All other procedures with only input parameters have no problems at all.
    Do you know the reason for that? Thanks!

    If anyone has figured this one out let me know. I'm getting the same problem. Only in my case I've tried both the "OraOLEDB.Oracle" provider and the "MSDAORA" provider and I get an error either way. Also my procedure has 2 in parameters and 1 out parameter. At least now I know I'm not the only one with this issue. :)
    '*** the Oracle procedure ***
    Create sp_getconfiguration(mygroup in varchar2, myparameter in varchar2, myvalue out varchar2)
    AS
    rec_config tblconfiguration.configvalue%type;
    cursor cur_config is select configvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter;
    begin
    open cur_config;
    fetch cur_config into rec_config;
    close cur_config;
    myvalue := rec_config;
    end;
    '** the ado code ****
    dim dbconn as new adodb.connection
    dim oCmd as new adodb.connection
    dim ors as new adodb.recordset
    dbconn.provider = "MSDAORA" 'or dbconn.provider = "OraOLEDB.Oracle"
    dbconn.open "Data Source=dahdah;User ID=didi;Password=humdy;PLSQLRSet=1;"
    set ocmd.activeconnection = dbconn
    cmd.commandtext = "{call fogle.sp_getconfiguration(?,?)}"
    'i've also tried creating a public synonym called getconfiguration and just refering to procedure by that.
    ' "{call getconfiguration(?, ?)}"
    ' "{call getconfiguration(?,?, {resultset 1, myvalue})}"
    'and numerous numerous other combinations
    set oPrm = cmd.createparameter("MYGROUP", advarchar, adparaminput, 50, strGrouptoPassIn$)
    cmd.parameters.append oPrm
    set oPrm = cmd.createParameter("MYPARAMETER", advarchar, adParamInput, 50, strParameterToPassIn$)
    cmdParameters.append oPrm
    set rs = cmd.execute

  • ABAP WebDynpro app calling Transaction iview with Dynamic Parameters..?

    Good day!
    I need to code a call to a transaction (with dynamic parameters) from an Abap WD application.  It appears that to achieve this, the app needs to call a new portal transaction iview, passing the parameters in the call..? 
    This should ideally be via a Sapgui for Windows, but Html also an option (does it matter with regards to the method used?). 
    Kindly assist with advise/instructions, idealy with sample code extract to illustrate (new to Abap WD)...
    Kind regards
    j

    Hi
    this will help you doing so
    http://help.sap.com/saphelp_nw04s/helpdata/en/18/f96f4132f15c58e10000000a1550b0/frameset.htm
    Use BUSINESS_PARAMETERS to pass the data
    Abhi

  • Generic with holdingtac report T Code : S_P00_07000134

    Hi,
    I am executing the generic with holding tac report RFIDYYWT ( T Code S_P00_07000134 ).
    the report should
    1) All vendor invoices paid
    2) All credit memos paid
    3) All open down payments i.e. down payment paid but not yet settled against a final invoice.
    But , I am getting only 1 & 2 documents ( above mentioned ) it means that I am not getting the All open down payments documents in the report output.
    please do the needful ASAP.
    Thanks in Advance
    Arjun

    Resolved by using Check Register

  • How to create a generic with iMovie for iPad?

    How do i create A generic with iMovie for iPad?

    luckyuis wrote:
    Hi All,
    > I have generated a report showing data for past 12 months and after that i need to include a chart showing Month on X axis with data for past 12 months ..for example if i run the report for June 2011 then on the chart it should take as june 11..>may 11..>april 11........so on june 10 with respect to other values
    >
    > fyi .. i am using type: Numeric Axis..> Date Axis line chart and created seperate formule on top of date field to get past 12 months data
    >
    > Please advise how can i do that on the chart
    >
    > Thanks much,
    > Lucky
    Once you pull the data, goup on the date monthly, most recent first ,and then graph the summaries in the group.

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

  • Start IC WebClient with URL Parameters

    Hi,
    we are currently implementing IC WebClient 5.0. One of the customer needs is it, to start the IC WebClient with a service order ID, so that the order is displayed immediately without searching and confirming an account. Is it possible to start the IC WebClient with URL parameters to solve that issue?
    Thank you for you help in advance!
    Marcus Walena

    Hallo Marcus,
    This is currently not possible.
    However, you don't need to always confirm the customer. You can use the agent inbox to do the search and navigate directly to the service order. However, if you want to do any processing after that, then you will need to identify the customer. The other option is to implement this yourself.
    BTW: It is possible to navigate via a URL to the service order directly using PC UI.
    Regards,
    Shiv

Maybe you are looking for

  • Out of Bounds

    I am using Elements 9 in a quad core computer 8gig memory and everytime I try to use Out of Bounds in the Guided section my whole computer freezes after I click in Add a Frame.  Hope someone can help, thank you.

  • Firefox 8.0 in safe mode crashes multiple times daily on my 64 bit Vista PC , so how do I fix this?

    For the last 2 weeks after installing Firefox 7 and then this week installing update version 8.0 my 64 bit Vista PC started to crash at least twice each day; tried running disabling selected plug ins and extensions, and then using the safe mode optio

  • App performance influenced by hardware power?

    Is flash app performance in anyway influenced by the hardware of the device?the ipad3 is coming out in few days and i was wondering if apps that used to run bad on ipad2/iphone4 are going to run good on the new ipad.Iphone 4S was at least twice as fa

  • How downsize a 112 GB .mov file in DVDSP to fit standard DVD?

    Help, please. I burned a Quicktime .mov file from HD footage off my FCP 7 timeline. The resulting file is 112 GBs. I took it into DVD Studio Pro as I thought  DVDSP would downsize the file to fit on a standard DVD. But the Disc Meter shows the size t

  • Flex & PHP - Send email attachment

    I'ld like for my visitor to be able to send an email to a friend with the creation from my application as an attatchment (so like a screencap of the creation). I can get Flex and PHP to communicate and send an email, but I can't get the image to send