mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
Merge
This commit is contained in:
commit
f73e24fb02
24 changed files with 796 additions and 33 deletions
|
@ -1435,7 +1435,17 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||||
// documented, this must be an inherited link. Redirect it.
|
// documented, this must be an inherited link. Redirect it.
|
||||||
// The current class either overrides the referenced member or
|
// The current class either overrides the referenced member or
|
||||||
// inherits it automatically.
|
// inherits it automatically.
|
||||||
containing = ((ClassWriterImpl) this).getClassDoc();
|
if (this instanceof ClassWriterImpl) {
|
||||||
|
containing = ((ClassWriterImpl) this).getClassDoc();
|
||||||
|
} else if (!containing.isPublic()){
|
||||||
|
configuration.getDocletSpecificMsg().warning(
|
||||||
|
see.position(), "doclet.see.class_or_package_not_accessible",
|
||||||
|
tagName, containing.qualifiedName());
|
||||||
|
} else {
|
||||||
|
configuration.getDocletSpecificMsg().warning(
|
||||||
|
see.position(), "doclet.see.class_or_package_not_found",
|
||||||
|
tagName, seetext);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (configuration.currentcd != containing) {
|
if (configuration.currentcd != containing) {
|
||||||
refMemName = containing.name() + "." + refMemName;
|
refMemName = containing.name() + "." + refMemName;
|
||||||
|
|
|
@ -69,6 +69,7 @@ doclet.URL_error=Error fetching URL: {0}
|
||||||
doclet.No_Package_Comment_File=For Package {0} Package.Comment file not found
|
doclet.No_Package_Comment_File=For Package {0} Package.Comment file not found
|
||||||
doclet.No_Source_For_Class=Source information for class {0} not available.
|
doclet.No_Source_For_Class=Source information for class {0} not available.
|
||||||
doclet.see.class_or_package_not_found=Tag {0}: reference not found: {1}
|
doclet.see.class_or_package_not_found=Tag {0}: reference not found: {1}
|
||||||
|
doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
|
||||||
doclet.see.malformed_tag=Tag {0}: Malformed: {1}
|
doclet.see.malformed_tag=Tag {0}: Malformed: {1}
|
||||||
doclet.Inherited_API_Summary=Inherited API Summary
|
doclet.Inherited_API_Summary=Inherited API Summary
|
||||||
doclet.Deprecated_API=Deprecated API
|
doclet.Deprecated_API=Deprecated API
|
||||||
|
|
|
@ -159,6 +159,12 @@ public enum Source {
|
||||||
public boolean allowTypeAnnotations() {
|
public boolean allowTypeAnnotations() {
|
||||||
return compareTo(JDK1_7) >= 0;
|
return compareTo(JDK1_7) >= 0;
|
||||||
}
|
}
|
||||||
|
public boolean allowBinaryLiterals() {
|
||||||
|
return compareTo(JDK1_7) >= 0;
|
||||||
|
}
|
||||||
|
public boolean allowUnderscoresInLiterals() {
|
||||||
|
return compareTo(JDK1_7) >= 0;
|
||||||
|
}
|
||||||
public static SourceVersion toSourceVersion(Source source) {
|
public static SourceVersion toSourceVersion(Source source) {
|
||||||
switch(source) {
|
switch(source) {
|
||||||
case JDK1_2:
|
case JDK1_2:
|
||||||
|
|
|
@ -69,8 +69,10 @@ class CloseableURLClassLoader
|
||||||
if (l.getClass().getName().equals("sun.misc.URLClassPath$JarLoader")) {
|
if (l.getClass().getName().equals("sun.misc.URLClassPath$JarLoader")) {
|
||||||
Field jarField = l.getClass().getDeclaredField("jar");
|
Field jarField = l.getClass().getDeclaredField("jar");
|
||||||
JarFile jar = (JarFile) getField(l, jarField);
|
JarFile jar = (JarFile) getField(l, jarField);
|
||||||
//System.err.println("CloseableURLClassLoader: closing " + jar);
|
if (jar != null) {
|
||||||
jar.close();
|
//System.err.println("CloseableURLClassLoader: closing " + jar);
|
||||||
|
jar.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
|
@ -593,7 +593,7 @@ public class JavacParser implements Parser {
|
||||||
//where
|
//where
|
||||||
boolean isZero(String s) {
|
boolean isZero(String s) {
|
||||||
char[] cs = s.toCharArray();
|
char[] cs = s.toCharArray();
|
||||||
int base = ((Character.toLowerCase(s.charAt(1)) == 'x') ? 16 : 10);
|
int base = ((cs.length > 1 && Character.toLowerCase(cs[1]) == 'x') ? 16 : 10);
|
||||||
int i = ((base==16) ? 2 : 0);
|
int i = ((base==16) ? 2 : 0);
|
||||||
while (i < cs.length && (cs[i] == '0' || cs[i] == '.')) i++;
|
while (i < cs.length && (cs[i] == '0' || cs[i] == '.')) i++;
|
||||||
return !(i < cs.length && (Character.digit(cs[i], base) > 0));
|
return !(i < cs.length && (Character.digit(cs[i], base) > 0));
|
||||||
|
|
|
@ -100,6 +100,18 @@ public class Scanner implements Lexer {
|
||||||
*/
|
*/
|
||||||
private boolean allowHexFloats;
|
private boolean allowHexFloats;
|
||||||
|
|
||||||
|
/** Allow binary literals.
|
||||||
|
*/
|
||||||
|
private boolean allowBinaryLiterals;
|
||||||
|
|
||||||
|
/** Allow underscores in literals.
|
||||||
|
*/
|
||||||
|
private boolean allowUnderscoresInLiterals;
|
||||||
|
|
||||||
|
/** The source language setting.
|
||||||
|
*/
|
||||||
|
private Source source;
|
||||||
|
|
||||||
/** The token's position, 0-based offset from beginning of text.
|
/** The token's position, 0-based offset from beginning of text.
|
||||||
*/
|
*/
|
||||||
private int pos;
|
private int pos;
|
||||||
|
@ -162,10 +174,13 @@ public class Scanner implements Lexer {
|
||||||
|
|
||||||
/** Common code for constructors. */
|
/** Common code for constructors. */
|
||||||
private Scanner(Factory fac) {
|
private Scanner(Factory fac) {
|
||||||
this.log = fac.log;
|
log = fac.log;
|
||||||
this.names = fac.names;
|
names = fac.names;
|
||||||
this.keywords = fac.keywords;
|
keywords = fac.keywords;
|
||||||
this.allowHexFloats = fac.source.allowHexFloats();
|
source = fac.source;
|
||||||
|
allowBinaryLiterals = source.allowBinaryLiterals();
|
||||||
|
allowHexFloats = source.allowHexFloats();
|
||||||
|
allowUnderscoresInLiterals = source.allowBinaryLiterals();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final boolean hexFloatsWork = hexFloatsWork();
|
private static final boolean hexFloatsWork = hexFloatsWork();
|
||||||
|
@ -396,23 +411,42 @@ public class Scanner implements Lexer {
|
||||||
scanLitChar(true);
|
scanLitChar(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scanDigits(int digitRadix) {
|
||||||
|
char saveCh;
|
||||||
|
int savePos;
|
||||||
|
do {
|
||||||
|
if (ch != '_') {
|
||||||
|
putChar(ch);
|
||||||
|
} else {
|
||||||
|
if (!allowUnderscoresInLiterals) {
|
||||||
|
lexError("unsupported.underscore", source.name);
|
||||||
|
allowUnderscoresInLiterals = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveCh = ch;
|
||||||
|
savePos = bp;
|
||||||
|
scanChar();
|
||||||
|
} while (digit(digitRadix) >= 0 || ch == '_');
|
||||||
|
if (saveCh == '_')
|
||||||
|
lexError(savePos, "illegal.underscore");
|
||||||
|
}
|
||||||
|
|
||||||
/** Read fractional part of hexadecimal floating point number.
|
/** Read fractional part of hexadecimal floating point number.
|
||||||
*/
|
*/
|
||||||
private void scanHexExponentAndSuffix() {
|
private void scanHexExponentAndSuffix() {
|
||||||
if (ch == 'p' || ch == 'P') {
|
if (ch == 'p' || ch == 'P') {
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
|
skipIllegalUnderscores();
|
||||||
if (ch == '+' || ch == '-') {
|
if (ch == '+' || ch == '-') {
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
}
|
}
|
||||||
|
skipIllegalUnderscores();
|
||||||
if ('0' <= ch && ch <= '9') {
|
if ('0' <= ch && ch <= '9') {
|
||||||
do {
|
scanDigits(10);
|
||||||
putChar(ch);
|
|
||||||
scanChar();
|
|
||||||
} while ('0' <= ch && ch <= '9');
|
|
||||||
if (!allowHexFloats) {
|
if (!allowHexFloats) {
|
||||||
lexError("unsupported.fp.lit");
|
lexError("unsupported.fp.lit", source.name);
|
||||||
allowHexFloats = true;
|
allowHexFloats = true;
|
||||||
}
|
}
|
||||||
else if (!hexFloatsWork)
|
else if (!hexFloatsWork)
|
||||||
|
@ -438,23 +472,22 @@ public class Scanner implements Lexer {
|
||||||
/** Read fractional part of floating point number.
|
/** Read fractional part of floating point number.
|
||||||
*/
|
*/
|
||||||
private void scanFraction() {
|
private void scanFraction() {
|
||||||
while (digit(10) >= 0) {
|
skipIllegalUnderscores();
|
||||||
putChar(ch);
|
if ('0' <= ch && ch <= '9') {
|
||||||
scanChar();
|
scanDigits(10);
|
||||||
}
|
}
|
||||||
int sp1 = sp;
|
int sp1 = sp;
|
||||||
if (ch == 'e' || ch == 'E') {
|
if (ch == 'e' || ch == 'E') {
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
|
skipIllegalUnderscores();
|
||||||
if (ch == '+' || ch == '-') {
|
if (ch == '+' || ch == '-') {
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
}
|
}
|
||||||
|
skipIllegalUnderscores();
|
||||||
if ('0' <= ch && ch <= '9') {
|
if ('0' <= ch && ch <= '9') {
|
||||||
do {
|
scanDigits(10);
|
||||||
putChar(ch);
|
|
||||||
scanChar();
|
|
||||||
} while ('0' <= ch && ch <= '9');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lexError("malformed.fp.lit");
|
lexError("malformed.fp.lit");
|
||||||
|
@ -487,10 +520,10 @@ public class Scanner implements Lexer {
|
||||||
assert ch == '.';
|
assert ch == '.';
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
while (digit(16) >= 0) {
|
skipIllegalUnderscores();
|
||||||
|
if (digit(16) >= 0) {
|
||||||
seendigit = true;
|
seendigit = true;
|
||||||
putChar(ch);
|
scanDigits(16);
|
||||||
scanChar();
|
|
||||||
}
|
}
|
||||||
if (!seendigit)
|
if (!seendigit)
|
||||||
lexError("invalid.hex.number");
|
lexError("invalid.hex.number");
|
||||||
|
@ -498,28 +531,35 @@ public class Scanner implements Lexer {
|
||||||
scanHexExponentAndSuffix();
|
scanHexExponentAndSuffix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void skipIllegalUnderscores() {
|
||||||
|
if (ch == '_') {
|
||||||
|
lexError(bp, "illegal.underscore");
|
||||||
|
while (ch == '_')
|
||||||
|
scanChar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Read a number.
|
/** Read a number.
|
||||||
* @param radix The radix of the number; one of 8, 10, 16.
|
* @param radix The radix of the number; one of 2, j8, 10, 16.
|
||||||
*/
|
*/
|
||||||
private void scanNumber(int radix) {
|
private void scanNumber(int radix) {
|
||||||
this.radix = radix;
|
this.radix = radix;
|
||||||
// for octal, allow base-10 digit in case it's a float literal
|
// for octal, allow base-10 digit in case it's a float literal
|
||||||
int digitRadix = (radix <= 10) ? 10 : 16;
|
int digitRadix = (radix == 8 ? 10 : radix);
|
||||||
boolean seendigit = false;
|
boolean seendigit = false;
|
||||||
while (digit(digitRadix) >= 0) {
|
if (digit(digitRadix) >= 0) {
|
||||||
seendigit = true;
|
seendigit = true;
|
||||||
putChar(ch);
|
scanDigits(digitRadix);
|
||||||
scanChar();
|
|
||||||
}
|
}
|
||||||
if (radix == 16 && ch == '.') {
|
if (radix == 16 && ch == '.') {
|
||||||
scanHexFractionAndSuffix(seendigit);
|
scanHexFractionAndSuffix(seendigit);
|
||||||
} else if (seendigit && radix == 16 && (ch == 'p' || ch == 'P')) {
|
} else if (seendigit && radix == 16 && (ch == 'p' || ch == 'P')) {
|
||||||
scanHexExponentAndSuffix();
|
scanHexExponentAndSuffix();
|
||||||
} else if (radix <= 10 && ch == '.') {
|
} else if (digitRadix == 10 && ch == '.') {
|
||||||
putChar(ch);
|
putChar(ch);
|
||||||
scanChar();
|
scanChar();
|
||||||
scanFractionAndSuffix();
|
scanFractionAndSuffix();
|
||||||
} else if (radix <= 10 &&
|
} else if (digitRadix == 10 &&
|
||||||
(ch == 'e' || ch == 'E' ||
|
(ch == 'e' || ch == 'E' ||
|
||||||
ch == 'f' || ch == 'F' ||
|
ch == 'f' || ch == 'F' ||
|
||||||
ch == 'd' || ch == 'D')) {
|
ch == 'd' || ch == 'D')) {
|
||||||
|
@ -821,6 +861,7 @@ public class Scanner implements Lexer {
|
||||||
scanChar();
|
scanChar();
|
||||||
if (ch == 'x' || ch == 'X') {
|
if (ch == 'x' || ch == 'X') {
|
||||||
scanChar();
|
scanChar();
|
||||||
|
skipIllegalUnderscores();
|
||||||
if (ch == '.') {
|
if (ch == '.') {
|
||||||
scanHexFractionAndSuffix(false);
|
scanHexFractionAndSuffix(false);
|
||||||
} else if (digit(16) < 0) {
|
} else if (digit(16) < 0) {
|
||||||
|
@ -828,8 +869,25 @@ public class Scanner implements Lexer {
|
||||||
} else {
|
} else {
|
||||||
scanNumber(16);
|
scanNumber(16);
|
||||||
}
|
}
|
||||||
|
} else if (ch == 'b' || ch == 'B') {
|
||||||
|
if (!allowBinaryLiterals) {
|
||||||
|
lexError("unsupported.binary.lit", source.name);
|
||||||
|
allowBinaryLiterals = true;
|
||||||
|
}
|
||||||
|
scanChar();
|
||||||
|
skipIllegalUnderscores();
|
||||||
|
scanNumber(2);
|
||||||
} else {
|
} else {
|
||||||
putChar('0');
|
putChar('0');
|
||||||
|
if (ch == '_') {
|
||||||
|
int savePos = bp;
|
||||||
|
do {
|
||||||
|
scanChar();
|
||||||
|
} while (ch == '_');
|
||||||
|
if (digit(10) < 0) {
|
||||||
|
lexError(savePos, "illegal.underscore");
|
||||||
|
}
|
||||||
|
}
|
||||||
scanNumber(8);
|
scanNumber(8);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -216,6 +216,8 @@ compiler.err.illegal.line.end.in.char.lit=\
|
||||||
illegal line end in character literal
|
illegal line end in character literal
|
||||||
compiler.err.illegal.nonascii.digit=\
|
compiler.err.illegal.nonascii.digit=\
|
||||||
illegal non-ASCII digit
|
illegal non-ASCII digit
|
||||||
|
compiler.err.illegal.underscore=\
|
||||||
|
illegal underscore
|
||||||
compiler.err.illegal.qual.not.icls=\
|
compiler.err.illegal.qual.not.icls=\
|
||||||
illegal qualifier; {0} is not an inner class
|
illegal qualifier; {0} is not an inner class
|
||||||
compiler.err.illegal.start.of.expr=\
|
compiler.err.illegal.start.of.expr=\
|
||||||
|
@ -1163,7 +1165,16 @@ compiler.misc.varargs.clash.with=\
|
||||||
# Diagnostics for language feature changes
|
# Diagnostics for language feature changes
|
||||||
########################################
|
########################################
|
||||||
compiler.err.unsupported.fp.lit=\
|
compiler.err.unsupported.fp.lit=\
|
||||||
hexadecimal floating-point literals are not supported before -source 5
|
hexadecimal floating point literals are not supported in -source {0}\n\
|
||||||
|
(use -source 5 or higher to enable hexadecimal floating point literals)
|
||||||
|
|
||||||
|
compiler.err.unsupported.binary.lit=\
|
||||||
|
binary literals are not supported in -source {0}\n\
|
||||||
|
(use -source 7 or higher to enable binary literals)
|
||||||
|
|
||||||
|
compiler.err.unsupported.underscore.lit=\
|
||||||
|
underscores in literals are not supported in -source {0}\n\
|
||||||
|
(use -source 7 or higher to enable underscores in literals)
|
||||||
|
|
||||||
compiler.warn.enum.as.identifier=\
|
compiler.warn.enum.as.identifier=\
|
||||||
as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
|
as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
|
||||||
|
|
|
@ -60,7 +60,12 @@ public class AnnotationDescImpl implements AnnotationDesc {
|
||||||
*/
|
*/
|
||||||
public AnnotationTypeDoc annotationType() {
|
public AnnotationTypeDoc annotationType() {
|
||||||
ClassSymbol atsym = (ClassSymbol)annotation.type.tsym;
|
ClassSymbol atsym = (ClassSymbol)annotation.type.tsym;
|
||||||
return (AnnotationTypeDoc)env.getClassDoc(atsym);
|
if (annotation.type.isErroneous()) {
|
||||||
|
env.warning(null, "javadoc.class_not_found", annotation.type.toString());
|
||||||
|
return new AnnotationTypeDocImpl(env, atsym);
|
||||||
|
} else {
|
||||||
|
return (AnnotationTypeDoc)env.getClassDoc(atsym);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
34
langtools/test/com/sun/javadoc/5093723/DocumentedClass.java
Normal file
34
langtools/test/com/sun/javadoc/5093723/DocumentedClass.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Google, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** A documented class. */
|
||||||
|
public class DocumentedClass extends UndocumentedClass {
|
||||||
|
/** {@link #method} */
|
||||||
|
public void m1() {}
|
||||||
|
/** {@link #publicMethod} */
|
||||||
|
public void m2() {}
|
||||||
|
/** {@link #protectedMethod} */
|
||||||
|
public void m3() {}
|
||||||
|
/** {@link #privateMethod} */
|
||||||
|
public void m4() {}
|
||||||
|
}
|
57
langtools/test/com/sun/javadoc/5093723/T5093723.java
Normal file
57
langtools/test/com/sun/javadoc/5093723/T5093723.java
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Google, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 5093723
|
||||||
|
* @summary REGRESSION: ClassCastException in SingleIndexWriter
|
||||||
|
* @library ../lib/
|
||||||
|
* @build JavadocTester
|
||||||
|
* @build T5093723
|
||||||
|
* @run main T5093723
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class T5093723 extends JavadocTester {
|
||||||
|
|
||||||
|
private static final String BUG_ID = "5093723";
|
||||||
|
|
||||||
|
private static final String[] ARGS = new String[] {
|
||||||
|
"-d", BUG_ID + ".out", "-source", "5",
|
||||||
|
SRC_DIR + "/DocumentedClass.java",
|
||||||
|
SRC_DIR + "/UndocumentedClass.java"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void main(String... args) {
|
||||||
|
T5093723 tester = new T5093723();
|
||||||
|
if (tester.runJavadoc(ARGS) != 0)
|
||||||
|
throw new AssertionError("non-zero return code from javadoc");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBugId() {
|
||||||
|
return BUG_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBugName() {
|
||||||
|
return getClass().getName();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Google, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class UndocumentedClass {
|
||||||
|
void method() {}
|
||||||
|
public void publicMethod() {}
|
||||||
|
protected void protectedMethod() {}
|
||||||
|
private void privateMethod() {}
|
||||||
|
}
|
14
langtools/test/tools/javac/T6882235.java
Normal file
14
langtools/test/tools/javac/T6882235.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 6882235
|
||||||
|
* @summary invalid exponent causes silent javac crash
|
||||||
|
*
|
||||||
|
* @compile/fail T6882235.java
|
||||||
|
* @compile/fail/ref=T6882235.out -XDrawDiagnostics T6882235.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
class T6882235 {
|
||||||
|
int i = ; // invalid expression
|
||||||
|
float f = 0e*; // invalid exponent, should not crash compiler
|
||||||
|
int j = ; // invalid expression
|
||||||
|
}
|
5
langtools/test/tools/javac/T6882235.out
Normal file
5
langtools/test/tools/javac/T6882235.out
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
T6882235.java:11:13: compiler.err.illegal.start.of.expr
|
||||||
|
T6882235.java:12:15: compiler.err.malformed.fp.lit
|
||||||
|
T6882235.java:12:18: compiler.err.illegal.start.of.expr
|
||||||
|
T6882235.java:13:13: compiler.err.illegal.start.of.expr
|
||||||
|
4 errors
|
|
@ -1,6 +1,6 @@
|
||||||
T6384542.java:10:8: compiler.err.static.import.not.supported.in.source: 1.4
|
T6384542.java:10:8: compiler.err.static.import.not.supported.in.source: 1.4
|
||||||
T6384542.java:12:8: compiler.err.enums.not.supported.in.source: 1.4
|
T6384542.java:12:8: compiler.err.enums.not.supported.in.source: 1.4
|
||||||
T6384542.java:14:13: compiler.err.unsupported.fp.lit
|
T6384542.java:14:13: compiler.err.unsupported.fp.lit: 1.4
|
||||||
T6384542.java:15:9: compiler.err.generics.not.supported.in.source: 1.4
|
T6384542.java:15:9: compiler.err.generics.not.supported.in.source: 1.4
|
||||||
T6384542.java:16:35: compiler.err.varargs.not.supported.in.source: 1.4
|
T6384542.java:16:35: compiler.err.varargs.not.supported.in.source: 1.4
|
||||||
T6384542.java:17:25: compiler.err.foreach.not.supported.in.source: 1.4
|
T6384542.java:17:25: compiler.err.foreach.not.supported.in.source: 1.4
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
BadBinaryLiterals.java:10:17: compiler.err.unsupported.binary.lit: 1.6
|
||||||
|
BadBinaryLiterals.java:11:24: compiler.err.expected: ';'
|
||||||
|
BadBinaryLiterals.java:13:21: compiler.err.int.number.too.large: 111111111111111111111111111111111
|
||||||
|
BadBinaryLiterals.java:15:21: compiler.err.int.number.too.large: 11111111111111111111111111111111111111111111111111111111111111111
|
||||||
|
BadBinaryLiterals.java:16:27: compiler.err.expected: ';'
|
||||||
|
BadBinaryLiterals.java:17:27: compiler.err.expected: ';'
|
||||||
|
BadBinaryLiterals.java:17:30: compiler.err.expected: token.identifier
|
||||||
|
7 errors
|
|
@ -0,0 +1,7 @@
|
||||||
|
BadBinaryLiterals.java:11:24: compiler.err.expected: ';'
|
||||||
|
BadBinaryLiterals.java:13:21: compiler.err.int.number.too.large: 111111111111111111111111111111111
|
||||||
|
BadBinaryLiterals.java:15:21: compiler.err.int.number.too.large: 11111111111111111111111111111111111111111111111111111111111111111
|
||||||
|
BadBinaryLiterals.java:16:27: compiler.err.expected: ';'
|
||||||
|
BadBinaryLiterals.java:17:27: compiler.err.expected: ';'
|
||||||
|
BadBinaryLiterals.java:17:30: compiler.err.expected: token.identifier
|
||||||
|
6 errors
|
18
langtools/test/tools/javac/literals/BadBinaryLiterals.java
Normal file
18
langtools/test/tools/javac/literals/BadBinaryLiterals.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 6860965
|
||||||
|
* @summary Project Coin: binary literals
|
||||||
|
* @compile/fail/ref=BadBinaryLiterals.6.out -XDrawDiagnostics -source 6 BadBinaryLiterals.java
|
||||||
|
* @compile/fail/ref=BadBinaryLiterals.7.out -XDrawDiagnostics BadBinaryLiterals.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BadBinaryLiterals {
|
||||||
|
int valid = 0b0; // valid literal, illegal in source 6
|
||||||
|
int baddigit = 0b012; // bad digit
|
||||||
|
//aaaabbbbccccddddeeeeffffgggghhhh
|
||||||
|
int overflow1 = 0b111111111111111111111111111111111; // too long for int
|
||||||
|
//aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooopppp
|
||||||
|
int overflow2 = 0b11111111111111111111111111111111111111111111111111111111111111111L; // too long for long
|
||||||
|
float badfloat1 = 0b01.01; // no binary floats
|
||||||
|
float badfloat2 = 0b01e01; // no binary floats
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
BadUnderscoreLiterals.java:14:17: compiler.err.unsupported.underscore: 1.6
|
||||||
|
BadUnderscoreLiterals.java:18:15: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:22:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:25:14: compiler.err.unsupported.binary.lit: 1.6
|
||||||
|
BadUnderscoreLiterals.java:25:16: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:26:17: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:29:16: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:30:17: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:33:17: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:34:18: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:35:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:36:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:37:18: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:38:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:41:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:42:20: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:43:21: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:44:22: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:45:21: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:46:22: compiler.err.illegal.underscore
|
||||||
|
20 errors
|
|
@ -0,0 +1,19 @@
|
||||||
|
BadUnderscoreLiterals.java:18:15: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:22:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:25:16: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:26:17: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:29:16: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:30:17: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:33:17: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:34:18: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:35:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:36:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:37:18: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:38:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:41:19: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:42:20: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:43:21: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:44:22: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:45:21: compiler.err.illegal.underscore
|
||||||
|
BadUnderscoreLiterals.java:46:22: compiler.err.illegal.underscore
|
||||||
|
18 errors
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 6860973
|
||||||
|
* @summary Project Coin: underscores in literals
|
||||||
|
*
|
||||||
|
* @compile/fail BadUnderscoreLiterals.java
|
||||||
|
* @compile/fail/ref=BadUnderscoreLiterals.7.out -XDrawDiagnostics BadUnderscoreLiterals.java
|
||||||
|
*
|
||||||
|
* @compile/fail -source 6 BadUnderscoreLiterals.java
|
||||||
|
* @compile/fail/ref=BadUnderscoreLiterals.6.out -XDrawDiagnostics -source 6 BadUnderscoreLiterals.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BadUnderscoreLiterals {
|
||||||
|
int valid = 1_1; // valid literal; illegal in -source 6
|
||||||
|
|
||||||
|
// test zero
|
||||||
|
int z1 = _0; // valid (but undefined) variable
|
||||||
|
int z2 = 0_; // trailing underscore
|
||||||
|
|
||||||
|
// test simple (decimal) integers
|
||||||
|
int i1 = _1_2_3; // valid (but undefined) variable
|
||||||
|
int i2 = 1_2_3_; // trailing underscore
|
||||||
|
|
||||||
|
// test binary integers
|
||||||
|
int b1 = 0b_0; // leading underscore after radix
|
||||||
|
int b2 = 0b0_; // trailing underscore
|
||||||
|
|
||||||
|
// test hexadecimal integers
|
||||||
|
int x1 = 0x_0; // leading underscore after radix
|
||||||
|
int x2 = 0x0_; // trailing underscore
|
||||||
|
|
||||||
|
// test floating point numbers
|
||||||
|
float f1 = 0_.1; // trailing underscore before decimal point
|
||||||
|
float f2 = 0._1; // leading underscore after decimal point
|
||||||
|
float f3 = 0.1_; // trailing underscore
|
||||||
|
float f4 = 0.1_e0; // trailing underscore before exponent
|
||||||
|
float f5 = 0e_1; // leading underscore in exponent
|
||||||
|
float f6 = 0e1_; // trailing underscore in exponent
|
||||||
|
|
||||||
|
// hexadecimal floating point
|
||||||
|
float xf1 = 0x_0.1p0; // leading underscore after radix
|
||||||
|
float xf2 = 0x0_.1p0; // trailing underscore before decimal point
|
||||||
|
float xf3 = 0x0._1p0; // leading underscore after decimal point
|
||||||
|
float xf4 = 0x0.1_p0; // trailing underscore before exponent
|
||||||
|
float xf5 = 0x0p_1; // leading underscore after exponent
|
||||||
|
float xf6 = 0x0p1_; // trailing underscore
|
||||||
|
}
|
||||||
|
|
132
langtools/test/tools/javac/literals/BinaryLiterals.java
Normal file
132
langtools/test/tools/javac/literals/BinaryLiterals.java
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6860965
|
||||||
|
* @summary Project Coin: binary literals
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BinaryLiterals {
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
|
new BinaryLiterals().run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() throws Exception {
|
||||||
|
test(0, 0B0);
|
||||||
|
test(1, 0B1);
|
||||||
|
test(2, 0B10);
|
||||||
|
test(3, 0B11);
|
||||||
|
|
||||||
|
test(0, 0b0);
|
||||||
|
test(1, 0b1);
|
||||||
|
test(2, 0b10);
|
||||||
|
test(3, 0b11);
|
||||||
|
|
||||||
|
test(-0, -0b0);
|
||||||
|
test(-1, -0b1);
|
||||||
|
test(-2, -0b10);
|
||||||
|
test(-3, -0b11);
|
||||||
|
|
||||||
|
test(-1, 0b11111111111111111111111111111111);
|
||||||
|
test(-2, 0b11111111111111111111111111111110);
|
||||||
|
test(-3, 0b11111111111111111111111111111101);
|
||||||
|
|
||||||
|
test( 1, -0b11111111111111111111111111111111);
|
||||||
|
test( 2, -0b11111111111111111111111111111110);
|
||||||
|
test( 3, -0b11111111111111111111111111111101);
|
||||||
|
|
||||||
|
test(0, 0b00);
|
||||||
|
test(1, 0b001);
|
||||||
|
test(2, 0b00010);
|
||||||
|
test(3, 0b000011);
|
||||||
|
|
||||||
|
// aaaabbbbccccddddeeeeffffgggghhhh
|
||||||
|
test( 0x10, 0b10000);
|
||||||
|
test( 0x100, 0b100000000);
|
||||||
|
test( 0x10000, 0b10000000000000000);
|
||||||
|
test(0x80000000, 0b10000000000000000000000000000000);
|
||||||
|
test(0xffffffff, 0b11111111111111111111111111111111);
|
||||||
|
|
||||||
|
test(0L, 0b0L);
|
||||||
|
test(1L, 0b1L);
|
||||||
|
test(2L, 0b10L);
|
||||||
|
test(3L, 0b11L);
|
||||||
|
|
||||||
|
test(0, 0b00L);
|
||||||
|
test(1, 0b001L);
|
||||||
|
test(2, 0b00010L);
|
||||||
|
test(3, 0b000011L);
|
||||||
|
|
||||||
|
// aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooopppp
|
||||||
|
test( 0x10L, 0b10000L);
|
||||||
|
test( 0x100L, 0b100000000L);
|
||||||
|
test( 0x10000L, 0b10000000000000000L);
|
||||||
|
test( 0x80000000L, 0b10000000000000000000000000000000L);
|
||||||
|
test( 0xffffffffL, 0b11111111111111111111111111111111L);
|
||||||
|
test(0x8000000000000000L, 0b1000000000000000000000000000000000000000000000000000000000000000L);
|
||||||
|
test(0xffffffffffffffffL, 0b1111111111111111111111111111111111111111111111111111111111111111L);
|
||||||
|
|
||||||
|
test(0l, 0b0l);
|
||||||
|
test(1l, 0b1l);
|
||||||
|
test(2l, 0b10l);
|
||||||
|
test(3l, 0b11l);
|
||||||
|
|
||||||
|
test(0, 0b00l);
|
||||||
|
test(1, 0b001l);
|
||||||
|
test(2, 0b00010l);
|
||||||
|
test(3, 0b000011l);
|
||||||
|
|
||||||
|
// aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnoooopppp
|
||||||
|
test( 0x10l, 0b10000l);
|
||||||
|
test( 0x100l, 0b100000000l);
|
||||||
|
test( 0x10000l, 0b10000000000000000l);
|
||||||
|
test( 0x80000000l, 0b10000000000000000000000000000000l);
|
||||||
|
test( 0xffffffffl, 0b11111111111111111111111111111111l);
|
||||||
|
test(0x8000000000000000l, 0b1000000000000000000000000000000000000000000000000000000000000000l);
|
||||||
|
test(0xffffffffffffffffl, 0b1111111111111111111111111111111111111111111111111111111111111111l);
|
||||||
|
|
||||||
|
if (errors > 0)
|
||||||
|
throw new Exception(errors + " errors found");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test(int expect, int found) {
|
||||||
|
count++;
|
||||||
|
if (found != expect)
|
||||||
|
error("test " + count + "\nexpected: 0x" + Integer.toHexString(expect) + "\n found: 0x" + Integer.toHexString(found));
|
||||||
|
}
|
||||||
|
|
||||||
|
void test(long expect, long found) {
|
||||||
|
count++;
|
||||||
|
if (found != expect)
|
||||||
|
error("test " + count + "\nexpected: 0x" + Long.toHexString(expect) + "\n found: 0x" + Long.toHexString(found));
|
||||||
|
}
|
||||||
|
|
||||||
|
void error(String message) {
|
||||||
|
System.out.println(message);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count;
|
||||||
|
int errors;
|
||||||
|
}
|
195
langtools/test/tools/javac/literals/UnderscoreLiterals.java
Normal file
195
langtools/test/tools/javac/literals/UnderscoreLiterals.java
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6860973
|
||||||
|
* @summary Project Coin: Underscores in literals
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class UnderscoreLiterals {
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
|
new UnderscoreLiterals().run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() throws Exception {
|
||||||
|
// decimal
|
||||||
|
test(1, 1);
|
||||||
|
test(10, 10);
|
||||||
|
test(1_0, 10);
|
||||||
|
test(1__0, 10);
|
||||||
|
test(1_0_0, 100);
|
||||||
|
test(1__0__0, 100);
|
||||||
|
test(123_456_789, 123456789);
|
||||||
|
|
||||||
|
// long
|
||||||
|
test(1l, 1l);
|
||||||
|
test(10l, 10l);
|
||||||
|
test(1_0l, 10l);
|
||||||
|
test(1__0l, 10l);
|
||||||
|
test(1_0_0l, 100l);
|
||||||
|
test(1__0__0l, 100l);
|
||||||
|
test(123_456_789l, 123456789l);
|
||||||
|
|
||||||
|
// float
|
||||||
|
test(.1f, .1f);
|
||||||
|
test(.10f, .10f);
|
||||||
|
test(.1_0f, .10f);
|
||||||
|
test(.1__0f, .10f);
|
||||||
|
test(.1_0_0f, .100f);
|
||||||
|
test(.1__0__0f, .100f);
|
||||||
|
test(1e1, 1e1);
|
||||||
|
test(1e10, 1e10);
|
||||||
|
test(1e1_0, 1e10);
|
||||||
|
test(1e1__0, 1e10);
|
||||||
|
test(1e1_0_0, 1e100);
|
||||||
|
test(1e1__0__0, 1e100);
|
||||||
|
test(.123_456_789f, .123456789f);
|
||||||
|
test(0.1f, 0.1f);
|
||||||
|
test(0.10f, 0.10f);
|
||||||
|
test(0.1_0f, 0.10f);
|
||||||
|
test(0.1__0f, 0.10f);
|
||||||
|
test(0.1_0_0f, 0.100f);
|
||||||
|
test(0.1__0__0f, 0.100f);
|
||||||
|
test(0.123_456_789f, 0.123456789f);
|
||||||
|
test(1_1.1f, 1_1.1f);
|
||||||
|
test(1_1.10f, 1_1.10f);
|
||||||
|
test(1_1.1_0f, 1_1.10f);
|
||||||
|
test(1_1.1__0f, 1_1.10f);
|
||||||
|
test(1_1.1_0_0f, 1_1.100f);
|
||||||
|
test(1_1.1__0__0f, 1_1.100f);
|
||||||
|
test(1_1.123_456_789f, 1_1.123456789f);
|
||||||
|
|
||||||
|
// double
|
||||||
|
test(.1d, .1d);
|
||||||
|
test(.10d, .10d);
|
||||||
|
test(.1_0d, .10d);
|
||||||
|
test(.1__0d, .10d);
|
||||||
|
test(.1_0_0d, .100d);
|
||||||
|
test(.1__0__0d, .100d);
|
||||||
|
test(1e1, 1e1);
|
||||||
|
test(1e10, 1e10);
|
||||||
|
test(1e1_0, 1e10);
|
||||||
|
test(1e1__0, 1e10);
|
||||||
|
test(1e1_0_0, 1e100);
|
||||||
|
test(1e1__0__0, 1e100);
|
||||||
|
test(.123_456_789d, .123456789d);
|
||||||
|
test(0.1d, 0.1d);
|
||||||
|
test(0.10d, 0.10d);
|
||||||
|
test(0.1_0d, 0.10d);
|
||||||
|
test(0.1__0d, 0.10d);
|
||||||
|
test(0.1_0_0d, 0.100d);
|
||||||
|
test(0.1__0__0d, 0.100d);
|
||||||
|
test(0.123_456_789d, 0.123456789d);
|
||||||
|
test(1_1.1d, 1_1.1d);
|
||||||
|
test(1_1.10d, 1_1.10d);
|
||||||
|
test(1_1.1_0d, 1_1.10d);
|
||||||
|
test(1_1.1__0d, 1_1.10d);
|
||||||
|
test(1_1.1_0_0d, 1_1.100d);
|
||||||
|
test(1_1.1__0__0d, 1_1.100d);
|
||||||
|
test(1_1.123_456_789d, 1_1.123456789d);
|
||||||
|
|
||||||
|
// binary
|
||||||
|
test(0b1, 1);
|
||||||
|
test(0b10, 2);
|
||||||
|
test(0b1_0, 2);
|
||||||
|
test(0b1__0, 2);
|
||||||
|
test(0b1_0_0, 4);
|
||||||
|
test(0b1__0__0, 4);
|
||||||
|
test(0b0001_0010_0011, 0x123);
|
||||||
|
|
||||||
|
// octal
|
||||||
|
test(01, 1);
|
||||||
|
test(010, 8);
|
||||||
|
test(01_0, 8);
|
||||||
|
test(01__0, 8);
|
||||||
|
test(01_0_0, 64);
|
||||||
|
test(01__0__0, 64);
|
||||||
|
test(0_1, 1);
|
||||||
|
test(0_10, 8);
|
||||||
|
test(0_1_0, 8);
|
||||||
|
test(0_1__0, 8);
|
||||||
|
test(0_1_0_0, 64);
|
||||||
|
test(0_1__0__0, 64);
|
||||||
|
test(0_001_002_003, 01002003);
|
||||||
|
|
||||||
|
// hexadecimal
|
||||||
|
test(0x1, 1);
|
||||||
|
test(0x10, 16);
|
||||||
|
test(0x1_0, 16);
|
||||||
|
test(0x1__0, 16);
|
||||||
|
test(0x1_0_0, 256);
|
||||||
|
test(0x1__0__0, 256);
|
||||||
|
test(0x01_02_03_04, 0x1020304);
|
||||||
|
|
||||||
|
// misc
|
||||||
|
long creditCardNumber = 1234_5678_9012_3456L;
|
||||||
|
test(creditCardNumber, 1234567890123456L);
|
||||||
|
long socialSecurityNumbers = 999_99_9999L;
|
||||||
|
test(socialSecurityNumbers, 999999999L);
|
||||||
|
double monetaryAmount = 12_345_132.12d;
|
||||||
|
test(monetaryAmount, 12345132.12d);
|
||||||
|
long hexBytes = 0xFF_EC_DE_5E;
|
||||||
|
test(hexBytes, 0xffecde5e);
|
||||||
|
long hexWords = 0xFFEC_DE5E;
|
||||||
|
test(hexWords, 0xffecde5e);
|
||||||
|
long maxLong = 0x7fff_ffff_ffff_ffffL;
|
||||||
|
test(maxLong, 0x7fffffffffffffffL);
|
||||||
|
long maxLongDecimal = 9223372036854775807L;
|
||||||
|
long alsoMaxLong = 9_223_372_036_854_775_807L;
|
||||||
|
test(alsoMaxLong, maxLongDecimal);
|
||||||
|
double whyWouldYouEverDoThis = 0x1.ffff_ffff_ffff_fp10_23;
|
||||||
|
double whyWouldYouEverDoEvenThis = 0x1.fffffffffffffp1023;
|
||||||
|
test(whyWouldYouEverDoThis, whyWouldYouEverDoEvenThis);
|
||||||
|
|
||||||
|
if (errors > 0)
|
||||||
|
throw new Exception(errors + " errors found");
|
||||||
|
}
|
||||||
|
|
||||||
|
void test(int value, int expect) {
|
||||||
|
count++;
|
||||||
|
if (value != expect)
|
||||||
|
error("test " + count + "\nexpected: 0x" + Integer.toHexString(expect) + "\n found: 0x" + Integer.toHexString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
void test(double value, double expect) {
|
||||||
|
count++;
|
||||||
|
if (value != expect)
|
||||||
|
error("test " + count + "\nexpected: 0x" + expect + "\n found: 0x" + value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test(long value, long expect) {
|
||||||
|
count++;
|
||||||
|
if (value != expect)
|
||||||
|
error("test " + count + "\nexpected: 0x" + Long.toHexString(expect) + "\n found: 0x" + Long.toHexString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
void error(String message) {
|
||||||
|
System.out.println(message);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count;
|
||||||
|
int errors;
|
||||||
|
}
|
52
langtools/test/tools/javadoc/annotations/missing/Main.java
Normal file
52
langtools/test/tools/javadoc/annotations/missing/Main.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Google, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6709246
|
||||||
|
* @summary Class-cast exception when annotation type is missing.
|
||||||
|
* @library ../../lib
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import com.sun.javadoc.RootDoc;
|
||||||
|
import com.sun.javadoc.ClassDoc;
|
||||||
|
import com.sun.javadoc.AnnotationDesc;
|
||||||
|
|
||||||
|
public class Main extends Tester.Doclet {
|
||||||
|
|
||||||
|
private static final Tester tester = new Tester("Main", "somepackage");
|
||||||
|
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
|
tester.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean start(RootDoc root) {
|
||||||
|
for (ClassDoc d : root.classes()) {
|
||||||
|
for (AnnotationDesc a : d.annotations()) {
|
||||||
|
System.out.println(a.annotationType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2009 Google, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package somepackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class has an annotation which is not available.
|
||||||
|
*/
|
||||||
|
@NoSuchAnnotation
|
||||||
|
public class MissingAnnotationClass {
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue