This commit is contained in:
Lana Steuck 2014-09-18 13:27:02 -07:00
commit ea3bc6a6cd
27 changed files with 132 additions and 256 deletions

View File

@ -358,11 +358,9 @@ public class Infer {
for (Type aLowerBound : from.getBounds(InferenceBound.LOWER)) {
for (Type anotherLowerBound : from.getBounds(InferenceBound.LOWER)) {
if (aLowerBound != anotherLowerBound &&
commonSuperWithDiffParameterization(aLowerBound, anotherLowerBound)) {
/* self comment check if any lower bound may be and undetVar,
* in that case the result of this call may be a false positive.
* Should this be restricted to non free types?
*/
!inferenceContext.free(aLowerBound) &&
!inferenceContext.free(anotherLowerBound) &&
commonSuperWithDiffParameterization(aLowerBound, anotherLowerBound)) {
return generateReferenceToTargetConstraint(tree, from, to,
resultInfo, inferenceContext);
}

View File

@ -397,20 +397,19 @@ public class HtmlDocletWriter extends HtmlDocWriter {
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(getGeneratedBy(!configuration.notimestamp));
if (configuration.charset.length() > 0) {
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
configuration.charset);
head.addContent(meta);
}
head.addContent(getTitle());
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
(configuration.charset.length() > 0) ?
configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
head.addContent(meta);
if (!configuration.notimestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Content meta = HtmlTree.META("date", dateFormat.format(new Date()));
meta = HtmlTree.META("date", dateFormat.format(new Date()));
head.addContent(meta);
}
if (metakeywords != null) {
for (String metakeyword : metakeywords) {
Content meta = HtmlTree.META("keywords", metakeyword);
meta = HtmlTree.META("keywords", metakeyword);
head.addContent(meta);
}
}

View File

@ -90,8 +90,7 @@ public class PackageWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public Content getPackageHeader(String heading) {
String pkgName = packageDoc.name();
Content bodyTree = getBody(true, getWindowTitle(pkgName));
Content bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageDoc)));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree div = new HtmlTree(HtmlTag.DIV);

View File

@ -103,8 +103,7 @@ public class ProfilePackageWriterImpl extends HtmlDocletWriter
* {@inheritDoc}
*/
public Content getPackageHeader(String heading) {
String pkgName = packageDoc.name();
Content bodyTree = getBody(true, getWindowTitle(pkgName));
Content bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageDoc)));
addTop(bodyTree);
addNavLinks(true, bodyTree);
HtmlTree div = new HtmlTree(HtmlTag.DIV);

View File

@ -220,4 +220,9 @@ public class HtmlConstants {
* Html tag for the member heading.
*/
public static final HtmlTag MEMBER_HEADING = HtmlTag.H4;
/**
* Default charset for HTML.
*/
public static final String HTML_DEFAULT_CHARSET = "utf-8";
}

View File

@ -311,13 +311,12 @@ public abstract class HtmlDocWriter extends HtmlWriter {
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(getGeneratedBy(!noTimeStamp));
if (configuration.charset.length() > 0) {
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
configuration.charset);
head.addContent(meta);
}
Content windowTitle = HtmlTree.TITLE(new StringContent(title));
head.addContent(windowTitle);
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
(configuration.charset.length() > 0) ?
configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
head.addContent(meta);
head.addContent(getFramesetJavaScript());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
head, frameset);

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 7052170
* @bug 7052170 8047745
* @summary Run a test on -charset to make sure the charset gets generated as a
* part of the meta tag.
* @author Bhavesh Patel
@ -42,19 +42,32 @@ public class TestCharset extends JavadocTester {
@Test
void test() {
javadoc("-d", "out",
"-charset", "UTF-8",
"-charset", "ISO-8859-1",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("index.html", true,
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
checkOutput("pkg/Foo.html", true,
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
checkOutput("index.html", false,
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"ISO-8859-1\">");
checkOutput("pkg/Foo.html", false,
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"ISO-8859-1\">");
}
@Test
void test1() {
javadoc("-d", "out-1",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("index.html", true,
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
checkOutput("pkg/Foo.html", true,
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
}
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 4904075 4774450 5015144
* @bug 4904075 4774450 5015144 8043698
* @summary Reference unnamed package as "Unnamed", not empty string.
* Generate a package summary for the unnamed package.
* @author jamieh
@ -51,6 +51,9 @@ public class TestUnnamedPackage extends JavadocTester {
"This is a package comment for the unnamed package.",
"This is a class in the unnamed package.");
checkOutput("package-summary.html", true,
"<title>&lt;Unnamed&gt;</title>");
checkOutput("package-tree.html", true,
"<h1 class=\"title\">Hierarchy For Package &lt;Unnamed&gt;</h1>");

View File

@ -1,33 +1,10 @@
/*
* 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
* @test /nodynamiccopyright/
* @bug 4391330
* @summary compiler accepted (Integer).toString(123)
* @author gafter
*
* @compile/fail Parens1.java
* @compile/fail/ref=Parens1.out -XDrawDiagnostics Parens1.java
*/
class Parens1 {

View File

@ -0,0 +1,2 @@
Parens1.java:12:20: compiler.err.illegal.start.of.type
1 error

View File

@ -1,33 +1,10 @@
/*
* 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
* @test /nodynamiccopyright/
* @bug 4408036
* @summary Compiler accepted "(i=2);" as a valid expession statement.
* @author gafter
*
* @compile/fail Parens2.java
* @compile/fail/ref=Parens2.out -XDrawDiagnostics Parens2.java
*/
class Parens2 {

View File

@ -0,0 +1,2 @@
Parens2.java:13:9: compiler.err.not.stmt
1 error

View File

@ -1,33 +1,10 @@
/*
* 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
* @test /nodynamiccopyright/
* @bug 4394546
* @summary get no err msg if label wrapped in parentheses
* @author gafter
*
* @compile/fail Parens3.java
* @compile/fail/ref=Parens3.out -XDrawDiagnostics Parens3.java
*/
class Parens3 {

View File

@ -0,0 +1,3 @@
Parens3.java:12:5: compiler.err.not.stmt
Parens3.java:12:10: compiler.err.expected: ';'
2 errors

View File

@ -1,33 +1,10 @@
/*
* 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
* @test /nodynamiccopyright/
* @bug 4933317
* @summary javac accepts parens in package names
* @author gafter
*
* @compile/fail Parens4.java
* @compile/fail/ref=Parens4.out -XDrawDiagnostics Parens4.java
*/
class Parens4 {

View File

@ -0,0 +1,2 @@
Parens4.java:12:16: compiler.err.illegal.start.of.type
1 error

View File

@ -1,34 +1,11 @@
/*
* Copyright (c) 1997, 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
* @test /nodynamiccopyright/
* @bug 4092958
* @summary The compiler was too permissive in its parsing of conditional
* expressions.
* @author turnidge
*
* @compile/fail ParseConditional.java
* @compile/fail/ref=ParseConditional.out -XDrawDiagnostics ParseConditional.java
*/
public class ParseConditional {
@ -38,6 +15,11 @@ public class ParseConditional {
int b = 2;
int c = 3;
int d = 4;
a = condition ? b = c : c = d; // Should get a parse error.
// The following line should give an error because the conditional ?: operator
// is higher priority than the final assignment operator, between c and d.
// As such, the correct parsing is:
// a = (condition ? b = c : c) = d;
// and it is illegal to try and assign to the value of the conditional expression.
a = condition ? b = c : c = d;
}
}

View File

@ -0,0 +1,2 @@
ParseConditional.java:23:23: compiler.err.unexpected.type: kindname.variable, kindname.value
1 error

View File

@ -1,33 +1,10 @@
/*
* 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
* @test /nodynamiccopyright/
* @bug 4350352
* @summary InternalError: store unsupported: com.sun.tools.javac.v8.comp.Items
* @author gafter
*
* @compile/fail StoreClass.java
* @compile/fail/ref=StoreClass.out -XDrawDiagnostics StoreClass.java
*/
class StoreClass {

View File

@ -0,0 +1,3 @@
StoreClass.java:12:19: compiler.err.cant.assign.val.to.final.var: class
StoreClass.java:13:12: compiler.err.cant.assign.val.to.final.var: class
2 errors

View File

@ -1,33 +1,10 @@
/*
* 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
* @test /nodynamiccopyright/
* @bug 4725650
* @summary Restrict scope of local classes in switch-block-group
* @author gafter
*
* @compile/fail SwitchScope.java
* @compile/fail/ref=SwitchScope.out -XDrawDiagnostics SwitchScope.java
*/
public class SwitchScope {

View File

@ -0,0 +1,2 @@
SwitchScope.java:22:28: compiler.err.cant.resolve.location: kindname.class, Local, , , (compiler.misc.location: kindname.class, SwitchScope, null)
1 error

View File

@ -1,38 +1,15 @@
/*
* Copyright (c) 2001, 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
* @test /nodynamiccopyright/
* @bug 4462714
* @summary using of synthetic names in local class causes ClassFormatError
* @author gafter
*
* @compile/fail SynthName2.java
* @compile/fail/ref=SynthName2.out -XDrawDiagnostics SynthName2.java
*/
import java.io.PrintStream;
class SynthName1 {
class SynthName2 {
public static void main(String args[]) {
run(args, System.out);
}

View File

@ -0,0 +1,4 @@
SynthName2.java:33:9: compiler.err.synthetic.name.conflict: val$zzz, InnClass
SynthName2.java:34:17: compiler.err.synthetic.name.conflict: val$prm1, InnClass
SynthName2.java:35:17: compiler.err.synthetic.name.conflict: val$zzz, InnClass
3 errors

View File

@ -1,30 +1,7 @@
/*
* Copyright (c) 2005, 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 /nodynamiccopyright/
* @bug 6234077
* @compile/fail/ref=T6234077.out -XDrawDiagnostics T6234077.java
*/
/*
* @test
* @bug 6234077
* @compile/fail T6234077.java
*/
@Deprecated /** @deprecated */
public class Foo { }

View File

@ -0,0 +1,2 @@
T6234077.java:7:8: compiler.err.class.public.should.be.in.file: Foo
1 error

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2014, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 8055963
* @summary Inference failure with nested invocation
* @compile T8055963.java
*/
class T8055963 {
static class C<T> {}
<T> T choose(T first, T second) { return null; }
void test() {
C<String> cs = choose(new C<String>(), new C<>());
}
}