file_name stringlengths 6 86 | file_path stringlengths 45 249 | content stringlengths 47 6.26M | file_size int64 47 6.26M | language stringclasses 1 value | extension stringclasses 1 value | repo_name stringclasses 767 values | repo_stars int64 8 14.4k | repo_forks int64 0 1.17k | repo_open_issues int64 0 788 | repo_created_at stringclasses 767 values | repo_pushed_at stringclasses 767 values |
|---|---|---|---|---|---|---|---|---|---|---|---|
ConstantInfiniteWhile.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/ConstantInfiniteWhile.java | /*
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4053875
* @summary Verify correct treatment of '|', '&', and '^' in constant expression
* controlling loop. No 'return' statements are necessary, as the loops
* cannot terminate normally.
*
* @author maddox
*
* @run compile ConstantInfiniteWhile.java
public class ConstantInfiniteWhile {
int test1() {
while ( false | true ) {}
}
int test2() {
while ( true & true ) {}
}
int test3() {
while ( false ^ true ) {}
}
// Just for grins... (included in original bug report)
int test4() {
while ( false == false ) {}
}
int test5() {
while ( 1 != 0 ) {}
}
int test6() {
while ( 1 + 2 > 0 ) {}
}
int test7() {
while ( true ? true : false ) {}
}
}
| 1,804 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignAfterTry1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry1.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4240487
* @summary Verify that we keep track of init/uninits in Try statement
* without finalizer.
*
* @compile/fail DefAssignAfterTry1.java
*/
class E1 extends Exception {}
class E2 extends Exception {}
public class DefAssignAfterTry1 {
public static void main(String argv[]) {
boolean t = true;
E1 se1 = new E1();
E2 se2 = new E2();
int i;
try {
if (t) {
throw se1;
}
} catch (E1 e) {
i = 0;
}
// the following line should result in a compile-time error
// variable i may not have been initialized
System.out.println(i);
System.out.println("Error : there should be compile-time errors");
}
}
| 1,822 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4721062b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/T4721062b.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4721062
* @summary DA treatment of return statements in constructors
* @author Neal Gafter (gafter)
*
* @compile/fail T4721062b.java
*/
class T4721062b {
final int i;
T4721062b(boolean b) {
if (b)
return;
i = 1;
}
}
| 1,334 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DUBeforeDefined2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DUBeforeDefined2.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4708676
* @summary Compiler assertion failure with forward reference
* @author Neal Gafter (gafter)
*
* @compile DUBeforeDefined2.java
* @run main DUBeforeDefined2
*/
public class DUBeforeDefined2 {
int i = j = 1;
final int j;
void f() {
if (i != j) throw new Error();
}
public static void main(String[] args) {
new DUBeforeDefined2().f();
}
}
| 1,463 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4721062a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/T4721062a.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4721062
* @summary DA treatment of return statements in constructors
* @author Neal Gafter (gafter)
*
* @compile/fail T4721062a.java
*/
class T4721062a {
final int i;
T4721062a() {
if (true)
return;
i = 1;
}
}
| 1,328 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignAfterTry3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignAfterTry3.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4240487
* @summary Verify that we keep track of init/uninits in Try statement
* without finalizer.
*
* @compile/fail DefAssignAfterTry3.java
*/
class E1 extends Exception {}
class E2 extends Exception {}
public class DefAssignAfterTry3 {
public static void main(String argv[]) {
boolean t = true;
E1 se1 = new E1();
E2 se2 = new E2();
int i;
try {
i = 0;
if (t)
throw se1;
else
throw se2;
} catch (E1 e) {
} catch (E2 e) {
i = 0;
}
// the following line should result in a compile-time error
// variable i may not have been initialized
System.out.println(i);
System.out.println("Error : there should be compile-time errors");
}
}
| 1,895 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7003744b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/7003744/T7003744b.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7003744 6999622
* @summary Compiler error concerning final variables
* @author mcimadamore
*
* @compile T7003744b.java
*/
class T7003744b {
void test() {
final int bogus;
for (int i1 = 0, i2 = 2; i1 < i2; i1++) {
final int i_1 = 2;
}
for (Object o : new Object[] { null }) {
final int i_2 = 2;
}
bogus = 4;
}
}
| 1,465 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7003744a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/7003744/T7003744a.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7003744 6999622
* @summary Compiler error concerning final variables
* @author mcimadamore
*
* @compile T7003744a.java
*/
class T7003744a {
final Object x;
T7003744a() {
{
int inx = 0;
for(int i = 0; i < 5; i++) { }
}
for(String am: new String[1]) {
final String mode = am;
}
x = null;
}
}
| 1,458 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_10.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_10.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_10.java
*/
public class DefAssignBoolean_10 {
public static void main(String[] args) {
int i, j;
boolean [] a = new boolean [10];
if (a[1] |= a[0] || (j = -1) > 0);
else
if (j != -1)
;
}
}
| 1,528 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignConstantBoolean.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignConstantBoolean.java | /*
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4304751
* @summary Verify correct treatment of boolean constant expressions with '|'. "&', and '^'.
* @author maddox
*
* @run compile DefAssignConstantBoolean.java
*/
public class DefAssignConstantBoolean {
public static void main(String args[]) {
boolean b;
if (true | false) ;
else
if (b) ; // case '|'
if (true & true) ;
else
if (b) ; // case '&'
if (true ^ false) ;
else
if (b) ; // case '^'
}
}
| 1,599 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_16.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_16.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_16.java
*/
public class DefAssignBoolean_16 {
public static void main(String[] args) {
int i = 777, j;
boolean b;
if (b = i < 0 || (j = -1) > 0);
else
if (j != -1)
;
}
}
| 1,453 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_11.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_11.java | /*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168 6348328
* @summary Verify that the valid boolean expression compiles.
* @author maddox
*
* @run compile DefAssignBoolean_11.java
*/
public class DefAssignBoolean_11 {
public static void main(String[] args) {
boolean b1, b2;
boolean r = false;
boolean f = false;
boolean t = true;
if ((t && (b1 = t)) ? t : t && (b1 = f))
r = b1;
}
}
| 1,488 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignCond.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignCond.java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4354393 4402005
* @summary Verify correct treatment and code gen for ?: definite assignment
* @author gafter
*
* @compile DefAssignCond.java
* @run main DefAssignCond
*/
public class DefAssignCond {
public static void main (String[] args) {
boolean t = true, f = false, b1, b2;
if (t ? (b1 = t) : false)
t = b1;
if (f ? true : (b2 = f)) ;
else
f = b2;
}
}
| 1,499 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_15.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_15.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_15.java
*/
public class DefAssignBoolean_15 {
public static void main(String[] args) {
int i = 777, j;
boolean b;
if (b = i > 0 && (j = -1) < 0)
if (j != -1)
;
}
}
| 1,439 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_2.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_2.java
*/
public class DefAssignBoolean_2 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((r || (b4 = t)) == (t && (b4 = true)))
r = b4;
}
}
| 1,512 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_6.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_6.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_6.java
*/
public class DefAssignBoolean_6 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((r || (b4 = r)) != (r || (b4 = t)))
r = b4;
}
}
| 1,506 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_9.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_9.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_9.java
*/
public class DefAssignBoolean_9 {
public static void main(String[] args) {
int i, j;
boolean [] a = new boolean [10];
if (a[1] &= a[0] && (j = -1) < 0)
if (j != -1)
;
}
}
| 1,504 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_12.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_12.java | /*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168 6348328
* @summary Verify that the valid boolean expression compiles.
* @author maddox
*
* @run compile DefAssignBoolean_12.java
*/
public class DefAssignBoolean_12 {
public static void main(String[] args) {
boolean b1, b2;
boolean r = false;
boolean f = false;
boolean t = true;
if ((t || (b2 = f)) ? t && (b2 = t) : f)
r = b2;
}
}
| 1,489 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_3.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_3.java
*/
public class DefAssignBoolean_3 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((t && (b3 = r)) == (t && (b3 = t)));
else
r = b3;
}
}
| 1,532 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_13.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_13.java | /*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168 6348328
* @summary Verify that the valid boolean expression compiles.
* @author maddox
*
* @run compile DefAssignBoolean_13.java
*/
public class DefAssignBoolean_13 {
public static void main(String[] args) {
boolean b1, b2;
boolean r = false;
boolean f = false;
boolean t = true;
if ((t && (b1 = t)) ? f : t || (b1 = f));
else
r = b1;
}
}
| 1,503 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_5.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_5.java
*/
public class DefAssignBoolean_5 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((t && (b3 = r)) != (t && (b3 = t)))
r = b3;
}
}
| 1,505 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_7.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_7.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_7.java
*/
public class DefAssignBoolean_7 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((t && (b3 = r)) != (r || (b3 = false)));
else
r = b3;
}
}
| 1,531 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_8.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_8.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_8.java
*/
public class DefAssignBoolean_8 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((r || (b4 = t)) != (t && (b4 = true)));
else
r = b4;
}
}
| 1,530 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_4.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_4.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_4.java
*/
public class DefAssignBoolean_4 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((r || (b4 = r)) == (r || (b4 = t)));
else
r = b4;
}
}
| 1,531 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_1.java | /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168
* @summary Verify that certain unverifiable boolean expressions fail DA test.
* @author maddox
*
* @run compile/fail DefAssignBoolean_1.java
*/
public class DefAssignBoolean_1 {
public static void main(String[] args) {
boolean b3, b4;
boolean r = false;
boolean t = true;
if ((t && (b3 = r)) == (r || (b3 = false)))
r = b3;
}
}
| 1,514 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DefAssignBoolean_14.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/DefiniteAssignment/DefAssignBoolean/DefAssignBoolean_14.java | /*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4262168 6348328
* @summary Verify that the valid boolean expression compiles.
* @author maddox
*
* @run compile DefAssignBoolean_14.java
*/
public class DefAssignBoolean_14 {
public static void main(String[] args) {
boolean b1, b2;
boolean r = false;
boolean f = false;
boolean t = true;
if ((t || (b2 = f)) ? f || (b2 = f) : t);
else
r = b2;
}
}
| 1,503 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Error.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/rawDiags/Error.java | /*
* @test /nodynamiccopyright/
* @bug 6177732
* @summary add hidden option to have compiler generate diagnostics in more machine-readable form
* @compile/fail/ref=Error.out -XDrawDiagnostics Error.java
*/
class Error
{
static void error
| 248 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Note.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/rawDiags/Note.java | /*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6177732
* @summary add hidden option to have compiler generate diagnostics in more machine-readable form
* @compile/ref=Note.out -XDrawDiagnostics Note.java
*/
class Note
{
static void useDeprecated() {
String s = new String(new byte[3], 0);
}
}
| 1,343 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Warning.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/rawDiags/Warning.java | /*
* @test /nodynamiccopyright/
* @bug 6177732
* @summary add hidden option to have compiler generate diagnostics in more machine-readable form
* @compile/ref=Warning.out -XDrawDiagnostics -Xlint:unchecked Warning.java
*/
import java.util.HashSet;
import java.util.Set;
class Warning
{
static void useUnchecked() {
Set s = new HashSet<String>();
s.add("abc");
}
}
| 396 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
SourcePath.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/sourcePath/SourcePath.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4648973
* @summary compiler does not emit code for second class in source file
* @author gafter
*
* @compile SourcePath.java
* @run main SourcePath
*/
public class SourcePath {
SourcePathA a;
public static void main(String[] args) throws Throwable {
Class b = Class.forName("SourcePathB");
b.getClass();
}
}
| 1,415 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
SourcePathA.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/sourcePath/SourcePathA.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
class SourcePathA {
}
class SourcePathB {
}
| 1,097 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6547131/T.java | /**
* @test
* @bug 6547131
* @summary java.lang.ClassFormatError when using old collection API
* @compile T.java
* @run main T
*/
import p.*;
class SubI implements Outer.I {
SubI() { }
Outer.I getI() { return this; }
}
public class T {
public static void main(String argv[]){
SubI sub = new SubI();
Outer.I inter = (Outer.I)sub.getI();
}
}
| 385 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6863465a.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6863465/T6863465a.java | /**
* @test /nodynamiccopyright/
* @bug 6863465
* @summary javac doesn't detect circular subclass dependencies via qualified names
* @author Maurizio Cimadamore
* @compile/fail/ref=T6863465a.out -XDrawDiagnostics T6863465a.java
*/
class T6863465a {
static class a { static interface b {} }
static class c extends a implements z.y {}
static class x { static interface y {} }
static class z extends x implements c.b {}
}
| 447 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6863465b.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6863465/T6863465b.java | /**
* @test /nodynamiccopyright/
* @bug 6863465
* @summary javac doesn't detect circular subclass dependencies via qualified names
* @author Maurizio Cimadamore
* @compile/fail/ref=T6863465b.out -XDrawDiagnostics T6863465b.java
*/
class T6863465b {
static class a { static interface b { static interface d {} } }
static class c extends a implements z.y, z.d {}
static class x { static interface y {} }
static class z extends x implements c.b {}
}
| 475 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
TestCircularClassfile.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6863465/TestCircularClassfile.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6863465
* @summary javac doesn't detect circular subclass dependencies via qualified names
* @run main TestCircularClassfile
*/
import java.io.*;
import java.net.URI;
import java.util.Arrays;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileObject;
import javax.tools.SimpleJavaFileObject;
import javax.tools.ToolProvider;
import com.sun.source.util.JavacTask;
import java.util.EnumSet;
public class TestCircularClassfile {
enum ClassName {
A("A"),
B("B"),
C("C"),
OBJECT("Object");
String name;
ClassName(String name) {
this.name = name;
}
}
static class JavaSource extends SimpleJavaFileObject {
final static String sourceStub = "class #C extends #S {}";
String source;
public JavaSource(ClassName clazz, ClassName sup) {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
source = sourceStub.replace("#C", clazz.name).replace("#S", sup.name);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors) {
return source;
}
}
public static void main(String... args) throws Exception {
int count = 0;
for (ClassName clazz : EnumSet.of(ClassName.A, ClassName.B, ClassName.C)) {
for (ClassName sup : EnumSet.of(ClassName.A, ClassName.B, ClassName.C)) {
if (sup.ordinal() < clazz.ordinal()) continue;
check("sub_"+count++, clazz, sup);
}
}
}
static JavaSource[] initialSources = new JavaSource[] {
new JavaSource(ClassName.A, ClassName.OBJECT),
new JavaSource(ClassName.B, ClassName.A),
new JavaSource(ClassName.C, ClassName.B)
};
static String workDir = System.getProperty("user.dir");
static void check(String destPath, ClassName clazz, ClassName sup) throws Exception {
File destDir = new File(workDir, destPath); destDir.mkdir();
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
JavacTask ct = (JavacTask)tool.getTask(null, null, null,
Arrays.asList("-d", destPath), null, Arrays.asList(initialSources));
ct.generate();
File fileToRemove = new File(destPath, clazz.name + ".class");
fileToRemove.delete();
JavaSource newSource = new JavaSource(clazz, sup);
DiagnosticChecker checker = new DiagnosticChecker();
ct = (JavacTask)tool.getTask(null, null, checker,
Arrays.asList("-cp", destPath), null, Arrays.asList(newSource));
ct.analyze();
if (!checker.errorFound) {
throw new AssertionError(newSource.source);
}
}
static class DiagnosticChecker implements DiagnosticListener<JavaFileObject> {
boolean errorFound = false;
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
if (diagnostic.getKind() == Diagnostic.Kind.ERROR &&
diagnostic.getCode().equals("compiler.err.cyclic.inheritance")) {
errorFound = true;
}
}
}
}
| 4,316 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6863465d.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6863465/T6863465d.java | /**
* @test /nodynamiccopyright/
* @bug 6863465
* @summary javac doesn't detect circular subclass dependencies via qualified names
* @author Maurizio Cimadamore
* @compile/fail/ref=T6863465d.out -XDrawDiagnostics T6863465d.java
*/
class T6863465d {
static class a { static interface b { static interface d {} } }
static class c extends a implements z.y, z.d {}
static class x { static interface y { static interface w {} } }
static class z extends x implements c.b, c.w {}
}
| 503 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6863465c.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/6863465/T6863465c.java | /**
* @test /nodynamiccopyright/
* @bug 6863465
* @summary javac doesn't detect circular subclass dependencies via qualified names
* @author Maurizio Cimadamore
* @compile/fail/ref=T6863465c.out -XDrawDiagnostics T6863465c.java
*/
class T6863465c {
static class x { static interface y {} }
static class z extends x implements c.b {}
static class a { static interface b { static interface d {} } }
static class c extends a implements z.y, z.d {}
}
| 475 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
AnonymousProtect.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/AnonymousProtect/AnonymousProtect.java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4308759
* @summary Anonymous class with inaccessible type in constructor is rejected
* @author gafter
*
* @run compile AnonymousProtect.java P1/priv.java P1/pub.java P1/pubExposePriv.java P2/usePub.java
*/
class AnonymousProtect {
public static void main(String[] args) {
P2.usePub.main(args);
}
}
| 1,392 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
usePub.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/AnonymousProtect/P2/usePub.java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package P2;
public class usePub extends P1.pub {
void bar () {
P1.pubExposePriv pd = new P1.pubExposePriv(new P1.pub());
P1.pubExposePriv pe = new P1.pubExposePriv(new P1.pub()){};
P1.pubExposePriv pf = new P1.pubExposePriv(null){};
P1.pub p = new P1.pub();
p.foo();
this.foo();
foo();
}
public static void main(String[] args) {
(new usePub()).bar();
}
}
| 1,489 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
priv.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/AnonymousProtect/P1/priv.java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package P1;
class priv {
public void foo() {};
}
| 1,106 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
pubExposePriv.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/AnonymousProtect/P1/pubExposePriv.java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package P1;
public class pubExposePriv extends priv {
public priv baz() { return new priv(); }
public void bar(priv p) {}
public pubExposePriv(priv p) {}
}
| 1,221 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
pub.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/AnonymousProtect/P1/pub.java | /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package P1;
public class pub extends priv {
}
| 1,099 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/incompatibleNoninherited/A.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4738690
* @summary javac improperly complains of conflict with non-inherited method
* @author gafter
*
* @compile A.java B.java
*/
package a;
public abstract class A {
abstract void f();
}
| 1,271 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
B.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/incompatibleNoninherited/B.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
interface B {
int f();
}
/** C is legal because no two *inherited* methods conflict. a.A.f() is
* not inherited because it is package private in another package. */
abstract class C extends a.A implements B {
}
| 1,270 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/4846262/Test.java | /* /nodynamiccopyright/ */
public class Test {
public void test() {
abcdefg
}
}
| 96 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Capture2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/capture/Capture2.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5029773
* @summary soundness problem with failure to subsitute wildcard as type formal argument
* @author gafter
*
* @compile/fail Capture2.java
*/
package capture2;
class R<T extends R<T>> {
T f() { return null; }
T t;
void x(R<?> r) {
this.t = r.f().t; // this should be an error!
}
}
| 1,391 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Capture5.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/capture/Capture5.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4916650
* @summary wildcards versus recursive F-bounds
* @author Peter von der Ahe
*
* @compile Capture5.java
*/
package capture5;
interface R<T extends R<T>> {}
class A implements R<A> {}
class B<T> implements R<B<T>> {}
class C implements R<C> {}
class Recursive {
<t> t choose(t x, t y) {
return x;
}
void f(boolean b1, boolean b2, boolean b3, A a, B<String> b, C c) {
R<? extends R<? extends R<? extends R<? extends R<?>>>>> r = null;
r = b2 ? a : b;
r = b1 ? (b2 ? a : b) : (b3 ? b : c);
r = choose(a,c);
r = choose(choose(a,b), choose(b,c));
}
}
| 1,696 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Capture3.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/capture/Capture3.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4916563
* @summary new wildcard subst scheme breaks java.lang.ref
* @author gafter
*
* @compile Capture3.java
*/
package capture3;
class Q<T> {
void enqueue(Ref<? extends T> r) {
}
}
class Ref<T> {
Q<? super T> queue;
void enqueue() {
this.queue.enqueue(this);
}
}
| 1,374 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Capture1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/capture/Capture1.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5011312
* @summary wildcard capture (snapshotting)
* @author gafter
*
* @compile -Xlint:unchecked -Werror Capture1.java
*/
package capture1;
import java.util.List;
class C {
public static <T> void copy1(List<? super T> dest, List<? extends T> src) {
copy1(dest, src);
copy2(dest, src); // oops
copy3(dest, src); // oops
}
public static <T> void copy2(List<T> dest, List<? extends T> src) {
copy1(dest, src);
copy2(dest, src);
copy3(dest, src); // oops
}
public static <T> void copy3(List<? super T> dest, List<T> src) {
copy1(dest, src);
copy2(dest, src); // oops
copy3(dest, src);
}
}
| 1,762 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Martin.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/capture/Martin.java | /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 6384510
* @summary improper handling of wildcard captures
* @author Martin Buchholz
* @compile/fail Martin.java
*/
import java.util.List;
public class Martin {
public static void main(String[] args) throws Throwable {
List<?> x1 = null;
List<?> x2 = null;
x1.addAll(x2);
}
}
| 1,391 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6594284.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/capture/T6594284.java | /*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6594284
* @summary NPE thrown when calling a method on an intersection type
* @author Maurizio Cimadamore
*
* @compile/fail T6594284.java
*/
public class T6594284 {
class A{ public void a(){}}
class B extends A{ public void b(){}}
interface I{ void i();}
interface I1 { void i1(); }
class E extends B implements I{ public void i(){};}
class C<W extends B & I1, T extends W>{
C<? extends I, ? extends E> arg;
}
}
| 1,527 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BasicTest.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javac/typeAnnotations/newlocations/BasicTest.java |
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6843077
* @summary random tests for new locations
* @author Matt Papi
* @compile/fail/ref=BasicTest.out -XDrawDiagnostics BasicTest.java
*/
import java.util.*;
import java.io.*;
@interface A {}
@interface B {}
@interface C {}
@interface D {}
//308: Test inverted to verify that type annotations can not be parsed yet.
/**
* Tests basic JSR 308 parser functionality. We don't really care about what
* the parse tree looks like, just that these annotations can be parsed.
*/
class BasicTest<T extends @A Object> extends @B LinkedList<T> implements @C List<T> {
void test() {
// Handle annotated class literals/cast types
Class<?> c = @A String.class;
Object o = (@A Object) "foo";
// Handle annotated "new" expressions (except arrays; see ArrayTest)
String s = new @A String("bar");
boolean b = o instanceof @A Object;
@A Map<@B List<@C String>, @D String> map =
new @A HashMap<@B List<@C String>, @D String>();
Class<? extends @A String> c2 = @A String.class;
}
// Handle receiver annotations
// Handle annotations on a qualified identifier list
void test2() @C @D throws @A IllegalArgumentException, @B IOException {
}
// Handle annotations on a varargs element type
void test3(Object @A... objs) {
}
}
| 2,416 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
FlagsTooEarly.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/FlagsTooEarly.java | /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4904495
* @summary Compilation may go awry if we ask a symbol for its flags during
* javac's Enter phase, before the flags are generally available.
*/
import com.sun.javadoc.*;
public class FlagsTooEarly extends Doclet {
public static void main(String[] args) {
String thisFile = "" +
new java.io.File(System.getProperty("test.src", "."),
"FlagsTooEarly.java");
if (com.sun.tools.javadoc.Main.execute(
"javadoc",
"FlagsTooEarly",
FlagsTooEarly.class.getClassLoader(),
new String[] {"-Xwerror", thisFile}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
/*
* The world's simplest doclet.
*/
public static boolean start(RootDoc root) {
return true;
}
/*
* The following sets up the scenario for triggering the (potential) bug.
*/
C2 c;
static class C1 { }
static class C2 { }
}
| 2,090 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
XWerror.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/XWerror.java | /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4099527
* @summary javadoc tool: want flag to exit nonzero if there were warnings.
* @author gafter
* @run main XWerror
*/
import com.sun.javadoc.*;
import java.util.*;
public class XWerror extends Doclet
{
public static void main(String[] args) {
if (com.sun.tools.javadoc.Main.
execute("javadoc", "XWerror", XWerror.class.getClassLoader(),
new String[] {"-Xwerror",
System.getProperty("test.src", ".") +
java.io.File.separatorChar +
"XWerror.java"}) == 0)
throw new Error();
}
public static boolean start(com.sun.javadoc.RootDoc root) {
root.printWarning(null, "warning message");
return false;
}
}
| 1,872 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
LangVers.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/LangVers.java | /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4909767
* @summary Verify that omitting Doclet.languageVersion() hides 1.5 language
* features from the doclet.
*/
import java.util.List;
import com.sun.javadoc.*;
public class LangVers extends Doclet {
public static void main(String[] args) {
String thisFile = "" +
new java.io.File(System.getProperty("test.src", "."),
"LangVers.java");
if (com.sun.tools.javadoc.Main.execute(
"javadoc",
"LangVers",
LangVers.class.getClassLoader(),
new String[] {"-source", "1.5", thisFile}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
public static boolean start(RootDoc root) {
ClassDoc fishdoc = root.classNamed("LangVers.Fish");
System.out.println(fishdoc);
if (fishdoc.isEnum()) {
throw new Error("Enums are not hidden.");
}
for (MethodDoc meth : fishdoc.methods()) {
System.out.println(meth);
if (meth.flatSignature().indexOf('<') >= 0) {
throw new Error("Type parameters are not hidden.");
}
}
return true;
}
public enum Fish {
One, Two, Red, Blue;
public void enroll(List<? super Fish> school) {
school.add(this);
}
}
}
| 2,446 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6551367.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/T6551367.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 6551367
* @summary javadoc throws ClassCastException when an link tag tries to reference constructor.
* @author A. Sundararajan
* @run main T6551367 T6551367.java
*/
import com.sun.javadoc.*;
import java.io.File;
import static com.sun.tools.javadoc.Main.execute;
public class T6551367 extends com.sun.tools.doclets.standard.Standard {
public T6551367() {}
/** Here, in the javadoc for this method, I try to link to
* {@link #<init> a constructor}.
*/
public static void main(String... args) {
File testSrc = new File(System.getProperty("test.src", "."));
File destDir = new File(System.getProperty("user.dir", "."));
for (String file : args) {
File source = new File(testSrc, file);
int rc = execute("javadoc", "T6551367",
T6551367.class.getClassLoader(),
new String[]{source.getPath(), "-d", destDir.getAbsolutePath()});
if (rc != 0)
throw new Error("unexpected exit from javadoc: " + rc);
}
}
}
| 2,121 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T6968833.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/T6968833.java | /*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6968833
* @summary javadoc reports error but still returns 0
*/
import java.io.*;
public class T6968833 {
public static void main(String... args) throws IOException {
new T6968833().run();
}
void run() throws IOException {
File srcDir = new File("src");
// following file causes error: No public or protected classes found to document.
File f = writeFile(srcDir, "Foo.java", "class Foo { }");
String[] args = { f.getPath() };
int rc = com.sun.tools.javadoc.Main.execute(args);
if (rc == 0)
throw new Error("Unexpected exit from javadoc: " + rc);
}
File writeFile(File dir, String path, String s) throws IOException {
File f = new File(dir, path);
f.getParentFile().mkdirs();
try (Writer out = new FileWriter(f)) {
out.write(s);
}
return f;
}
}
| 1,973 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
InlineTagsWithBraces.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/InlineTagsWithBraces.java | /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4965490
* @summary Verify that matching braces can appear within inline tags.
*/
import com.sun.javadoc.*;
/**
* This is a {@code test} comment.
* It is {@bold {@underline only} a test}.
* We would like some code
* {@code for (int i : nums) { doit(i); } return; }
* to be embedded {@maybe {even {a couple {of levels}}} deep}.
*/
public class InlineTagsWithBraces extends Doclet {
private static String[] expectedTags = {
"Text", "@code", "Text",
"@bold", "Text", "@code", "Text",
"@maybe", "Text"
};
private static String[] expectedText = {
"This is a ", "test", " comment.\n" +
" It is ", "{@underline only} a test", ".\n" +
" We would like some code\n" +
" ", "for (int i : nums) { doit(i); } return; ", "\n" +
" to be embedded ", "{even {a couple {of levels}}} deep", "."
};
public static void main(String[] args) {
String thisFile = "" +
new java.io.File(System.getProperty("test.src", "."),
"InlineTagsWithBraces.java");
if (com.sun.tools.javadoc.Main.execute(
"javadoc",
"InlineTagsWithBraces",
InlineTagsWithBraces.class.getClassLoader(),
new String[] {"-Xwerror", thisFile}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
public static boolean start(RootDoc root) {
ClassDoc cd = root.classes()[0];
Tag[] tags = cd.inlineTags();
for (int i = 0; i < tags.length; i++) {
if (!tags[i].name().equals(expectedTags[i]) ||
!tags[i].text().equals(expectedText[i])) {
throw new Error("Tag \"" + tags[i] + "\" not as expected");
}
}
return true;
}
}
| 2,897 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BooleanConst.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/BooleanConst.java | /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4587494
* @summary Constant field values for boolean Data-Types don't use true and false
* @author gafter
* @run main BooleanConst
*/
import com.sun.javadoc.*;
import java.util.*;
public class BooleanConst extends Doclet
{
public static void main(String[] args) {
// run javadoc on package p
if (com.sun.tools.javadoc.Main.
execute("javadoc", "BooleanConst", BooleanConst.class.getClassLoader(),
new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "BooleanConst.java"}) != 0)
throw new Error();
}
public static final boolean b1 = false;
public static final boolean b2 = true;
public static boolean start(com.sun.javadoc.RootDoc root) {
ClassDoc[] classes = root.classes();
if (classes.length != 1)
throw new Error("1 " + Arrays.asList(classes));
ClassDoc self = classes[0];
FieldDoc[] fields = self.fields();
if (fields.length != 2)
throw new Error("2 " + Arrays.asList(fields));
for (int i=0; i<fields.length; i++) {
FieldDoc f = fields[i];
if (f.name().equals("b1")) {
Object value = f.constantValue();
if (value == null || !(value instanceof Boolean) || ((Boolean)value).booleanValue())
throw new Error("4 " + value);
} else if (f.name().equals("b2")) {
Object value = f.constantValue();
if (value == null || !(value instanceof Boolean) || !((Boolean)value).booleanValue())
throw new Error("5 " + value);
} else throw new Error("3 " + f.name());
}
return true;
}
}
| 2,807 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BreakIteratorWarning.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/BreakIteratorWarning.java | /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4959985
* @summary Verify that (verbose) warnings are no longer generated when
* the default first-sentence algorithm doesn't match the
* BreakIterator algorithm.
*/
import com.sun.javadoc.*;
public class BreakIteratorWarning extends Doclet {
public static void main(String[] args) {
String thisFile = "" +
new java.io.File(System.getProperty("test.src", "."),
"BreakIteratorWarning.java");
if (com.sun.tools.javadoc.Main.execute(
"javadoc",
"BreakIteratorWarning",
BreakIteratorWarning.class.getClassLoader(),
new String[] {"-Xwerror", thisFile}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
public static boolean start(RootDoc root) {
ClassDoc cd = root.classes()[0];
FieldDoc fd = cd.fields()[0];
fd.firstSentenceTags();
return true;
}
/**
* "He'll never catch up!" the Sicilian cried. "Inconceivable!"
* "You keep using that word!" the Spaniard snapped. "I do not
* think it means what you think it means."
*
* <p> This comment used to trigger a warning, but no longer does.
*/
public String author = "William Goldman";
}
| 2,377 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
NoStar.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/NoStar.java | /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4587562
* @summary tool: Indentation messed up for javadoc comments omitting preceding *
* @author gafter
* @run main NoStar
*/
import com.sun.javadoc.*;
import java.util.*;
/** First sentence.
0
1
2
3
4
5
*/
public class NoStar extends Doclet
{
public static void main(String[] args) {
if (com.sun.tools.javadoc.Main.
execute("javadoc", "NoStar", NoStar.class.getClassLoader(),
new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "NoStar.java"}) != 0)
throw new Error();
}
public static boolean start(com.sun.javadoc.RootDoc root) {
ClassDoc[] classes = root.classes();
if (classes.length != 1)
throw new Error("1 " + Arrays.asList(classes));
ClassDoc self = classes[0];
String c = self.commentText();
System.out.println("\"" + c + "\"");
return c.equals("First sentence.\n0\n 1\n 2\n 3\n 4\n 5");
}
}
| 2,070 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
MethodLinks.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/MethodLinks.java | /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4628281
* @summary Int. links missing from return/param types when .java files passd in
* @author gafter
* @run main MethodLinks
*/
import com.sun.javadoc.*;
import java.util.*;
public class MethodLinks extends Doclet
{
public static void main(String[] args) {
if (com.sun.tools.javadoc.Main.
execute("javadoc", "MethodLinks", MethodLinks.class.getClassLoader(),
new String[] {System.getProperty("test.src", ".") +
java.io.File.separatorChar + "MethodLinks.java"}
) != 0)
throw new Error();
}
/** The parameter type and return type should link to the current
* class. */
public MethodLinks SAMPLE(MethodLinks x) {
return x;
}
public static boolean start(com.sun.javadoc.RootDoc root) {
ClassDoc[] classes = root.classes();
if (classes.length != 1)
throw new Error("1 " + Arrays.asList(classes));
ClassDoc self = classes[0];
MethodDoc[] allMethods = self.methods();
MethodDoc SAMPLE = null;
for (int i=0; i<allMethods.length; i++)
if (allMethods[i].name().equals("SAMPLE"))
SAMPLE = allMethods[i];
return
self == SAMPLE.parameters()[0].type().asClassDoc()
&&
self == SAMPLE.returnType().asClassDoc()
;
}
}
| 2,483 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
FileWithTabs.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/T4994049/FileWithTabs.java | /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class FileWithTabs {
\tpublic void tabbedMethod() {}
}
| 1,120 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T4994049.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/T4994049/T4994049.java | /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4994049
* @summary Unit test for SourcePosition.column with respect to tab expansion
* @author Peter von der Ah\u00e9
* @run main T4994049 FileWithTabs.java
*/
import com.sun.javadoc.*;
import java.io.*;
import static com.sun.tools.javadoc.Main.execute;
public class T4994049 extends Doclet {
public static boolean start(RootDoc root) {
for (ClassDoc klass : root.classes()) {
for (MethodDoc method : klass.methods()) {
if (method.name().equals("tabbedMethod")) {
if (method.position().column() == 21) {
System.out.println(method.position().column() + ": OK!");
return true;
} else {
System.err.println(method.position() + ": wrong tab expansion");
return false;
}
}
}
}
return false;
}
public static void main(String... args) throws Exception {
File testSrc = new File(System.getProperty("test.src"));
File tmpSrc = new File("tmpSrc");
initTabs(testSrc, tmpSrc);
for (String file : args) {
File source = new File(tmpSrc, file);
int rc = execute("javadoc", "T4994049", T4994049.class.getClassLoader(),
new String[]{ source.getPath() } );
if (rc != 0)
throw new Error("Unexpected return code from javadoc: " + rc);
}
}
static void initTabs(File from, File to) throws IOException {
for (File f: from.listFiles()) {
File t = new File(to, f.getName());
if (f.isDirectory()) {
initTabs(f, t);
} else if (f.getName().endsWith(".java")) {
write(t, read(f).replace("\\t", "\t"));
}
}
}
static String read(File f) throws IOException {
StringBuilder sb = new StringBuilder();
try (BufferedReader in = new BufferedReader(new FileReader(f))) {
String line;
while ((line = in.readLine()) != null) {
sb.append(line);
sb.append("\n");
}
}
return sb.toString();
}
static void write(File f, String s) throws IOException {
f.getParentFile().mkdirs();
try (Writer out = new FileWriter(f)) {
out.write(s);
}
}
}
| 3,513 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Main.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/enum/docComments/Main.java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4421066
* @summary Verify the comments in an enum type.
* @library ../../lib
* @compile ../../lib/Tester.java Main.java
* @run main Main
*/
import java.io.IOException;
import com.sun.javadoc.*;
public class Main extends Tester.Doclet {
private static final Tester tester =
new Tester("Main", "-package", "pkg1");
public static void main(String[] args) throws IOException {
tester.run();
}
public static boolean start(RootDoc root) {
ClassDoc operation = root.classes()[0];
boolean ok =
checkComment(operation.commentText(), "Arithmetic operations.");
for (FieldDoc f : operation.fields()) {
if (f.name().equals("plus")) {
ok = checkComment(f.commentText(), "Addition") && ok;
for (MethodDoc m : operation.methods()) {
if (m.name().equals("eval")) {
ok = checkComment(m.commentText(),
"Perform arithmetic operation " +
"represented by this constant.") &&
ok;
break;
}
}
break;
}
}
if (!ok) {
throw new Error("Comments don't match expectations.");
} else {
return true;
}
}
private static boolean checkComment(String found, String expected) {
System.out.println("expected: \"" + expected + "\"");
System.out.println("found: \"" + found + "\"");
return expected.equals(found);
}
}
| 2,718 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Operation.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/enum/docComments/pkg1/Operation.java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
/*
* Example from JSR 201, which borrowed it from "Effective Java".
*/
/**
* Arithmetic operations.
*/
public abstract enum Operation {
/** Addition */
plus {
/** Add 'em up. */
double eval(double x, double y) { return x + y; }
},
minus {
double eval(double x, double y) { return x - y; }
},
times {
double eval(double x, double y) { return x * y; }
},
divided_by {
double eval(double x, double y) { return x / y; }
};
/**
* Perform arithmetic operation represented by this constant.
*/
abstract double eval(double x, double y);
}
| 1,698 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Main.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/enum/enumType/Main.java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4421066
* @summary Verify the contents of an enum type.
* @library ../../lib
* @compile ../../lib/Tester.java Main.java
* @run main Main
*/
import java.io.IOException;
import com.sun.javadoc.*;
public class Main extends Tester.Doclet {
private static final Tester tester = new Tester("Main", "pkg1");
public static void main(String[] args) throws IOException {
tester.run();
tester.verify();
}
public static boolean start(RootDoc root) {
try {
for (ClassDoc cd : root.classes()) {
tester.printClass(cd);
}
return true;
} catch (IOException e) {
return false;
}
}
}
| 1,773 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
QuotablePerson.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/enum/enumType/pkg1/QuotablePerson.java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
/**
* Some people we love to quote.
*/
public enum QuotablePerson {
/** "Beware of all enterprises that require new clothes." */
Thoreau,
/**
* "A point of view can be a dangerous luxury when substituted for
* insight and understanding."
*/
McLuhan,
/**
* "If they can keep you asking the wrong questions, they don't have to
* worry about the answers."
*/
Pynchon,
/**
* "For every problem, there is a solution that is simple, elegant,
* and wrong."
*/
Mencken,
/**
* "Formerly unsolvable equations are dealt with by threats of reprisals."
*/
Allen,
/** "It is not enough to succeed. Others must fail." */
Vidal,
/** "Entia non sunt multiplicanda praeter necessitatem." */
Occam,
/**
* "Love is a snowmobile racing across the tundra and then suddenly it
* flips over, pinning you underneath. At night, the ice weasels come."
*/
Groening,
/** "Sed Quis custodiet ipsos custodes?" */
Juvenal,
/**
* "The list could surely go on, and there is nothing more wonderful
* than a list, instrument of wondrous hypotyposis."
*/
Eco
}
| 2,270 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Main.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/varArgs/Main.java | /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4421066 5006659
* @summary Verify the contents of a ClassDoc containing a varArgs method.
* Verify that see/link tags can use "..." notation.
* @library ../lib
* @compile ../lib/Tester.java Main.java
* @run main Main
*/
import java.io.IOException;
import com.sun.javadoc.*;
public class Main extends Tester.Doclet {
private static final Tester tester =
new Tester("Main", "-Xwerror", "pkg1");
public static void main(String[] args) throws IOException {
tester.run();
tester.verify();
}
public static boolean start(RootDoc root) {
try {
for (ClassDoc cd : root.classes()) {
tester.printClass(cd);
for (SeeTag tag : cd.seeTags()) {
if (tag.referencedMember() != cd.methods()[0]) {
throw new Error("5006659: @see tag meets varArgs");
}
}
}
return true;
} catch (IOException e) {
return false;
}
}
}
| 2,129 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/varArgs/pkg1/A.java | /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg1;
/**
* Interface A.
*
* @see #m1(int, String[])
* @see #m1(int, String...)
*/
public interface A {
void m1(int i, String... ss);
}
| 1,212 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
T7091528.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/parser/7091528/T7091528.java | /*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 7091528
* @summary javadoc attempts to parse .class files
* @compile p/C1.java p/q/C2.java
* @run main T7091528
*/
import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
public class T7091528 {
public static void main(String... args) {
new T7091528().run();
}
void run() {
File testSrc = new File(System.getProperty("test.src"));
File testClasses = new File(System.getProperty("test.classes"));
String[] args = {
"-d", ".",
"-sourcepath", testClasses + File.pathSeparator + testSrc,
"-subpackages",
"p"
};
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
String doclet = com.sun.tools.doclets.standard.Standard.class.getName();
int rc = com.sun.tools.javadoc.Main.execute("javadoc", pw, pw, pw, doclet, args);
pw.close();
String out = sw.toString();
if (!out.isEmpty()) {
System.err.println(out);
}
if (rc != 0)
System.err.println("javadoc failed: exit code = " + rc);
if (out.matches("(?s).*p/[^ ]+\\.class.*"))
throw new Error("reading .class files");
if (!new File("index.html").exists())
throw new Error("index.html not found");
}
}
| 2,422 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
C1.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/parser/7091528/p/C1.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p1;
/** This is class C1. */
public class C1 { }
| 1,111 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
C2.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/parser/7091528/p/q/C2.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p.q;
/** This is class p.q.C2. */
public class C2 { }
| 1,116 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
SourceOption.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/sourceOption/SourceOption.java | /*
* Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6507179
* @summary Ensure that "-source" option isn't ignored.
* @author Scott Seligman
*/
import com.sun.javadoc.*;
public class SourceOption extends Doclet {
public static void main(String[] args) {
if (com.sun.tools.javadoc.Main.execute(
"javadoc",
"SourceOption",
SourceOption.class.getClassLoader(),
new String[] {"-source", "1.3", "p"}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
public static boolean start(RootDoc root) {
root.classes(); // force parser into action
return true;
}
}
| 1,730 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/sourceOption/p/A.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
public class A {
boolean assert; // illegal since 1.4
boolean enum; // illegal since 5
}
| 1,171 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
JavacWarning.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6964914/JavacWarning.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class JavacWarning {
int enum; // warning in source 1.4
}
| 1,128 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
JavadocWarning.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6964914/JavadocWarning.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class JavadocWarning {
/** @see DoesNotExist */
int x;
}
| 1,130 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
TestUserDoclet.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6964914/TestUserDoclet.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6964914
* @summary javadoc does not output number of warnings using user written doclet
*/
import java.io.*;
import com.sun.javadoc.Doclet;
import com.sun.javadoc.RootDoc;
public class TestUserDoclet extends Doclet {
public static void main(String... args) throws Exception {
new TestUserDoclet().run();
}
static final String docletWarning = "warning from test doclet";
/** Main doclet method. */
public static boolean start(RootDoc root) {
root.printWarning(null, docletWarning);
return true;
}
/** Main test method. */
void run() throws Exception {
File javaHome = new File(System.getProperty("java.home"));
if (javaHome.getName().equals("jre"))
javaHome = javaHome.getParentFile();
File javadoc = new File(new File(javaHome, "bin"), "javadoc");
File testSrc = new File(System.getProperty("test.src"));
File testClasses = new File(System.getProperty("test.classes"));
// run javadoc in separate process to ensure doclet executed under
// normal user conditions w.r.t. classloader
String thisClassName = TestUserDoclet.class.getName();
Process p = new ProcessBuilder()
.command(javadoc.getPath(),
"-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"),
"-doclet", thisClassName,
"-docletpath", testClasses.getPath(),
new File(testSrc, thisClassName + ".java").getPath())
.redirectErrorStream(true)
.start();
int actualDocletWarnCount = 0;
int reportedDocletWarnCount = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
try {
String line;
while ((line = in.readLine()) != null) {
System.err.println(line);
if (line.contains(docletWarning))
actualDocletWarnCount++;
if (line.matches("[0-9]+ warning(s)?"))
reportedDocletWarnCount =
Integer.valueOf(line.substring(0, line.indexOf(" ")));
}
} finally {
in.close();
}
int rc = p.waitFor();
if (rc != 0)
System.err.println("javadoc failed, rc:" + rc);
int expectedDocletWarnCount = 1;
checkEqual("actual", actualDocletWarnCount, "expected", expectedDocletWarnCount);
checkEqual("actual", actualDocletWarnCount, "reported", reportedDocletWarnCount);
}
void checkEqual(String l1, int i1, String l2, int i2) throws Exception {
if (i1 != i2)
throw new Exception(l1 + " warn count, " + i1 + ", does not match "
+ l2 + " warn count, " + i2);
}
}
| 3,875 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Error.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6964914/Error.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class Error {
Object x // no semicolon
}
| 1,110 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
TestStdDoclet.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6964914/TestStdDoclet.java | /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6964914
* @summary javadoc does not output number of warnings using user written doclet
*/
import java.io.*;
/**
* Dummy javadoc comment.
* @author jjg
* @see DoesNotExist
*/
public class TestStdDoclet {
public static void main(String... args) throws Exception {
new TestStdDoclet().run();
}
/**
* More dummy comments.
* @throws DoesNotExist oops, javadoc does not see this
* @see DoesNotExist
*/
void run() throws Exception {
File javaHome = new File(System.getProperty("java.home"));
if (javaHome.getName().equals("jre"))
javaHome = javaHome.getParentFile();
File javadoc = new File(new File(javaHome, "bin"), "javadoc");
File testSrc = new File(System.getProperty("test.src"));
// run javadoc in separate process to ensure doclet executed under
// normal user conditions w.r.t. classloader
String thisClassName = TestStdDoclet.class.getName();
Process p = new ProcessBuilder()
.command(javadoc.getPath(),
"-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"),
"-package",
new File(testSrc, thisClassName + ".java").getPath())
.redirectErrorStream(true)
.start();
int actualDocletWarnCount = 0;
int reportedDocletWarnCount = 0;
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
try {
String line;
while ((line = in.readLine()) != null) {
System.err.println(line);
if (line.contains("DoesNotExist"))
actualDocletWarnCount++;
if (line.matches("[0-9]+ warning(s)?"))
reportedDocletWarnCount =
Integer.valueOf(line.substring(0, line.indexOf(" ")));
}
} finally {
in.close();
}
int rc = p.waitFor();
if (rc != 0)
System.err.println("javadoc failed, rc:" + rc);
int expectedDocletWarnCount = 2;
checkEqual("actual", actualDocletWarnCount, "expected", expectedDocletWarnCount);
checkEqual("actual", actualDocletWarnCount, "reported", reportedDocletWarnCount);
}
/**
* Private method should not cause a warning.
* @see DoesNotExist
*/
private void checkEqual(String l1, int i1, String l2, int i2) throws Exception {
if (i1 != i2)
throw new Exception(l1 + " warn count, " + i1 + ", does not match "
+ l2 + " warn count, " + i2);
}
}
| 3,701 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6964914/Test.java | /*
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6964914
* @summary javadoc does not output number of warnings using user written doclet
*/
import java.io.*;
public class Test {
public static void main(String... args) throws Exception {
new Test().run();
}
public void run() throws Exception {
javadoc("Error.java", "1 error");
javadoc("JavacWarning.java", "1 warning");
javadoc("JavadocWarning.java", "1 warning");
if (errors > 0)
throw new Exception(errors + " errors found");
}
void javadoc(String path, String expect) {
File testSrc = new File(System.getProperty("test.src"));
String[] args = {
"-source", "1.4", // enables certain Parser warnings
"-bootclasspath", System.getProperty("sun.boot.class.path"),
"-classpath", ".",
"-package",
new File(testSrc, path).getPath()
};
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
int rc = com.sun.tools.javadoc.Main.execute(
"javadoc",
pw, pw, pw,
com.sun.tools.doclets.standard.Standard.class.getName(),
args);
pw.close();
String out = sw.toString();
if (!out.isEmpty())
System.err.println(out);
System.err.println("javadoc exit: rc=" + rc);
if (!out.contains(expect))
error("expected text not found: " + expect);
}
void error(String msg) {
System.err.println("Error: " + msg);
errors++;
}
int errors;
}
| 2,661 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Tester.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/lib/Tester.java | /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* A utility used to invoke and test the javadoc tool.
*
* @author Scott Seligman
*/
import java.io.*;
import java.util.*;
import com.sun.javadoc.*;
public class Tester {
protected final String TEST_SRC = System.getProperty("test.src", ".");
protected final String TEST_CLASSES = System.getProperty("test.classes",
".");
private final String DEFAULT_ARGS[] = {
"-sourcepath", TEST_SRC,
};
private final File outputFile = new File(TEST_CLASSES, "testrun.out");
private final File expectedOutputFile = new File(TEST_SRC, "expected.out");
// private final File bootstrapMarkerFile = new File("bootstrap");
// True if we should "set expectations" by writing the expected output file
// rather than reading it and comparing.
// private final boolean bootstrap = bootstrapMarkerFile.isFile();
private String docletName;
private String[] args;
private Writer out = null;
/*
* Individual tests can extend this to create generics-aware doclets.
*/
public static abstract class Doclet extends com.sun.javadoc.Doclet {
public static LanguageVersion languageVersion() {
return LanguageVersion.JAVA_1_5;
}
}
public Tester(String docletName) {
this(docletName, new String[0]);
}
public Tester(String docletName, String... additionalArgs) {
this.docletName = docletName;
int len = DEFAULT_ARGS.length + additionalArgs.length;
args = new String[len];
System.arraycopy(DEFAULT_ARGS, 0, args, 0, DEFAULT_ARGS.length);
System.arraycopy(additionalArgs, 0, args, DEFAULT_ARGS.length,
additionalArgs.length);
try {
out = new BufferedWriter(new FileWriter(outputFile));
} catch (IOException e) {
throw new Error("Could not open output file " + outputFile);
}
}
public void run() throws IOException {
try {
if (com.sun.tools.javadoc.Main.execute("javadoc",
docletName,
getClass().getClassLoader(),
args) != 0) {
throw new Error("Javadoc errors encountered.");
}
System.out.println("--> Output written to " + outputFile);
} finally {
out.close();
}
}
/*
* Compare output of test run to expected output.
* Throw an Error if they don't match.
*/
public void verify() throws IOException {
BufferedReader thisRun =
new BufferedReader(new FileReader(outputFile));
BufferedReader expected =
new BufferedReader(new FileReader(expectedOutputFile));
for (int lineNum = 1; true; lineNum++) {
String line1 = thisRun.readLine();
String line2 = expected.readLine();
if (line1 == null && line2 == null) {
return; // EOF with all lines matching
}
if (line1 == null || !line1.equals(line2)) {
throw new Error(outputFile + ":" + lineNum +
": output doesn't match");
}
}
}
public void println(Object o) throws IOException {
prln(0, o);
}
public void println() throws IOException {
prln();
}
public void printPackage(PackageDoc p) throws IOException {
prPackage(0, p);
}
public void printClass(ClassDoc cd) throws IOException {
if (cd.isAnnotationType())
printAnnotationType((AnnotationTypeDoc)cd);
else
prClass(0, cd);
}
public void printAnnotationType(AnnotationTypeDoc at) throws IOException {
prAnnotationType(0, at);
}
public void printField(FieldDoc f) throws IOException {
prField(0, f);
}
public void printParameter(Parameter p) throws IOException {
prParameter(0, p);
}
public void printMethod(MethodDoc m) throws IOException {
prln(0, "method " + m);
prMethod(0, m);
}
public void printAnnotationTypeElement(AnnotationTypeElementDoc e)
throws IOException {
prln(0, "element " + e);
prMethod(0, e);
}
public void printConstructor(ConstructorDoc c) throws IOException {
prln(0, "constructor " + c);
prExecutable(0, c);
}
private void prPackage(int off, PackageDoc p) throws IOException {
prln(off, "package " + p);
prAnnotations(off + 2, p.annotations());
}
private void prClass(int off, ClassDoc cd) throws IOException {
prln(off,
(cd.isInterface() ? "interface" : cd.isEnum() ? "enum" : "class")
+ " " + cd);
prln(off + 2, "name: " + cd.simpleTypeName() + " / " +
cd.typeName() + " / " + cd.qualifiedTypeName());
prAnnotations(off + 2, cd.annotations());
prLabel(off + 2, "type parameters");
for (Type t : cd.typeParameters())
prln(off + 4, t);
prParamTags(off + 2, cd.typeParamTags());
prLabel(off + 2, "nested in");
prln(off + 4, cd.containingClass());
prLabel(off + 2, "superclass");
prln(off + 4, cd.superclassType());
prLabel(off + 2, "interfaces");
Type[] ts = cd.interfaceTypes();
Arrays.sort(ts);
for (Type t : ts)
prln(off + 4, t);
prLabel(off + 2, "enum constants");
for (FieldDoc f : cd.enumConstants())
prln(off + 4, f.name());
prLabel(off + 2, "fields");
for (FieldDoc f : cd.fields())
prln(off + 4, f.type() + " " + f.name());
prLabel(off + 2, "constructors");
for (ConstructorDoc c : cd.constructors())
prln(off + 4, c.name() + c.flatSignature());
prLabel(off + 2, "methods");
for (MethodDoc m : cd.methods())
prln(off + 4, typeUseString(m.returnType()) + " " +
m.name() + m.flatSignature());
}
private void prAnnotationType(int off, AnnotationTypeDoc at)
throws IOException {
prln(off, "@interface " + at);
prAnnotations(off + 2, at.annotations());
prLabel(off + 2, "elements");
for (AnnotationTypeElementDoc e : at.elements()) {
String def = (e.defaultValue() == null)
? ""
: " default " + e.defaultValue();
prln(off + 4, typeUseString(e.returnType()) + " " + e.name() +
e.flatSignature() + def);
}
}
private void prField(int off, FieldDoc f) throws IOException {
prln(off, "field " + typeUseString(f.type()) + " " + f.name());
prAnnotations(off + 2, f.annotations());
}
private void prParameter(int off, Parameter p) throws IOException {
prln(off, "parameter " + p);
prAnnotations(off + 2, p.annotations());
}
private void prMethod(int off, MethodDoc m) throws IOException {
prExecutable(off, m);
prLabel(off + 2, "returns");
prln(off + 4, typeUseString(m.returnType()));
prLabel(off + 2, "overridden type");
prln(off + 4, m.overriddenType());
}
private void prExecutable(int off, ExecutableMemberDoc m)
throws IOException {
if (!m.isAnnotationTypeElement()) {
prln(off + 2, "signature: " + m.flatSignature());
prln(off + 2, " " + m.signature());
}
prAnnotations(off + 2, m.annotations());
prParamTags(off + 2, m.typeParamTags());
prParamTags(off + 2, m.paramTags());
prLabel(off + 2, "type parameters");
for (Type t : m.typeParameters())
prln(off + 4, t);
prLabel(off + 2, "throws");
Type[] ts = m.thrownExceptionTypes();
Arrays.sort(ts);
for (Type t : ts)
prln(off + 4, t);
}
private void prAnnotations(int off, AnnotationDesc[] as)
throws IOException {
prLabel(off, "annotations");
for (AnnotationDesc a : as)
prln(off + 2, a.toString());
}
private void prParamTags(int off, ParamTag tags[]) throws IOException {
for (ParamTag tag : tags)
prParamTag(off, tag);
}
private void prParamTag(int off, ParamTag tag) throws IOException {
String name = tag.parameterName();
if (tag.isTypeParameter()) name = "<" + name + ">";
prln(off, "@param " + name + " " + tag.parameterComment());
}
private String typeUseString(Type t) {
return (t instanceof ClassDoc || t instanceof TypeVariable)
? t.typeName()
: t.toString();
}
// Labels queued for possible printing. Innermost is first in list.
List<Line> labels = new ArrayList<Line>();
// Print label if its section is nonempty.
void prLabel(int off, String s) {
while (!labels.isEmpty() && labels.get(0).off >= off)
labels.remove(0);
labels.add(0, new Line(off, s));
}
// Print queued labels with offsets less than "off".
void popLabels(int off) throws IOException {
while (!labels.isEmpty()) {
Line label = labels.remove(0);
if (label.off < off)
prln(label.off, label.o + ":");
}
}
// Print "o" at given offset.
void pr(int off, Object o) throws IOException {
popLabels(off);
for (int i = 0; i < off; i++)
out.write(' ');
if (o != null)
out.write(o.toString());
}
// Print "o" (if non-null) at given offset, then newline.
void prln(int off, Object o) throws IOException {
if (o != null) {
pr(off, o);
prln();
}
}
// Print newline.
void prln() throws IOException {
out.write('\n'); // don't want platform-dependent separator
}
static class Line {
int off;
Object o;
Line(int off, Object o) { this.off = off; this.o = o; }
}
}
| 11,473 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
CompletionFailure.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/completionFailure/CompletionFailure.java | /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4670772 6328529
* @summary Completion failures should be ignored in javadoc.
* @author gafter
*/
import com.sun.javadoc.*;
import java.util.*;
public class CompletionFailure extends Doclet
{
public static void main(String[] args) {
// run javadoc on package pkg
if (com.sun.tools.javadoc.Main.execute("javadoc",
"CompletionFailure",
CompletionFailure.class.getClassLoader(),
new String[]{"pkg"}) != 0)
throw new Error();
}
public static boolean start(com.sun.javadoc.RootDoc root) {
ClassDoc[] classes = root.classes();
if (classes.length != 1)
throw new Error("1 " + Arrays.asList(classes));
return true;
}
}
| 1,915 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/completionFailure/pkg/A.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
public class A {
}
| 1,085 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
B.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/completionFailure/pkg/B.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import pkg.A;
public class B {
}
| 1,086 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6958836/Test.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6958836
* @summary javadoc should support -Xmaxerrs and -Xmaxwarns
*/
import java.io.*;
import java.util.*;
public class Test {
public static void main(String... args) throws Exception {
new Test().run();
}
void run() throws Exception {
javadoc("errs", list(), 10, 0);
javadoc("errs", list("-Xmaxerrs", "0"), 10, 0);
javadoc("errs", list("-Xmaxerrs", "2"), 2, 0);
javadoc("errs", list("-Xmaxerrs", "4"), 4, 0);
javadoc("errs", list("-Xmaxerrs", "20"), 10, 0);
javadoc("warns", list(), 0, 10);
javadoc("warns", list("-Xmaxwarns", "0"), 0, 10);
javadoc("warns", list("-Xmaxwarns", "2"), 0, 2);
javadoc("warns", list("-Xmaxwarns", "4"), 0, 4);
javadoc("warns", list("-Xmaxwarns", "20"), 0, 10);
if (errors > 0)
throw new Exception(errors + " errors occurred.");
}
void javadoc(String pkg, List<String> testOpts,
int expectErrs, int expectWarns) {
System.err.println("Test " + (++count) + ": " + pkg + " " + testOpts);
File testOutDir = new File("test" + count);
List<String> opts = new ArrayList<String>();
// Force en_US locale in lieu of something like -XDrawDiagnostics.
// For some reason, this must be the first option when used.
opts.addAll(list("-locale", "en_US"));
opts.addAll(list("-classpath", System.getProperty("test.src")));
opts.addAll(list("-d", testOutDir.getPath()));
opts.addAll(testOpts);
opts.add(pkg);
StringWriter errSW = new StringWriter();
PrintWriter errPW = new PrintWriter(errSW);
StringWriter warnSW = new StringWriter();
PrintWriter warnPW = new PrintWriter(warnSW);
StringWriter noteSW = new StringWriter();
PrintWriter notePW = new PrintWriter(noteSW);
int rc = com.sun.tools.javadoc.Main.execute("javadoc",
errPW, warnPW, notePW,
"com.sun.tools.doclets.standard.Standard",
getClass().getClassLoader(),
opts.toArray(new String[opts.size()]));
System.err.println("rc: " + rc);
errPW.close();
String errOut = errSW.toString();
System.err.println("Errors:\n" + errOut);
warnPW.close();
String warnOut = warnSW.toString();
System.err.println("Warnings:\n" + warnOut);
notePW.close();
String noteOut = noteSW.toString();
System.err.println("Notes:\n" + noteOut);
check(errOut, "Errors.java", expectErrs);
check(warnOut, " warning ", expectWarns); // requires -locale en_US
}
void check(String text, String expectText, int expectCount) {
int foundCount = 0;
for (String line: text.split("[\r\n]+")) {
if (line.contains(expectText))
foundCount++;
}
if (foundCount != expectCount) {
error("incorrect number of matches found: " + foundCount
+ ", expected: " + expectCount);
}
}
private List<String> list(String... args) {
return Arrays.asList(args);
}
void error(String msg) {
System.err.println(msg);
errors++;
}
int count;
int errors;
}
| 4,467 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Errors.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6958836/errs/Errors.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package errs;
// class with 10 errors
class Errors {
X m0() { }
X m1() { }
X m2() { }
X m3() { }
X m4() { }
X m5() { }
X m6() { }
X m7() { }
X m8() { }
X m9() { }
}
| 1,258 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Warnings.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/6958836/warns/Warnings.java | /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package warns;
// class with 10 warnings
public class Warnings {
/** @param x */
public void m0() { }
/** @param x */
public void m1() { }
/** @param x */
public void m2() { }
/** @param x */
public void m3() { }
/** @param x */
public void m4() { }
/** @param x */
public void m5() { }
/** @param x */
public void m6() { }
/** @param x */
public void m7() { }
/** @param x */
public void m8() { }
/** @param x */
public void m9() { }
}
| 1,579 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
BadSuper.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/badSuper/BadSuper.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4983023
* @summary A bad superclass shouldn't throw the standard doclet into a loop
*/
public class BadSuper {
public static void main(String[] args) {
String srcpath = System.getProperty("test.src", ".");
if (com.sun.tools.javadoc.Main.execute(
new String[] {"-d", "doc", "-sourcepath", srcpath, "p"}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
}
| 1,502 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/badSuper/p/A.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
public class A extends Bogus {
}
| 1,097 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
B.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/badSuper/p/B.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
public class B extends I { // should be "implements"
}
interface I {
}
| 1,141 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Test.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/outputRedirect/Test.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4587487
* @summary com.sun.tools.javadoc.Main.execute ignores PrintWriters
* @author gafter
* @compile p/OutputRedirect.java
* @run main p.OutputRedirect
*/
// jtreg description-only file
| 1,263 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
OutputRedirect.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/outputRedirect/p/OutputRedirect.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
import java.io.*;
import com.sun.tools.javadoc.Main;
public class OutputRedirect {
public static void main(String[] args) {
PrintStream originalOutput = System.out;
try {
doTest();
} finally {
// restore things
System.setOut(originalOutput);
}
}
static void doTest() {
ByteArrayOutputStream redirectedOutput = new ByteArrayOutputStream();
PrintStream originalOutput = System.out;
// redirect System.out to a buffer
System.setOut(new PrintStream(redirectedOutput));
PrintWriter sink = new PrintWriter(new ByteArrayOutputStream());
// execute javadoc
int result = Main.execute("javadoc", sink, sink, sink,
"com.sun.tools.doclets.standard.Standard",
new String[] {"p"}
);
// test whether javadoc did any output to System.out
if (redirectedOutput.toByteArray().length > 0) {
originalOutput.println("Test failed; here's what javadoc wrote on its standard output:");
originalOutput.println(redirectedOutput.toString());
throw new Error("javadoc output wasn\'t properly redirected");
} else if (result != 0) {
throw new Error("javadoc run failed");
} else {
originalOutput.println("OK, good");
}
}
}
| 2,507 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
MissingImport.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/imports/MissingImport.java | /*
* Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 5012972
* @summary ClassDoc.getImportedClasses should return a class even if
* it's not in the classpath.
*/
import com.sun.javadoc.*;
public class MissingImport extends Doclet {
public static void main(String[] args) {
String thisFile = "" +
new java.io.File(System.getProperty("test.src", "."),
"I.java");
if (com.sun.tools.javadoc.Main.execute(
"javadoc",
"MissingImport",
MissingImport.class.getClassLoader(),
new String[] {thisFile}) != 0)
throw new Error("Javadoc encountered warnings or errors.");
}
/*
* The world's simplest doclet.
*/
public static boolean start(RootDoc root) {
ClassDoc c = root.classNamed("I");
ClassDoc[] imps = c.importedClasses();
if (imps.length == 0 ||
!imps[0].qualifiedName().equals("bo.o.o.o.Gus")) {
throw new Error("Import bo.o.o.o.Gus not found");
}
return true;
}
}
| 2,129 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
I.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/imports/I.java | /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// The following imported class is bogus, but should still be returned
// when inquired of.
import bo.o.o.o.Gus;
public interface I {
}
| 1,189 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
DupOk.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/dupOk/DupOk.java | /*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4673477
* @summary The first definition found for each class should be documented
* @author gafter
*/
import com.sun.javadoc.*;
import java.util.*;
public class DupOk extends Doclet
{
public static void main(String[] args) {
// run javadoc on package p
if (com.sun.tools.javadoc.Main.
execute("javadoc", "DupOk", DupOk.class.getClassLoader(),
new String[]
{"-sourcepath",
System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp1" +
System.getProperty("path.separator") +
System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp2",
"p"
}) != 0)
throw new Error();
}
public static boolean start(com.sun.javadoc.RootDoc root) {
ClassDoc[] classes = root.classes();
if (classes.length != 2)
throw new Error("1 " + Arrays.asList(classes));
for (int i=0; i<classes.length; i++) {
ClassDoc clazz = classes[i];
if (clazz.fields().length != 1)
throw new Error("2 " + clazz + " " + Arrays.asList(clazz.fields()));
}
return true;
}
}
| 2,304 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/dupOk/sp1/p/A.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
public class A {
public int x;
}
| 1,101 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
A.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/dupOk/sp2/p/A.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
public class A {}
| 1,082 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
B.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/dupOk/sp2/p/B.java | /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package p;
public class B {
public int x;
}
| 1,101 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Main.java | /FileExtraction/Java_unseen/openjdk-mirror_jdk7u-langtools/test/tools/javadoc/generics/supertypes/Main.java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4922918
* @summary Check supertypes and superinterfaces of parameterized types.
* @library ../../lib
* @compile ../../lib/Tester.java Main.java
* @run main Main
*/
import java.io.IOException;
import java.util.Comparator;
import java.util.Arrays;
import com.sun.javadoc.*;
public class Main extends Tester.Doclet {
private static final Tester tester = new Tester("Main", "pkg1");
public static void main(String[] args) throws IOException {
tester.run();
tester.verify();
}
public static boolean start(RootDoc root) {
try {
ClassDoc[] cds = root.classes();
Arrays.sort(cds);
for (ClassDoc cd : cds) {
ParameterizedType arrayList =
cd.superclassType().asParameterizedType();
tester.println(arrayList);
tester.println();
tester.println(arrayList.superclassType());
Type[] interfaces = arrayList.interfaceTypes();
// Sort interfaces by type name, for consistent output.
Arrays.sort(interfaces,
new Comparator<Type>() {
public int compare(Type t1, Type t2) {
String name1 = t1.qualifiedTypeName();
String name2 = t2.qualifiedTypeName();
return name1.compareTo(name2);
}
});
for (Type t : interfaces) {
tester.println(t);
}
tester.println();
}
return true;
} catch (IOException e) {
return false;
}
}
}
| 2,865 | Java | .java | openjdk-mirror/jdk7u-langtools | 9 | 3 | 0 | 2012-05-07T19:45:34Z | 2012-05-08T17:47:06Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.