MyClass T extends MyClass T problem

Hi, I have the following two abstract classes in the same package:
public abstract class State <T> {
  private T owner;
  void setOwner(T owner) {
    this.owner = owner;
public abstract class MyClass <T extends MyClass<T>> {
  private State<T> state;
  public void setState(State<T> state) {
    this.state = state;
    this.state.setOwner(this);
}The idea is that if I create a new class, say MyClassSub, that extends MyClass, then it should supply itself as the type parameter for MyClass, eg:
public class MyClassSub extends MyClass<MyClassSub> {
}The point of this is that when such a class is created, it can only set subclasses of State<MyClassSub> as its "state" variable, and the "owner" variable in the state is automatically updated within the setState method. (Notice how the setOwner method is hidden from public, visible only inside the package).
The problem is that this doesn't compile. I get the error:
setOwner(T) in State<T> cannot be applied to (MyClass<T>)
   this.state.setOwner(this);
   ^Any ideas?

Thanks for your reply.
My understanding is that you are trying to assign a
supertype to a subtype, and so the compiler is right
to complain.That is correct, however, since MyClass is abstract I will only ever assign a subtype.
More specifically the offending line is
"this.state.setOwner(this);"
where:
- "this.state" is of type T, and the setOwner()
method, according to your definition of class State,
thus expects a type T
- "this" is of type MyClass<T>
Your class type parameter says precisely "T extends
MyClass<T>", in other words T is a subtype of
MyClass<T>. You are thus not allowed to assign a
MyClass<T> instance where a T instance (or a subtype
of T) is expected.Yep, "this" is MyClass<T> at the moment, however it will be of type MyClassSub extends MyClass<MyClassSub> etc, when it actually executes. The reason I am doing this is because I have a few subclasses of MyClass.
So, I would rewrite MyClass definition as follows:
public abstract class MyClass <T extends MyClass<T>>
private State<MyClass<T>> state;
public void setState(State<MyClass<T>> state) {
this.state = state;
this.state.setOwner(this);
See that I use the proper instantiation of generic
State class, by using State<MyClass<T>>This works ok, however, it might as well not use generics since the State class would only ever allow the class MyClass and not a subtype as I wanted in the first place. i.e, I would like to have State class specific to each subtype: e.g, State<MyClassSub1>, State<MyClassSub2>, etc. where MyClassSub1 and MyClassSub2 are subclasses of MyClass<MyClassSub1> and MyClass<MyClassSub2> respectively.

Similar Messages

  • Extended Content type problem

    Extended Content type problem
    I want to extend the content type 'ExtendDocument' from 'Document'.
    So I use 'Oracle Internet File System Manager' to create a new Class Object named 'EXTENDDOCUMENT', which is extend from 'DOCUMENT', and add a attribute 'EXTENDURL'.
    This Class Object's bean class is 'ifs.beans.ExtendDocument' and server class is 'ifs.server.S_ExtendDocument'.
    I create these 2 java class and put the class files to ORACLE_AS_HOME\ifs\cmsdk\custom_classes directory.
    As I want to set the object type as 'ExtendDocument' when uploading a file which expend name is '*.wmv', so that need to change 2 default value 'ParserLookupByFileExtension' and 'IFS.PARSER.ObjectTypeLookupByFileExtension'
    So I add 'name=wmv, datatype=STRING, value=oracle.ifs.beans.parsers.ClassSelectionParser' to ParserLookupByFileExtension.
    And then add 'name=wmv, datatype=STRING, value=EXTENDDOCUMENT' to IFS.PARSER.ObjectTypeLookupByFileExtension.
    After done above actions, i restart my oracle application.
    I use CUP to upload a test file 'test.wmv' to CMSDK repository, and its type is 'EXTENDDOCUMENT'.
    But if I use FTP or WebStarterApp application to upload 'test.wmv' file to CMSDK repository, then its type is 'DOCUMENT'.
    Why and how to change to make FTP and WebStarterApp application can upload *.wmv file's type as 'EXTENDDOCUMENT'?
    anybody can help me?
    thanks.

    Nirav-P-Thakar wrote:
    FileNameMap  fnmMime        = URLConnection.getFileNameMap ( ) ;
    fnmMime.getContentTypeFor(fileName);
    URLConnection.guessContentTypeFromName(fileName);I have tried out both methods but it returns null when the file is of type MS Office or Open Office.In reply 1 BalusC said..
    "Alternatively you can use ServletContext#getMimeType() for this. It guesses the content type based on the mime mapping as it is been definied in the web.xml of the application server and the webapplication. If it returns null, then you need to add new <mime-mapping> entry to the web.xml."
    I would try doing it this way. Try including entries for the mime mappings in the deployment descriptor of the web application.

  • PS Extended Video Import Problem

    I cannot find any other reference to this problem in the FAQs or FORUMS.
    I cannot import any video files into PS Extended (10.0.1) without a Photoshop crash. The crash is caused by quicktime.qts file. I have tried to re-install quicktime several times with no success. Every other Quicktime function seems to work well.
    I have a newer Intel Quad PC with 2gb memory, 260GB of disk space and a nVidia Geforce 8800GTS video card.
    ANY HELP OUT THERE?!?!?

    John,
    Glad that you got it worked out. I was really interested in going to PS CS3 Extended, as I'm doing so much more graphics for video now. Unfortunately, though I've had PS as a standalone for decades (and AI and PM and on, and on), because I had gone the upgrade path to CS2 Production Studio, my individual app. path was cut off. I could only upgrade the full CS3 Production Studio (or whatever the flavor of the month name is) and I only wanted to upgrade PS. Premiere CS3 offered me little and seems frought with problems, so I'll just wait for CS4 to come out and get whichever bundle I'll need.
    Other than your above problem, how do you like it, so far? Do you interface with Premiere Pro and AfterEffects?
    Unfortunately, I do not know of any resources for this particular program. Maybe by CS4, there will be some good books, and tuts out.
    Hunt

  • Windows 7 - Acrobat Reader 9 Pro Extended License agreement problem

    so i wanted to try out acrobat reader 9 pro extended. I downloaded the trial, installed the program, updated to 9.2 restarted the computer. Everything worked fine, till i came to the license agreement.
    but when i clicked "accept" so i could use the program, acrobat simply closed! i tried it again --> same problem
    i reinstalled: same problem. Searched the internet and fount something about acrobat closing after 10secs, but that was only for cracked versions.
    i m getting kind of desperate...what could be the problem???

    hey help. I have the same problem. when i clicked "accept"  acrobat simply closed! i tried it again --> same problem. I'm trying to view a list from verizon BIOS.

  • Extended Notification Workflow Problem

    Hi,
    I have configured Extended Notification by using SWNCONFIG transcation code for 3 scenorios. For the first 2 scenorios, it is working fine. ie. Users getting an e-mail to the outlook with 'Execute Work item' link.
    My problem is for the 3rd scenorio, configuration is not working for this. SWN_SELSEN report is not picking up the notification. I configured the 3rd scenorio same as the first 2 scenorios. I tried all the different ways. Still it is not working. i.e SWN_SELSEN is not at all picking up the 3rd notification.
    Please let me know if any one facing the same problem.

    Hi PR,
    Please find the steps below,
    1. Created new Category
    2. Assigned message templates to new Category
    3. Created new subscription:
         Delivery Sch: Every 15 minutes
         Delivery type: EMAIL_HTML
         Granularity: One message per Notification
         R Address: *
         R type: Internal SAP user
    4. Filter Basic:
        Copied standard ALL_DELTA & ALL_FULL filters and named it as Z*.
        Assinged main filter ALL_DELTA to ZALL_DELTA and ALL_FULL to ZALL_FULL.
        In the ZALL_DELTA, the parameters are ALL_DELTA: 'X' and TASK: My task number.
         For ZALL_FULL, i have assinged only TASK number.
    5. Created Schedule Selection and Delivery Selection within 15minutes interval.
    Everything i created for the same as scenorio 1 & 2.

  • Dynadock Extended Window Settings Problem

    I am using a Dynadock PA3541U-2PRP and am having problems with the display settings attached to it.
    For some reason anytime I restart or lock/unlock the desktop the screen goes from extended mode back to mirror mode. According to the manual I should be able to change the display settings using an icon in my system tray but for some reason that icon doesnt appear. I am using Vista ultimate 32-bit and have downloaded the latest dynadock drivers.
    It is really a pain to have to go into the graphics settings to set the screen back to extended after every time i unlock my system.
    Has anyone else found a solution for this?

    Hello karldergrosse,
    you have to install the latest diplay drivers.
    From this page you can download it: http://www.displaylink.com/support/downloads.html
    Install them and make a restart.
    After this the issue should be fixed.
    best regards

  • Extended Notification authorization problem

    Hi All,
    We configured extended notification for all the workflow in ECC 6.0.
    We have been moved to production system. When users selecting the workitem link in the outlook, they are getting an authorization problem saying that 'You don't have an authorization to execute SWNWIEX'.
    However, with this transaction the user can execute the ANY workitem just by entering the Work item id.  The transaction does not check if the work item is actually in the users inbox, I would think this could be a security issue.
    could you anyone please help me out.
    -Steve

    Hello,
    I don't think giving access to tx SWNWIEX allows all users access to all workitems.
    Where did you read that? It could be the case for your account, but not everybody's.
    Test it out.
    regards
    Rick Bakker
    Hanabi Technology

  • Extended Receiver Determination problem

    Hi,
    I am making use of extended receiver determination to send 1 source to multiple target systems. When I was testing so that the interface would just send to 1 target system while still making use of the extended receiver determination, I got the following error CO_TXT_OUTBINDING_NOT_FOUND and "No receiver agreement found". The red flag error occurs during Technical Routing and when I checked the details SOAP Header -> Main, I found that the following:
    Sender Service: ServiceA (correct)
    Sender Interface: InterfaceA (correct)
    Sender namespace: NamespaceA (correct)
    Receiver Service: ServiceB (correct)
    Receiver Interface: InterfaceA (wrong)
    Receiver namespace: InterfaceA (wrong)
    It seems that extended receiver determination was able to successfully determine the receiver service but fail in determining the correct receiver interface and receiver namespace. Does anybody know why this happen and how to correct the problem?
    Some investigation that I already done:
    1.) I temporarily changed the extended receiver determination to a standard receiver determination and specifying the 1 target system explicity without changing any other object in both IR and ID as well as using the same test file. The result is that this worked and the file was sent succefully to my intended target system. This tells me that the problem might either be in the extended receiver determination or in the message mapping or message interface Receivers. Also, this means that all the other objects in ID for this interface is configured correctly.
    2.) I tried hard coding the target system as a constant in the message mapping for the Receivers message type and still make use of the extended receiver determination and I got the same problem mentioned above.
    3.) I tried deleting the receiver determination, activating the changes, re-create the object and activate it and I still got the problem
    4.) I tried checking sxi_cache and everything is up to date and correct
    Any suggestions is highly appreciated.

    Elbert,
    I you are doing only standard receiver determination only and using certain condition you are sending to different targets. If yes check this url:
    /people/prasadbabu.nemalikanti3/blog/2006/09/20/receiver-determination-based-on-the-payload-of-input-dataextended-xpathcontext-object
    Can you please put the payload after message mapping and the xpath condition you mentioned. or if you are doing enhanced receiver determination please check this:
    Re: Error in enhanced receiver determination
    ---Satish
    Edited by: Satish Reddy on Jun 23, 2009 9:08 AM

  • CSS and Extended Passive FTP problem.

    Hi everyone.
    I'm having a problem setting up a load balanced cluster of FTP servers behind a CSS 11506.
    I can FTP into the cluster fine. I am redirected to one of the machines in a round robin fashion and can log in. The problem arises on mac's where typing in an ls command returns this:
    ftp> ls
    229 Entering Extended Passive Mode (|||32999|)
    200 EPRT command successful
    421 Service not available, remote server timed out. Connection closed
    Now, if I type in the EPSV command and disable Extended Passive Mode prior to connecting to it, it works fine.
    Also, connecting to any of the servers directly with epsv enabled works fine as well.
    We have over 800k hits per month and telling everyone to disable epsv will be a problem. Is there a way to enable extended passive mode through the css?
    Here is my config:
    Group: ftpServers1 - Active (198.202.122.181 Not Redundant)
    Session Redundancy: Disabled
    Last Clearing of Stats Counters: 03/20/2007 14:28:25
    Associated ACLs: NONE
    Source Services:
    DNS
    Name: Hits: State: Load: Trans: Keepalive: Conn:
    rem_ftp1 19857 Alive 44 6 FTP 0
    rem_ftp2 38175 Alive 87 0 FTP 0
    Destination Services:
    NONE
    Group Service Total Counters:
    Hits/Frames/Bytes: 58032/58339/4277264
    Connections Total/Current: 25/0
    FTP Control Total/Current: 0/0
    CSS11506# show rule pdb ftp-rule1
    Name: ftp-rule1 Owner: pdb
    State: Active Type: FTP
    Balance: Round Robin Failover: N/A
    Persistence: Enabled Param-Bypass: Disabled
    Session Redundancy: Disabled
    IP Redundancy: Not Redundant
    L3: 198.202.122.181
    L4: TCP/21
    Url:
    Redirect: ""
    TCP RST client if service unreachable: Disabled
    Rule Services & Weights:
    1: rem_ftp1-Alive, S-1
    2: rem_ftp2-Alive, S-1
    Thanks
    Boki

    EPSV is not supported.
    The only workaround available to load balance passive ftp servers is to use "PASV" command instead of "EPSV" on clients.
    Syed Iftekhar Ahmed

  • Just downloaded and installed CS6 extended, it says problems with display driver? any solution?

    Just downloaded and installed trial version CS6 extended. It will not display any file and says display driver problem. Any solution?

    Update your graphics driver.
    Mylenium

  • Adobe Acrobat Pro 9 Extended Web Capture Problem

    There are three different ways to convert a web page to .pdf that I am aware of.  I have used the first for several years but it has stopped working.  The second now has corrupt fonts.  The third still works.  I have repaired Acrobat to no avail - does anyone have an idea of what might have happened?
    1.     When right click web page and convert to pdf:
    An error has occurred in the script on this page
    Line:       11
    Char:      3
    Error:      Permission denied
    Code:     0
    URL:       res://C:\Program Files (x86)\Common Files\Adobe\Acrobat\ActiveX\AcroIEFavClient.dll/AcroIECapture.html
    Do you want to continue running scripts on this page?
    Yes         No
    2.     When right click and print to pdf converts OK but fonts scrambled
    3.     When select web capture from within Acrobat it works fine
    System report from within Acrobat:
    System Parameters:
    Available Physical Memory: 3760808 KB
    Available Virtual Memory: 1888780 KB
    BIOS Version: Sony - 20091110
    Default Browser:
    Default Mail: Microsoft Outlook
        mapi32.dll
        Version: 1.0.2536.0 (win7_rtm.090713-1255)
        Creation Date: 2011/03/04
        Creation Time: 09:17:18
    Graphics Card: NVIDIA GeForce 9300M GS
        Version: 8.16.11.8735
        Check: OK
    Installed Acrobat: C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe
        Version: 9.4.5.236
        Creation Date: 2011/07/07
        Creation Time: 11:35:05
    Installed Acrobat: C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe
        Version: 9.4.5.236
        Creation Date: 2011/06/08
        Creation Time: 05:02:34
    Locale: English (United Kingdom)
    Monitor:
        Name: NVIDIA GeForce 9300M GS
        Resolution: 1600 x 900 x 59
        Bits per pixel: 32
    OS Manufacturer: Microsoft Corporation
    OS Name: Microsoft Windows Vista
    OS Version: 6.1.7601  Service Pack 1
    Page File Space: 4194303 KB
    Processor: Intel64 Family 6 Model 23 Stepping 10  GenuineIntel  ~2793  Mhz
    System Name: BOBOWEN-VAIO
    Temporary Directory: C:\Users\BOBOWE~1\AppData\Local\Temp\
    Time Zone: GMT Standard Time
    Total Physical Memory: 4194303 KB
    Total Virtual Memory: 2097024 KB
    User Name: Bob Owen
    Windows Directory: C:\Windows
    Installed Plug-ins:
    C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\plug_ins\Annots.api
        Version: 9.4.5.236
        Creation Date: 2011/07/07
        Creation Time: 11:35:20
    C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\plug_ins\Capture3D.api
        Version: 9.4.0.195
        Creation Date: 2011/07/07
        Creation Time: 11:35:34
    C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\plug_ins\EScript.api
        Version: 9.4.5.236
        Creation Date: 2011/07/07
        Creation Time: 11:35:19
    C:\Program Files (x86)\Adobe\Acrobat 9.0\Acrobat\plug_ins\Updater.api
        Version: 9.4.5.236
        Creation Date: 2011/07/07
        Creation Time: 11:35:18

    Since there were no answers, I will take a stab at a reponse. For the 2nd method, I suspect you could simply select the print or press job options to get the desired results or turn off "use local fonts" in Acrobat. If you check the font list, the fonts are probably not embedded and that is likely the problem.
    I noticed that you have both Reader and Acrobat installed and that might cause some conflict, but should not be the issue here. If you were to uninstall Reader, you would have to repair Acrobat. The conflict here is that you might have problems with the one opening when you want the other. If it works for you, then don't worry about it.
    For technique 1, I suspect you may be using IE 9 that has apparently been a problem since it came out. I have refused to install it. However, it may simply be that PDF Maker does not work correctly with your browser, or got deactivated and needs to be allowed to run in your browser (IE I am assuming).

  • Extended withholding tax problem - India

    Hello
    I have assigned ewt tax codes in vendor master. ewt tax code on invoice posting as well as payment posting are assigned. However i am facing two problems.
    1.In case ewt is deducted on invoicing, again it is getting deducted on payment for that invoice. One thing that comes to notice is that the payment ewt tax code appears in witholding tab at the time of invoice. However if i remove it manually and then post the invoice then it does not deduct the ewt on payment.Is there a way to allow only the invoce tax codes to appear during invoicing? The other tax code on ewt on payment should not appear in the withholding tax taab in FB60/MIRO
    2.At the time of downpayment - Advance is given to the vendor. I will again deduct the tax, however later when an invoice comes it can be for more or the same amount. How do i not deduct the tax on invoicing ?? Manually removing is a really bad option, as people tend to forget. That is also acceptable in case the vendor is giving complete invoice equal to advance, what can be done in case invoice exceeds the advance amount?? Here ideally i would like to deduct tax only for the balance (invoice amount in excess of advance given).
    Any ideas how we ccan meet these real world requirement
    Regards
    Sameer

    Hi Sameeer,
    The solution is not to enter the PAYMENT withholding tax code in the vendor master. Only enter the invoice withholding type and code and the payment withholding type.
    The following are the scenarios
    1. Normal invoice and payment - At the time of invoice the system uses only the invoice tax codes and the payment tax codes are blank. Therefore TDS is deducted only for invoicing and not during payment.
    2. Advance, Invoice , Balance Payment - At the time of advance payment the system gives a popup for entering the payment withholding tax code (as it is blank in the vendor master). The user can choose to enter the withholding tax. Therefore tds is deducted on the amount paid. At the time of invoice booking tds is deducted on the entire bill amount. Now use F-54 to clear the invoice against the down payment. At this time the system will reverse the excess tds deducted (during invoicing) into the vendor account. Note however that if the tds certificate is already given to the vendor for the advance the user has to manually change the base amount during invoicing. Also the tds certificate and the returns will also be automatically correct.
    Rgds
    Shivram.
    Assign points for useful answer.

  • CS4 extended file open problem in Windows 7

    I am having a little spot of trouble. I switched from Windows to Mac recently and got myselfa copy of Photoshop CS5. I used to run Photoshop CS4 on a 32bit Windows 7 build and it works swell. Not a hitch. I've since moved CS4 onto a 64bit Windows 7 build and... it crashes when I open an image. Any image I've tried opening causes CS4 to crash.
    I wonder if any of you would have a solution. I guess the only other piece of information I can talk about is that there's a version of Photoshop Elements 8 already installed on the system but I don't know if that would conflict or not.

    Since you're probably still familiar enough with Windows to do maintenance, it sounds like what you're running into may be a display driver problem with OpenGL on your system...
    Try this as a workaround:  Go into Photoshop, choose Edit - Preferences - Performance, and uncheck [ ] Enable OpenGL Drawing, then restart Photoshop.
    If this works around the problem, visit the web site of the maker of your video card and locate the display driver that matches your hardware and Windows 7 x64 OS.  Download and install, then go back into Photoshop and reverse the above change (remembering to restart Photoshop after).
    Good luck.
    -Noel

  • Photoshop cs6 extended trial download problem

    i want to download photoshop cs6 extended trial version, but Download Assistant is only showing downloading option for photoshop cs6 standard.

    Installation files of Photoshop CS6 and Photoshop CS& Extended are always the same. So just download the Photoshop CS6 through the Download Assistant.
    If you buy Photoshop CS6 it will hide all Extended functions, unless you bought Photoshop CS6 Extended ;-)

  • Extended ascii character problem

    Here is the message I am getting
    2004-10-12 10:04:44,207 ERROR [STDERR] org.postgresql.util.PSQLException: Invalid character data was found. This is most likely caused by stored data containing characters that are invalid for the character set the database was created in. The most common example of this is storing 8bit data in a SQL_ASCII database.
    this is the character that is causing the problem (ascii 0232 �)
    My question is how can I make java display this character. I am using Postgresql 7.4 as my database.

    I don't understand the connection between the database and "java display".
    And ASCII is a 7 bit character set, so the character you listed is not ASCII, rather it is a character in some other character set.

Maybe you are looking for