test/tools/javac/T6326754.java

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

     1 /*
     2  * Copyright (c) 2010, 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 /*
    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 }

mercurial