Typing rules for assigning non-wildcards to wildcards

Hi all,
I have the following code:
public class A<T extends Number> {
     T t;
     public void foo() {
          Number number = null;
          Integer integer = null;
          A<? extends Integer> a1 = null;
          A<? super Integer> a2 = null;
          a1.t = null; // OK
          a1.t = integer; // Error
          a2.t = number; // Error
          a2.t = integer; // OK
}The code contains four assignments of a non-wildcard type to a wildcard type. Two of them are correct, two are wrong. Now, intuitively, the following rules seem to hold for such assignments to upper/lower bounded wildcards:
- Only the null-type can be assigned to an upper bounded (or unbounded) wildcard.
- A non-wildcard type can be assigned to a lower bounded wildcard iff it can be assigned to the wildcard's lower bound.
I think that the rules are quite intuitive but I would be interested in finding the formal typing rules for such assignments in the JLS. Can anyone provide a reference into the
JLS which which cover the semantics of the above assignments?
Any help would be really appreciated. Thanks a lot in advance!

kablair & dannyyates,
first of all, thanks a lot for taking you the time to explain the things to me that clearly! Sorry also for the somewhat confusing example by having chosen the final class Integer which is some kind of a special and limiting case.
In any case, I have gone through the JLS yesterday as I was particularly interested in the role of capture conversion to formally explain the correctness of the above code and here are my conclusions I want to share with you: Actually, there seem to be no subtyping rules for wildcards because you always apply capture conversion (JLS3 5.1.10) to wildcards before looking for their subtype relationship to other types. Capture conversion converts each wildcard to a new fresh synthetic type variable which has appropriate upper bounds and also a lower bound. Now, in the very last sentence of section 4.10.2 of the JLS3, it is stated that a type variable is a direct supertype of its lower bound which I think is the key point. This means that you can assign something to a type variable iff you can assign it to its lower bound.
Now, capture conversion converts every unbounded or lower bounded wildcard into a type variable which has the null type as its lower bound. This formally shows that you can really just assign null to them as in the code above. Contrary, every lower bounded wildcard is capture converted to a type variable whose lower bound is the lower bound of the wildcard. So, again, you can assign it every type you can assign to that lower bound. This is also reflected in the above code.
So, that's maybe the formal explanation for something which is intuitively clear anyway...

Similar Messages

  • Rule for Assign Roles Portals

    Dear experts
    I have two roles created in the portal (Role A., Role B)
    Depending of the type of user , There are is way using rules that system use a role A or B ?
    Thanks
    Regards

    Hello Steffi.
    Rule collections are used to assign portal desktops to portal users at runtime. A rule collection comprises conditions made up of IF and THEN expressions. Conditions are prioritized according to their order of appearance in the rule collection.
    Thanks
    Regards

  • Thumb rule for assigning auth values after t-code addition to a role

    Hello everyone,
    Could you please share your expertise on this. When a transaction is added to (the menu of )a role in PFCG, it automatically pulls in its corresponding authorization objects. So my question is what values should be given to these newly pulled in auth objects. Is there any guideline to be followed? Any disucssion would be greatly appreciated. Thanks a lot!

    There really is no general rule.
    There are two things you need to prepare to work on authorizations:
    1. A list of critical authorization objects, such as S_DEVELOP, S_RFC and the like. In every role that you touch, these need to be managed properly. If you find that the default values in PFCG are not according to your policy, change them in SU24
    2. A list of authorization values that you have determined are necessary for control purposes, i.e. cost centers and other org values. These need to be set according to the desird usage of the role.
    Oh, there is ONE general rule: DO maintain SU24, i.e. manage what gets into PFCG in the first place. Make sure it's what your security design requires.
    Hope that helps,
    Frank.

  • Typing Rules for the Iphone

    The only problem I have with the Iphone and typing on it is when I abbreviate something like this: abbr. It will automatically capitalize the first letter of the word after the abbreviated word (this is with the setting for automatic capitalization turned on which I like).  What it should do is require two spaces for the capitalization of a word after a period.  That way, an abbreviated word would not cause the next word to be capitalized.  I know it is a bit anal-retentive of me, but it IS annoying. I just hope this simple fix can be done on later updates and new phone releases.

    I believe if you are a current AT&T Customer and wish to ADD a new phone to your account you will be able to get the new 16GB model for $199 or a 32GB model for $299. I went through
    http://www.apple.com/iphone/buy/
    and selected "Add a new line to my existing account" and was shown pricing as $199 for 16 GB and $299 for 32 GB.
    Hard to see this as any benefit unless you need an additional line on an existing account, which I happen to (I bought a new "additional line" 3G just before the 3GS was announced, and will fit into the "return" window)

  • Settlemnent rule for Non-Billable WBS at Level 2 .

    Hi Folks,
    We have the Finance related WBS at Level 2 one is billable & other is non billable WBS . As per the recommendation of SAP , we are generating the automatic settlement rule for Billable WBS at level 2 & all the below WBS ( which are non-billable ) & account assigned as Do not settle. ( settlemnet rule 90) .
    This issue is creating a issue to the non billable WBS at level 2 created wherein we are not able to settlement due to the strategy followed as Do not settle ( Rule 90 ) for the Account assigned WBS element.
    Is there any way we can settle the costs posted to the non-billable level 2 WBS to the reciever ?
    Your advice to this issue will be helpful.
    Thanks in advance.
    Ramu

    You can settle the cost of Non-billable WBSE to billable WBSE. and then from billable WBSE settle the cost to other reciever. for this to happen, you have to delete the settlement rule "do not settle" in non-billabe WBSE and write a settlement rule which settles to billable WBSE.

  • Look for a filename containing a Wildcard (how to?)

    My program enters a loop, and when a certain file is found, the loop exits and resumes duties. The file will start with "Pos_" or "Neg_" or "Warn_" then have some arbitrary junk, before suffixing in txt. So... how do I search for a filename with a wildcard? The attached JPG is how I'd like to do it, (and this works fine if the filenames are constant) but of course it doesn't work for the wildcard.
    Richard
    Attachments:
    wildcard.jpg ‏58 KB

    Thanks for the response Mads. I'll give that I try. I'm horrible at arrays, I tend to keep everything flat. Probably stoopid in this case.
    Richard

  • New account assignment category for GR Non Valuated

    Hi Friends,
    I want to make a New account assignment category for GR Non Valuated. I created the same in SPROMMPurchasingAccount assignmentMaintain account assignment categories.
    I selected followig:
    AA Changeable at IR - X
    Consumption account -V
    Acct modification- VBR
    ID: AcctAssgt Scrn- 1
    Distribution - 1
    Partial invoice- 2
    GR- Non Valuated - X
    GR non Valuated. Frim - X
    After this When I am trying to create a PO with above made Account assgn cat. it is giving a Error that
    "With non-valuated GR, please also enter GR indicator"
    When I am clicking on GR indicator in Delivery tab, it also selects GR-Based IV in Invoice tab.
    I want to have GR to be selected automatically in Delivery tab & GR- Based IV not to select in Invoice tab.
    How to do this ?
    Regards,
    Sai Krishna

    Hi ,
    In this case you may not enter the account modifier VBR . See as there is no GR posting you don't need it . But it is useful to determine the account in PO. For example if you maintain account modifier in your account assignment category you need not to enter the G/L account at the time of creating PO in account assignmnet Tab. If will be automatically picked . But if you are not maintaining the account modifier in account assignmnet category then you have to enter the account manually .
    So choice is yours whether you need an account modifier or not depending on your scenario.
    regards,
    Anupam

  • Fix for SOLR searches beginning with wildcard?

    All, I am having problems finding clear answers on if the above was corrected in ColdFusion 10. 
    I can't get my head around the idea of SOLR not allowing search criteria to begin with a wildcard.  I've seen a solution for reverse wildcard searching, which is great as long as I specify criteria for which I know the ending letters.  For example, if I am looking for all entries ending in "ing", I could do a search on "*ing", using the reverse wildcard to find "gni*".  I have yet to see, or come up with, a solution for a SOLR search with wildcards in the start and end of the criteria.  For example, lets say I am looking for any word with "fus" in the middle, such as "confusing" or "perfusing" or "profusely".  I would want to do a search such as "*fus*".  From what I understand thus far, this cannot be done in SOLR?
    Thanks,
    Tom

    ColdFusion will support whatever Apache solr supports as it is the underlying engine we are using.
    And Solr does support it: http://lucene.apache.org/solr/api/org/apache/solr/analysis/ReversedWildcardFilterFactory.h tml
    I think this is an egregious hack, but still, it's the way they've chosen to support it.
    Solr technically disables support of leading wildcards by default in the traditional query parsers due to concerns about query performance since it tends to select a large percentage of indexed terms.
    Be that as it may, this should be my decision, as the maintainer of the index, not your decision to blanketly disallow it.  If it's available, then one can use it if one choses, or not use it for the reasons you cite.  If you blanketly disallow it, you're removing the ability for me to make that decision.
    It's also a bit of a backwards compat issue, innit?  Verity allowed leading wildcards.
    Adam

  • Garnishment - Special Rule for Non-Exempt Amount

    There is calculation scheme for each special rule for non-exempt amount. For example federal rule for support is 04.  The calculation scheme for this rule has 2 lines with operation multiplication and subtraction; and operand F1 and DN.  Can someone explain to me what each line means and the cumulative effect of both the lines?
    Thanks for your help!!
    BBC

    Hi,
    Line 1 = F1 * DN i.e. Field 1 from infotype (IT0195 field 1 for fed exempt as per table T5UGA config) is multiplied by Disposable Net (wage type /G00) and stores result in R1 (intermediate result field)
    Line 2 = DN - R1 i.e. subtract intermediate result stored from line 1 in R1 field from Disposable Net (/G00 wage type) to output result as minimum limit defined for nonexempt amount.
    You can verify same in UGARN CALC (Garnishment Calculations section) in schema.
    Thanks,
    Ameet

  • Standard Oracle report for the "security rules define/assign"

    Dear all:
    Is there any Standard Oracle report to show the :"Application --> Setup : Financials : Flexfields : Key : Security " flexfield "security rules define/assign" ?
    Regards
    Terry
    Edited by: Terry Chen on 2010/5/4 上午 2:27

    yes i believe there is one report in sysadmin or gl which shows this.

  • Any thoughts on auto sourcing for a non catalogue request?

    Any thoughts of auto sourcing for a non catalogue request?
    If i have a Contract Purchase Agreement set for a certain Category and if i use the same category in the non catalogue request purchase requisition will the workflow automatically generate the PO?
    Following set to Y
    CONTRACT_REQUIRED_FLAG
    INCLUDE_NON_CATALOG_REQ_FLAG
    USE_CONTRACT_FLAG
    How the price will be determined in the PO in such cases?

    Hi,
    You need to define the sourcing rule, ASL and default assignment sets and map the CPA in the ASL setup.
    This will drive the autocreation of PO.
    Thanks,
    PS.

  • Standard WBS Elements Screen layout/Settlement rule/IM assignment

    Few questions about Standard WBS elements
    1. Is possible to have my own layout for the WBS element detail screens while creating/changing the standard WBS element (CJ91/CJ92)?
    2. Is it possible to maintain the settlement rules for the standard WBS elements?
    3. Is it possible assign the standard WBS elements to the IM program/position?
    I know that all the above possible are only in case of operavtive WBS.
    If possible with Std WBS elements, please help me and let me know.
    Regards
    Sreenivas

    Sreenivas,
    I´m afraid that none of the 3 options is available via standard tools
    I´m so sorry.
    Rgds
    Martina

  • Settlement rule for Rental unit

    Hello all,
    Request your kind help. i have created a Building under a BE. Then I have created a RO object of type Rental Space (RS).
    I am now trying to maintain settlement rule for the RS. First I am going into the Edit - CO settlement rule and maintaining the required rules.
    I find that the Save button is deactivated in this screen. So i click on the BACK button and come back to the master data screen of the RS. Now i am clicking on the SAVE button and the nessage appears "Rental Space has been changed".
    I am then coming out of the screen by typing /N.
    Again I am typing /NREBDRO and calling the same master data (RS). Now when i am trying to view the settlement rule that I just created and saved, the system issues an error message "no settlement rule is defined".
    My questions are:
    1.  What are the basic setting configs required to be able to save a settlement rule for a rental object?
    2.  Why am I unable to save the settlement rules to this RS.
    3. I am not facing any such problem when I am trying to assign settlement rules for RO of type Pooled Space. So why is it that there is a problem with Rental Spaces?
    Request your kind help please.
    Regards,
    Suvarghya Dutta

    Hello all,
    Let me rephrase the doubt:
    Can someone please tell me how I may find out as to which objects could the costs incurred on the following objects be settled to ?
    BE
    BU
    Pooled Space (PS)
    Rental Space (RS).
    Also, if the settlemnt rule in BU states that costs would be settled to BE, then is it possible to define:
    1. Valid settlement rule in PS, marking a cost centre as a receipient
    2. Valid settlement rule in RS, marking a cost centre as a receipient.
    Can someone please tell me what is the basis or ratinality to be followed while defining settlement rules on RE-FX objects?
    Kindly help.
    Regards,
    Suvarghya Dutta

  • Data not coming from DOE to Mobile After defining Rule for device attribute

    Hi All,
    I have created a DO and rule for it.In case of Bulk Rule for all definition when i triggere extract from Portal then all the data comes to outbound queue but when i define rule for Device attribute then no data comes to my Outboun queue.Here is the scenario what i am doing :
    1. I have order header in my backend which has a field named "Work_Center" and this will be criteria field.
    2. In CDS table i have all the records for all the work center.
    3. Now in RMM under customized , i have added an attribute named "Work_center".
    4. Now i defined a rule with Device attribute mapping and activated the rule.
    5. Now on Portal i assigned this data object and in the device attribute tab i assigned the value(this value exist in CDS table for few orders) of a   Work center to the attribute "Work_Center" .
    6. Then i triggrere extract but its Outbound queue is empty, what could be the reason.
    Is my approach is correct
    Regards,
    Abhishek

    Hi Abhishek,
    You can check one ore thing, after you have performed all the steps till step 5, i.e. just before triggering
    extract. Check if the AT table for ur DO has entries based on the criteria specified by you...
    1. In the workbench click on the Data Object, and then right click and select "View Metadata".
    2. Select Distribution Model tab.
    3. Now select your DO's Association table.
    4. For the input field DEVICE ID specify your corresponing device id,and also for status field specify it 
        as "I"  and execute
    If there are any entries now in the AT table, and on triggering extract if they are not coming to the
    outbound Q there is some EXTRACT Q blocked. And is there were no entries in the AT then the rule
    specified is not  the satifying.
    Thanks,
    Swarna
    Now if you have entries w

  • Any report to check vacation rule for users?

    any report to check vacation rule for users?

    Hello Anand,
    there is no report but you may use the production order info system with list "components" and create a layout contaning the issued quantity and/or the final issue indicator. With a correct sorting, the list should show all orders with non-issued components at the top.
    Regards, Andreas

Maybe you are looking for