summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-24 21:35:42 +0100
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-07-24 21:35:42 +0100
commitba0bd13ee41b84d205a3693a4c24249a2ce713e2 (patch)
tree46bb90f674798fa4e8d123e0603d0f2b8ce33c88
parenta5c4ed149e888f0126b7c9e686b6f51bc4168e5b (diff)
parent7791802d9b43c2067b566bf81667096ed91decb8 (diff)
downloadandroid_external_doclava-ba0bd13ee41b84d205a3693a4c24249a2ce713e2.tar.gz
android_external_doclava-ba0bd13ee41b84d205a3693a4c24249a2ce713e2.tar.bz2
android_external_doclava-ba0bd13ee41b84d205a3693a4c24249a2ce713e2.zip
Merge tag 'android-4.3_r2.1' into cm-10.2cm-10.2.1cm-10.2.0cm-10.2-M1stable/cm-10.2cm-10.2
Android 4.3 release 2.1
-rw-r--r--android-changes.txt6
-rw-r--r--res/assets/templates/jd_lists.cs8
-rw-r--r--res/assets/templates/lists.cs2
-rw-r--r--res/assets/templates/macros.cs30
-rw-r--r--src/com/google/doclava/ClassInfo.java25
-rw-r--r--src/com/google/doclava/ClearPage.java17
-rw-r--r--src/com/google/doclava/DocFile.java12
-rw-r--r--src/com/google/doclava/DocInfo.java4
-rw-r--r--src/com/google/doclava/Doclava.java112
-rw-r--r--src/com/google/doclava/Errors.java9
-rw-r--r--src/com/google/doclava/FieldInfo.java10
-rw-r--r--src/com/google/doclava/MethodInfo.java31
-rw-r--r--src/com/google/doclava/SampleCode.java4
13 files changed, 229 insertions, 41 deletions
diff --git a/android-changes.txt b/android-changes.txt
index 025bcd8..a62b071 100644
--- a/android-changes.txt
+++ b/android-changes.txt
@@ -1,6 +1,12 @@
Changes in this version relative to http://doclava.googlecode.com/
------------------------------------------------------------------
+* Added a new command line option -showAnnotation <@interface classname>,
+ which takes in a fully qualified annotation classname. The specified
+ annotation will override any @hide annotations within the javadoc. To
+ specify multiple annotations to override @hide, use multiple
+ -showAnnotation options.
+
* Modified the Java stub generator code to write out annotations for
methods and fields as well, not just classes. This meant adding a
writeAnnotations call to writeMethod and to writeField
diff --git a/res/assets/templates/jd_lists.cs b/res/assets/templates/jd_lists.cs
new file mode 100644
index 0000000..e205032
--- /dev/null
+++ b/res/assets/templates/jd_lists.cs
@@ -0,0 +1,8 @@
+var JD_DATA = [
+<?cs
+each:page = docs.pages
+?>
+ { label:"<?cs var:page.label ?>", link:"<?cs var:page.link ?>",
+ tags:[<?cs var:page.tags ?>], type:"<?cs var:page.type ?>" }<?cs if:!last(page) ?>,<?cs /if ?><?cs
+/each ?>
+];
diff --git a/res/assets/templates/lists.cs b/res/assets/templates/lists.cs
index 0af32b2..dcbf8e5 100644
--- a/res/assets/templates/lists.cs
+++ b/res/assets/templates/lists.cs
@@ -1,5 +1,5 @@
var DATA = [
<?cs each:page = docs.pages
-?> { id:<?cs var: page.id ?>, label:"<?cs var:page.label ?>", link:"<?cs var:page.link ?>", type:"<?cs var:page.type ?>" }<?cs if:!last(page) ?>,<?cs /if ?>
+?> { id:<?cs var: page.id ?>, label:"<?cs var:page.label ?>", link:"<?cs var:page.link ?>", type:"<?cs var:page.type ?>", deprecated:"<?cs var:page.deprecated ?>" }<?cs if:!last(page) ?>,<?cs /if ?>
<?cs /each ?>
];
diff --git a/res/assets/templates/macros.cs b/res/assets/templates/macros.cs
index bc6e46d..867abcd 100644
--- a/res/assets/templates/macros.cs
+++ b/res/assets/templates/macros.cs
@@ -101,23 +101,31 @@ def:tag_list(tags) ?><?cs
<?cs # Show the short-form description of something. These come from shortDescr and deprecated ?><?cs
def:short_descr(obj) ?><?cs
- if:subcount(obj.deprecated) ?>
- <em>This <?cs var:obj.kind ?> was deprecated
- in API level <?cs var:obj.deprecatedsince ?>.
- <?cs call:tag_list(obj.deprecated) ?></em><?cs
+ if:subcount(obj.deprecated) ?><em><?cs
+ if:obj.deprecatedsince ?>
+ This <?cs var:obj.kind ?> was deprecated
+ in API level <?cs var:obj.deprecatedsince ?>.<?cs
+ else ?>
+ This <?cs var:obj.kind ?> is deprecated.<?cs
+ /if ?>
+ <?cs call:tag_list(obj.deprecated) ?></em><?cs
else ?><?cs call:tag_list(obj.shortDescr) ?><?cs
/if ?><?cs
/def ?>
<?cs # Show the red box with the deprecated warning ?><?cs
-def:deprecated_warning(obj) ?><?cs
+def:deprecated_warning(obj) ?><?cs
if:subcount(obj.deprecated) ?><p>
- <p class="caution">
- <strong>This <?cs var:obj.kind ?> was deprecated
- in API level <?cs var:obj.deprecatedsince ?></strong>.<br/> <?cs
- call:tag_list(obj.deprecated) ?>
- </p><?cs
- /if ?><?cs
+ <p class="caution"><strong><?cs
+ if:obj.deprecatedsince ?>
+ This <?cs var:obj.kind ?> was deprecated
+ in API level <?cs var:obj.deprecatedsince ?>.<?cs
+ else ?>
+ This <?cs var:obj.kind ?> is deprecated.<?cs
+ /if ?></strong><br/>
+ <?cs call:tag_list(obj.deprecated) ?>
+ </p><?cs
+ /if ?><?cs
/def ?>
<?cs # print the See Also: section ?><?cs
diff --git a/src/com/google/doclava/ClassInfo.java b/src/com/google/doclava/ClassInfo.java
index 927b240..d3ed434 100644
--- a/src/com/google/doclava/ClassInfo.java
+++ b/src/com/google/doclava/ClassInfo.java
@@ -247,6 +247,10 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
return mIsFinal;
}
+ public boolean isEffectivelyFinal() {
+ return mIsFinal || mApiCheckConstructors.isEmpty();
+ }
+
public boolean isIncluded() {
return mIsIncluded;
}
@@ -1694,10 +1698,25 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
+ " changed abstract qualifier");
}
- if (mIsFinal != cl.mIsFinal) {
+ if (!mIsFinal && cl.mIsFinal) {
+ /*
+ * It is safe to make a class final if it did not previously have any public
+ * constructors because it was impossible for an application to create a subclass.
+ */
+ if (mApiCheckConstructors.isEmpty()) {
+ consistent = false;
+ Errors.error(Errors.ADDED_FINAL_UNINSTANTIABLE, cl.position(),
+ "Class " + cl.qualifiedName() + " added final qualifier but "
+ + "was previously uninstantiable and therefore could not be subclassed");
+ } else {
+ consistent = false;
+ Errors.error(Errors.ADDED_FINAL, cl.position(), "Class " + cl.qualifiedName()
+ + " added final qualifier");
+ }
+ } else if (mIsFinal && !cl.mIsFinal) {
consistent = false;
- Errors.error(Errors.CHANGED_FINAL, cl.position(), "Class " + cl.qualifiedName()
- + " changed final qualifier");
+ Errors.error(Errors.REMOVED_FINAL, cl.position(), "Class " + cl.qualifiedName()
+ + " removed final qualifier");
}
if (mIsStatic != cl.mIsStatic) {
diff --git a/src/com/google/doclava/ClearPage.java b/src/com/google/doclava/ClearPage.java
index 9c512c9..ed1f069 100644
--- a/src/com/google/doclava/ClearPage.java
+++ b/src/com/google/doclava/ClearPage.java
@@ -28,6 +28,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Arrays;
public class ClearPage {
/*
@@ -156,7 +157,7 @@ public class ClearPage {
}
}
- public static void copyFile(File from, String toPath) {
+ public static void copyFile(boolean allowExcepted, File from, String toPath) {
File to = new File(outputDir + "/" + toPath);
FileInputStream in;
FileOutputStream out;
@@ -176,7 +177,7 @@ public class ClearPage {
System.err.println(from.getAbsolutePath() + ": Error opening file");
return;
}
- if (!isValidContentType(toPath, DROIDDOC_VALID_CONTENT_TYPES)) {
+ if (!isValidContentType(allowExcepted, toPath, DROIDDOC_VALID_CONTENT_TYPES)) {
Errors.error(Errors.INVALID_CONTENT_TYPE, null, "Failed to process " + from
+ ": Invalid file type. Please move the file to frameworks/base/docs/image_sources/... or docs/downloads/...");
return;
@@ -220,9 +221,17 @@ public class ClearPage {
}
}
- public static String[] DROIDDOC_VALID_CONTENT_TYPES = {".txt", ".css", ".js", ".html", ".ico", ".png", ".jpg", ".gif", ".svg", ".webm", ".ogv","mp4", ".java", ".xml", ".aidl", ".rs",".zip", ".yaml", ".pdf"};
+ public static ArrayList<String> DROIDDOC_VALID_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(".txt", ".css",
+ ".js", ".html", ".ico", ".png", ".jpg", ".gif", ".svg", ".webm", ".ogv","mp4", ".java", ".xml", ".aidl", ".rs",".zip", ".yaml"));
+ /* Setting excepted types to allow everything. Leaving it this way in in case we want to explicitly
+ * specify file types later. This adds unneeded checking though since it lets everything through
+ */
+ public static ArrayList<String> DROIDDOC_EXCEPTED_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(""));
- public static boolean isValidContentType(String s, String[] list) {
+ public static boolean isValidContentType(boolean allowExcepted, String s, ArrayList<String> list) {
+ if(allowExcepted){
+ list.addAll(DROIDDOC_EXCEPTED_CONTENT_TYPES);
+ }
for (String t : list) {
if (s.endsWith(t)) {
return true;
diff --git a/src/com/google/doclava/DocFile.java b/src/com/google/doclava/DocFile.java
index da829a4..9e56235 100644
--- a/src/com/google/doclava/DocFile.java
+++ b/src/com/google/doclava/DocFile.java
@@ -24,8 +24,8 @@ import java.util.regex.Matcher;
public class DocFile {
- private static final Pattern LINE = Pattern.compile("(.*)[\r]?\n", Pattern.MULTILINE);
- private static final Pattern PROP = Pattern.compile("([^=]+)=(.*)");
+ public static final Pattern LINE = Pattern.compile("(.*)[\r]?\n", Pattern.MULTILINE);
+ public static final Pattern PROP = Pattern.compile("([^=]+)=(.*)");
public static String readFile(String filename) {
try {
@@ -164,6 +164,14 @@ public class DocFile {
} else if ((filename.indexOf("tools") == 0) || (filename.indexOf("sdk") == 0)) {
hdf.setValue("tools", "true");
fromTemplate = hdf.getValue("page.template", "");
+ } else if (filename.indexOf("devices") == 0) {
+ hdf.setValue("devices", "true");
+ } else if (filename.indexOf("source") == 0) {
+ hdf.setValue("source", "true");
+ } else if (filename.indexOf("accessories") == 0) {
+ hdf.setValue("accessories", "true");
+ } else if (filename.indexOf("compatibility") == 0) {
+ hdf.setValue("compatibility", "true");
}
if (fromTemplate.equals("sdk")) {
ClearPage.write(hdf, "sdkpage.cs", outfile);
diff --git a/src/com/google/doclava/DocInfo.java b/src/com/google/doclava/DocInfo.java
index 935bbda..714beb8 100644
--- a/src/com/google/doclava/DocInfo.java
+++ b/src/com/google/doclava/DocInfo.java
@@ -93,6 +93,10 @@ public abstract class DocInfo {
return mDeprecatedSince;
}
+ public boolean isDeprecated() {
+ return mDeprecatedSince != null ? true : false;
+ }
+
public final void addFederatedReference(FederatedSite source) {
mFederatedReferences.add(source);
}
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 4435018..3bcc689 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -27,6 +27,7 @@ import com.sun.javadoc.*;
import java.util.*;
import java.util.jar.JarFile;
+import java.util.regex.Matcher;
import java.io.*;
import java.lang.reflect.Proxy;
import java.lang.reflect.Array;
@@ -90,6 +91,7 @@ public class Doclava {
private static boolean gmsRef = false;
private static boolean gcmRef = false;
+ private static boolean sac = false;
public static boolean checkLevel(int level) {
return (showLevel & level) == level;
@@ -224,6 +226,8 @@ public class Doclava {
apiFile = a[1];
} else if (a[0].equals("-nodocs")) {
generateDocs = false;
+ } else if (a[0].equals("-nodefaultassets")) {
+ includeDefaultAssets = false;
} else if (a[0].equals("-parsecomments")) {
parseComments = true;
} else if (a[0].equals("-since")) {
@@ -583,6 +587,9 @@ public class Doclava {
if (option.equals("-nodocs")) {
return 1;
}
+ if (option.equals("-nodefaultassets")) {
+ return 1;
+ }
if (option.equals("-parsecomments")) {
return 1;
}
@@ -735,8 +742,11 @@ public class Doclava {
} else if (len > 3 && ".jd".equals(templ.substring(len - 3))) {
String filename = templ.substring(0, len - 3) + htmlExtension;
DocFile.writePage(f.getAbsolutePath(), relative, filename);
- } else {
- ClearPage.copyFile(f, templ);
+ } else if(!f.getName().equals(".DS_Store")){
+ Data data = makeHDF();
+ String hdfValue = data.getValue("sac") == null ? "" : data.getValue("sac");
+ boolean allowExcepted = hdfValue.equals("true") ? true : false;
+ ClearPage.copyFile(allowExcepted, f, templ);
}
} else if (f.isDirectory()) {
writeDirectory(f, relative + f.getName() + "/", js);
@@ -788,7 +798,11 @@ public class Doclava {
ClearPage.write(timedata, "timestamp.cs", "timestamp.js");
}
+ /** Go through the docs and generate meta-data about each
+ page to use in search suggestions */
public static void writeLists() {
+
+ // Write the lists for API references
Data data = makeHDF();
ClassInfo[] classes = Converter.rootClasses();
@@ -819,15 +833,107 @@ public class Doclava {
PackageInfo pkg = (PackageInfo) o;
data.setValue("docs.pages." + i + ".link", pkg.htmlPage());
data.setValue("docs.pages." + i + ".type", "package");
+ data.setValue("docs.pages." + i + ".deprecated", pkg.isDeprecated() ? "true" : "false");
} else if (o instanceof ClassInfo) {
ClassInfo cl = (ClassInfo) o;
data.setValue("docs.pages." + i + ".link", cl.htmlPage());
data.setValue("docs.pages." + i + ".type", "class");
+ data.setValue("docs.pages." + i + ".deprecated", cl.isDeprecated() ? "true" : "false");
}
i++;
}
-
ClearPage.write(data, "lists.cs", javadocDir + "lists.js");
+
+
+ // Write the lists for JD documents (if there are HTML directories to process)
+ if (inputPathHtmlDirs.size() > 0) {
+ Data jddata = makeHDF();
+ Iterator counter = new Iterator();
+ for (String htmlDir : inputPathHtmlDirs) {
+ File dir = new File(htmlDir);
+ if (!dir.isDirectory()) {
+ continue;
+ }
+ writeJdDirList(dir, jddata, counter);
+ }
+ ClearPage.write(jddata, "jd_lists.cs", javadocDir + "jd_lists.js");
+ }
+ }
+
+ private static class Iterator {
+ int i = 0;
+ }
+
+ /** Write meta-data for a JD file, used for search suggestions */
+ private static void writeJdDirList(File dir, Data data, Iterator counter) {
+ File[] files = dir.listFiles();
+ int i, count = files.length;
+ // Loop all files in given directory
+ for (i = 0; i < count; i++) {
+ File f = files[i];
+ if (f.isFile()) {
+ String filePath = f.getAbsolutePath();
+ String templ = f.getName();
+ int len = templ.length();
+ // If it's a .jd file we want to process
+ if (len > 3 && ".jd".equals(templ.substring(len - 3))) {
+ // remove the directories below the site root
+ String webPath = filePath.substring(filePath.indexOf("docs/html/") + 10, filePath.length());
+ // replace .jd with .html
+ webPath = webPath.substring(0, webPath.length() - 3) + htmlExtension;
+ // Parse the .jd file for properties data at top of page
+ Data hdf = Doclava.makeHDF();
+ String filedata = DocFile.readFile(filePath);
+ Matcher lines = DocFile.LINE.matcher(filedata);
+ String line = null;
+ // Get each line to add the key-value to hdf
+ while (lines.find()) {
+ line = lines.group(1);
+ if (line.length() > 0) {
+ // Stop when we hit the body
+ if (line.equals("@jd:body")) {
+ break;
+ }
+ Matcher prop = DocFile.PROP.matcher(line);
+ if (prop.matches()) {
+ String key = prop.group(1);
+ String value = prop.group(2);
+ hdf.setValue(key, value);
+ } else {
+ break;
+ }
+ }
+ } // done gathering page properties
+
+ // Insert the goods into HDF data (title, link, tags, type)
+ String title = hdf.getValue("page.title", "");
+ title = title.replaceAll("\"", "'");
+ // if there's a <span> in the title, get rid of it
+ if (title.indexOf("<span") != -1) {
+ String[] splitTitle = title.split("<span(.*?)</span>");
+ title = splitTitle[0];
+ for (int j = 1; j < splitTitle.length; j++) {
+ title.concat(splitTitle[j]);
+ }
+ }
+ String tags = hdf.getValue("page.tags", "");
+ String dirName = (webPath.indexOf("/") != -1)
+ ? webPath.substring(0, webPath.indexOf("/")) : "";
+
+ if (!"".equals(title) &&
+ !"intl".equals(dirName) &&
+ !hdf.getBooleanValue("excludeFromSuggestions")) {
+ data.setValue("docs.pages." + counter.i + ".label", title);
+ data.setValue("docs.pages." + counter.i + ".link", webPath);
+ data.setValue("docs.pages." + counter.i + ".tags", tags);
+ data.setValue("docs.pages." + counter.i + ".type", dirName);
+ counter.i++;
+ }
+ }
+ } else if (f.isDirectory()) {
+ writeJdDirList(f, data, counter);
+ }
+ }
}
public static void cantStripThis(ClassInfo cl, HashSet<ClassInfo> notStrippable) {
diff --git a/src/com/google/doclava/Errors.java b/src/com/google/doclava/Errors.java
index 2fc0f0c..e890aa4 100644
--- a/src/com/google/doclava/Errors.java
+++ b/src/com/google/doclava/Errors.java
@@ -134,7 +134,7 @@ public class Errors {
public static Error REMOVED_FIELD = new Error(10, WARNING);
public static Error REMOVED_INTERFACE = new Error(11, WARNING);
public static Error CHANGED_STATIC = new Error(12, WARNING);
- public static Error CHANGED_FINAL = new Error(13, WARNING);
+ public static Error ADDED_FINAL = new Error(13, WARNING);
public static Error CHANGED_TRANSIENT = new Error(14, WARNING);
public static Error CHANGED_VOLATILE = new Error(15, WARNING);
public static Error CHANGED_TYPE = new Error(16, WARNING);
@@ -147,6 +147,8 @@ public class Errors {
public static Error CHANGED_CLASS = new Error(23, WARNING);
public static Error CHANGED_DEPRECATED = new Error(24, WARNING);
public static Error CHANGED_SYNCHRONIZED = new Error(25, ERROR);
+ public static Error ADDED_FINAL_UNINSTANTIABLE = new Error(26, WARNING);
+ public static Error REMOVED_FINAL = new Error(27, WARNING);
// Errors in javadoc generation
public static final Error UNRESOLVED_LINK = new Error(101, WARNING);
@@ -175,10 +177,11 @@ public class Errors {
UNAVAILABLE_SYMBOL, HIDDEN_SUPERCLASS, DEPRECATED, DEPRECATION_MISMATCH, MISSING_COMMENT,
IO_ERROR, NO_SINCE_DATA, NO_FEDERATION_DATA, PARSE_ERROR, ADDED_PACKAGE, ADDED_CLASS,
ADDED_METHOD, ADDED_FIELD, ADDED_INTERFACE, REMOVED_PACKAGE, REMOVED_CLASS,
- REMOVED_METHOD, REMOVED_FIELD, REMOVED_INTERFACE, CHANGED_STATIC, CHANGED_FINAL,
+ REMOVED_METHOD, REMOVED_FIELD, REMOVED_INTERFACE, CHANGED_STATIC, ADDED_FINAL,
CHANGED_TRANSIENT, CHANGED_VOLATILE, CHANGED_TYPE, CHANGED_VALUE, CHANGED_SUPERCLASS,
CHANGED_SCOPE, CHANGED_ABSTRACT, CHANGED_THROWS, CHANGED_NATIVE, CHANGED_CLASS,
- CHANGED_DEPRECATED, CHANGED_SYNCHRONIZED, BROKEN_SINCE_FILE, INVALID_CONTENT_TYPE};
+ CHANGED_DEPRECATED, CHANGED_SYNCHRONIZED, ADDED_FINAL_UNINSTANTIABLE, REMOVED_FINAL,
+ BROKEN_SINCE_FILE, INVALID_CONTENT_TYPE};
public static boolean setErrorLevel(int code, int level) {
for (Error e : ERRORS) {
diff --git a/src/com/google/doclava/FieldInfo.java b/src/com/google/doclava/FieldInfo.java
index 0200b95..09391a6 100644
--- a/src/com/google/doclava/FieldInfo.java
+++ b/src/com/google/doclava/FieldInfo.java
@@ -438,9 +438,13 @@ public class FieldInfo extends MemberInfo {
consistent = false;
}
- if (mIsFinal != fInfo.mIsFinal) {
- Errors.error(Errors.CHANGED_FINAL, fInfo.position(), "Field " + fInfo.qualifiedName()
- + " has changed 'final' qualifier");
+ if (!mIsFinal && fInfo.mIsFinal) {
+ Errors.error(Errors.ADDED_FINAL, fInfo.position(), "Field " + fInfo.qualifiedName()
+ + " has added 'final' qualifier");
+ consistent = false;
+ } else if (mIsFinal && !fInfo.mIsFinal) {
+ Errors.error(Errors.REMOVED_FINAL, fInfo.position(), "Field " + fInfo.qualifiedName()
+ + " has removed 'final' qualifier");
consistent = false;
}
diff --git a/src/com/google/doclava/MethodInfo.java b/src/com/google/doclava/MethodInfo.java
index db5e0cf..fc8959f 100644
--- a/src/com/google/doclava/MethodInfo.java
+++ b/src/com/google/doclava/MethodInfo.java
@@ -624,6 +624,17 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv
return mIsVarargs;
}
+ public boolean isEffectivelyFinal() {
+ if (mIsFinal) {
+ return true;
+ }
+ ClassInfo containingClass = containingClass();
+ if (containingClass != null && containingClass.isEffectivelyFinal()) {
+ return true;
+ }
+ return false;
+ }
+
@Override
public String toString() {
return this.name();
@@ -729,17 +740,19 @@ public class MethodInfo extends MemberInfo implements AbstractMethodInfo, Resolv
+ " has changed 'native' qualifier");
}
- if (mIsFinal != mInfo.mIsFinal) {
- // Compiler-generated methods vary in their 'final' qual between versions of
+ if (!mIsStatic) {
+ // Compiler-generated methods vary in their 'final' qualifier between versions of
// the compiler, so this check needs to be quite narrow. A change in 'final'
// status of a method is only relevant if (a) the method is not declared 'static'
- // and (b) the method's class is not itself 'final'.
- if (!mIsStatic) {
- if ((containingClass() == null) || (!containingClass().isFinal())) {
- consistent = false;
- Errors.error(Errors.CHANGED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName()
- + " has changed 'final' qualifier");
- }
+ // and (b) the method is not already inferred to be 'final' by virtue of its class.
+ if (!isEffectivelyFinal() && mInfo.isEffectivelyFinal()) {
+ consistent = false;
+ Errors.error(Errors.ADDED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName()
+ + " has added 'final' qualifier");
+ } else if (isEffectivelyFinal() && !mInfo.isEffectivelyFinal()) {
+ consistent = false;
+ Errors.error(Errors.REMOVED_FINAL, mInfo.position(), "Method " + mInfo.qualifiedName()
+ + " has removed 'final' qualifier");
}
}
diff --git a/src/com/google/doclava/SampleCode.java b/src/com/google/doclava/SampleCode.java
index 0776af1..65d44b5 100644
--- a/src/com/google/doclava/SampleCode.java
+++ b/src/com/google/doclava/SampleCode.java
@@ -84,13 +84,13 @@ public class SampleCode {
if (inList(out, IMAGES)) {
// copied directly
- ClearPage.copyFile(f, out);
+ ClearPage.copyFile(false, f, out);
writeImagePage(f, convertExtension(out, Doclava.htmlExtension), subdir);
files.add(name);
}
if (inList(out, TEMPLATED)) {
// copied and goes through the template
- ClearPage.copyFile(f, out);
+ ClearPage.copyFile(false, f, out);
writePage(f, convertExtension(out, Doclava.htmlExtension), subdir);
files.add(name);
}