Merge "Make broken @see tags errors in doclava outside frameworks."
am: a3691b285b
Change-Id: Ib4d4c0c3658b970d70492f96f90dbed9ff48a87a
diff --git a/.gitignore b/.gitignore
index 3770f89..17d7fbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
.classpath
.project
.settings
+*.iml
diff --git a/res/assets/templates-sdk/class.cs b/res/assets/templates-sdk/class.cs
index 66134f8..d014edd 100644
--- a/res/assets/templates-sdk/class.cs
+++ b/res/assets/templates-sdk/class.cs
@@ -14,7 +14,13 @@
<?cs set:count = #1 ?>
<?cs each:method = methods ?>
<?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
- <tr class="api apilevel-<?cs var:method.since ?>" >
+ <tr class="api apilevel-<?cs var:method.since ?>"<?cs
+ if:method.since ?>
+ data-version-added="<?cs var:method.since ?>"<?cs
+ /if ?><?cs
+ if:method.deprecatedsince
+ ?> data-version-deprecated="<?cs var:method.deprecatedsince ?>"<?cs
+ /if ?> >
<?cs # leave out this cell if there is no return type = if constructors ?>
<?cs if:subcount(method.returnType) ?>
<td><code>
@@ -45,7 +51,13 @@
?><?cs def:write_field_summary(fields, included) ?>
<?cs set:count = #1 ?>
<?cs each:field=fields ?>
- <tr class="api apilevel-<?cs var:field.since ?>" >
+ <tr class="api apilevel-<?cs var:field.since ?>"<?cs
+ if:field.since ?>
+ data-version-added="<?cs var:field.since ?>"<?cs
+ /if ?><?cs
+ if:field.deprecatedsince
+ ?> data-version-deprecated="<?cs var:field.deprecatedsince ?>"<?cs
+ /if ?> >
<td><code>
<?cs var:field.scope ?>
<?cs var:field.static ?>
@@ -66,7 +78,13 @@
?><?cs def:write_constant_summary(fields, included) ?>
<?cs set:count = #1 ?>
<?cs each:field=fields ?>
- <tr class="api apilevel-<?cs var:field.since ?>" >
+ <tr class="api apilevel-<?cs var:field.since ?>"<?cs
+ if:field.since ?>
+ data-version-added="<?cs var:field.since ?>"<?cs
+ /if ?><?cs
+ if:field.deprecatedsince
+ ?> data-version-deprecated="<?cs var:field.deprecatedsince ?>"<?cs
+ /if ?> >
<td><code><?cs call:type_link(field.type) ?></code></td>
<td width="100%">
<code><?cs call:cond_link(field.name, toroot, field.href, included) ?></code>
@@ -83,7 +101,13 @@
?><?cs def:write_attr_summary(attrs, included) ?>
<?cs set:count = #1 ?>
<?cs each:attr=attrs ?>
- <tr class="api apilevel-<?cs var:attr.since ?>" >
+ <tr class="api apilevel-<?cs var:attr.since ?>"<?cs
+ if:attr.since ?>
+ data-version-added="<?cs var:attr.since ?>"<?cs
+ /if ?><?cs
+ if:attr.deprecatedsince
+ ?> data-version-deprecated="<?cs var:attr.deprecatedsince ?>"<?cs
+ /if ?> >
<td><?cs if:included ?><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs /if
?><code><?cs var:attr.name ?></code><?cs if:included ?></a><?cs /if ?></td>
<td width="100%">
@@ -100,7 +124,13 @@
?><?cs def:write_inners_summary(classes) ?>
<?cs set:count = #1 ?>
<?cs each:cl=class.inners ?>
- <tr class="api apilevel-<?cs var:cl.since ?>" >
+ <tr class="api apilevel-<?cs var:cl.since ?>"<?cs
+ if:cl.since ?>
+ data-version-added="<?cs var:cl.since ?>"<?cs
+ /if ?><?cs
+ if:cl.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.deprecatedsince ?>"<?cs
+ /if ?> >
<td class="jd-typecol"><code>
<?cs var:cl.scope ?>
<?cs var:cl.static ?>
@@ -131,16 +161,22 @@
<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
<A NAME="<?cs var:field.anchor ?>"></A>
<?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
-<div class="api apilevel-<?cs var:field.since ?>">
+<div class="api apilevel-<?cs var:field.since ?>"<?cs
+ if:field.since ?>
+ data-version-added="<?cs var:field.since ?>"<?cs
+ /if ?><?cs
+ if:field.deprecatedsince
+ ?> data-version-deprecated="<?cs var:field.deprecatedsince ?>"<?cs
+ /if ?> >
<h3 class="api-name"><?cs var:field.name ?></h3>
<div class="api-level">
<?cs call:since_tags(field) ?>
<?cs call:federated_refs(field) ?>
</div>
<pre class="api-signature no-pretty-print">
-<?cs if:subcount(field.scope) ?><?cs var:field.scope
-?> <?cs /if ?><?cs if:subcount(field.static) ?><?cs var:field.static
-?> <?cs /if ?><?cs if:subcount(field.final) ?><?cs var:field.final
+<?cs if:string.length(field.scope) ?><?cs var:field.scope
+?> <?cs /if ?><?cs if:string.length(field.static) ?><?cs var:field.static
+?> <?cs /if ?><?cs if:string.length(field.final) ?><?cs var:field.final
?> <?cs /if ?><?cs if:subcount(field.type) ?><?cs call:type_link(field.type)
?> <?cs /if ?><?cs var:field.name ?></pre>
<?cs call:show_annotations_list(field) ?>
@@ -163,17 +199,23 @@
<?cs # the A tag in the next line must remain where it is, so that Eclipse can parse the docs ?>
<A NAME="<?cs var:method.anchor ?>"></A>
<?cs # The apilevel-N class MUST BE LAST in the sequence of class names ?>
-<div class="api apilevel-<?cs var:method.since ?>">
+<div class="api apilevel-<?cs var:method.since ?>"<?cs
+ if:method.since ?>
+ data-version-added="<?cs var:method.since ?>"<?cs
+ /if ?><?cs
+ if:method.deprecatedsince
+ ?> data-version-deprecated="<?cs var:method.deprecatedsince ?>"<?cs
+ /if ?>>
<h3 class="api-name"><?cs var:method.name ?></h3>
<div class="api-level">
<div><?cs call:since_tags(method) ?></div>
<?cs call:federated_refs(method) ?>
</div>
<pre class="api-signature no-pretty-print">
-<?cs if:subcount(method.scope) ?><?cs var:method.scope
-?> <?cs /if ?><?cs if:subcount(method.static) ?><?cs var:method.static
-?> <?cs /if ?><?cs if:subcount(method.final) ?><?cs var:method.final
-?> <?cs /if ?><?cs if:subcount(method.abstract) ?><?cs var:method.abstract
+<?cs if:string.length(method.scope) ?><?cs var:method.scope
+?> <?cs /if ?><?cs if:string.length(method.static) ?><?cs var:method.static
+?> <?cs /if ?><?cs if:string.length(method.final) ?><?cs var:method.final
+?> <?cs /if ?><?cs if:string.length(method.abstract) ?><?cs var:method.abstract
?> <?cs /if ?><?cs if:subcount(method.returnType) ?><?cs call:type_link(method.returnType)
?> <?cs /if ?><?cs var:method.name ?> (<?cs call:parameter_list(method.params, 1) ?>)</pre>
<?cs call:show_annotations_list(method) ?>
@@ -193,7 +235,7 @@
<p><b>Related methods:</b></p>
<ul class="nolist">
<?cs each:m=attr.methods ?>
- <li><a href="<?cs var:toroot ?><?cs var:m.href ?>"><?cs var:m.name ?></a></li>
+ <li><code><a href="<?cs var:toroot ?><?cs var:m.href ?>"><?cs var:m.name ?></a></code></li>
<?cs /each ?>
</ul>
<?cs /if ?>
@@ -209,11 +251,29 @@
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<?cs include:"body_tag.cs" ?>
+<div itemscope itemtype="http://developers.google.com/ReferenceObject">
+<!-- This DIV closes at the end of the BODY -->
+ <meta itemprop="name" content="<?cs var:class.qualifiedType.label ?>" />
+ <?cs if:(dac&&class.artifact)
+ ?><meta itemprop="path" content="<?cs
+ if:class.deprecatedsince ?>Deprecated<?cs
+ else ?>Support Library<?cs /if ?>" /><?cs
+ elif:(dac&&class.since)
+ ?><meta itemprop="path" content="<?cs
+ if:class.deprecatedsince ?>Deprecated<?cs
+ else ?>API level <?cs var:class.since ?><?cs /if ?>" /><?cs
+ /if ?>
<?cs include:"header.cs" ?>
<?cs # Includes api-info-block DIV at top of page. Standard Devsite uses right nav. ?>
<?cs if:dac ?><?cs include:"page_info.cs" ?><?cs /if ?>
<?cs # This DIV spans the entire document to provide scope for some scripts ?>
-<div class="api apilevel-<?cs var:class.since ?>" id="jd-content">
+<div class="api apilevel-<?cs var:class.since ?>" id="jd-content"<?cs
+ if:class.since ?>
+ data-version-added="<?cs var:class.since ?>"<?cs
+ /if ?><?cs
+ if:class.deprecatedsince
+ ?> data-version-deprecated="<?cs var:class.deprecatedsince ?>"<?cs
+ /if ?> >
<?cs # this next line must be exactly like this to be parsed by eclipse ?>
<!-- ======== START OF CLASS DATA ======== -->
<?cs
@@ -281,14 +341,11 @@
if:subcount(class.subclasses.direct) && !class.subclasses.hidden ?>
<table class="jd-sumtable jd-sumtable-subclasses">
<tr>
- <td style="border:none;margin:0;padding:0;"><?cs
- if:enable_javascript ?>
- <?cs call:expando_trigger("subclasses-direct", "closed") ?><span>Known Direct Subclasses</span>
- <?cs call:expandable_class_list("subclasses-direct", class.subclasses.direct, "list") ?><?cs
- else ?>
- <span>Known Direct Subclasses</span>
- <?cs call:expandable_class_list("subclasses-direct", class.subclasses.direct, "summary") ?><?cs
- /if ?>
+ <td>
+ <div class="expandable">
+ <span class="expand-control">Known direct subclasses</span>
+ <?cs call:expandable_class_list("subclasses-direct", class.subclasses.direct, "list") ?>
+ </div>
</td>
</tr>
</table>
@@ -296,14 +353,11 @@
<?cs if:subcount(class.subclasses.indirect) && !class.subclasses.hidden ?>
<table class="jd-sumtable jd-sumtable-subclasses">
<tr>
- <td colspan="2" style="border:none;margin:0;padding:0;"><?cs
- if:enable_javascript ?>
- <?cs call:expando_trigger("subclasses-indirect", "closed") ?><span>Known Indirect Subclasses</span>
- <?cs call:expandable_class_list("subclasses-indirect", class.subclasses.indirect, "list") ?><?cs
- else ?>
- <span>Known Indirect Subclasses</span>
- <?cs call:expandable_class_list("subclasses-indirect", class.subclasses.indirect, "summary") ?><?cs
- /if ?>
+ <td>
+ <div class="expandable">
+ <span class="expand-control">Known indirect subclasses</span>
+ <?cs call:expandable_class_list("subclasses-indirect", class.subclasses.indirect, "list") ?>
+ </div>
</td>
</tr>
</table><?cs
@@ -369,24 +423,22 @@
<tr><th><h3>Inherited XML attributes</h3></th></tr>
<?cs each:cl=class.inherited ?>
<?cs if:subcount(cl.attrs) ?>
-<tr class="api apilevel-<?cs var:cl.since ?>" >
-<td colspan="2"><?cs
- if:enable_javascript ?><?cs
- call:expando_trigger("inherited-attrs-"+cl.qualified, "closed") ?><?cs
- /if ?>From
-<?cs var:cl.kind ?>
-<code>
- <?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
-</code>
-<div id="inherited-attrs-<?cs var:cl.qualified ?>">
- <div id="inherited-attrs-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
+<tr class="api apilevel-<?cs var:cl.since ?>"<?cs
+ if:cl.since ?>
+ data-version-added="<?cs var:cl.since ?>"<?cs
+ /if ?><?cs
+ if:cl.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.deprecatedsince ?>"<?cs
+ /if ?> >
+<td colspan="2">
+ <div class="expandable jd-inherited-apis">
+ <span class="expand-control">From <?cs var:cl.kind ?>
+ <code><?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?></code>
+ </span>
+ <table class="responsive">
+ <?cs call:write_attr_summary(cl.attrs, cl.included) ?>
+ </table>
</div>
- <div id="inherited-attrs-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando">
- <?cs call:write_attr_summary(cl.attrs, cl.included) ?></table>
- </div>
-</div>
</td></tr>
<?cs /if ?>
<?cs /each ?>
@@ -400,7 +452,13 @@
<tr><th colspan="2"><h3>Enum values</h3></th></tr>
<?cs set:count = #1 ?>
<?cs each:field=class.enumConstants ?>
- <tr class="api apilevel-<?cs var:field.since ?>" >
+ <tr class="api apilevel-<?cs var:field.since ?>"<?cs
+ if:field.since ?>
+ data-version-added="<?cs var:field.since ?>"<?cs
+ /if ?><?cs
+ if:field.deprecatedsince
+ ?> data-version-deprecated="<?cs var:field.deprecatedsince ?>"<?cs
+ /if ?> >
<td><code><?cs call:type_link(field.type) ?></code> </td>
<td width="100%">
<code><?cs call:cond_link(field.name, toroot, field.href, cl.included) ?></code>
@@ -429,24 +487,22 @@
<tr><th><h3>Inherited constants</h3></th></tr>
<?cs each:cl=class.inherited ?>
<?cs if:subcount(cl.constants) ?>
- <tr class="api apilevel-<?cs var:cl.since ?>" >
- <td><?cs
- if:enable_javascript ?><?cs
- call:expando_trigger("inherited-constants-"+cl.qualified, "closed") ?><?cs
- /if ?>From
- <?cs var:cl.kind ?>
- <code>
- <?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
- </code>
- <div id="inherited-constants-<?cs var:cl.qualified ?>">
- <div id="inherited-constants-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
+ <tr class="api apilevel-<?cs var:cl.since ?>"<?cs
+ if:cl.since ?>
+ data-version-added="<?cs var:cl.since ?>"<?cs
+ /if ?><?cs
+ if:cl.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.deprecatedsince ?>"<?cs
+ /if ?> >
+ <td>
+ <div class="expandable jd-inherited-apis">
+ <span class="expand-control">From <?cs var:cl.kind ?>
+ <code><?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?></code>
+ </span>
+ <table class="responsive">
+ <?cs call:write_constant_summary(cl.constants, cl.included) ?>
+ </table>
</div>
- <div id="inherited-constants-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando responsive">
- <?cs call:write_constant_summary(cl.constants, cl.included) ?></table>
- </div>
- </div>
</td></tr>
<?cs /if ?>
<?cs /each ?>
@@ -466,28 +522,26 @@
<?cs if:inhfields ?>
<?cs # this next line must be exactly like this to be parsed by eclipse ?>
<!-- =========== FIELD SUMMARY =========== -->
-<table id="inhfields" class="properties inhtable">
+<table id="inhfields" class="responsive properties inhtable">
<tr><th><h3>Inherited fields</h3></th></tr>
<?cs each:cl=class.inherited ?>
<?cs if:subcount(cl.fields) ?>
- <tr class="api apilevel-<?cs var:cl.since ?>" >
- <td><?cs
- if:enable_javascript ?><?cs
- call:expando_trigger("inherited-fields-"+cl.qualified, "closed") ?><?cs
- /if ?>From
- <?cs var:cl.kind ?>
- <code>
- <?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?>
- </code>
- <div id="inherited-fields-<?cs var:cl.qualified ?>">
- <div id="inherited-fields-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
+ <tr class="api apilevel-<?cs var:cl.since ?>"<?cs
+ if:cl.since ?>
+ data-version-added="<?cs var:cl.since ?>"<?cs
+ /if ?><?cs
+ if:cl.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.deprecatedsince ?>"<?cs
+ /if ?> >
+ <td>
+ <div class="expandable jd-inherited-apis">
+ <span class="expand-control">From <?cs var:cl.kind ?>
+ <code><?cs call:cond_link(cl.qualified, toroot, cl.link, cl.included) ?></code>
+ </span>
+ <table class="responsive">
+ <?cs call:write_field_summary(cl.fields, cl.included) ?>
+ </table>
</div>
- <div id="inherited-fields-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando responsive">
- <?cs call:write_field_summary(cl.fields, cl.included) ?></table>
- </div>
- </div>
</td></tr>
<?cs /if ?>
<?cs /each ?>
@@ -534,35 +588,34 @@
<?cs if:inhmethods ?>
<?cs # this next line must be exactly like this to be parsed by eclipse ?>
<!-- ========== METHOD SUMMARY =========== -->
-<table id="inhmethods" class="methods inhtable">
+<table id="inhmethods" class="responsive methods inhtable">
<tr><th><h3>Inherited methods</h3></th></tr>
<?cs each:cl=class.inherited ?>
<?cs if:subcount(cl.methods) ?>
-<tr class="api apilevel-<?cs var:cl.since ?>" >
-<td colspan="2"><?cs
- if:enable_javascript ?><?cs
- call:expando_trigger("inherited-methods-"+cl.qualified, "closed") ?><?cs
- /if ?>From
-<?cs var:cl.kind ?>
-<code>
- <?cs if:cl.included ?>
- <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
- <?cs elif:cl.federated ?>
- <a href="<?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
- <?cs else ?>
- <?cs var:cl.qualified ?>
- <?cs /if ?>
-</code>
-<div id="inherited-methods-<?cs var:cl.qualified ?>">
- <div id="inherited-methods-<?cs var:cl.qualified ?>-list"
- class="jd-inheritedlinks">
- </div>
- <div id="inherited-methods-<?cs var:cl.qualified ?>-summary" style="display: none;">
- <table class="jd-sumtable-expando responsive">
+<tr class="api apilevel-<?cs var:cl.since ?>"<?cs
+ if:cl.since ?>
+ data-version-added="<?cs var:cl.since ?>"<?cs
+ /if ?><?cs
+ if:cl.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.deprecatedsince ?>"<?cs
+ /if ?> >
+<td colspan="2">
+ <div class="expandable jd-inherited-apis">
+ <span class="expand-control">From <?cs var:cl.kind ?>
+ <code>
+ <?cs if:cl.included ?>
+ <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
+ <?cs elif:cl.federated ?>
+ <a href="<?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
+ <?cs else ?>
+ <?cs var:cl.qualified ?>
+ <?cs /if ?>
+ </code>
+ </span>
+ <table class="responsive">
<?cs call:write_method_summary(cl.methods, cl.included) ?>
</table>
</div>
-</div>
</td></tr>
<?cs /if ?>
<?cs /each ?>
@@ -671,5 +724,6 @@
<?cs include:"footer.cs" ?>
<?cs include:"trailer.cs" ?>
<?cs /if ?>
+</div><!-- end devsite ReferenceObject -->
</body>
</html>
diff --git a/res/assets/templates-sdk/classes.cs b/res/assets/templates-sdk/classes.cs
index 007b57e..bc6b98d 100644
--- a/res/assets/templates-sdk/classes.cs
+++ b/res/assets/templates-sdk/classes.cs
@@ -24,7 +24,13 @@
<table>
<?cs set:cur_row = #0 ?>
<?cs each:cl = letter ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.since ?>" >
+ <tr class="api apilevel-<?cs var:cl.since ?>"<?cs
+ if:cl.since ?>
+ data-version-added="<?cs var:cl.since ?>"<?cs
+ /if ?><?cs
+ if:cl.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.deprecatedsince ?>"<?cs
+ /if ?> >
<td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
<td class="jd-descrcol" width="100%">
<?cs call:short_descr(cl) ?>
diff --git a/res/assets/templates-sdk/head_tag.cs b/res/assets/templates-sdk/head_tag.cs
index 1f24860..bb698b9 100644
--- a/res/assets/templates-sdk/head_tag.cs
+++ b/res/assets/templates-sdk/head_tag.cs
@@ -12,171 +12,28 @@
<?cs /if ?><?cs
# END if/else devsite ?></title><?cs
####### If building devsite, add some meta data needed for when generating the top nav ######### ?><?cs
-if:devsite ?>
- <meta name="top_category" value="<?cs
- if:ndk ?>ndk<?cs
- elif:(guide||develop||training||reference||tools||sdk||google||reference.gms||reference.gcm||samples) ?>develop<?cs
- elif:(topic||libraries||instantapps||perf||arc) ?>develop<?cs
- elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?>distribute<?cs
- elif:(design||vision||material||patterns||devices||designdownloads) ?>design<?cs
- elif:(about||versions||wear||tv||auto) ?>about<?cs
- elif:wearpreview ?>about<?cs
- elif:work ?>about<?cs
- elif:preview ?>preview<?cs
- else ?>none<?cs
- /if ?>" /><?cs set:dac_subcategory_set = #1 ?>
- <meta name="subcategory" value="<?cs
- if:ndk ?><?cs
- if:guide ?>guide<?cs
- elif:samples ?>samples<?cs
- if:(samplesDocPage&&!samplesProjectIndex) ?> samples-docpage<?cs /if ?><?cs
- elif:reference ?>reference<?cs
- elif:downloads ?>downloads<?cs
- else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
- else ?><?cs
- if:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
- if:guide ?>guide<?cs
- elif:training ?><?cs
- if:page.trainingcourse ?>trainingcourse<?cs
- else ?>training<?cs /if ?><?cs
- elif:reference ?>reference<?cs
- elif:samples ?>samples<?cs
- if:(samplesDocPage&&!samplesProjectIndex) ?> samples-docpage<?cs /if ?><?cs
- else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
- elif:(google||reference.gms||reference.gcm) ?>google<?cs
- elif:(topic||libraries||perf||arc) ?><?cs
- if:libraries ?>libraries<?cs
- elif:instantapps ?>instantapps<?cs
- elif:perf ?>perf<?cs
- elif:arc ?>arc<?cs
- else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
- elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?><?cs
- if:googleplay ?>googleplay<?cs
- elif:essentials ?>essentials<?cs
- elif:users ?>users<?cs
- elif:engage ?>engage<?cs
- elif:monetize ?>monetize<?cs
- elif:disttools ?>disttools<?cs
- elif:stories ?>stories<?cs
- elif:analyze ?>analyze<?cs
- else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
- elif:(about||versions||wear||tv||auto) ?>about<?cs
- elif:preview ?>preview<?cs
- elif:wearpreview ?>wear<?cs
- elif:work ?>work<?cs
- elif:design ?>design<?cs
- elif:walkthru ?>walkthru<?cs
- else ?>none<?cs set:dac_subcategory_set = #0 ?><?cs /if ?><?cs
+if:devsite ?><?cs
+ if:dac ?><?cs
+ # if this build set `library.root` then set a django variable to be used by the subsequent
+ # _reference-head-tags.html file for the book path (or ignored if its no longer needed)
+ ?><?cs
+ if:library.root ?>
+ {% setvar book_path %}/reference/<?cs var:library.root ?>/_book.yaml{% endsetvar %}<?cs
+ /if ?>
+ {% include "_shared/_reference-head-tags.html" %}
+ <meta name="body_class" value="api apilevel-<?cs var:class.since ?><?cs var:package.since ?>" /><?cs
+ else ?><?cs # If NOT dac... ?>
+ <meta name="hide_page_heading" value="true" />
+ <meta name="book_path" value="<?cs
+ if:book.path ?><?cs var:book.path ?><?cs
+ else ?>/_book.yaml<?cs
+ /if ?>" />
+ <meta name="project_path" value="<?cs
+ if:project.path ?><?cs var:project.path ?><?cs
+ else ?>/_project.yaml<?cs
/if ?>" /><?cs
- if:nonavpage ?>
- <meta name="hide_toc" value='True' /><?cs
- elif: !nonavpage && dac_subcategory_set && !tools && !sdk ?>
- <meta name="book_path" value="<?cs
- if:!dac ?><?cs
- if:book.path ?><?cs var:book.path ?><?cs
- else ?>/_book.yaml<?cs
- /if ?>" /><?cs
- else ?><?cs
- if:ndk ?>/ndk<?cs
- if:guide ?>/guides<?cs
- elif:samples ?>/samples<?cs
- elif:reference ?>/reference<?cs
- elif:downloads ?>/downloads<?cs /if ?><?cs
- elif:library.root ?>/reference/<?cs var:library.root ?><?cs
- else ?><?cs
- if:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
- if:guide ?>/guide<?cs
- elif:training ?>/training<?cs
- elif:reference ?>/reference<?cs
- elif:samples ?>/samples<?cs /if ?><?cs
- elif:(google||reference.gms||reference.gcm) ?>/google<?cs
- elif:(topic||libraries||perf) ?>/topic<?cs
- if:libraries ?>/libraries<?cs
- elif:instantapps ?>/instant-apps<?cs
- elif:perf ?>/performance<?cs
- elif:arc ?>/arc<?cs /if ?><?cs
- elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?>/distribute<?cs
- if:googleplay ?>/googleplay<?cs
- elif:essentials ?>/essentials<?cs
- elif:users ?>/users<?cs
- elif:engage ?>/engage<?cs
- elif:monetize ?>/monetize<?cs
- elif:disttools ?>/tools<?cs
- elif:stories ?>/stories<?cs
- elif:analyze ?>/analyze<?cs /if ?><?cs
- elif:(about||versions||wear||tv||auto) ?>/about<?cs
- elif:preview ?>/preview<?cs
- elif:wearpreview ?>/wear/preview<?cs
- elif:work ?>/work<?cs
- elif:design ?>/design<?cs
- elif:walkthru ?>/walkthru<?cs /if ?><?cs
- /if ?>/_book.yaml" /><?cs
- /if ?><?cs
- /if ?>
- <meta name="project_path" value="<?cs
- if:!dac ?><?cs
- if:project.path ?><?cs var:project.path ?><?cs
- else ?>/_project.yaml<?cs
- /if ?>" /><?cs
- else ?><?cs
- if:(guide||develop||training||reference||tools||sdk||samples) ?><?cs
- if:guide ?>/guide<?cs
- elif:training ?>/training<?cs
- elif:reference ?>/reference<?cs
- elif:samples ?>/samples<?cs /if ?><?cs
- elif:(google||reference.gms||reference.gcm) ?>/google<?cs
- elif:(topic||libraries) ?>/develop<?cs
- elif:(distribute||googleplay||essentials||users||engage||monetize||disttools||stories||analyze) ?>/distribute<?cs
- if:googleplay ?>/googleplay<?cs
- elif:essentials ?>/essentials<?cs
- elif:users ?>/users<?cs
- elif:engage ?>/engage<?cs
- elif:monetize ?>/monetize<?cs
- elif:disttools ?>/tools<?cs
- elif:stories ?>/stories<?cs
- elif:analyze ?>/analyze<?cs
- else ?><?cs /if ?><?cs
- elif:(about||versions||wear||tv||auto) ?><?cs
- if:versions ?>/about/versions<?cs
- elif:wear ?>/wear<?cs
- elif:tv ?>/tv<?cs
- elif:auto ?>/auto<?cs
- else ?>/about<?cs /if ?><?cs
- elif:wearpreview ?>/wear/preview<?cs
- elif:work ?>/work<?cs
- elif:preview ?>/preview<?cs
- elif:design ?>/design<?cs /if ?>/_project.yaml" /><?cs
- /if ?><?cs
- if:page.tags && page.tags != "" ?>
- <meta name="keywords" value='<?cs var:page.tags ?>' /><?cs
- /if ?><?cs
- if:meta.tags && meta.tags != "" ?>
- <meta name="meta_tags" value='<?cs var:meta.tags ?>' /><?cs
- /if ?><?cs
- if:fullpage ?>
- <meta name="full_width" value="True" /><?cs
- /if ?><?cs
- if:page.landing ?>
- <meta name="page_type" value="landing" /><?cs
- /if ?><?cs
- if:page.article ?>
- <meta name="page_type" value="article" /><?cs
- /if ?><?cs
- if:page.image ?>
- <meta name="image_path" value='<?cs var:page.image ?>' /><?cs
- /if ?><?cs
- if:excludeFromSuggestions ?>
- <meta name="hide_from_search_suggest" value="true" /><?cs
- /if ?><?cs
- if:reference ?>
- <meta name="body_class" value="api apilevel-<?cs var:class.since ?><?cs var:package.since ?>" /><?cs
- /if ?><?cs
- if:!dac ?>
- <meta name="hide_page_heading" value="true" /><?cs
- /if ?><?cs
-/if ?><?cs # END if/else devsite ?><?cs
-
- if:!devsite ?>
+ /if ?><?cs # End if/else dac ?><?cs
+else ?><?cs # if NOT devsite... ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta content="IE=edge" http-equiv="X-UA-Compatible">
diff --git a/res/assets/templates-sdk/macros_override.cs b/res/assets/templates-sdk/macros_override.cs
index 453eb59..b475798 100644
--- a/res/assets/templates-sdk/macros_override.cs
+++ b/res/assets/templates-sdk/macros_override.cs
@@ -23,7 +23,13 @@
<?cs set:count = #1 ?>
<table class="jd-sumtable-expando">
<?cs each:cl=classes ?>
- <tr class="<?cs if:count % #2 ?>alt-color<?cs /if ?> api apilevel-<?cs var:cl.type.since ?>" >
+ <tr class="api apilevel-<?cs var:cl.type.since ?>"<?cs
+ if:cl.type.since ?>
+ data-version-added="<?cs var:cl.type.since ?>"<?cs
+ /if ?><?cs
+ if:cl.type.deprecatedsince
+ ?> data-version-deprecated="<?cs var:cl.type.deprecatedsince ?>"<?cs
+ /if ?> >
<td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
<td class="jd-descrcol" width="100%">
<?cs call:short_descr(cl) ?>
@@ -58,8 +64,10 @@
elif:tag.kind == "@returnDoc" ?><?cs call:tag_list(tag.commentTags) ?><?cs
elif:tag.kind == "@range" ?><?cs call:dump_range(tag) ?><?cs
elif:tag.kind == "@intDef" ?><?cs call:dump_int_def(tag) ?><?cs
+ elif:tag.kind == "@stringDef" ?><?cs call:dump_string_def(tag) ?><?cs
elif:tag.kind == "@permission" ?><?cs call:dump_permission(tag) ?><?cs
elif:tag.kind == "@service" ?><?cs call:dump_service(tag) ?><?cs
+ elif:tag.kind == "@feature" ?><?cs call:dump_feature(tag) ?><?cs
/if ?><?cs
/each ?></p><?cs
/def ?><?cs
@@ -90,6 +98,18 @@
/loop ?>.<?cs
/def ?><?cs
+# Print output for @stringDef tags ?><?cs
+def:dump_string_def(tag) ?>Value is <?cs
+ loop:i = #0, subcount(tag.values), #1 ?><?cs
+ with:val = tag.values[i] ?><?cs
+ call:tag_list(val.commentTags) ?><?cs
+ if i == subcount(tag.values) - 2 ?> or <?cs
+ elif:i < subcount(tag.values) - 2 ?>, <?cs
+ /if ?><?cs
+ /with ?><?cs
+ /loop ?>.<?cs
+/def ?><?cs
+
# Print output for @permission tags ?><?cs
def:dump_permission(tag) ?>Requires the <?cs
loop:i = #0, subcount(tag.values), #1 ?><?cs
@@ -116,4 +136,10 @@
if i < subcount(tag.values) - 2 ?> or <?cs
/if ?><?cs
/loop ?>.<?cs
+/def ?><?cs
+
+# Print output for @feature tags ?><?cs
+def:dump_feature(tag) ?>Requires the <?cs
+ call:tag_list(tag.values[0].commentTags) ?> feature which can be detected using <?cs
+ call:tag_list(tag.values[1].commentTags) ?>.<?cs
/def ?>
diff --git a/res/assets/templates-sdk/package.cs b/res/assets/templates-sdk/package.cs
index 6a16bc0..ab66449 100644
--- a/res/assets/templates-sdk/package.cs
+++ b/res/assets/templates-sdk/package.cs
@@ -6,10 +6,22 @@
<html<?cs if:devsite ?> devsite<?cs /if ?>>
<?cs include:"head_tag.cs" ?>
<?cs include:"body_tag.cs" ?>
+<div itemscope itemtype="http://developers.google.com/ReferenceObject" >
+<!-- This DIV closes at the end of the BODY -->
+ <meta itemprop="name" content="<?cs var:page.title ?>" />
+ <?cs if:(dac&&package.since)
+ ?><meta itemprop="path" content="API level <?cs var:package.since ?>" /><?cs
+ /if ?>
<?cs include:"header.cs" ?>
<?cs # Includes api-info-block DIV at top of page. Standard Devsite uses right nav. ?>
<?cs if:dac ?><?cs include:"page_info.cs" ?><?cs /if ?>
-<div class="api apilevel-<?cs var:package.since ?>" id="jd-content">
+<div class="api apilevel-<?cs var:package.since ?>" id="jd-content"<?cs
+ if:package.since ?>
+ data-version-added="<?cs var:package.since ?>"<?cs
+ /if ?><?cs
+ if:package.deprecatedsince
+ ?> data-version-deprecated="<?cs var:package.deprecatedsince ?>"<?cs
+ /if ?> >
<h1><?cs var:package.name ?></h1>
@@ -61,5 +73,6 @@
<?cs include:"footer.cs" ?>
<?cs include:"trailer.cs" ?>
<?cs /if ?>
+</div><!-- end devsite ReferenceObject -->
</body>
</html>
diff --git a/res/assets/templates-sdk/page_info.cs b/res/assets/templates-sdk/page_info.cs
index 4bdda67..8585ee1 100644
--- a/res/assets/templates-sdk/page_info.cs
+++ b/res/assets/templates-sdk/page_info.cs
@@ -27,10 +27,12 @@
<?cs if:class.artifact ?>
<br><?cs call:artifact_tags(class) ?>
<?cs /if ?>
- <?cs if:class.deprecatedsince ?>
- <br>Deprecated since
+ <?cs if:class.deprecatedsince ?><?cs
+ if:class.artifact ?><br>Deprecated since version <?cs var:class.deprecatedsince ?><?cs
+ else ?><br>Deprecated since
<a href="<?cs var:toroot ?>guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level
- <?cs var:class.deprecatedsince ?></a>
+ <?cs var:class.deprecatedsince ?></a><?cs
+ /if ?>
<?cs /if ?>
<?cs call:federated_refs(class) ?>
</div>
@@ -106,7 +108,6 @@
<?cs if:inhmethods ?>
<?cs if:linkcount ?>| <?cs /if ?><a href="#inhmethods">Inherited Methods</a>
<?cs /if ?>
-| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>
<?cs /if ?>
</div><!-- end sum-details-links -->
</div><!-- end api-info-block --><?cs
diff --git a/res/assets/templates-sdk/yaml_navtree2.cs b/res/assets/templates-sdk/yaml_navtree2.cs
new file mode 100644
index 0000000..66ef5aa
--- /dev/null
+++ b/res/assets/templates-sdk/yaml_navtree2.cs
@@ -0,0 +1,9 @@
+toc:
+<?cs
+if:docs.packages.link ?>
+- title: Class Index
+ path: /<?cs var:docs.classes.link ?>
+- title: Package Index
+ path: /<?cs var:docs.packages.link ?><?cs
+/if ?>
+<?cs var:reference_tree ?>
\ No newline at end of file
diff --git a/res/assets/templates/macros.cs b/res/assets/templates/macros.cs
index cf8c86e..6590b51 100644
--- a/res/assets/templates/macros.cs
+++ b/res/assets/templates/macros.cs
@@ -8,7 +8,10 @@
<?cs # A link to a package ?><?cs
def:package_link(pkg) ?>
- <a href="<?cs var:toroot ?><?cs var:pkg.link ?>"><?cs var:pkg.name ?></a><?cs
+ <a href="<?cs
+ if:!pkg.federatedSite ?><?cs
+ var:toroot ?><?cs
+ /if ?><?cs var:pkg.link ?>"><?cs var:pkg.name ?></a><?cs
/def ?><?cs
# A link to a type, or not if it is a primitive type
@@ -245,7 +248,10 @@
<p><b>See also:</b></p>
<ul class="nolist"><?cs
each:tag=also ?><li><?cs
- if:tag.kind == "@see" ?><code><a href="<?cs var:toroot ?><?cs var:tag.href ?>"><?cs
+ if:tag.kind == "@see" ?><code><a href="<?cs
+ if:!tag.federatedSite ?><?cs
+ var:toroot ?><?cs
+ /if ?><?cs var:tag.href ?>"><?cs
var:tag.label ?></a></code><?cs
elif:tag.kind == "@seeHref" ?><a href="<?cs var:tag.href ?>"><?cs var:tag.label ?></a><?cs
elif:tag.kind == "@seeJustLabel" ?><?cs var:tag.label ?><?cs
@@ -304,13 +310,16 @@
call:aux_tag_list(obj.descrAux) ?><?cs
if:subcount(obj.annotationdocumentation)?><?cs
each:annodoc=obj.annotationdocumentation ?>
- <div style="display:block"><?cs var:annodoc.text?></div><?cs
+ <div><?cs var:annodoc.text?></div><?cs
/each?><?cs /if?><?cs
if:subcount(obj.attrRefs) ?>
<p><b>Related XML Attributes:</b></p>
<ul class="nolist"><?cs
each:attr=obj.attrRefs ?>
- <li><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs
+ <li><a href="<?cs
+ if:!attr.federatedSite ?><?cs
+ var:toroot ?><?cs
+ /if ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li><?cs
/each ?>
</ul><?cs
/if ?><?cs
@@ -395,7 +404,7 @@
# A list of links to classes, for use in the side navigation of classes when viewing a package (panel nav) ?><?cs
def:class_link_list(label, classes) ?><?cs
if:subcount(classes) ?>
- <li><h2><?cs var:label ?></h2>
+ <li><h2 class="hide-from-toc"><?cs var:label ?></h2>
<ul><?cs
each:cl=classes ?>
<li class="api apilevel-<?cs var:cl.type.since ?>"><?cs call:type_link2(cl.type,"true") ?></li><?cs
@@ -408,7 +417,7 @@
# A list of links to classes, for use in the side navigation of classes when viewing a class (panel nav) ?><?cs
def:list(label, classes) ?><?cs
if:subcount(classes) ?>
- <li><h2><?cs var:label ?></h2>
+ <li><h2 class="hide-from-toc"><?cs var:label ?></h2>
<ul><?cs
each:cl=classes ?>
<li class="<?cs if:class.name == cl.label?>selected <?cs /if ?>api apilevel-<?cs var:cl.since ?>"><?cs call:type_link2(cl,"true") ?></li><?cs
@@ -444,40 +453,30 @@
# An expandable list of classes
?><?cs
def:expandable_class_list(id, classes, default) ?>
- <div id="<?cs var:id ?>">
- <div id="<?cs var:id ?>-list" class="jd-inheritedlinks"<?cs
- if:default != "list" ?>
- style="display: none;"<?cs
- /if ?> > <?cs
- if:subcount(classes) <= #20 ?><?cs
- each:cl=classes ?><?cs
- call:type_link(cl.type) ?><?cs
- if:!last(cl)
- ?>,<?cs
- /if ?><?cs
- /each ?><?cs
- else ?><?cs
- set:leftovers = subcount(classes) - #15 ?><?cs
- loop:i = #0, #14, #1 ?><?cs
- with:cl=classes[i] ?><?cs
- call:type_link(cl.type) ?>,<?cs
- /with ?><?cs
- if:(#i == #14) ?>and
- <a href="#"<?cs
- if:enable_javascript ?>
- onclick="return toggleInherited(document.getElementById('<?cs var:id ?>', null))"<?cs
- /if ?> >
- <?cs var:leftovers ?> others.</a><?cs
- /if ?><?cs
- /loop ?><?cs
- /if ?>
- </div>
- <div id="<?cs var:id ?>-summary"<?cs
- if:default != "summary" ?>
- style="display: none;"<?cs
- /if ?> >
- <?cs call:class_link_table(classes) ?>
- </div>
+ <div id="<?cs var:id ?>" class="showalways" > <?cs
+ if:subcount(classes) <= #20 ?><?cs
+ each:cl=classes ?><?cs
+ call:type_link(cl.type) ?><?cs
+ if:!last(cl)
+ ?>, <?cs
+ /if ?><?cs
+ /each ?><?cs
+ else ?><?cs
+ set:leftovers = subcount(classes) - #15 ?><?cs
+ loop:i = #0, #14, #1 ?><?cs
+ with:cl=classes[i] ?><?cs
+ call:type_link(cl.type) ?>, <?cs
+ /with ?><?cs
+ if:(#i == #14) ?> and <?cs var:leftovers ?> others.<?cs
+ /if ?><?cs
+ /loop ?><?cs
+ /if ?>
+ </div>
+ <div id="<?cs var:id ?>-summary"<?cs
+ if:default == "summary" ?>
+ class="showalways"<?cs
+ /if ?> >
+ <?cs call:class_link_table(classes) ?>
</div><?cs
/def ?>
diff --git a/src/com/google/doclava/AndroidAuxSource.java b/src/com/google/doclava/AndroidAuxSource.java
index 8ed9fb0..1c97b18 100644
--- a/src/com/google/doclava/AndroidAuxSource.java
+++ b/src/com/google/doclava/AndroidAuxSource.java
@@ -23,10 +23,11 @@
import java.util.regex.Pattern;
public class AndroidAuxSource implements AuxSource {
- private static final int TYPE_FIELD = 0;
- private static final int TYPE_METHOD = 1;
- private static final int TYPE_PARAM = 2;
- private static final int TYPE_RETURN = 3;
+ private static final int TYPE_CLASS = 0;
+ private static final int TYPE_FIELD = 1;
+ private static final int TYPE_METHOD = 2;
+ private static final int TYPE_PARAM = 3;
+ private static final int TYPE_RETURN = 4;
@Override
public TagInfo[] classAuxTags(ClassInfo clazz) {
@@ -72,6 +73,7 @@
valueTags.toArray(TagInfo.getArray(valueTags.size()))));
}
}
+ auxTags(TYPE_CLASS, clazz.annotations(), toString(clazz.inlineTags()), tags);
return tags.toArray(TagInfo.getArray(tags.size()));
}
@@ -103,6 +105,12 @@
private static TagInfo[] auxTags(int type, List<AnnotationInstanceInfo> annotations,
String[] comment) {
ArrayList<TagInfo> tags = new ArrayList<>();
+ auxTags(type, annotations, comment, tags);
+ return tags.toArray(TagInfo.getArray(tags.size()));
+ }
+
+ private static void auxTags(int type, List<AnnotationInstanceInfo> annotations,
+ String[] comment, ArrayList<TagInfo> tags) {
for (AnnotationInstanceInfo annotation : annotations) {
// Ignore null-related annotations when docs already mention
if (annotation.type().qualifiedNameMatches("android", "annotation.NonNull")
@@ -121,6 +129,7 @@
switch (type) {
case TYPE_METHOD:
case TYPE_FIELD:
+ case TYPE_CLASS:
docTags = annotation.type().comment().memberDocTags();
break;
case TYPE_PARAM:
@@ -135,14 +144,13 @@
}
// Document required permissions
- if ((type == TYPE_METHOD || type == TYPE_FIELD)
+ if ((type == TYPE_CLASS || type == TYPE_METHOD || type == TYPE_FIELD)
&& annotation.type().qualifiedNameMatches("android", "annotation.RequiresPermission")) {
- ArrayList<AnnotationValueInfo> values = null;
+ ArrayList<AnnotationValueInfo> values = new ArrayList<>();
boolean any = false;
for (AnnotationValueInfo val : annotation.elementValues()) {
switch (val.element().name()) {
case "value":
- values = new ArrayList<AnnotationValueInfo>();
values.add(val);
break;
case "allOf":
@@ -154,7 +162,7 @@
break;
}
}
- if (values == null || values.isEmpty()) continue;
+ if (values.isEmpty()) continue;
ClassInfo permClass = annotation.type().findClass("android.Manifest.permission");
ArrayList<TagInfo> valueTags = new ArrayList<>();
@@ -176,6 +184,41 @@
valueTags.toArray(TagInfo.getArray(valueTags.size()))));
}
+ // Document required features
+ if ((type == TYPE_CLASS || type == TYPE_METHOD || type == TYPE_FIELD)
+ && annotation.type().qualifiedNameMatches("android", "annotation.RequiresFeature")) {
+ AnnotationValueInfo value = null;
+ for (AnnotationValueInfo val : annotation.elementValues()) {
+ switch (val.element().name()) {
+ case "value":
+ value = val;
+ break;
+ }
+ }
+ if (value == null) continue;
+
+ ClassInfo pmClass = annotation.type().findClass("android.content.pm.PackageManager");
+ ArrayList<TagInfo> valueTags = new ArrayList<>();
+ final String expected = String.valueOf(value.value());
+ for (FieldInfo field : pmClass.fields()) {
+ if (field.isHiddenOrRemoved()) continue;
+ if (String.valueOf(field.constantValue()).equals(expected)) {
+ valueTags.add(new ParsedTagInfo("", "",
+ "{@link " + pmClass.qualifiedName() + "#" + field.name() + "}", null,
+ SourcePositionInfo.UNKNOWN));
+ }
+ }
+
+ valueTags.add(new ParsedTagInfo("", "",
+ "{@link android.content.pm.PackageManager#hasSystemFeature(String)"
+ + " PackageManager.hasSystemFeature(String)}",
+ null, SourcePositionInfo.UNKNOWN));
+
+ Map<String, String> args = new HashMap<>();
+ tags.add(new AuxTagInfo("@feature", "@feature", SourcePositionInfo.UNKNOWN, args,
+ valueTags.toArray(TagInfo.getArray(valueTags.size()))));
+ }
+
// The remaining annotations below always appear on return docs, and
// should not be included in the method body
if (type == TYPE_METHOD) continue;
@@ -202,21 +245,28 @@
// Document integer values
for (AnnotationInstanceInfo inner : annotation.type().annotations()) {
- if (inner.type().qualifiedNameMatches("android", "annotation.IntDef")) {
+ boolean intDef = inner.type().qualifiedNameMatches("android", "annotation.IntDef");
+ boolean stringDef = inner.type().qualifiedNameMatches("android", "annotation.StringDef");
+ if (intDef || stringDef) {
ArrayList<AnnotationValueInfo> prefixes = null;
+ ArrayList<AnnotationValueInfo> suffixes = null;
ArrayList<AnnotationValueInfo> values = null;
+ final String kind = intDef ? "@intDef" : "@stringDef";
boolean flag = false;
for (AnnotationValueInfo val : inner.elementValues()) {
switch (val.element().name()) {
case "prefix": prefixes = (ArrayList<AnnotationValueInfo>) val.value(); break;
+ case "suffix": suffixes = (ArrayList<AnnotationValueInfo>) val.value(); break;
case "value": values = (ArrayList<AnnotationValueInfo>) val.value(); break;
case "flag": flag = Boolean.parseBoolean(String.valueOf(val.value())); break;
}
}
- // Sadly we can only generate docs when told about a prefix
- if (prefixes == null || prefixes.isEmpty()) continue;
+ // Sadly we can only generate docs when told about a prefix/suffix
+ if (prefixes == null) prefixes = new ArrayList<>();
+ if (suffixes == null) suffixes = new ArrayList<>();
+ if (prefixes.isEmpty() && suffixes.isEmpty()) continue;
final ClassInfo clazz = annotation.type().containingClass();
final HashMap<String, FieldInfo> candidates = new HashMap<>();
@@ -227,6 +277,11 @@
candidates.put(String.valueOf(field.constantValue()), field);
}
}
+ for (AnnotationValueInfo suffix : suffixes) {
+ if (field.name().endsWith(String.valueOf(suffix.value()))) {
+ candidates.put(String.valueOf(field.constantValue()), field);
+ }
+ }
}
ArrayList<TagInfo> valueTags = new ArrayList<>();
@@ -243,13 +298,12 @@
if (!valueTags.isEmpty()) {
Map<String, String> args = new HashMap<>();
if (flag) args.put("flag", "true");
- tags.add(new AuxTagInfo("@intDef", "@intDef", SourcePositionInfo.UNKNOWN, args,
+ tags.add(new AuxTagInfo(kind, kind, SourcePositionInfo.UNKNOWN, args,
valueTags.toArray(TagInfo.getArray(valueTags.size()))));
}
}
}
}
- return tags.toArray(TagInfo.getArray(tags.size()));
}
private static String[] toString(TagInfo[] tags) {
diff --git a/src/com/google/doclava/AndroidLinter.java b/src/com/google/doclava/AndroidLinter.java
index 399226d..c5a00f0 100644
--- a/src/com/google/doclava/AndroidLinter.java
+++ b/src/com/google/doclava/AndroidLinter.java
@@ -77,7 +77,7 @@
for (AnnotationInstanceInfo a : method.annotations()) {
if (a.type().qualifiedNameMatches("android", "annotation.RequiresPermission")) {
hasAnnotation = true;
- ArrayList<AnnotationValueInfo> values = new ArrayList<AnnotationValueInfo>();
+ ArrayList<AnnotationValueInfo> values = new ArrayList<>();
for (AnnotationValueInfo val : a.elementValues()) {
switch (val.element().name()) {
case "value":
@@ -91,6 +91,8 @@
break;
}
}
+ if (values.isEmpty()) continue;
+
for (AnnotationValueInfo value : values) {
String perm = String.valueOf(value.value());
if (perm.indexOf('.') >= 0) perm = perm.substring(perm.lastIndexOf('.') + 1);
diff --git a/src/com/google/doclava/ClassInfo.java b/src/com/google/doclava/ClassInfo.java
index 2393c2c..dbe7783 100644
--- a/src/com/google/doclava/ClassInfo.java
+++ b/src/com/google/doclava/ClassInfo.java
@@ -2193,16 +2193,20 @@
* abstractness affects how users use it. See also Stubs.methodIsOverride().
*/
MethodInfo mi = ClassInfo.overriddenMethod(mInfo, this);
- if (mi == null ||
- mi.isAbstract() != mInfo.isAbstract()) {
- Errors.error(Errors.ADDED_METHOD, mInfo.position(), "Added public method "
- + mInfo.prettyQualifiedSignature());
- if (diffMode) {
- newMethods.add(mInfo);
- }
+ if (mi == null && mInfo.isAbstract()) {
+ Errors.error(Errors.ADDED_ABSTRACT_METHOD, mInfo.position(),
+ "Added abstract public method "
+ + mInfo.prettyQualifiedSignature() + " to existing class");
consistent = false;
+ } else if (mi == null || mi.isAbstract() != mInfo.isAbstract()) {
+ Errors.error(Errors.ADDED_METHOD, mInfo.position(), "Added public method "
+ + mInfo.prettyQualifiedSignature());
+ if (diffMode) {
+ newMethods.add(mInfo);
+ }
+ consistent = false;
+ }
}
- }
}
if (diffMode) {
Collections.sort(newMethods, MethodInfo.comparator);
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 9aaf577..caa44a6 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -120,6 +120,7 @@
public static Map<String, String> annotationDocumentationMap = null;
public static boolean referenceOnly = false;
public static boolean staticOnly = false;
+ public static boolean yamlV2 = false; /* whether to build the new version of the yaml file */
public static AuxSource auxSource = new EmptyAuxSource();
public static Linter linter = new EmptyLinter();
public static boolean android = false;
@@ -371,6 +372,8 @@
NAVTREE_ONLY = true;
} else if (a[0].equals("-atLinksNavtree")) {
AT_LINKS_NAVTREE = true;
+ } else if (a[0].equals("-yamlV2")) {
+ yamlV2 = true;
} else if (a[0].equals("-devsite")) {
// Don't copy any assets to devsite output
includeAssets = false;
@@ -518,6 +521,12 @@
// Write yaml tree.
if (yamlNavFile != null){
NavTree.writeYamlTree(javadocDir, yamlNavFile);
+ if (yamlV2) {
+ // Generate both for good measure, to make transitions easier, but change the filename
+ // for the new one so there's yet another explicit opt-in required by fixing the name.
+ yamlNavFile = "_NEW" + yamlNavFile;
+ NavTree.writeYamlTree2(javadocDir, yamlNavFile);
+ }
}
// Packages Pages
@@ -750,6 +759,9 @@
if (option.equals("-devsite")) {
return 1;
}
+ if (option.equals("-yamlV2")) {
+ return 1;
+ }
if (option.equals("-dac_libraryroot")) {
return 2;
}
@@ -798,6 +810,9 @@
if (option.equals("-showAnnotation")) {
return 2;
}
+ if (option.equals("-hideAnnotation")) {
+ return 2;
+ }
if (option.equals("-showAnnotationOverridesVisibility")) {
return 1;
}
diff --git a/src/com/google/doclava/Errors.java b/src/com/google/doclava/Errors.java
index 9edd239..6b0eee0 100644
--- a/src/com/google/doclava/Errors.java
+++ b/src/com/google/doclava/Errors.java
@@ -281,6 +281,7 @@
public static final Error REMOVED_DEPRECATED_CLASS = new Error(28, REMOVED_CLASS);
public static final Error REMOVED_DEPRECATED_METHOD = new Error(29, REMOVED_METHOD);
public static final Error REMOVED_DEPRECATED_FIELD = new Error(30, REMOVED_FIELD);
+ public static final Error ADDED_ABSTRACT_METHOD = new Error(31, ADDED_METHOD);
// Errors in javadoc generation
public static final Error UNRESOLVED_LINK = new Error(101, LINT);
diff --git a/src/com/google/doclava/LinkReference.java b/src/com/google/doclava/LinkReference.java
index 0fb7fcb..0bfa42f 100644
--- a/src/com/google/doclava/LinkReference.java
+++ b/src/com/google/doclava/LinkReference.java
@@ -400,7 +400,14 @@
}
}
if (result.label.length() == 0) {
- result.label = result.referencedMemberName;
+ // Qualify labels that link beyond the base context
+ final boolean beyondBase = base != null && containing != null
+ && !base.qualifiedName().equals(containing.qualifiedName());
+ if (beyondBase) {
+ result.label = containing.name() + "." + result.referencedMemberName;
+ } else {
+ result.label = result.referencedMemberName;
+ }
}
setHref(result, containing, result.memberInfo.anchor());
if (DBG) System.out.println(" ---- member reference");
diff --git a/src/com/google/doclava/MethodInfo.java b/src/com/google/doclava/MethodInfo.java
index 908c0ea..ac6d2c5 100644
--- a/src/com/google/doclava/MethodInfo.java
+++ b/src/com/google/doclava/MethodInfo.java
@@ -909,8 +909,6 @@
+ " to " + mInfo.scope());
}
- // Changing the deprecated annotation is binary- and source-compatible, but
- // we still need to log the API change.
if (!isDeprecated() == mInfo.isDeprecated()) {
Errors.error(Errors.CHANGED_DEPRECATED, mInfo.position(), "Method "
+ mInfo.prettyQualifiedSignature() + " has changed deprecation state " + isDeprecated()
@@ -918,14 +916,16 @@
consistent = false;
}
- // Changing the synchronized modifier is binary- and source-compatible (see
- // JLS 3 13.4.20), but we still need to log the API change.
+ // see JLS 3 13.4.20 "Adding or deleting a synchronized modifier of a method does not break "
+ // "compatibility with existing binaries."
+ /*
if (mIsSynchronized != mInfo.mIsSynchronized) {
Errors.error(Errors.CHANGED_SYNCHRONIZED, mInfo.position(), "Method " + mInfo.qualifiedName()
+ " has changed 'synchronized' qualifier from " + mIsSynchronized + " to "
+ mInfo.mIsSynchronized);
consistent = false;
}
+ */
for (ClassInfo exception : thrownExceptions()) {
if (!mInfo.throwsException(exception)) {
diff --git a/src/com/google/doclava/NavTree.java b/src/com/google/doclava/NavTree.java
index de9dd4e..b4861c8 100644
--- a/src/com/google/doclava/NavTree.java
+++ b/src/com/google/doclava/NavTree.java
@@ -60,6 +60,40 @@
/**
* Write the YAML formatted navigation tree.
+ * This is intended to replace writeYamlTree(), but for now requires an explicit opt-in via
+ * the yamlV2 flag in the doclava command. This version creates a yaml file with all classes,
+ * interface, exceptions, etc. separated into collapsible groups.
+ */
+ public static void writeYamlTree2(String dir, String fileName){
+ List<Node> children = new ArrayList<Node>();
+ for (PackageInfo pkg : Doclava.choosePackages()) {
+ children.add(makePackageNode(pkg));
+ }
+ Node node = new Node("Reference", Doclava.ensureSlash(dir) + "packages.html", children, null);
+ StringBuilder buf = new StringBuilder();
+
+ node.renderChildrenYaml(buf, 0);
+
+ Data data = Doclava.makeHDF();
+ data.setValue("reference_tree", buf.toString());
+
+ if (Doclava.USE_DEVSITE_LOCALE_OUTPUT_PATHS && (Doclava.libraryRoot != null)) {
+ dir = Doclava.ensureSlash(dir) + Doclava.libraryRoot;
+ }
+
+ data.setValue("docs.classes.link", Doclava.ensureSlash(dir) + "classes.html");
+ data.setValue("docs.packages.link", Doclava.ensureSlash(dir) + "packages.html");
+
+ ClearPage.write(data, "yaml_navtree2.cs", Doclava.ensureSlash(dir) + fileName);
+
+ }
+
+
+ /**
+ * Write the YAML formatted navigation tree (legacy version).
+ * This creates a yaml file with package names followed by all
+ * classes, interfaces, exceptions, etc. But they are not separated by classes, interfaces, etc.
+ * It also nests any nested classes under the parent class, instead of listing them as siblings.
* @see "http://yaml.org/"
*/
public static void writeYamlTree(String dir, String fileName){
@@ -254,5 +288,76 @@
renderString(buf, mArtifact);
buf.append(" ]");
}
+
+
+ // YAML VERSION
+
+
+ static void renderStringYaml(StringBuilder buf, String s) {
+ if (s != null) {
+ final int N = s.length();
+ for (int i = 0; i < N; i++) {
+ char c = s.charAt(i);
+ if (c >= ' ' && c <= '~' && c != '"' && c != '\\') {
+ buf.append(c);
+ } else {
+ buf.append("\\u");
+ for (int j = 0; i < 4; i++) {
+ char x = (char) (c & 0x000f);
+ if (x >= 10) {
+ x = (char) (x - 10 + 'a');
+ } else {
+ x = (char) (x + '0');
+ }
+ buf.append(x);
+ c >>= 4;
+ }
+ }
+ }
+ }
+ }
+ void renderChildrenYaml(StringBuilder buf, int depth) {
+ List<Node> list = mChildren;
+ if (list != null && list.size() > 0) {
+ if (depth > 0) {
+ buf.append("\n\n" + getIndent(depth));
+ buf.append("section:");
+ }
+ final int N = list.size();
+ for (int i = 0; i < N; i++) {
+ // get each child Node and render it
+ list.get(i).renderYaml(buf, depth);
+ }
+ // Extra line break after each "section"
+ buf.append("\n");
+ }
+ }
+ void renderYaml(StringBuilder buf, int depth) {
+ buf.append("\n" + getIndent(depth));
+ buf.append("- title: \"");
+ renderStringYaml(buf, mLabel);
+ buf.append("\"");
+ // Add link path, if it exists (the class/interface toggles don't have links)
+ if (mLink != null) {
+ buf.append("\n" + getIndent(depth));
+ buf.append(" path: ");
+ renderStringYaml(buf, "/" + mLink);
+ // add the API level info only if we have it
+ if (mSince != null) {
+ buf.append("\n" + getIndent(depth));
+ buf.append(" version_added: ");
+ renderStringYaml(buf, "'" + mSince + "'");
+ }
+ }
+ // try rendering child Nodes
+ renderChildrenYaml(buf, depth + 1);
+ }
+ String getIndent(int depth) {
+ String spaces = "";
+ for (int i = 0; i < depth; i++) {
+ spaces += " ";
+ }
+ return spaces;
+ }
}
-}
+}
\ No newline at end of file
diff --git a/src/com/google/doclava/Stubs.java b/src/com/google/doclava/Stubs.java
index 343a020..dd2a5a7 100644
--- a/src/com/google/doclava/Stubs.java
+++ b/src/com/google/doclava/Stubs.java
@@ -722,6 +722,7 @@
int N = enumConstants.size();
int i = 0;
for (FieldInfo field : enumConstants) {
+ writeAnnotations(stream, field.annotations(), field.isDeprecated());
if (!field.constantLiteralValue().equals("null")) {
stream.println(field.name() + "(" + field.constantLiteralValue()
+ (i == N - 1 ? ");" : "),"));
@@ -973,7 +974,7 @@
if (canCallMethod(cl, m)) {
if (m.thrownExceptions() != null) {
for (ClassInfo thrown : m.thrownExceptions()) {
- if (!exceptionNames.contains(thrown.name())) {
+ if (thrownExceptions != null && !exceptionNames.contains(thrown.name())) {
badException = true;
}
}
@@ -1071,6 +1072,14 @@
stream.println(";");
}
+ public static void writeXml(PrintStream xmlWriter, Collection<PackageInfo> pkgs, boolean strip) {
+ if (strip) {
+ Stubs.writeXml(xmlWriter, pkgs);
+ } else {
+ Stubs.writeXml(xmlWriter, pkgs, c -> true);
+ }
+ }
+
public static void writeXml(PrintStream xmlWriter, Collection<PackageInfo> pkgs,
Predicate<ClassInfo> notStrippable) {
@@ -1618,11 +1627,10 @@
if (a.type().qualifiedNameMatches("android", "annotation.RequiresPermission")) {
hasAnnotation = true;
for (AnnotationValueInfo val : a.elementValues()) {
- ArrayList<AnnotationValueInfo> values = null;
+ ArrayList<AnnotationValueInfo> values = new ArrayList<>();
boolean any = false;
switch (val.element().name()) {
case "value":
- values = new ArrayList<AnnotationValueInfo>();
values.add(val);
break;
case "allOf":
@@ -1633,6 +1641,7 @@
values = (ArrayList<AnnotationValueInfo>) val.value();
break;
}
+ if (values.isEmpty()) continue;
ArrayList<String> system = new ArrayList<>();
ArrayList<String> nonSystem = new ArrayList<>();
diff --git a/src/com/google/doclava/apicheck/ApiCheck.java b/src/com/google/doclava/apicheck/ApiCheck.java
index 4828720..ab7ee84 100644
--- a/src/com/google/doclava/apicheck/ApiCheck.java
+++ b/src/com/google/doclava/apicheck/ApiCheck.java
@@ -71,7 +71,11 @@
} else if (originalArgs.length == 4 && "-new_api".equals(originalArgs[0])) {
// command syntax: -new_api oldapi.txt newapi.txt diff.xml
// TODO: Support reading in other options for new_api, such as ignored classes/packages.
- System.exit(newApi(originalArgs[1], originalArgs[2], originalArgs[3]));
+ System.exit(newApi(originalArgs[1], originalArgs[2], originalArgs[3], true));
+ } else if (originalArgs.length == 4 && "-new_api_no_strip".equals(originalArgs[0])) {
+ // command syntax: -new_api oldapi.txt newapi.txt diff.xml
+ // TODO: Support reading in other options for new_api, such as ignored classes/packages.
+ System.exit(newApi(originalArgs[1], originalArgs[2], originalArgs[3], false));
} else {
ApiCheck acheck = new ApiCheck();
Report report = acheck.checkApi(originalArgs);
@@ -272,7 +276,7 @@
System.err.println("can't open file: " + dst);
}
- Stubs.writeXml(apiWriter, api.getPackages().values(), c -> true);
+ Stubs.writeXml(apiWriter, api.getPackages().values(), strip);
return 0;
}
@@ -282,9 +286,10 @@
* @param origApiPath path to old API text file
* @param newApiPath path to new API text file
* @param outputPath output XML path for the generated diff
+ * @param strip true if any unknown classes should be stripped from the output, false otherwise
* @return
*/
- static int newApi(String origApiPath, String newApiPath, String outputPath) {
+ static int newApi(String origApiPath, String newApiPath, String outputPath, boolean strip) {
ApiInfo origApi, newApi;
try {
origApi = parseApi(origApiPath);
@@ -308,7 +313,7 @@
} catch (FileNotFoundException ex) {
System.err.println("can't open file: " + outputPath);
}
- Stubs.writeXml(apiWriter, pkgInfoDiff);
+ Stubs.writeXml(apiWriter, pkgInfoDiff, strip);
} else {
System.err.println("No API change detected, not generating diff.");
}
diff --git a/test/doclava/ApiCheckTest.java b/test/doclava/ApiCheckTest.java
index ce0464a..98cb020 100644
--- a/test/doclava/ApiCheckTest.java
+++ b/test/doclava/ApiCheckTest.java
@@ -17,31 +17,26 @@
package doclava;
import com.google.doclava.Errors;
+import com.google.doclava.Errors.Error;
import com.google.doclava.Errors.ErrorMessage;
import com.google.doclava.apicheck.ApiCheck;
import com.google.doclava.apicheck.ApiCheck.Report;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
+import junit.framework.TestCase;
import java.util.Iterator;
-public class ApiCheckTest {
-
- @Before
+public class ApiCheckTest extends TestCase {
+ /**
+ * Clear all errors and make sure all future errors will be recorded.
+ */
public void setUp() {
- // Clear all errors and make sure all future errors will be recorded.
Errors.clearErrors();
for (Errors.Error error : Errors.sErrors) {
Errors.setErrorLevel(error.code, Errors.ERROR);
}
}
- @Test
public void testEquivalentApi() {
String[] args = { "test/api/medium.xml", "test/api/medium.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -49,7 +44,6 @@
assertEquals(report.errors().size(), 0);
}
- @Test
public void testMethodReturnTypeChanged() {
String[] args = { "test/api/return-type-changed-1.xml", "test/api/return-type-changed-2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -58,7 +52,6 @@
assertEquals(Errors.CHANGED_TYPE, report.errors().iterator().next().error());
}
- @Test
public void testMethodParameterChanged() {
String[] args = { "test/api/parameter-changed-1.xml", "test/api/parameter-changed-2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -73,7 +66,6 @@
assertTrue(m2.error().equals(Errors.ADDED_METHOD) || m2.error().equals(Errors.REMOVED_METHOD));
}
- @Test
public void testConstructorParameterChanged() {
String[] args = { "test/api/parameter-changed-1.xml", "test/api/parameter-changed-3.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -87,7 +79,6 @@
assertTrue(m2.error().equals(Errors.ADDED_METHOD) || m2.error().equals(Errors.REMOVED_METHOD));
}
- @Test
public void testAddedClass() {
String[] args = { "test/api/simple.xml", "test/api/added-class.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -96,7 +87,6 @@
assertEquals(Errors.ADDED_CLASS, report.errors().iterator().next().error());
}
- @Test
public void testRemovedClass() {
String[] args = { "test/api/added-class.xml", "test/api/simple.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -105,7 +95,6 @@
assertEquals(Errors.REMOVED_CLASS, report.errors().iterator().next().error());
}
- @Test
public void testRemovedDeprecatedClass() {
String[] args = { "test/api/added-deprecated-class.xml", "test/api/simple.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -114,7 +103,6 @@
assertEquals(Errors.REMOVED_DEPRECATED_CLASS, report.errors().iterator().next().error());
}
- @Test
public void testChangedSuper() {
String[] args = { "test/api/simple.xml", "test/api/changed-super.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -123,7 +111,6 @@
assertEquals(Errors.CHANGED_SUPERCLASS, report.errors().iterator().next().error());
}
- @Test
public void testChangedAssignableReturn() {
String[] args = {
"test/api/changed-assignable-return-1.xml",
@@ -135,7 +122,6 @@
assertEquals(Errors.CHANGED_TYPE, report.errors().iterator().next().error());
}
- @Test
public void testInsertedSuper() {
String[] args = { "test/api/inserted-super-1.xml", "test/api/inserted-super-2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -143,7 +129,6 @@
assertEquals(0, report.errors().size());
}
- @Test
public void testAddedInterface() {
String[] args = { "test/api/removed-interface.xml", "test/api/medium.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -152,7 +137,6 @@
assertEquals(Errors.ADDED_INTERFACE, report.errors().iterator().next().error());
}
- @Test
public void testRemovedInterface() {
String[] args = { "test/api/medium.xml", "test/api/removed-interface.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -161,7 +145,6 @@
assertEquals(Errors.REMOVED_INTERFACE, report.errors().iterator().next().error());
}
- @Test
public void testChangedAbstractClass() {
String[] args = { "test/api/medium.xml", "test/api/changed-abstract.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -170,7 +153,6 @@
assertEquals(Errors.CHANGED_ABSTRACT, report.errors().iterator().next().error());
}
- @Test
public void testChangedAbstractClass2() {
String[] args = { "test/api/changed-abstract.xml", "test/api/medium.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -179,7 +161,6 @@
assertEquals(Errors.CHANGED_ABSTRACT, report.errors().iterator().next().error());
}
- @Test
public void testChangedAbstractMethod() {
String[] args = { "test/api/medium.xml", "test/api/changed-abstract2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -188,7 +169,6 @@
assertEquals(Errors.CHANGED_ABSTRACT, report.errors().iterator().next().error());
}
- @Test
public void testChangedAbstractMethod2() {
String[] args = { "test/api/changed-abstract2.xml", "test/api/medium.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -197,7 +177,6 @@
assertEquals(Errors.CHANGED_ABSTRACT, report.errors().iterator().next().error());
}
- @Test
public void testAddedPackage() {
String[] args = { "test/api/medium.xml", "test/api/added-package.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -206,7 +185,6 @@
assertEquals(Errors.ADDED_PACKAGE, report.errors().iterator().next().error());
}
- @Test
public void testRemovedPackage() {
String[] args = { "test/api/added-package.xml", "test/api/medium.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -215,7 +193,6 @@
assertEquals(Errors.REMOVED_PACKAGE, report.errors().iterator().next().error());
}
- @Test
public void testChangedValue() {
String[] args = { "test/api/constants.xml", "test/api/changed-value.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -224,7 +201,6 @@
assertEquals(Errors.CHANGED_VALUE, report.errors().iterator().next().error());
}
- @Test
public void testChangedValue2() {
String[] args = { "test/api/constants.xml", "test/api/changed-value2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -233,7 +209,6 @@
assertEquals(Errors.CHANGED_VALUE, report.errors().iterator().next().error());
}
- @Test
public void testChangedType() {
String[] args = { "test/api/constants.xml", "test/api/changed-type.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -242,7 +217,6 @@
assertEquals(Errors.CHANGED_TYPE, report.errors().iterator().next().error());
}
- @Test
public void testAddedFinalField() {
String[] args = { "test/api/constants.xml", "test/api/changed-final.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -251,7 +225,6 @@
assertEquals(Errors.ADDED_FINAL, report.errors().iterator().next().error());
}
- @Test
public void testAddedFinalMethod() {
String[] args = { "test/api/constants.xml", "test/api/changed-final2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -260,7 +233,6 @@
assertEquals(Errors.ADDED_FINAL, report.errors().iterator().next().error());
}
- @Test
public void testAddedFinalClass() {
String[] args = { "test/api/constants.xml", "test/api/changed-final3.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -270,7 +242,6 @@
assertEquals(Errors.ADDED_FINAL, report.errors().iterator().next().error());
}
- @Test
public void testRemovedFinalClass() {
String[] args = { "test/api/changed-final3.xml", "test/api/constants.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -280,7 +251,6 @@
assertEquals(Errors.REMOVED_FINAL, report.errors().iterator().next().error());
}
- @Test
public void testAddedField() {
String[] args = { "test/api/constants.xml", "test/api/added-field.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -289,7 +259,6 @@
assertEquals(Errors.ADDED_FIELD, report.errors().iterator().next().error());
}
- @Test
public void testRemovedField() {
String[] args = { "test/api/added-field.xml", "test/api/constants.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -298,7 +267,6 @@
assertEquals(Errors.REMOVED_FIELD, report.errors().iterator().next().error());
}
- @Test
public void testRemovedDeprecatedField() {
String[] args = { "test/api/added-deprecated-field.xml", "test/api/constants.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -307,7 +275,6 @@
assertEquals(Errors.REMOVED_DEPRECATED_FIELD, report.errors().iterator().next().error());
}
- @Test
public void testAddedMethod() {
String[] args = { "test/api/constants.xml", "test/api/added-method.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -316,7 +283,6 @@
assertEquals(Errors.ADDED_METHOD, report.errors().iterator().next().error());
}
- @Test
public void testRemovedMethod() {
String[] args = { "test/api/added-method.xml", "test/api/constants.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -325,7 +291,6 @@
assertEquals(Errors.REMOVED_METHOD, report.errors().iterator().next().error());
}
- @Test
public void testRemovedDeprecatedMethod() {
String[] args = { "test/api/added-deprecated-method.xml", "test/api/constants.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -334,7 +299,6 @@
assertEquals(Errors.REMOVED_DEPRECATED_METHOD, report.errors().iterator().next().error());
}
- @Test
public void testChangedStaticMethod() {
String[] args = { "test/api/constants.xml", "test/api/changed-static.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -343,7 +307,6 @@
assertEquals(Errors.CHANGED_STATIC, report.errors().iterator().next().error());
}
- @Test
public void testChangedStaticClass() {
String[] args = { "test/api/constants.xml", "test/api/changed-static2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -352,7 +315,6 @@
assertEquals(Errors.CHANGED_STATIC, report.errors().iterator().next().error());
}
- @Test
public void testChangedStaticField() {
String[] args = { "test/api/constants.xml", "test/api/changed-static3.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -361,7 +323,6 @@
assertEquals(Errors.CHANGED_STATIC, report.errors().iterator().next().error());
}
- @Test
public void testChangedTransient() {
String[] args = { "test/api/constants.xml", "test/api/changed-transient.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -370,15 +331,13 @@
assertEquals(Errors.CHANGED_TRANSIENT, report.errors().iterator().next().error());
}
- @Test
public void testChangedSynchronized() {
String[] args = { "test/api/constants.xml", "test/api/changed-synchronized.xml" };
ApiCheck apiCheck = new ApiCheck();
Report report = apiCheck.checkApi(args);
- assertEquals(1, report.errors().size());
+ assertEquals(0, report.errors().size());
}
- @Test
public void testChangedVolatile() {
String[] args = { "test/api/constants.xml", "test/api/changed-volatile.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -387,7 +346,6 @@
assertEquals(Errors.CHANGED_VOLATILE, report.errors().iterator().next().error());
}
- @Test
public void testChangedNative() {
String[] args = { "test/api/constants.xml", "test/api/changed-native.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -396,7 +354,6 @@
assertEquals(Errors.CHANGED_NATIVE, report.errors().iterator().next().error());
}
- @Test
public void testChangedScopeMethod() {
String[] args = { "test/api/constants.xml", "test/api/changed-scope.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -405,7 +362,6 @@
assertEquals(Errors.CHANGED_SCOPE, report.errors().iterator().next().error());
}
- @Test
public void testChangedScopeClass() {
String[] args = { "test/api/changed-scope.xml", "test/api/constants.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -414,7 +370,6 @@
assertEquals(Errors.CHANGED_SCOPE, report.errors().iterator().next().error());
}
- @Test
public void testChangedScopeClass2() {
String[] args = { "test/api/constants.xml", "test/api/changed-scope2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -423,7 +378,6 @@
assertEquals(Errors.CHANGED_SCOPE, report.errors().iterator().next().error());
}
- @Test
public void testChangedScopeField() {
String[] args = { "test/api/constants.xml", "test/api/changed-scope3.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -432,7 +386,6 @@
assertEquals(Errors.CHANGED_SCOPE, report.errors().iterator().next().error());
}
- @Test
public void testChangedConstructorScope() {
String[] args = { "test/api/constants.xml", "test/api/changed-scope4.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -441,7 +394,6 @@
assertEquals(Errors.CHANGED_SCOPE, report.errors().iterator().next().error());
}
- @Test
public void testChangedMethodThrows() {
String[] args = { "test/api/throws.xml", "test/api/removed-exception.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -450,7 +402,6 @@
assertEquals(Errors.CHANGED_THROWS, report.errors().iterator().next().error());
}
- @Test
public void testChangedMethodThrows2() {
String[] args = { "test/api/removed-exception.xml", "test/api/throws.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -459,7 +410,6 @@
assertEquals(Errors.CHANGED_THROWS, report.errors().iterator().next().error());
}
- @Test
public void testChangedConstructorThrows() {
String[] args = { "test/api/throws.xml", "test/api/added-exception.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -468,7 +418,6 @@
assertEquals(Errors.CHANGED_THROWS, report.errors().iterator().next().error());
}
- @Test
public void testChangedConstructorThrows2() {
String[] args = { "test/api/added-exception.xml", "test/api/throws.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -477,7 +426,6 @@
assertEquals(Errors.CHANGED_THROWS, report.errors().iterator().next().error());
}
- @Test
public void testChangedMethodDeprecated() {
String[] args = { "test/api/constants.xml", "test/api/changed-deprecated.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -486,7 +434,6 @@
assertEquals(Errors.CHANGED_DEPRECATED, report.errors().iterator().next().error());
}
- @Test
public void testChangedConstructorDeprecated() {
String[] args = { "test/api/constants.xml", "test/api/changed-deprecated2.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -495,7 +442,6 @@
assertEquals(Errors.CHANGED_DEPRECATED, report.errors().iterator().next().error());
}
- @Test
public void testChangedFieldDeprecated() {
String[] args = { "test/api/constants.xml", "test/api/changed-deprecated3.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -504,7 +450,6 @@
assertEquals(Errors.CHANGED_DEPRECATED, report.errors().iterator().next().error());
}
- @Test
public void testChangedClassToInterface() {
String[] args = { "test/api/changed-class-info2.xml", "test/api/changed-class-info.xml" };
ApiCheck apiCheck = new ApiCheck();
@@ -513,7 +458,6 @@
assertEquals(Errors.CHANGED_CLASS, report.errors().iterator().next().error());
}
- @Test
public void testChangedInterfaceToClass() {
String[] args = { "test/api/changed-class-info.xml", "test/api/changed-class-info2.xml" };
ApiCheck apiCheck = new ApiCheck();