langtools/test/tools/javac/resolve/tests/PrimitiveBinopOverload.java
changeset 29262 1698800c8606
parent 29261 ea6e20f98dfa
parent 29099 766801b4d95d
child 29263 66e30e926405
child 29505 682be03b8f41
equal deleted inserted replaced
29261:ea6e20f98dfa 29262:1698800c8606
     1 /*
       
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 @TraceResolve
       
    25 class PrimitiveBinopOverload {
       
    26 
       
    27     @Candidate(applicable=Phase.BASIC, mostSpecific=true)
       
    28     int _plus(int x, int y) { return -1; }
       
    29     @Candidate(applicable=Phase.BASIC)
       
    30     long _plus(long x, long y) { return -1; }
       
    31     @Candidate(applicable=Phase.BASIC)
       
    32     float _plus(float x, float y) { return -1; }
       
    33     @Candidate(applicable=Phase.BASIC)
       
    34     double _plus(double x, double y) { return -1; }
       
    35     //not a candidate
       
    36     Object _plus(Object x, Object y) { return -1; }
       
    37 
       
    38     @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true)
       
    39     int _minus(int x, int y) { return -1; }
       
    40     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    41     long _minus(long x, long y) { return -1; }
       
    42     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    43     float _minus(float x, float y) { return -1; }
       
    44     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    45     double _minus(double x, double y) { return -1; }
       
    46 
       
    47     @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true)
       
    48     int _mul(int x, int y) { return -1; }
       
    49     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    50     long _mul(long x, long y) { return -1; }
       
    51     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    52     float _mul(float x, float y) { return -1; }
       
    53     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    54     double _mul(double x, double y) { return -1; }
       
    55 
       
    56     @Candidate(applicable= { Phase.BASIC, Phase.BOX }, mostSpecific=true)
       
    57     int _div(int x, int y) { return -1; }
       
    58     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    59     long _div(long x, long y) { return -1; }
       
    60     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    61     float _div(float x, float y) { return -1; }
       
    62     @Candidate(applicable= { Phase.BASIC, Phase.BOX })
       
    63     double _div(double x, double y) { return -1; }
       
    64 
       
    65     {
       
    66         int i1 = 1 + 1;
       
    67         int i2 = 5 - new Integer(3);
       
    68         int i3 = new Integer(5) * 3;
       
    69         int i4 = new Integer(6) / new Integer(2);
       
    70     }
       
    71 }