# HG changeset patch
# User lana
# Date 1379431271 25200
# Node ID 669e1adcbf50ee7f4f06dd541674ef7373a65948
# Parent dd285b441e441daaaab1148215b44cd31041c743# Parent e9dae0e41075e4a76702adf5b8abfc5f2507a60e
Merge
diff -r dd285b441e44 -r 669e1adcbf50 langtools/README
--- a/langtools/README Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/README Tue Sep 17 08:21:11 2013 -0700
@@ -32,7 +32,7 @@
JLS and JVMS.
In addition, there is a substantial collection of regression and unit
-tests for all the tools in the maain langtools test/ directory.
+tests for all the tools in the main langtools test/ directory.
Finally, there is a small set of tests to do basic validation of a build
of the langtools workspace for use by JDK. These tests check the contents
diff -r dd285b441e44 -r 669e1adcbf50 langtools/make/netbeans/langtools/build.xml
--- a/langtools/make/netbeans/langtools/build.xml Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/make/netbeans/langtools/build.xml Tue Sep 17 08:21:11 2013 -0700
@@ -1,6 +1,6 @@
@@ -136,9 +145,9 @@
-
+
-
+
@@ -207,6 +216,7 @@
@@ -216,6 +226,7 @@
@@ -226,10 +237,12 @@
+
+
-
+
diff -r dd285b441e44 -r 669e1adcbf50 langtools/make/tools/anttasks/SelectToolTask.java
--- a/langtools/make/tools/anttasks/SelectToolTask.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/make/tools/anttasks/SelectToolTask.java Tue Sep 17 08:21:11 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -43,6 +43,7 @@
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.EnumSet;
import java.util.List;
import java.util.Properties;
import javax.swing.JButton;
@@ -71,6 +72,31 @@
* is invoked to allow the user to set or reset values for use in property mode.
*/
public class SelectToolTask extends Task {
+
+ enum ToolChoices {
+ NONE(""),
+ JAVAC("javac"),
+ JAVADOC("javadoc"),
+ JAVAH("javah"),
+ JAVAP("javap");
+
+ String toolName;
+ boolean bootstrap;
+
+ ToolChoices(String toolName) {
+ this(toolName, false);
+ }
+
+ ToolChoices(String toolName, boolean boostrap) {
+ this.toolName = toolName;
+ }
+
+ @Override
+ public String toString() {
+ return toolName;
+ }
+ }
+
/**
* Set the location of the private properties file used to keep the retain
* user preferences for this repository.
@@ -97,6 +123,14 @@
}
/**
+ * Set the name of the property which will be set to the execution args of the
+ * selected tool, if any. The args default to an empty string.
+ */
+ public void setBootstrapProperty(String bootstrapProperty) {
+ this.bootstrapProperty = bootstrapProperty;
+ }
+
+ /**
* Specify whether or not to pop up a dialog if the user has not specified
* a default value for a property.
*/
@@ -110,6 +144,7 @@
Properties props = readProperties(propertyFile);
toolName = props.getProperty("tool.name");
+ toolBootstrap = props.getProperty("tool.bootstrap") != null;
if (toolName != null) {
toolArgs = props.getProperty(toolName + ".args", "");
}
@@ -123,6 +158,8 @@
// finally, return required values, if any
if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
p.setProperty(toolProperty, toolName);
+ if (toolBootstrap)
+ p.setProperty(bootstrapProperty, "true");
if (argsProperty != null && toolArgs != null)
p.setProperty(argsProperty, toolArgs);
@@ -134,14 +171,20 @@
JOptionPane p = createPane(guiProps);
p.createDialog("Select Tool").setVisible(true);
- toolName = (String) toolChoice.getSelectedItem();
+ toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
toolArgs = argsField.getText();
-
+ toolBootstrap = bootstrapCheckbox.isSelected();
if (defaultCheck.isSelected()) {
if (toolName.equals("")) {
fileProps.remove("tool.name");
+ fileProps.remove("tool.bootstrap");
} else {
fileProps.put("tool.name", toolName);
+ if (toolBootstrap) {
+ fileProps.put("tool.bootstrap", "true");
+ } else {
+ fileProps.remove("tool.bootstrap");
+ }
fileProps.put(toolName + ".args", toolArgs);
}
writeProperties(propertyFile, fileProps);
@@ -154,32 +197,38 @@
lc.insets.right = 10;
lc.insets.bottom = 3;
GridBagConstraints fc = new GridBagConstraints();
- fc.anchor = GridBagConstraints.WEST;
fc.gridx = 1;
- fc.gridwidth = GridBagConstraints.REMAINDER;
+ fc.gridwidth = GridBagConstraints.NONE;
fc.insets.bottom = 3;
+ JPanel toolPane = new JPanel(new GridBagLayout());
+
JLabel toolLabel = new JLabel("Tool:");
body.add(toolLabel, lc);
- String[] toolChoices = { "apt", "javac", "javadoc", "javah", "javap" };
- if (true || toolProperty == null) {
- // include empty value in setup mode
- List l = new ArrayList(Arrays.asList(toolChoices));
- l.add(0, "");
- toolChoices = l.toArray(new String[l.size()]);
- }
- toolChoice = new JComboBox(toolChoices);
+ EnumSet toolChoices = toolProperty == null ?
+ EnumSet.allOf(ToolChoices.class) : EnumSet.range(ToolChoices.JAVAC, ToolChoices.JAVAP);
+ toolChoice = new JComboBox(toolChoices.toArray());
if (toolName != null)
- toolChoice.setSelectedItem(toolName);
+ toolChoice.setSelectedItem(ToolChoices.valueOf(toolName.toUpperCase()));
toolChoice.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
- String tn = (String) e.getItem();
+ String tn = ((ToolChoices)e.getItem()).toolName;
argsField.setText(getDefaultArgsForTool(props, tn));
if (toolProperty != null)
okButton.setEnabled(!tn.equals(""));
}
});
- body.add(toolChoice, fc);
+ GridBagConstraints checkConstraint = new GridBagConstraints();
+ fc.anchor = GridBagConstraints.EAST;
+
+ GridBagConstraints toolConstraint = new GridBagConstraints();
+ fc.anchor = GridBagConstraints.WEST;
+
+ toolPane.add(toolChoice, toolConstraint);
+ bootstrapCheckbox = new JCheckBox("bootstrap", toolBootstrap);
+ toolPane.add(bootstrapCheckbox, checkConstraint);
+
+ body.add(toolPane, fc);
argsField = new JTextField(getDefaultArgsForTool(props, toolName), 40);
if (toolProperty == null || argsProperty != null) {
@@ -190,7 +239,7 @@
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
- String toolName = (String) toolChoice.getSelectedItem();
+ String toolName = ((ToolChoices)toolChoice.getSelectedItem()).toolName;
if (toolName.length() > 0)
props.put(toolName + ".args", argsField.getText());
}
@@ -271,16 +320,19 @@
// Ant task parameters
private boolean askIfUnset;
private String toolProperty;
+ private String bootstrapProperty;
private String argsProperty;
private File propertyFile;
// GUI components
private JComboBox toolChoice;
+ private JCheckBox bootstrapCheckbox;
private JTextField argsField;
private JCheckBox defaultCheck;
private JButton okButton;
// Result values for the client
private String toolName;
+ private boolean toolBootstrap;
private String toolArgs;
}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java Tue Sep 17 08:21:11 2013 -0700
@@ -157,7 +157,7 @@
addAllProfilesLink(div);
}
body.addContent(div);
- if (configuration.showProfiles) {
+ if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
Content profileSummary = configuration.getResource("doclet.Profiles");
addProfilesList(profileSummary, body);
}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Sep 17 08:21:11 2013 -0700
@@ -118,7 +118,7 @@
if (prev != null) {
Content prevLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, prev.asClassDoc())
- .label(configuration.getText("doclet.Prev_Class")).strong(true));
+ .label(prevclassLabel).strong(true));
li = HtmlTree.LI(prevLink);
}
else
@@ -136,7 +136,7 @@
if (next != null) {
Content nextLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, next.asClassDoc())
- .label(configuration.getText("doclet.Next_Class")).strong(true));
+ .label(nextclassLabel).strong(true));
li = HtmlTree.LI(nextLink);
}
else
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java Tue Sep 17 08:21:11 2013 -0700
@@ -126,7 +126,7 @@
if (prev != null) {
Content prevLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, prev)
- .label(configuration.getText("doclet.Prev_Class")).strong(true));
+ .label(prevclassLabel).strong(true));
li = HtmlTree.LI(prevLink);
}
else
@@ -144,7 +144,7 @@
if (next != null) {
Content nextLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.CLASS, next)
- .label(configuration.getText("doclet.Next_Class")).strong(true));
+ .label(nextclassLabel).strong(true));
li = HtmlTree.LI(nextLink);
}
else
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java Tue Sep 17 08:21:11 2013 -0700
@@ -205,13 +205,20 @@
* {@inheritDoc}
*/
protected void generateProfileFiles() throws Exception {
- if (configuration.showProfiles) {
+ if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
ProfileIndexFrameWriter.generate(configuration);
Profile prevProfile = null, nextProfile;
+ String profileName;
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
- ProfilePackageIndexFrameWriter.generate(configuration, Profile.lookup(i).name);
+ profileName = Profile.lookup(i).name;
+ // Generate profile package pages only if there are any packages
+ // in a profile to be documented. The profilePackages map will not
+ // contain an entry for the profile if there are no packages to be documented.
+ if (!configuration.shouldDocumentProfile(profileName))
+ continue;
+ ProfilePackageIndexFrameWriter.generate(configuration, profileName);
PackageDoc[] packages = configuration.profilePackages.get(
- Profile.lookup(i).name);
+ profileName);
PackageDoc prev = null, next;
for (int j = 0; j < packages.length; j++) {
// if -nodeprecated option is set and the package is marked as
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue Sep 17 08:21:11 2013 -0700
@@ -406,10 +406,7 @@
Content htmlDocType = DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
- if (!configuration.notimestamp) {
- Content headComment = new Comment(getGeneratedByString());
- head.addContent(headComment);
- }
+ head.addContent(getGeneratedBy(!configuration.notimestamp));
if (configuration.charset.length() > 0) {
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
configuration.charset);
@@ -502,16 +499,17 @@
if (!configuration.nonavbar) {
String allClassesId = "allclasses_";
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
+ Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
if (header) {
body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
navDiv.addStyle(HtmlStyle.topNav);
allClassesId += "navbar_top";
Content a = getMarkerAnchor("navbar_top");
+ //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
navDiv.addContent(a);
- Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_top"),
- HtmlTree.EMPTY,
- configuration.getText("doclet.Skip_navigation_links"),
- "");
+ Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
+ DocLink.fragment("skip-navbar_top"), skipNavLinks,
+ skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
} else {
body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
@@ -519,10 +517,9 @@
allClassesId += "navbar_bottom";
Content a = getMarkerAnchor("navbar_bottom");
navDiv.addContent(a);
- Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_bottom"),
- HtmlTree.EMPTY,
- configuration.getText("doclet.Skip_navigation_links"),
- "");
+ Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
+ DocLink.fragment("skip-navbar_bottom"), skipNavLinks,
+ skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
}
if (header) {
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Tue Sep 17 08:21:11 2013 -0700
@@ -130,10 +130,14 @@
String profileName;
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
profileName = Profile.lookup(i).name;
- Content profileLinkContent = getTargetProfileLink("classFrame",
- new StringContent(profileName), profileName);
- Content li = HtmlTree.LI(profileLinkContent);
- ul.addContent(li);
+ // If the profile has valid packages to be documented, add it to the
+ // profiles list on overview-summary.html page.
+ if (configuration.shouldDocumentProfile(profileName)) {
+ Content profileLinkContent = getTargetProfileLink("classFrame",
+ new StringContent(profileName), profileName);
+ Content li = HtmlTree.LI(profileLinkContent);
+ ul.addContent(li);
+ }
}
profilesDiv.addContent(ul);
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, profilesDiv);
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java Tue Sep 17 08:21:11 2013 -0700
@@ -88,8 +88,13 @@
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.setTitle(profilesLabel);
+ String profileName;
for (int i = 1; i < profiles.getProfileCount(); i++) {
- ul.addContent(getProfile(i));
+ profileName = (Profile.lookup(i)).name;
+ // If the profile has valid packages to be documented, add it to the
+ // left-frame generated for profile index.
+ if (configuration.shouldDocumentProfile(profileName))
+ ul.addContent(getProfile(profileName));
}
div.addContent(ul);
body.addContent(div);
@@ -98,13 +103,12 @@
/**
* Gets each profile name as a separate link.
*
- * @param profile the profile being documented
+ * @param profileName the profile being documented
* @return content for the profile link
*/
- protected Content getProfile(int profile) {
+ protected Content getProfile(String profileName) {
Content profileLinkContent;
Content profileLabel;
- String profileName = (Profile.lookup(profile)).name;
profileLabel = new StringContent(profileName);
profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "",
"packageListFrame");
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java Tue Sep 17 08:21:11 2013 -0700
@@ -138,6 +138,7 @@
"classFrame", new StringContent(pkg.name()), profile.name);
Content heading = HtmlTree.HEADING(HtmlTag.H3, pkgName);
HtmlTree li = HtmlTree.LI(HtmlStyle.blockList, heading);
+ addPackageDeprecationInfo(li, pkg);
return li;
}
@@ -175,6 +176,30 @@
}
/**
+ * Add the profile package deprecation information to the documentation tree.
+ *
+ * @param li the content tree to which the deprecation information will be added
+ * @param pkg the PackageDoc that is added
+ */
+ public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
+ Tag[] deprs;
+ if (Util.isDeprecated(pkg)) {
+ deprs = pkg.tags("deprecated");
+ HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
+ deprDiv.addStyle(HtmlStyle.deprecatedContent);
+ Content deprPhrase = HtmlTree.SPAN(HtmlStyle.strong, deprecatedPhrase);
+ deprDiv.addContent(deprPhrase);
+ if (deprs.length > 0) {
+ Tag[] commentTags = deprs[0].inlineTags();
+ if (commentTags.length > 0) {
+ addInlineDeprecatedComment(pkg, deprs[0], deprDiv);
+ }
+ }
+ li.addContent(deprDiv);
+ }
+ }
+
+ /**
* Get "PREV PROFILE" link in the navigation bar.
*
* @return a content tree for the previous link
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Tue Sep 17 08:21:11 2013 -0700
@@ -191,10 +191,7 @@
Content htmlDocType = DocType.FRAMESET;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
- if (! noTimeStamp) {
- Content headComment = new Comment(getGeneratedByString());
- head.addContent(headComment);
- }
+ head.addContent(getGeneratedBy(!noTimeStamp));
if (configuration.charset.length() > 0) {
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
configuration.charset);
@@ -210,9 +207,13 @@
write(htmlDocument);
}
- protected String getGeneratedByString() {
- Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
- Date today = calendar.getTime();
- return "Generated by javadoc ("+ ConfigurationImpl.BUILD_DATE + ") on " + today;
+ protected Comment getGeneratedBy(boolean timestamp) {
+ String text = "Generated by javadoc"; // marker string, deliberately not localized
+ if (timestamp) {
+ Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
+ Date today = calendar.getTime();
+ text += " ("+ ConfigurationImpl.BUILD_DATE + ") on " + today;
+ }
+ return new Comment(text);
}
}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Tue Sep 17 08:21:11 2013 -0700
@@ -68,6 +68,7 @@
packageSummary,
rowColor,
serializedFormContainer,
+ skipNav,
sourceContainer,
sourceLineNo,
strong,
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Tue Sep 17 08:21:11 2013 -0700
@@ -203,27 +203,27 @@
useLabel = getResource("doclet.navClassUse");
prevLabel = getResource("doclet.Prev");
nextLabel = getResource("doclet.Next");
- prevclassLabel = getResource("doclet.Prev_Class");
- nextclassLabel = getResource("doclet.Next_Class");
+ prevclassLabel = getNonBreakResource("doclet.Prev_Class");
+ nextclassLabel = getNonBreakResource("doclet.Next_Class");
summaryLabel = getResource("doclet.Summary");
detailLabel = getResource("doclet.Detail");
framesLabel = getResource("doclet.Frames");
- noframesLabel = getResource("doclet.No_Frames");
+ noframesLabel = getNonBreakResource("doclet.No_Frames");
treeLabel = getResource("doclet.Tree");
classLabel = getResource("doclet.Class");
deprecatedLabel = getResource("doclet.navDeprecated");
deprecatedPhrase = getResource("doclet.Deprecated");
- allclassesLabel = getResource("doclet.All_Classes");
- allpackagesLabel = getResource("doclet.All_Packages");
- allprofilesLabel = getResource("doclet.All_Profiles");
+ allclassesLabel = getNonBreakResource("doclet.All_Classes");
+ allpackagesLabel = getNonBreakResource("doclet.All_Packages");
+ allprofilesLabel = getNonBreakResource("doclet.All_Profiles");
indexLabel = getResource("doclet.Index");
helpLabel = getResource("doclet.Help");
seeLabel = getResource("doclet.See");
descriptionLabel = getResource("doclet.Description");
- prevpackageLabel = getResource("doclet.Prev_Package");
- nextpackageLabel = getResource("doclet.Next_Package");
- prevprofileLabel = getResource("doclet.Prev_Profile");
- nextprofileLabel = getResource("doclet.Next_Profile");
+ prevpackageLabel = getNonBreakResource("doclet.Prev_Package");
+ nextpackageLabel = getNonBreakResource("doclet.Next_Package");
+ prevprofileLabel = getNonBreakResource("doclet.Prev_Profile");
+ nextprofileLabel = getNonBreakResource("doclet.Next_Profile");
packagesLabel = getResource("doclet.Packages");
profilesLabel = getResource("doclet.Profiles");
methodDetailsLabel = getResource("doclet.Method_Detail");
@@ -257,6 +257,27 @@
}
/**
+ * Get the configuration string as a content, replacing spaces
+ * with non-breaking spaces.
+ *
+ * @param key the key to look for in the configuration file
+ * @return a content tree for the text
+ */
+ public Content getNonBreakResource(String key) {
+ String text = configuration.getText(key);
+ Content c = configuration.newContent();
+ int start = 0;
+ int p;
+ while ((p = text.indexOf(" ", start)) != -1) {
+ c.addContent(text.substring(start, p));
+ c.addContent(RawHtml.nbsp);
+ start = p + 1;
+ }
+ c.addContent(text.substring(start));
+ return c;
+ }
+
+ /**
* Get the configuration string as a content.
*
* @param key the key to look for in the configuration file
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java Tue Sep 17 08:21:11 2013 -0700
@@ -383,35 +383,52 @@
DocErrorReporter reporter);
private void initProfiles() throws IOException {
+ if (profilespath.isEmpty())
+ return;
+
profiles = Profiles.read(new File(profilespath));
- // Generate profiles documentation only is profilespath is set and if
- // profiles is not null and profiles count is 1 or more.
- showProfiles = (!profilespath.isEmpty() && profiles != null &&
- profiles.getProfileCount() > 0);
- }
+
+ // Group the packages to be documented by the lowest profile (if any)
+ // in which each appears
+ Map> interimResults =
+ new EnumMap>(Profile.class);
+ for (Profile p: Profile.values())
+ interimResults.put(p, new ArrayList());
- private void initProfilePackages() throws IOException {
- profilePackages = new HashMap();
- ArrayList results;
- Map packageIndex = new HashMap();
- for (int i = 0; i < packages.length; i++) {
- PackageDoc pkg = packages[i];
- packageIndex.put(pkg.name(), pkg);
+ for (PackageDoc pkg: packages) {
+ if (nodeprecated && Util.isDeprecated(pkg)) {
+ continue;
+ }
+ // the getProfile method takes a type name, not a package name,
+ // but isn't particularly fussy about the simple name -- so just use *
+ int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*");
+ Profile p = Profile.lookup(i);
+ if (p != null) {
+ List pkgs = interimResults.get(p);
+ pkgs.add(pkg);
+ }
}
- for (int i = 1; i < profiles.getProfileCount(); i++) {
- Set profPkgs = profiles.getPackages(i);
- results = new ArrayList();
- for (String packageName : profPkgs) {
- packageName = packageName.replace("/", ".");
- PackageDoc profPkg = packageIndex.get(packageName);
- if (profPkg != null) {
- results.add(profPkg);
- }
- }
- Collections.sort(results);
- PackageDoc[] profilePkgs = results.toArray(new PackageDoc[]{});
- profilePackages.put(Profile.lookup(i).name, profilePkgs);
+
+ // Build the profilePackages structure used by the doclet
+ profilePackages = new HashMap();
+ List prev = Collections.emptyList();
+ int size;
+ for (Map.Entry> e: interimResults.entrySet()) {
+ Profile p = e.getKey();
+ List pkgs = e.getValue();
+ pkgs.addAll(prev); // each profile contains all lower profiles
+ Collections.sort(pkgs);
+ size = pkgs.size();
+ // For a profile, if there are no packages to be documented, do not add
+ // it to profilePackages map.
+ if (size > 0)
+ profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()]));
+ prev = pkgs;
}
+
+ // Generate profiles documentation if any profile contains any
+ // of the packages to be documented.
+ showProfiles = !prev.isEmpty();
}
private void initPackageArray() {
@@ -534,13 +551,10 @@
public void setOptions() throws Fault {
initPackageArray();
setOptions(root.options());
- if (!profilespath.isEmpty()) {
- try {
- initProfiles();
- initProfilePackages();
- } catch (Exception e) {
- throw new DocletAbortException(e);
- }
+ try {
+ initProfiles();
+ } catch (Exception e) {
+ throw new DocletAbortException(e);
}
setSpecificDocletOptions(root.options());
}
@@ -713,6 +727,17 @@
}
/**
+ * Check the validity of the given profile. Return false if there are no
+ * valid packages to be documented for the profile.
+ *
+ * @param profileName the profile that needs to be validated.
+ * @return true if the profile has valid packages to be documented.
+ */
+ public boolean shouldDocumentProfile(String profileName) {
+ return profilePackages.containsKey(profileName);
+ }
+
+ /**
* Check the validity of the given Source or Output File encoding on this
* platform.
*
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Tue Sep 17 08:21:11 2013 -0700
@@ -180,6 +180,12 @@
margin: auto 5px;
border:1px solid #c9aa44;
}
+.skipNav {
+ position:absolute;
+ top:auto;
+ left:-9999px;
+ overflow:hidden;
+ }
/*
Page header and footer styles
*/
@@ -372,7 +378,6 @@
overflow:hidden;
padding:0px;
margin:0px;
- white-space:pre;
}
caption a:link, caption a:hover, caption a:active, caption a:visited {
color:#FFFFFF;
@@ -381,35 +386,32 @@
white-space:nowrap;
padding-top:8px;
padding-left:8px;
- display:block;
+ display:inline-block;
float:left;
background-image:url(resources/titlebar.gif);
- height:18px;
}
.contentContainer ul.blockList li.blockList caption span.activeTableTab span {
white-space:nowrap;
padding-top:8px;
padding-left:8px;
- display:block;
+ display:inline-block;
float:left;
background-image:url(resources/activetitlebar.gif);
- height:18px;
}
.contentContainer ul.blockList li.blockList caption span.tableTab span {
white-space:nowrap;
padding-top:8px;
padding-left:8px;
- display:block;
+ display:inline-block;
float:left;
background-image:url(resources/titlebar.gif);
- height:18px;
}
.contentContainer ul.blockList li.blockList caption span.tableTab, .contentContainer ul.blockList li.blockList caption span.activeTableTab {
padding-top:0px;
padding-left:0px;
background-image:none;
float:none;
- display:inline;
+ display:inline-block;
}
.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd {
width:10px;
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LegacyTaglet.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LegacyTaglet.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/LegacyTaglet.java Tue Sep 17 08:21:11 2013 -0700
@@ -130,7 +130,13 @@
public Content getTagletOutput(Doc holder, TagletWriter writer)
throws IllegalArgumentException {
Content output = writer.getOutputInstance();
- output.addContent(new RawHtml(legacyTaglet.toString(holder.tags(getName()))));
+ Tag[] tags = holder.tags(getName());
+ if (tags.length > 0) {
+ String tagString = legacyTaglet.toString(tags);
+ if (tagString != null) {
+ output.addContent(new RawHtml(tagString));
+ }
+ }
return output;
}
}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PathDocFileFactory.java Tue Sep 17 08:21:11 2013 -0700
@@ -34,6 +34,7 @@
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -221,8 +222,10 @@
/** If the file is a directory, list its contents. */
public Iterable list() throws IOException {
List files = new ArrayList();
- for (Path f: Files.newDirectoryStream(file)) {
- files.add(new StandardDocFile(f));
+ try (DirectoryStream ds = Files.newDirectoryStream(file)) {
+ for (Path f: ds) {
+ files.add(new StandardDocFile(f));
+ }
}
return files;
}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/javac/Main.java
--- a/langtools/src/share/classes/com/sun/tools/javac/Main.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/Main.java Tue Sep 17 08:21:11 2013 -0700
@@ -30,14 +30,6 @@
/**
* The programmatic interface for the Java Programming Language
* compiler, javac.
- *
- *
Except for the two methods
- * {@link #compile(java.lang.String[])}
- * {@link #compile(java.lang.String[],java.io.PrintWriter)},
- * nothing described in this source file is part of any supported
- * API. If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.
*/
@jdk.Supported
public class Main {
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java Thu Sep 12 11:09:20 2013 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- */
-
-package com.sun.tools.javac.code;
-
-import java.util.Map;
-
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.comp.Annotate;
-import com.sun.tools.javac.comp.AttrContext;
-import com.sun.tools.javac.comp.Env;
-import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.Assert;
-import com.sun.tools.javac.util.List;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Pair;
-import static com.sun.tools.javac.code.Kinds.PCK;
-
-/**
- * Container for all annotations (attributes in javac) on a Symbol.
- *
- * This class is explicitly mutable. Its contents will change when attributes
- * are annotated onto the Symbol. However this class depends on the facts that
- * List (in javac) is immutable.
- *
- * An instance of this class can be in one of three states:
- *
- * NOT_STARTED indicates that the Symbol this instance belongs to has not been
- * annotated (yet). Specifically if the declaration is not annotated this
- * instance will never move past NOT_STARTED. You can never go back to
- * NOT_STARTED.
- *
- * IN_PROGRESS annotations have been found on the declaration. Will be processed
- * later. You can reset to IN_PROGRESS. While IN_PROGRESS you can set the list
- * of attributes (and this moves out of the IN_PROGRESS state).
- *
- * "unnamed" this Annotations contains some attributes, possibly the final set.
- * While in this state you can only prepend or append to the attributes not set
- * it directly. You can also move back to the IN_PROGRESS state using reset().
- *
- *
This is NOT part of any supported API. If you write code that depends
- * on this, you do so at your own risk. This code and its internal interfaces
- * are subject to change or deletion without notice.
- */
-public class Annotations {
-
- private static final List DECL_NOT_STARTED = List.of(null);
- private static final List DECL_IN_PROGRESS = List.of(null);
-
- /*
- * This field should never be null
- */
- private List attributes = DECL_NOT_STARTED;
-
- /*
- * Type attributes for this symbol.
- * This field should never be null.
- */
- private List type_attributes = List.nil();
-
- /*
- * Type attributes of initializers in this class.
- * Unused if the current symbol is not a ClassSymbol.
- */
- private List init_type_attributes = List.nil();
-
- /*
- * Type attributes of class initializers in this class.
- * Unused if the current symbol is not a ClassSymbol.
- */
- private List clinit_type_attributes = List.nil();
-
- /*
- * The Symbol this Annotations instance belongs to
- */
- private final Symbol sym;
-
- public Annotations(Symbol sym) {
- this.sym = sym;
- }
-
- public List getDeclarationAttributes() {
- return filterDeclSentinels(attributes);
- }
-
- public List getTypeAttributes() {
- return type_attributes;
- }
-
- public List getInitTypeAttributes() {
- return init_type_attributes;
- }
-
- public List getClassInitTypeAttributes() {
- return clinit_type_attributes;
- }
-
- public void setDeclarationAttributes(List a) {
- Assert.check(pendingCompletion() || !isStarted());
- if (a == null) {
- throw new NullPointerException();
- }
- attributes = a;
- }
-
- public void setTypeAttributes(List a) {
- if (a == null) {
- throw new NullPointerException();
- }
- type_attributes = a;
- }
-
- public void setInitTypeAttributes(List a) {
- if (a == null) {
- throw new NullPointerException();
- }
- init_type_attributes = a;
- }
-
- public void setClassInitTypeAttributes(List a) {
- if (a == null) {
- throw new NullPointerException();
- }
- clinit_type_attributes = a;
- }
-
- public void setAttributes(Annotations other) {
- if (other == null) {
- throw new NullPointerException();
- }
- setDeclarationAttributes(other.getDeclarationAttributes());
- setTypeAttributes(other.getTypeAttributes());
- setInitTypeAttributes(other.getInitTypeAttributes());
- setClassInitTypeAttributes(other.getClassInitTypeAttributes());
- }
-
- public void setDeclarationAttributesWithCompletion(final Annotate.AnnotateRepeatedContext ctx) {
- Assert.check(pendingCompletion() || (!isStarted() && sym.kind == PCK));
- this.setDeclarationAttributes(getAttributesForCompletion(ctx));
- }
-
- public void appendTypeAttributesWithCompletion(final Annotate.AnnotateRepeatedContext ctx) {
- this.appendUniqueTypes(getAttributesForCompletion(ctx));
- }
-
- private List getAttributesForCompletion(
- final Annotate.AnnotateRepeatedContext ctx) {
-
- Map> annotated = ctx.annotated;
- boolean atLeastOneRepeated = false;
- List buf = List.nil();
- for (ListBuffer lb : annotated.values()) {
- if (lb.size() == 1) {
- buf = buf.prepend(lb.first());
- } else { // repeated
- // This will break when other subtypes of Attributs.Compound
- // are introduced, because PlaceHolder is a subtype of TypeCompound.
- T res;
- @SuppressWarnings("unchecked")
- T ph = (T) new Placeholder(ctx, lb.toList(), sym);
- res = ph;
- buf = buf.prepend(res);
- atLeastOneRepeated = true;
- }
- }
-
- if (atLeastOneRepeated) {
- // The Symbol s is now annotated with a combination of
- // finished non-repeating annotations and placeholders for
- // repeating annotations.
- //
- // We need to do this in two passes because when creating
- // a container for a repeating annotation we must
- // guarantee that the @Repeatable on the
- // contained annotation is fully annotated
- //
- // The way we force this order is to do all repeating
- // annotations in a pass after all non-repeating are
- // finished. This will work because @Repeatable
- // is non-repeating and therefore will be annotated in the
- // fist pass.
-
- // Queue a pass that will replace Attribute.Placeholders
- // with Attribute.Compound (made from synthesized containers).
- ctx.annotateRepeated(new Annotate.Annotator() {
- @Override
- public String toString() {
- return "repeated annotation pass of: " + sym + " in: " + sym.owner;
- }
-
- @Override
- public void enterAnnotation() {
- complete(ctx);
- }
- });
- }
- // Add non-repeating attributes
- return buf.reverse();
- }
-
- public Annotations reset() {
- attributes = DECL_IN_PROGRESS;
- return this;
- }
-
- public boolean isEmpty() {
- return !isStarted()
- || pendingCompletion()
- || attributes.isEmpty();
- }
-
- public boolean isTypesEmpty() {
- return type_attributes.isEmpty();
- }
-
- public boolean pendingCompletion() {
- return attributes == DECL_IN_PROGRESS;
- }
-
- public Annotations append(List l) {
- attributes = filterDeclSentinels(attributes);
-
- if (l.isEmpty()) {
- ; // no-op
- } else if (attributes.isEmpty()) {
- attributes = l;
- } else {
- attributes = attributes.appendList(l);
- }
- return this;
- }
-
- public Annotations appendUniqueTypes(List l) {
- if (l.isEmpty()) {
- ; // no-op
- } else if (type_attributes.isEmpty()) {
- type_attributes = l;
- } else {
- // TODO: in case we expect a large number of annotations, this
- // might be inefficient.
- for (Attribute.TypeCompound tc : l) {
- if (!type_attributes.contains(tc))
- type_attributes = type_attributes.append(tc);
- }
- }
- return this;
- }
-
- public Annotations appendInitTypeAttributes(List l) {
- if (l.isEmpty()) {
- ; // no-op
- } else if (init_type_attributes.isEmpty()) {
- init_type_attributes = l;
- } else {
- init_type_attributes = init_type_attributes.appendList(l);
- }
- return this;
- }
-
- public Annotations appendClassInitTypeAttributes(List l) {
- if (l.isEmpty()) {
- ; // no-op
- } else if (clinit_type_attributes.isEmpty()) {
- clinit_type_attributes = l;
- } else {
- clinit_type_attributes = clinit_type_attributes.appendList(l);
- }
- return this;
- }
-
- public Annotations prepend(List l) {
- attributes = filterDeclSentinels(attributes);
-
- if (l.isEmpty()) {
- ; // no-op
- } else if (attributes.isEmpty()) {
- attributes = l;
- } else {
- attributes = attributes.prependList(l);
- }
- return this;
- }
-
- private List filterDeclSentinels(List a) {
- return (a == DECL_IN_PROGRESS || a == DECL_NOT_STARTED)
- ? List.nil()
- : a;
- }
-
- private boolean isStarted() {
- return attributes != DECL_NOT_STARTED;
- }
-
- private List getPlaceholders() {
- List res = List.nil();
- for (Attribute.Compound a : filterDeclSentinels(attributes)) {
- if (a instanceof Placeholder) {
- res = res.prepend(a);
- }
- }
- return res.reverse();
- }
-
- private List getTypePlaceholders() {
- List res = List.nil();
- for (Attribute.TypeCompound a : type_attributes) {
- if (a instanceof Placeholder) {
- res = res.prepend(a);
- }
- }
- return res.reverse();
- }
-
- /*
- * Replace Placeholders for repeating annotations with their containers
- */
- private void complete(Annotate.AnnotateRepeatedContext ctx) {
- Log log = ctx.log;
- Env env = ctx.env;
- JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
- try {
- // TODO: can we reduce duplication in the following branches?
- if (ctx.isTypeCompound) {
- Assert.check(!isTypesEmpty());
-
- if (isTypesEmpty()) {
- return;
- }
-
- List result = List.nil();
- for (Attribute.TypeCompound a : getTypeAttributes()) {
- if (a instanceof Placeholder) {
- @SuppressWarnings("unchecked")
- Placeholder ph = (Placeholder) a;
- Attribute.TypeCompound replacement = replaceOne(ph, ph.getRepeatedContext());
-
- if (null != replacement) {
- result = result.prepend(replacement);
- }
- } else {
- result = result.prepend(a);
- }
- }
-
- type_attributes = result.reverse();
-
- Assert.check(Annotations.this.getTypePlaceholders().isEmpty());
- } else {
- Assert.check(!pendingCompletion());
-
- if (isEmpty()) {
- return;
- }
-
- List result = List.nil();
- for (Attribute.Compound a : getDeclarationAttributes()) {
- if (a instanceof Placeholder) {
- @SuppressWarnings("unchecked")
- Attribute.Compound replacement = replaceOne((Placeholder) a, ctx);
-
- if (null != replacement) {
- result = result.prepend(replacement);
- }
- } else {
- result = result.prepend(a);
- }
- }
-
- attributes = result.reverse();
-
- Assert.check(Annotations.this.getPlaceholders().isEmpty());
- }
- } finally {
- log.useSource(oldSource);
- }
- }
-
- private T replaceOne(Placeholder placeholder, Annotate.AnnotateRepeatedContext ctx) {
- Log log = ctx.log;
-
- // Process repeated annotations
- T validRepeated = ctx.processRepeatedAnnotations(placeholder.getPlaceholderFor(), sym);
-
- if (validRepeated != null) {
- // Check that the container isn't manually
- // present along with repeated instances of
- // its contained annotation.
- ListBuffer manualContainer = ctx.annotated.get(validRepeated.type.tsym);
- if (manualContainer != null) {
- log.error(ctx.pos.get(manualContainer.first()), "invalid.repeatable.annotation.repeated.and.container.present",
- manualContainer.first().type.tsym);
- }
- }
-
- // A null return will delete the Placeholder
- return validRepeated;
- }
-
- private static class Placeholder extends Attribute.TypeCompound {
-
- private final Annotate.AnnotateRepeatedContext ctx;
- private final List placeholderFor;
- private final Symbol on;
-
- public Placeholder(Annotate.AnnotateRepeatedContext ctx, List placeholderFor, Symbol on) {
- super(on.type, List.>nil(),
- ctx.isTypeCompound ?
- ((Attribute.TypeCompound)placeholderFor.head).position :
- null);
- this.ctx = ctx;
- this.placeholderFor = placeholderFor;
- this.on = on;
- }
-
- @Override
- public String toString() {
- return "";
- }
-
- public List getPlaceholderFor() {
- return placeholderFor;
- }
-
- public Annotate.AnnotateRepeatedContext getRepeatedContext() {
- return ctx;
- }
- }
-}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/DeferredLintHandler.java Tue Sep 17 08:21:11 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -28,6 +28,8 @@
import java.util.HashMap;
import java.util.Map;
+import com.sun.tools.javac.tree.EndPosTable;
+import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -53,10 +55,13 @@
protected DeferredLintHandler(Context context) {
context.put(deferredLintHandlerKey, this);
+ this.currentPos = IMMEDIATE_POSITION;
}
- private DeferredLintHandler() {}
-
+ /**An interface for deferred lint reporting - loggers passed to
+ * {@link #report(LintLogger) } will be called when
+ * {@link #flush(DiagnosticPosition) } is invoked.
+ */
public interface LintLogger {
void report();
}
@@ -64,12 +69,26 @@
private DiagnosticPosition currentPos;
private Map> loggersQueue = new HashMap>();
+ /**Associate the given logger with the current position as set by {@link #setPos(DiagnosticPosition) }.
+ * Will be invoked when {@link #flush(DiagnosticPosition) } will be invoked with the same position.
+ *
+ * Will invoke the logger synchronously if {@link #immediate() } was called
+ * instead of {@link #setPos(DiagnosticPosition) }.
+ */
public void report(LintLogger logger) {
- ListBuffer loggers = loggersQueue.get(currentPos);
- Assert.checkNonNull(loggers);
- loggers.append(logger);
+ if (currentPos == IMMEDIATE_POSITION) {
+ logger.report();
+ } else {
+ ListBuffer loggers = loggersQueue.get(currentPos);
+ if (loggers == null) {
+ loggersQueue.put(currentPos, loggers = ListBuffer.lb());
+ }
+ loggers.append(logger);
+ }
}
+ /**Invoke all {@link LintLogger}s that were associated with the provided {@code pos}.
+ */
public void flush(DiagnosticPosition pos) {
ListBuffer loggers = loggersQueue.get(pos);
if (loggers != null) {
@@ -80,16 +99,46 @@
}
}
- public DeferredLintHandler setPos(DiagnosticPosition currentPos) {
+ /**Sets the current position to the provided {@code currentPos}. {@link LintLogger}s
+ * passed to subsequent invocations of {@link #report(LintLogger) } will be associated
+ * with the given position.
+ */
+ public DiagnosticPosition setPos(DiagnosticPosition currentPos) {
+ DiagnosticPosition prevPosition = this.currentPos;
this.currentPos = currentPos;
- loggersQueue.put(currentPos, ListBuffer.lb());
- return this;
+ return prevPosition;
+ }
+
+ /**{@link LintLogger}s passed to subsequent invocations of
+ * {@link #report(LintLogger) } will be invoked immediately.
+ */
+ public DiagnosticPosition immediate() {
+ return setPos(IMMEDIATE_POSITION);
}
- public static final DeferredLintHandler immediateHandler = new DeferredLintHandler() {
+ private static final DiagnosticPosition IMMEDIATE_POSITION = new DiagnosticPosition() {
+ @Override
+ public JCTree getTree() {
+ Assert.error();
+ return null;
+ }
+
@Override
- public void report(LintLogger logger) {
- logger.report();
+ public int getStartPosition() {
+ Assert.error();
+ return -1;
+ }
+
+ @Override
+ public int getPreferredPosition() {
+ Assert.error();
+ return -1;
+ }
+
+ @Override
+ public int getEndPosition(EndPosTable endPosTable) {
+ Assert.error();
+ return -1;
}
};
}
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/javac/code/Flags.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Flags.java Tue Sep 17 08:21:11 2013 -0700
@@ -97,7 +97,6 @@
public static final int MANDATED = 1<<15;
public static final int StandardFlags = 0x0fff;
- public static final int ModifierFlags = StandardFlags & ~INTERFACE;
// Because the following access flags are overloaded with other
// bit positions, we translate them when reading and writing class
@@ -266,6 +265,11 @@
*/
public static final long THROWS = 1L<<47;
+ /**
+ * Flag that marks potentially ambiguous overloads
+ */
+ public static final long POTENTIALLY_AMBIGUOUS = 1L<<48;
+
/** Modifier masks.
*/
public static final int
@@ -282,7 +286,9 @@
SYNCHRONIZED | FINAL | STRICTFP;
public static final long
ExtendedStandardFlags = (long)StandardFlags | DEFAULT,
+ ModifierFlags = ((long)StandardFlags & ~INTERFACE) | DEFAULT,
InterfaceMethodMask = ABSTRACT | STATIC | PUBLIC | STRICTFP | DEFAULT,
+ AnnotationTypeElementMask = FINAL | ABSTRACT | PUBLIC | STRICTFP,
LocalVarFlags = FINAL | PARAMETER;
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/javac/code/Lint.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Lint.java Tue Sep 17 08:21:11 2013 -0700
@@ -33,9 +33,6 @@
import com.sun.tools.javac.util.Options;
import com.sun.tools.javac.util.Pair;
-import static com.sun.tools.javac.code.Flags.*;
-
-
/**
* A class for handling -Xlint suboptions and @SuppresssWarnings.
*
@@ -81,7 +78,6 @@
return l;
}
-
private final AugmentVisitor augmentor;
private final EnumSet values;
@@ -90,7 +86,6 @@
private static final Map map =
new java.util.concurrent.ConcurrentHashMap(20);
-
protected Lint(Context context) {
// initialize values according to the lint options
Options options = Options.instance(context);
@@ -175,6 +170,11 @@
OPTIONS("options"),
/**
+ * Warn about issues regarding method overloads.
+ */
+ OVERLOADS("overloads"),
+
+ /**
* Warn about issues regarding method overrides.
*/
OVERRIDES("overrides"),
diff -r dd285b441e44 -r 669e1adcbf50 langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Sep 12 11:09:20 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue Sep 17 08:21:11 2013 -0700
@@ -46,6 +46,7 @@
import static com.sun.tools.javac.code.TypeTag.CLASS;
import static com.sun.tools.javac.code.TypeTag.FORALL;
import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
+import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
/** Root class for Java symbols. It contains subclasses
* for specific sorts of symbols, such as variables, methods and operators,
@@ -98,9 +99,9 @@
//
/** The attributes of this symbol are contained in this
- * Annotations. The Annotations instance is NOT immutable.
+ * SymbolMetadata. The SymbolMetadata instance is NOT immutable.
*/
- protected Annotations annotations;
+ protected SymbolMetadata annotations;
/** An accessor method for the attributes of this symbol.
* Attributes of class symbols should be accessed through the accessor
@@ -217,19 +218,19 @@
public void setTypeAttributes(List a) {
if (annotations != null || a.nonEmpty()) {
if (annotations == null)
- annotations = new Annotations(this);
+ annotations = new SymbolMetadata(this);
annotations.setTypeAttributes(a);
}
}
- private Annotations initedAnnos() {
+ private SymbolMetadata initedAnnos() {
if (annotations == null)
- annotations = new Annotations(this);
+ annotations = new SymbolMetadata(this);
return annotations;
}
/** This method is intended for debugging only. */
- public Annotations getAnnotations() {
+ public SymbolMetadata getAnnotations() {
return annotations;
}
@@ -852,7 +853,7 @@
private void mergeAttributes() {
if (annotations == null &&
package_info.annotations != null) {
- annotations = new Annotations(this);
+ annotations = new SymbolMetadata(this);
annotations.setAttributes(package_info.annotations);
}
}
@@ -1167,11 +1168,11 @@
public void setLazyConstValue(final Env env,
final Attr attr,
- final JCTree.JCExpression initializer)
+ final JCVariableDecl variable)
{
setData(new Callable