langtools/test/tools/javac/T6326754.java
changeset 4699 e58edf3542b3
child 5520 86e4b9a9da40
equal deleted inserted replaced
4698:4ea5b8e20252 4699:e58edf3542b3
       
     1 /*
       
     2  * Copyright 2010 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    21  * have any questions.
       
    22  */
       
    23 
       
    24 /*
       
    25  * @test
       
    26  * @bug 6326754
       
    27  * @summary Compiler will fail to handle -Xmaxerrs with -ve numbers
       
    28  *
       
    29  * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs -1 T6326754.java
       
    30  * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs  0 T6326754.java
       
    31  * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs 10 T6326754.java
       
    32  * @compile/fail/ref=T6326754.out -XDrawDiagnostics              T6326754.java
       
    33  */
       
    34 class TestConstructor<T,K>{
       
    35     T t;
       
    36     K k;
       
    37     public TestConstructor(T t,K k){
       
    38         this.t =t;
       
    39     }
       
    40     public TestConstructor(K k){
       
    41         this.k = k;
       
    42         this.t = null;
       
    43     }
       
    44     public TestConstructor(T t){
       
    45         this.t=t;
       
    46         this.k=null;
       
    47     }
       
    48     public void setT(T t){
       
    49         this.t=t;
       
    50         this.k=null;
       
    51     }
       
    52     public void setT(K k){
       
    53         this.k = k;
       
    54         this.t = null;
       
    55     }
       
    56     public void setT(T t,K k){
       
    57         this.t = t;
       
    58         this.k = k;
       
    59     }
       
    60 }
       
    61 class TestC<T>{
       
    62     T t;
       
    63     public <T>void setT(T t){
       
    64         this.t = t;
       
    65     }
       
    66 }
       
    67 public class T6326754{
       
    68     public static void main(String... arg){
       
    69         TestC tC =new TestC();
       
    70         tC.setT();
       
    71         TestConstructor tc = new TestConstructor("saaa");
       
    72         tc.setT("sasa");
       
    73         TestC<Integer> tC1 = new TestC();
       
    74         tC1.setT(545);
       
    75     }
       
    76 }