# HG changeset patch # User chegar # Date 1376598886 -3600 # Node ID 84b6d75ff2c91a20e5d2fbae79dfa13594339007 # Parent 2d1a54d213c23188dede5a9574153672990b6287# Parent dd4a00c220c6e14d9b2ce93a2bd436a1d04f0d03 Merge diff -r 2d1a54d213c2 -r 84b6d75ff2c9 .hgtags --- a/.hgtags Fri Aug 09 14:44:53 2013 +0100 +++ b/.hgtags Thu Aug 15 21:34:46 2013 +0100 @@ -224,3 +224,4 @@ 82f68da70e471ee5640016e3f38c014347a5c785 jdk8-b100 0324dbf07b0f1cc51ad9fa18976489d02d23b60d jdk8-b101 453a305e116507847cc6577b80b4d9794bcb08bf jdk8-b102 +76cfe7c61f2575ea5400845b8e80dab6f4b1d7d0 jdk8-b103 diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Thu Aug 15 21:34:46 2013 +0100 @@ -101,7 +101,7 @@ Content tdSummary) { ExecutableMemberDoc emd = (ExecutableMemberDoc)member; String name = emd.name(); - Content strong = HtmlTree.STRONG( + Content strong = HtmlTree.SPAN(HtmlStyle.strong, writer.getDocLink(context, cd, (MemberDoc) emd, name, false)); Content code = HtmlTree.CODE(strong); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -225,7 +225,7 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.STRONG( + Content strong = HtmlTree.SPAN(HtmlStyle.strong, writer.getDocLink(context, (MemberDoc) member, member.name(), false)); Content code = HtmlTree.CODE(strong); tdSummary.addContent(code); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -262,7 +262,7 @@ annotationInfoTree.addContent(hr); Tag[] deprs = annotationType.tags("deprecated"); if (Util.isDeprecated(annotationType)) { - Content strong = HtmlTree.STRONG(deprecatedPhrase); + Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); Content div = HtmlTree.DIV(HtmlStyle.block, strong); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -547,7 +547,7 @@ classInfoTree.addContent(hr); Tag[] deprs = classDoc.tags("deprecated"); if (Util.isDeprecated(classDoc)) { - Content strong = HtmlTree.STRONG(deprecatedPhrase); + Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); Content div = HtmlTree.DIV(HtmlStyle.block, strong); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -222,7 +222,7 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.STRONG( + Content strong = HtmlTree.SPAN(HtmlStyle.strong, writer.getDocLink(context, (MemberDoc) member, member.name(), false)); Content code = HtmlTree.CODE(strong); tdSummary.addContent(code); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -139,7 +139,7 @@ holder.typeName() : holder.qualifiedTypeName(), false); Content codeLink = HtmlTree.CODE(link); - Content strong = HtmlTree.STRONG(holder.isClass()? + Content strong = HtmlTree.SPAN(HtmlStyle.strong, holder.isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); strong.addContent(writer.getSpace()); strong.addContent(codeLink); @@ -256,7 +256,7 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.STRONG( + Content strong = HtmlTree.SPAN(HtmlStyle.strong, writer.getDocLink(context, cd , (MemberDoc) member, member.name(), false)); Content code = HtmlTree.CODE(strong); tdSummary.addContent(code); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java Thu Aug 15 21:34:46 2013 +0100 @@ -316,7 +316,7 @@ liConst.addContent(constPara); ul.addContent(liConst); Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul); - Content line30 = HtmlTree.EM(getResource("doclet.Help_line_30")); + Content line30 = HtmlTree.SPAN(HtmlStyle.italic, getResource("doclet.Help_line_30")); divContent.addContent(line30); contentTree.addContent(divContent); } diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Aug 15 21:34:46 2013 +0100 @@ -467,8 +467,7 @@ } } Content rawContent = new RawHtml(content); - Content em = HtmlTree.EM(rawContent); - return em; + return rawContent; } /** @@ -1029,7 +1028,7 @@ public Content italicsClassName(ClassDoc cd, boolean qual) { Content name = new StringContent((qual)? cd.qualifiedName(): cd.name()); - return (cd.isInterface())? HtmlTree.I(name): name; + return (cd.isInterface())? HtmlTree.SPAN(HtmlStyle.italic, name): name; } /** @@ -1545,7 +1544,7 @@ Content div; Content result = commentTagsToContent(null, doc, tags, first); if (depr) { - Content italic = HtmlTree.I(result); + Content italic = HtmlTree.SPAN(HtmlStyle.italic, result); div = HtmlTree.DIV(HtmlStyle.block, italic); htmltree.addContent(div); } diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -159,7 +159,7 @@ holder.typeName() : holder.qualifiedTypeName(), false); Content codelLink = HtmlTree.CODE(link); - Content strong = HtmlTree.STRONG(holder.asClassDoc().isClass()? + Content strong = HtmlTree.SPAN(HtmlStyle.strong, holder.asClassDoc().isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); strong.addContent(writer.getSpace()); strong.addContent(codelLink); @@ -309,7 +309,7 @@ label = writer.specifiedByLabel; context = LinkInfoImpl.Kind.METHOD_SPECIFIED_BY; } - Content dt = HtmlTree.DT(HtmlTree.STRONG(label)); + Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, label)); dl.addContent(dt); Content overriddenTypeLink = writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType)); @@ -364,7 +364,7 @@ Content intfaclink = writer.getLink(new LinkInfoImpl( writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac)); Content codeIntfacLink = HtmlTree.CODE(intfaclink); - Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel)); + Content dt = HtmlTree.DT(HtmlTree.SPAN(HtmlStyle.strong, writer.specifiedByLabel)); dl.addContent(dt); Content methlink = writer.getDocLink( LinkInfoImpl.Kind.MEMBER, implementedMeth, diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -164,7 +164,7 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.STRONG( + Content strong = HtmlTree.SPAN(HtmlStyle.strong, writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member))); Content code = HtmlTree.CODE(strong); tdSummary.addContent(code); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java Thu Aug 15 21:34:46 2013 +0100 @@ -183,7 +183,7 @@ printedHeader = true; } Content arr_i_name = new StringContent(arr[i].name()); - if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name); + if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.italic, arr_i_name); Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame")); Content li = HtmlTree.LI(link); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java Thu Aug 15 21:34:46 2013 +0100 @@ -174,7 +174,7 @@ printedHeader = true; } Content arr_i_name = new StringContent(arr[i].name()); - if (arr[i].isInterface()) arr_i_name = HtmlTree.I(arr_i_name); + if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.italic, arr_i_name); Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame")); Content li = HtmlTree.LI(link); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -135,7 +135,7 @@ holder.typeName() : holder.qualifiedTypeName(), false); Content codeLink = HtmlTree.CODE(link); - Content strong = HtmlTree.STRONG(holder.isClass()? + Content strong = HtmlTree.SPAN(HtmlStyle.strong, holder.isClass()? writer.descfrmClassLabel : writer.descfrmInterfaceLabel); strong.addContent(writer.getSpace()); strong.addContent(codeLink); @@ -252,13 +252,12 @@ */ protected void addSummaryLink(LinkInfoImpl.Kind context, ClassDoc cd, ProgramElementDoc member, Content tdSummary) { - Content strong = HtmlTree.STRONG( - writer.getDocLink(context, - cd, - (MemberDoc) member, - member.name().substring(0, member.name().lastIndexOf("Property")), - false, - true)); + Content strong = HtmlTree.SPAN(HtmlStyle.strong, + writer.getDocLink(context, cd, + (MemberDoc) member, + member.name().substring(0, member.name().lastIndexOf("Property")), + false, + true)); Content code = HtmlTree.CODE(strong); tdSummary.addContent(code); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java Thu Aug 15 21:34:46 2013 +0100 @@ -175,7 +175,7 @@ Tag[] deprs = member.tags("deprecated"); Content div; if (Util.isDeprecated((ProgramElementDoc) member)) { - Content strong = HtmlTree.STRONG(deprecatedPhrase); + Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); div = HtmlTree.DIV(HtmlStyle.block, strong); div.addContent(getSpace()); if (deprs.length > 0) { @@ -186,7 +186,7 @@ } else { ClassDoc cd = ((ProgramElementDoc)member).containingClass(); if (cd != null && Util.isDeprecated(cd)) { - Content strong = HtmlTree.STRONG(deprecatedPhrase); + Content strong = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase); div = HtmlTree.DIV(HtmlStyle.block, strong); div.addContent(getSpace()); tdSummary.addContent(div); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Thu Aug 15 21:34:46 2013 +0100 @@ -118,7 +118,7 @@ if (deprs.length > 0) { Content body = commentTagsToOutput(null, doc, deprs[0].inlineTags(), false); - result.addContent(HtmlTree.I(body)); + result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body)); } } else { if (Util.isDeprecated(member.containingClass())) { diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, 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 @@ -59,6 +59,7 @@ indexContainer, indexHeader, inheritance, + italic, legalCopy, nameValue, navBarCell1Rev, diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Thu Aug 15 21:34:46 2013 +0100 @@ -282,17 +282,6 @@ } /** - * Generates a EM tag with some content. - * - * @param body content to be added to the tag - * @return an HtmlTree object for the EM tag - */ - public static HtmlTree EM(Content body) { - HtmlTree htmltree = new HtmlTree(HtmlTag.EM, nullCheck(body)); - return htmltree; - } - - /** * Generates a FRAME tag. * * @param src the url of the document to be shown in the frame @@ -416,17 +405,6 @@ } /** - * Generates a I tag with some content. - * - * @param body content for the tag - * @return an HtmlTree object for the I tag - */ - public static HtmlTree I(Content body) { - HtmlTree htmltree = new HtmlTree(HtmlTag.I, nullCheck(body)); - return htmltree; - } - - /** * Generates a LI tag with some content. * * @param body content for the tag @@ -559,17 +537,6 @@ } /** - * Generates a STRONG tag with some content. - * - * @param body content for the tag - * @return an HtmlTree object for the STRONG tag - */ - public static HtmlTree STRONG(Content body) { - HtmlTree htmltree = new HtmlTree(HtmlTag.STRONG, nullCheck(body)); - return htmltree; - } - - /** * Generates a SPAN tag with some content. * * @param body content for the tag diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Aug 15 21:34:46 2013 +0100 @@ -77,6 +77,7 @@ float:right; padding:0px 21px; font-size:.8em; + font-style:italic; z-index:200; margin-top:-7px; } @@ -519,3 +520,6 @@ .strong { font-weight:bold; } +.italic { + font-style:italic; +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/javac/Main.java --- a/src/share/classes/com/sun/tools/javac/Main.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/Main.java Thu Aug 15 21:34:46 2013 +0100 @@ -26,8 +26,6 @@ package com.sun.tools.javac; import java.io.PrintWriter; -import java.lang.reflect.*; - /** * The programmatic interface for the Java Programming Language @@ -44,23 +42,12 @@ @jdk.Supported public class Main { - /** Unsupported command line interface. - * @param args The command line parameters. + /** Main entry point for the launcher. + * Note: This method calls System.exit. + * @param args command line arguments */ public static void main(String[] args) throws Exception { - if (args.length > 0 && args[0].equals("-Xjdb")) { - String[] newargs = new String[args.length + 2]; - Class c = Class.forName("com.sun.tools.example.debug.tty.TTY"); - Method method = c.getDeclaredMethod ("main", new Class[] {args.getClass()}); - method.setAccessible(true); - System.arraycopy(args, 1, newargs, 3, args.length - 1); - newargs[0] = "-connect"; - newargs[1] = "com.sun.jdi.CommandLineLaunch:options=-esa -ea:com.sun.tools..."; - newargs[2] = "com.sun.tools.javac.Main"; - method.invoke(null, new Object[] { newargs }); - } else { System.exit(compile(args)); - } } /** Programmatic interface to the Java Programming Language diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Aug 15 21:34:46 2013 +0100 @@ -1478,74 +1478,82 @@ code.statBegin(TreeInfo.endPos(body)); genFinalizer(env); code.statBegin(TreeInfo.endPos(env.tree)); - Chain exitChain = code.branch(goto_); + Chain exitChain; + if (startpc != endpc) { + exitChain = code.branch(goto_); + } else { + exitChain = code.branch(dontgoto); + } endFinalizerGap(env); - if (startpc != endpc) for (List l = catchers; l.nonEmpty(); l = l.tail) { - // start off with exception on stack - code.entryPoint(stateTry, l.head.param.sym.type); - genCatch(l.head, env, startpc, endpc, gaps); - genFinalizer(env); - if (hasFinalizer || l.tail.nonEmpty()) { - code.statBegin(TreeInfo.endPos(env.tree)); - exitChain = Code.mergeChains(exitChain, - code.branch(goto_)); + if (startpc != endpc) { + for (List l = catchers; l.nonEmpty(); l = l.tail) { + // start off with exception on stack + code.entryPoint(stateTry, l.head.param.sym.type); + genCatch(l.head, env, startpc, endpc, gaps); + genFinalizer(env); + if (hasFinalizer || l.tail.nonEmpty()) { + code.statBegin(TreeInfo.endPos(env.tree)); + exitChain = Code.mergeChains(exitChain, + code.branch(goto_)); + } + endFinalizerGap(env); } - endFinalizerGap(env); - } - if (hasFinalizer) { - // Create a new register segement to avoid allocating - // the same variables in finalizers and other statements. - code.newRegSegment(); - - // Add a catch-all clause. - - // start off with exception on stack - int catchallpc = code.entryPoint(stateTry, syms.throwableType); - // Register all exception ranges for catch all clause. - // The range of the catch all clause is from the beginning - // of the try or synchronized block until the present - // code pointer excluding all gaps in the current - // environment's GenContext. - int startseg = startpc; - while (env.info.gaps.nonEmpty()) { - int endseg = env.info.gaps.next().intValue(); - registerCatch(body.pos(), startseg, endseg, - catchallpc, 0); - startseg = env.info.gaps.next().intValue(); - } - code.statBegin(TreeInfo.finalizerPos(env.tree)); - code.markStatBegin(); + if (hasFinalizer) { + // Create a new register segement to avoid allocating + // the same variables in finalizers and other statements. + code.newRegSegment(); + + // Add a catch-all clause. + + // start off with exception on stack + int catchallpc = code.entryPoint(stateTry, syms.throwableType); - Item excVar = makeTemp(syms.throwableType); - excVar.store(); - genFinalizer(env); - excVar.load(); - registerCatch(body.pos(), startseg, - env.info.gaps.next().intValue(), - catchallpc, 0); - code.emitop0(athrow); - code.markDead(); - - // If there are jsr's to this finalizer, ... - if (env.info.cont != null) { - // Resolve all jsr's. - code.resolve(env.info.cont); - - // Mark statement line number + // Register all exception ranges for catch all clause. + // The range of the catch all clause is from the beginning + // of the try or synchronized block until the present + // code pointer excluding all gaps in the current + // environment's GenContext. + int startseg = startpc; + while (env.info.gaps.nonEmpty()) { + int endseg = env.info.gaps.next().intValue(); + registerCatch(body.pos(), startseg, endseg, + catchallpc, 0); + startseg = env.info.gaps.next().intValue(); + } code.statBegin(TreeInfo.finalizerPos(env.tree)); code.markStatBegin(); - // Save return address. - LocalItem retVar = makeTemp(syms.throwableType); - retVar.store(); + Item excVar = makeTemp(syms.throwableType); + excVar.store(); + genFinalizer(env); + excVar.load(); + registerCatch(body.pos(), startseg, + env.info.gaps.next().intValue(), + catchallpc, 0); + code.emitop0(athrow); + code.markDead(); + + // If there are jsr's to this finalizer, ... + if (env.info.cont != null) { + // Resolve all jsr's. + code.resolve(env.info.cont); - // Generate finalizer code. - env.info.finalize.genLast(); + // Mark statement line number + code.statBegin(TreeInfo.finalizerPos(env.tree)); + code.markStatBegin(); + + // Save return address. + LocalItem retVar = makeTemp(syms.throwableType); + retVar.store(); - // Return. - code.emitop1w(ret, retVar.reg); - code.markDead(); + // Generate finalizer code. + env.info.finalize.genLast(); + + // Return. + code.emitop1w(ret, retVar.reg); + code.markDead(); + } } } // Resolve all breaks. diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java --- a/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Thu Aug 15 21:34:46 2013 +0100 @@ -172,8 +172,8 @@ } // So we have a containing type - String annoTypeName = annoType.getSimpleName(); - String containerTypeName = containerType.getSimpleName(); + String annoTypeName = annoType.getName(); + String containerTypeName = containerType.getName(); int directIndex = -1, containerIndex = -1; Attribute.Compound direct = null, container = null; // Find directly (explicit or implicit) present annotations @@ -303,8 +303,8 @@ } // So we have a containing type - String annoTypeName = annoType.getSimpleName(); - String containerTypeName = containerType.getSimpleName(); + String annoTypeName = annoType.getName(); + String containerTypeName = containerType.getName(); int directIndex = -1, containerIndex = -1; Attribute.Compound direct = null, container = null; // Find directly (explicit or implicit) present annotations diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/javac/tree/Pretty.java --- a/src/share/classes/com/sun/tools/javac/tree/Pretty.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/tree/Pretty.java Thu Aug 15 21:34:46 2013 +0100 @@ -973,7 +973,6 @@ printBrackets((JCArrayTypeTree) elem); } if (tree.elems != null) { - if (tree.elemtype != null) print("[]"); print("{"); printExprs(tree.elems); print("}"); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 src/share/classes/com/sun/tools/javac/tree/TreeMaker.java --- a/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Fri Aug 09 14:44:53 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java Thu Aug 15 21:34:46 2013 +0100 @@ -781,7 +781,7 @@ class AnnotationBuilder implements Attribute.Visitor { JCExpression result = null; public void visitConstant(Attribute.Constant v) { - result = Literal(v.value); + result = Literal(v.type.getTag(), v.value); } public void visitClass(Attribute.Class clazz) { result = ClassLiteral(clazz.classType).setType(syms.classType); diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java --- a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, 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 @@ -48,7 +48,7 @@ "Link to external member gcd"}, {BUG_ID + FS + "C.html", - "
" + NL + "
Overrides:
" + NL + + "
" + NL + "
Overrides:
" + NL + "
toString in class java.lang.Object
" + NL + "
"} }; diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java --- a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -39,13 +39,13 @@ private static final String BUG_ID = "4857717"; private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "XReader.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
read in class " + "FilterReader
"}, {BUG_ID + FS + "pkg" + FS + "XReader.html", - "
Specified by:
" + NL + + "
Specified by:
" + NL + "
readInt in interface " + "" + NL + "
" + "C1.setUndecorated(boolean)
" + NL + "
"}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
This field indicates whether the C1 is " + "undecorated.
" + NL + " " + NL + "
" + NL + "
Since:
" + NL + "
1.4
" + NL + "
See Also:" + "
" + NL + "
" + "C1.setUndecorated(boolean)
" + NL + "
"}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
Reads the object stream.
" + NL + "
" + NL + "
Throws:" + "
" + NL + "
" + @@ -153,18 +153,18 @@ "" + NL + "
" + "C1.setUndecorated(boolean)
" + NL + "
"}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
This field indicates whether the C1 is " + "undecorated.
" + NL + " " + NL + "
" + NL + "
Since:
" + NL + "
1.4
" + NL + "
See Also:" + "
" + NL + "
" + "C1.setUndecorated(boolean)
" + NL + "
"}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
Reads the object stream.
" + NL + "
" + NL + "
Throws:" + "
" + NL + "
" + @@ -187,14 +187,14 @@ "APPLICATION_EXCLUDE" + NL + ""}, {BUG_ID + FS + "serialized-form.html", "
boolean " +
                  "undecorated
" + NL + "
" + - "Deprecated. As of JDK version 1.5, replaced by" + NL + + "Deprecated. As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean).
" + NL + ""}, + "setUndecorated(boolean)
." + NL + ""}, {BUG_ID + FS + "serialized-form.html", "" + - "Deprecated. As of JDK version" + + "Deprecated. As of JDK version" + " 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + ""}}; + "setUndecorated(boolean)." + NL + ""}}; // Test for valid HTML generation which should not comprise of empty // definition list tags. diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testInterface/TestInterface.java --- a/test/com/sun/javadoc/testInterface/TestInterface.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testInterface/TestInterface.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -83,7 +83,7 @@ }, //Make sure "Specified By" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", - "
Specified by:
" + NL + + "
Specified by:
" + NL + "
method" + " in interface " + "" + @@ -92,7 +92,7 @@ }, //Make sure "Overrides" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
method" + " in class Parent<Gets the value of the property rate." + NL + "
" + NL + "
Property description:
" }, {"./" + BUG_ID + "/C.html", - "
rate" + NL + + "rate" + NL + "
Defines the direction/speed at which the Timeline is expected to"}, {"./" + BUG_ID + "/C.html", @@ -63,7 +63,7 @@ {"./" + BUG_ID + "/C.html", "Property description:"}, {"./" + BUG_ID + "/C.html", - "setTestMethodProperty() " }, + "setTestMethodProperty() " }, {"./" + BUG_ID + "/C.html", "

isPaused

" + NL + "
public final double isPaused()
" + NL + diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java --- a/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, 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 @@ -72,7 +72,7 @@ // Test overriding/implementing methods with generic parameters. {BUG_ID + FS + "pkg" + FS + "BaseClass.html", - "
" + NL + "
Specified by:
" + NL + + "
" + NL + "
Specified by:
" + NL + "
" + "getAnnotation in interface " + "" + diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java --- a/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -49,8 +49,8 @@ // Check return type in member summary. {BUG_ID + FS + "pkg" + FS + "PublicChild.html", "PublicChild" + NL + - "" + - "returnTypeTest()" + "" + + "returnTypeTest()" }, // Check return type in member detail. {BUG_ID + FS + "pkg" + FS + "PublicChild.html", diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java --- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Thu Aug 15 21:34:46 2013 +0100 @@ -62,7 +62,7 @@ " "}, //Detail for enum constant {BUG_ID + FS + "pkg" + FS + "Coin.html", - "Dime"}, + "Dime"}, //Automatically insert documentation for values() and valueOf(). {BUG_ID + FS + "pkg" + FS + "Coin.html", "Returns an array containing the constants of this enum type,"}, @@ -320,11 +320,11 @@ "Foo " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "ClassUseTest1<T extends " + "Foo" + " & " + - "Foo2> " + "Foo2> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", "Methods in ClassUseTest1." + - "method" + + "method" + "(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", @@ -372,11 +372,11 @@ "" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "ClassUseTest1<T extends " + "Foo" + " & " + - "Foo2> " + "Foo2> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", "Methods in " + - "ClassUseTest1.method" + + "ClassUseTest1.method" + "(T t) " }, @@ -401,11 +401,11 @@ " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "ClassUseTest2<T extends " + "" + "ParamTest<" + - "Foo3>> " + "Foo3>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", "Methods in ClassUseTest2." + - "method" + + "method" + "(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", @@ -456,11 +456,11 @@ "Foo3 " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "ClassUseTest2<T extends " + "" + "ParamTest<" + - "Foo3>> " + "Foo3>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", "Methods in ClassUseTest2." + - "method" + + "method" + "(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", @@ -500,12 +500,12 @@ " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "ClassUseTest3<T extends " + "" + "ParamTest2<java.util.List<? extends " + "" + - "Foo4>>> " + "Foo4>>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "Methods in ClassUseTest3" + - ".method(T t) " + ".method(T t) " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "<T extends " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "ClassUseTest3<T extends " + "" + "ParamTest2<java.util.List<? extends " + "" + - "Foo4>>> " + "Foo4>>> " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "Methods in ClassUseTest3." + - "method(T t)" + + "method(T t)" + " " }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", @@ -587,8 +587,8 @@ "" + NL + "" + NL + "" + NL + "void" + NL + "ClassUseTest3." + - "method(java." + + "method(java." + "util.Set<Foo4> p) " + NL + "" + NL + "" @@ -698,25 +698,25 @@ {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Class Annotation\"," + NL + " required=1994)" + NL + - "public class AnnotationTypeUsage
extends java.lang.Object
"}, + "public class AnnotationTypeUsage
extends java.lang.Object
"}, //FIELD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Field Annotation\"," + NL + " required=1994)" + NL + - "public int field"}, + "public int field"}, //CONSTRUCTOR {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Constructor Annotation\"," + NL + " required=1994)" + NL + - "public AnnotationTypeUsage()"}, + "public AnnotationTypeUsage()"}, //METHOD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "@AnnotationTypeUndocumented(optional=\"Method Annotation\"," + NL + " required=1994)" + NL + - "public void method()"}, + "public void method()"}, //================================= // Make sure annotation types do not diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testOptions/TestOptions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testOptions/TestOptions.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2013, 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 4749567 + * @summary Test the output for -header and -footer options. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester TestOptions + * @run main TestOptions + */ + +public class TestOptions extends JavadocTester { + + //Test information. + private static final String BUG_ID = "4749567"; + + //Javadoc arguments. + private static final String[] ARGS = new String[] { + "-d", BUG_ID, "-header", "Test header", "-footer", "Test footer", + "-sourcepath", SRC_DIR, "pkg" + }; + + private static final String[][] TEST = { + {BUG_ID + FS + "pkg" + FS + "package-summary.html", + "
Test header
"}, + {BUG_ID + FS + "pkg" + FS + "package-summary.html", + "
Test footer
"} + }; + + private static final String[][] NEGATED_TEST = NO_TEST; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestOptions tester = new TestOptions(); + run(tester, ARGS, TEST, NEGATED_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} + diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testOptions/pkg/Foo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/com/sun/javadoc/testOptions/pkg/Foo.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2013, 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 Foo {} + diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java --- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -46,9 +46,9 @@ //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Description copied from class: " + + "Description copied from class: " + "" + - "BaseClass" + "BaseClass" } }; private static final String[][] NEGATED_TEST = NO_TEST; diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java --- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, 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 @@ -40,12 +40,12 @@ private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
" + "publicMethod in class " + "BaseClass
"}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
" + "publicMethod in class " + "BaseClass
"}, @@ -55,7 +55,7 @@ //The package private method should be overriden since the base and sub class are in the same //package. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
" + "packagePrivateMethod in class " + "BaseClass
"} @@ -65,18 +65,18 @@ //The private method in should not be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
"}, //The private method in different package should not be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
"}, //The package private method should not be overriden since the base and sub class are in //different packages. {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
"}, }; diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java --- a/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java Thu Aug 15 21:34:46 2013 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, 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 @@ -40,18 +40,18 @@ private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "
Overrides:
" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Overrides:" + NL + + "
Overrides:
" + NL + "
Deprecated." + NL + - "
This package is Deprecated.
" + "
This package is Deprecated." + + "
" }, {BUG_ID + "-1" + FS + "deprecated-list.html", "
  • Deprecated Packages
  • " diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java --- a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Thu Aug 15 21:34:46 2013 +0100 @@ -112,12 +112,12 @@ private static final String[][] NEGATED_TEST1 = { // Should not document that a method overrides method from private class. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "Overrides:"}, + "Overrides:"}, // Should not document that a method specified by private interface. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "Specified by:"}, + "Specified by:"}, {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", - "Specified by:"}, + "Specified by:"}, // Should not mention that any documentation was copied. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", "Description copied from"}, @@ -139,7 +139,7 @@ //Do not inherit private interface method with generic parameters. //This method has been implemented. {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html", - "hello"}, + "hello"}, }; // Test output when -private flag is used. @@ -176,14 +176,14 @@ }, // Should document that a method overrides method from private class. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "
    Overrides:
    " + NL + + "
    Overrides:
    " + NL + "
    " + "methodOverridenFromParent in class " + "" + "PrivateParent
    "}, // Should document that a method is specified by private interface. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "
    Specified by:
    " + NL + + "
    Specified by:
    " + NL + "
    " + "methodInterface in interface " + "" + @@ -227,11 +227,11 @@ //Since private flag is used, we can document that private interface method //with generic parameters has been implemented. {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "Description copied from interface: " + - "I"}, + "Description copied from interface: " + + "I"}, {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "
    Specified by:
    " + NL + + "
    Specified by:
    " + NL + "
    hello" + " in interface " + "I" + diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java --- a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Fri Aug 09 14:44:53 2013 +0100 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Thu Aug 15 21:34:46 2013 +0100 @@ -47,9 +47,9 @@ "" + NL + "
    " + "C1.setUndecorated(boolean)
    " + NL + "
    "}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean).
    " + NL + + "setUndecorated(boolean)." + NL + "
    This field indicates whether the C1 " + "is undecorated.
    " + NL + " " + NL + "
    " + NL + "
    Since:
    " + NL + @@ -57,9 +57,9 @@ "" + NL + "
    " + "C1.setUndecorated(boolean)
    " + NL + "
    "}, {BUG_ID + FS + "serialized-form.html", "Deprecated." + - " As of JDK version 1.5, replaced by" + NL + + " As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + + "setUndecorated(boolean)." + NL + "
    Reads the object stream.
    " + NL + "
    " + NL + "
    Throws:
    " + NL + "
    " + "IOException
    " + NL + @@ -73,15 +73,15 @@ // information if any. private static final String[][] TEST_NOCMNT = { {BUG_ID + FS + "serialized-form.html", "
    boolean undecorated
    " + NL + - "
    Deprecated. " + + "
    Deprecated. " + "As of JDK version 1.5, replaced by" + NL + " " + - "setUndecorated(boolean).
    " + NL + ""}, + "setUndecorated(boolean)
    .
    " + NL + ""}, {BUG_ID + FS + "serialized-form.html", "" + - "Deprecated. As of JDK version" + + "Deprecated. As of JDK version" + " 1.5, replaced by" + NL + " " + - "setUndecorated(boolean)." + NL + ""}}; + "setUndecorated(boolean)." + NL + ""}}; // Test with -nodeprecated option. The serialized-form.html should // ignore the -nodeprecated tag and display the deprecation info. This diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,46 @@ + +/* + * Copyright (c) 2013, 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 8020997 + * @summary Cannot compile class with repeating annotation + * @compile CannotCompileRepeatedAnnoTest.java + */ + +import java.lang.annotation.*; + +@Anno(req = true) +@Anno() +public class CannotCompileRepeatedAnnoTest { +} + +@Repeatable(Container.class) +@interface Anno { + boolean req() default false; +} + +@interface Container{ + Anno[] value(); +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2013, 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 8022186 + * @summary javac generates dead code if a try with an empty body has a finalizer + */ + +import com.sun.tools.classfile.Attribute; +import com.sun.tools.classfile.ClassFile; +import com.sun.tools.classfile.Code_attribute; +import com.sun.tools.classfile.ConstantPool; +import com.sun.tools.classfile.ConstantPool.CONSTANT_String_info; +import com.sun.tools.classfile.ConstantPool.CPInfo; +import com.sun.tools.classfile.ConstantPool.InvalidIndex; +import com.sun.tools.classfile.Instruction; +import com.sun.tools.classfile.Instruction.KindVisitor; +import com.sun.tools.classfile.Instruction.TypeKind; +import com.sun.tools.classfile.Method; +import com.sun.tools.javac.util.Assert; +import java.io.BufferedInputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class DeadCodeGeneratedForEmptyTryTest { + + public static void main(String[] args) throws Exception { + new DeadCodeGeneratedForEmptyTryTest().run(); + } + + void run() throws Exception { + checkClassFile(Paths.get(System.getProperty("test.classes"), + this.getClass().getName() + "$Test.class")); + } + + int utf8Index; + int numberOfRefToStr = 0; + ConstantPool constantPool; + + void checkClassFile(final Path path) throws Exception { + ClassFile classFile = ClassFile.read( + new BufferedInputStream(Files.newInputStream(path))); + constantPool = classFile.constant_pool; + utf8Index = constantPool.getUTF8Index("STR_TO_LOOK_FOR"); + for (Method method: classFile.methods) { + if (method.getName(constantPool).equals("methodToLookFor")) { + Code_attribute codeAtt = (Code_attribute)method.attributes.get(Attribute.Code); + for (Instruction inst: codeAtt.getInstructions()) { + inst.accept(codeVisitor, null); + } + } + } + Assert.check(numberOfRefToStr == 1, + "There should only be one reference to a CONSTANT_String_info structure in the generated code"); + } + + CodeVisitor codeVisitor = new CodeVisitor(); + + class CodeVisitor implements KindVisitor { + + void checkIndirectRefToString(int cp_index) { + try { + CPInfo cInfo = constantPool.get(cp_index); + if (cInfo instanceof CONSTANT_String_info) { + CONSTANT_String_info strInfo = (CONSTANT_String_info)cInfo; + if (strInfo.string_index == utf8Index) { + numberOfRefToStr++; + } + } + } catch (InvalidIndex ex) { + throw new AssertionError("invalid constant pool index at " + cp_index); + } + } + + @Override + public Void visitNoOperands(Instruction instr, Void p) { + return null; + } + + @Override + public Void visitArrayType(Instruction instr, TypeKind kind, Void p) { + return null; + } + + @Override + public Void visitBranch(Instruction instr, int offset, Void p) { + return null; + } + + @Override + public Void visitConstantPoolRef(Instruction instr, int index, Void p) { + checkIndirectRefToString(index); + return null; + } + + @Override + public Void visitConstantPoolRefAndValue(Instruction instr, int index, int value, Void p) { + checkIndirectRefToString(index); + return null; + } + + @Override + public Void visitLocal(Instruction instr, int index, Void p) { + return null; + } + + @Override + public Void visitLocalAndValue(Instruction instr, int index, int value, Void p) { + return null; + } + + @Override + public Void visitLookupSwitch(Instruction instr, int default_, int npairs, int[] matches, int[] offsets, Void p) { + return null; + } + + @Override + public Void visitTableSwitch(Instruction instr, int default_, int low, int high, int[] offsets, Void p) { + return null; + } + + @Override + public Void visitValue(Instruction instr, int value, Void p) { + return null; + } + + @Override + public Void visitUnknown(Instruction instr, Void p) { + return null; + } + + } + + public class Test { + void methodToLookFor() { + try { + } finally { + System.out.println("STR_TO_LOOK_FOR"); + } + } + } +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/processing/model/element/8009367/TestQualifiedNameUsed.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/8009367/TestQualifiedNameUsed.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, 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 8009367 + * @summary Test that the correct kind of names (binary) are used when comparing + * Class and Symbol for repeatable Classes. + * @library /tools/javac/lib + * @build JavacTestingAbstractProcessor TestQualifiedNameUsed p.Q p.QQ p.R p.RR + * @run compile -processor TestQualifiedNameUsed -proc:only TestQualifiedNameUsed.java + */ + +import java.lang.annotation.Repeatable; +import java.util.Set; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import static javax.lang.model.util.ElementFilter.*; + +import com.sun.tools.javac.util.Assert; + +import java.util.Arrays; + +public class TestQualifiedNameUsed extends JavacTestingAbstractProcessor { + @Q + @p.Q + @p.R.Q + public boolean process(Set annotations, + RoundEnvironment roundEnv) { + if (!roundEnv.processingOver()) { + boolean hasRun = false; + for (Element element : roundEnv.getRootElements()) { + for (ExecutableElement e : methodsIn(element.getEnclosedElements())) { + if (e.getSimpleName().contentEquals("value")) + continue; // don't want to look Q.value() in this file + + hasRun = true; + Q[] qs = e.getAnnotationsByType(Q.class); + Assert.check(qs.length == 1); + Assert.check(qs[0] instanceof Q); + + p.Q[] ps = e.getAnnotationsByType(p.Q.class); + Assert.check(ps.length == 1); + Assert.check(ps[0] instanceof p.Q); + + p.R.Q[] rs = e.getAnnotationsByType(p.R.Q.class); + Assert.check(rs.length == 1); + Assert.check(rs[0] instanceof p.R.Q); + } + } + if (!hasRun) throw new RuntimeException("No methods!"); + } + return true; + } +} + +@Repeatable(QQ.class) +@interface Q {} + +@interface QQ { + Q[] value(); +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/processing/model/element/8009367/p/Q.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/8009367/p/Q.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2013, 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.lang.annotation.Repeatable; + +@Repeatable(QQ.class) +public @interface Q {} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/processing/model/element/8009367/p/QQ.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/8009367/p/QQ.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, 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 @interface QQ { + Q[] value(); +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/processing/model/element/8009367/p/R.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/8009367/p/R.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, 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.lang.annotation.Repeatable; + +public class R { + + @Repeatable(RR.class) + public @interface Q {} +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/processing/model/element/8009367/p/RR.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/processing/model/element/8009367/p/RR.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2013, 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 @interface RR { + R.Q[] value(); +} diff -r 2d1a54d213c2 -r 84b6d75ff2c9 test/tools/javac/tree/NewArrayPretty.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/tree/NewArrayPretty.java Thu Aug 15 21:34:46 2013 +0100 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2013, 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 8014826 + * @summary test Pretty print of NewArray + * @author ksrini + */ +import com.sun.source.tree.ClassTree; +import com.sun.source.tree.CompilationUnitTree; +import com.sun.tools.javac.api.JavacTaskImpl; +import com.sun.tools.javac.tree.JCTree; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import javax.tools.JavaCompiler; +import javax.tools.JavaFileObject; +import javax.tools.SimpleJavaFileObject; +import javax.tools.ToolProvider; + +public class NewArrayPretty { + private final JavaCompiler tool; + NewArrayPretty() { + tool = ToolProvider.getSystemJavaCompiler(); + } + public static void main(String... args) throws Exception { + NewArrayPretty nap = new NewArrayPretty(); + nap.run("Class[] cls = null"); + nap.run("Class[] cls = new Class[]{Object.class}"); + } + void run(String code) throws IOException { + String src = "public class Test {" + code + ";}"; + + JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, null, + null, Arrays.asList(new MyFileObject(src))); + + for (CompilationUnitTree cut : ct.parse()) { + JCTree.JCVariableDecl var = + (JCTree.JCVariableDecl) ((ClassTree) cut.getTypeDecls().get(0)).getMembers().get(0); + + if (!code.equals(var.toString())) { + System.err.println("Expected: " + code); + System.err.println("Obtained: " + var.toString()); + throw new RuntimeException("strings do not match!"); + } + } + } +} +class MyFileObject extends SimpleJavaFileObject { + + private String text; + + public MyFileObject(String text) { + super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE); + this.text = text; + } + + @Override + public CharSequence getCharContent(boolean ignoreEncodingErrors) { + return text; + } +}