test/tools/javac/resolve/tests/PrimitiveBinopOverload.java

Mon, 01 Jul 2013 14:57:03 +0100

author
mcimadamore
date
Mon, 01 Jul 2013 14:57:03 +0100
changeset 1875
f559ef7568ce
parent 0
959103a6100f
permissions
-rw-r--r--

7034798: Ambiguity error for abstract method call is too eager
Summary: Javac should wait and see if ambiguous methods can be reconciled at the end of an overload resolution round
Reviewed-by: jjg, vromero

     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  */
    24 @TraceResolve
    25 class PrimitiveBinopOverload {
    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; }
    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; }
    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; }
    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; }
    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 }

mercurial