aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-03-31 02:15:43 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-03-31 02:15:43 +0000
commit61de515992e5c336e1e572ac24acc1b340cf5d23 (patch)
tree78d04f8a5ef6a414b67dba731e2f4a6af9d0b4f0
parent0179d6988a5f448f2ceef2689eb18bced34778a4 (diff)
parentc9e30c0f72acab790f8f494a37b4316cfcf3f078 (diff)
downloadxsdc-android11-s1-release.tar.gz
Snap for 6348860 from c9e30c0f72acab790f8f494a37b4316cfcf3f078 to rvc-releaseandroid-vts-11.0_r9android-vts-11.0_r8android-vts-11.0_r7android-vts-11.0_r6android-vts-11.0_r5android-vts-11.0_r4android-vts-11.0_r3android-vts-11.0_r2android-vts-11.0_r16android-vts-11.0_r15android-vts-11.0_r14android-vts-11.0_r13android-vts-11.0_r12android-vts-11.0_r11android-vts-11.0_r10android-vts-11.0_r1android-security-11.0.0_r76android-security-11.0.0_r75android-security-11.0.0_r74android-security-11.0.0_r73android-security-11.0.0_r72android-security-11.0.0_r71android-security-11.0.0_r70android-security-11.0.0_r69android-security-11.0.0_r68android-security-11.0.0_r67android-security-11.0.0_r66android-security-11.0.0_r65android-security-11.0.0_r64android-security-11.0.0_r63android-security-11.0.0_r62android-security-11.0.0_r61android-security-11.0.0_r60android-security-11.0.0_r59android-security-11.0.0_r58android-security-11.0.0_r57android-security-11.0.0_r56android-security-11.0.0_r55android-security-11.0.0_r54android-security-11.0.0_r53android-security-11.0.0_r52android-security-11.0.0_r51android-security-11.0.0_r50android-security-11.0.0_r49android-security-11.0.0_r1android-cts-11.0_r9android-cts-11.0_r8android-cts-11.0_r7android-cts-11.0_r6android-cts-11.0_r5android-cts-11.0_r4android-cts-11.0_r3android-cts-11.0_r2android-cts-11.0_r16android-cts-11.0_r15android-cts-11.0_r14android-cts-11.0_r13android-cts-11.0_r12android-cts-11.0_r11android-cts-11.0_r10android-cts-11.0_r1android-11.0.0_r5android-11.0.0_r4android-11.0.0_r3android-11.0.0_r25android-11.0.0_r2android-11.0.0_r17android-11.0.0_r1android11-tests-releaseandroid11-security-releaseandroid11-s1-releaseandroid11-release
Change-Id: I033720641517c677c4ec220ba12d3c8bffab7ce8
-rw-r--r--src/com/android/xsdc/XsdHandler.java18
-rw-r--r--tests/resources/simple_complex_content/api/current.txt8
-rw-r--r--tests/resources/simple_complex_content/simple_complex_content.xsd2
3 files changed, 16 insertions, 12 deletions
diff --git a/src/com/android/xsdc/XsdHandler.java b/src/com/android/xsdc/XsdHandler.java
index 5a7c0d4..a2cc57c 100644
--- a/src/com/android/xsdc/XsdHandler.java
+++ b/src/com/android/xsdc/XsdHandler.java
@@ -204,8 +204,10 @@ public class XsdHandler extends DefaultHandler {
// Tags under simpleType <restriction>. They are ignored.
break;
case "annotation":
- stateStack.peek().deprecated = isDeprecated(state.attributeMap, state.tags);
- stateStack.peek().finalValue = isFinalValue(state.attributeMap, state.tags);
+ stateStack.peek().deprecated = isDeprecated(state.attributeMap, state.tags,
+ stateStack.peek().deprecated);
+ stateStack.peek().finalValue = isFinalValue(state.attributeMap, state.tags,
+ stateStack.peek().finalValue);
stateStack.peek().nullability = getNullability(state.attributeMap, state.tags,
stateStack.peek().nullability);
break;
@@ -656,22 +658,22 @@ public class XsdHandler extends DefaultHandler {
state.finalValue, state.nullability);
}
- private boolean isDeprecated(Map<String, String> attributeMap,List<XsdTag> tags)
- throws XsdParserException {
+ private boolean isDeprecated(Map<String, String> attributeMap,List<XsdTag> tags,
+ boolean deprecated) throws XsdParserException {
String name = attributeMap.get("name");
if ("Deprecated".equals(name)) {
return true;
}
- return false;
+ return deprecated;
}
- private boolean isFinalValue(Map<String, String> attributeMap,List<XsdTag> tags)
- throws XsdParserException {
+ private boolean isFinalValue(Map<String, String> attributeMap,List<XsdTag> tags,
+ boolean finalValue) throws XsdParserException {
String name = attributeMap.get("name");
if ("final".equals(name)) {
return true;
}
- return false;
+ return finalValue;
}
private Nullability getNullability(Map<String, String> attributeMap,List<XsdTag> tags,
diff --git a/tests/resources/simple_complex_content/api/current.txt b/tests/resources/simple_complex_content/api/current.txt
index 601a57e..8ca1793 100644
--- a/tests/resources/simple_complex_content/api/current.txt
+++ b/tests/resources/simple_complex_content/api/current.txt
@@ -41,10 +41,10 @@ package simple.complex.content {
public class SubAddress {
ctor public SubAddress();
- method @Nullable public String getChoice1_optional();
- method @NonNull public String getChoice2_optional();
- method public void setChoice1_optional(@Nullable String);
- method public void setChoice2_optional(@NonNull String);
+ method @Nullable public final String getChoice1_optional();
+ method @NonNull public final String getChoice2_optional();
+ method public final void setChoice1_optional(@Nullable String);
+ method public final void setChoice2_optional(@NonNull String);
}
public final class USAddressP extends simple.complex.content.Address {
diff --git a/tests/resources/simple_complex_content/simple_complex_content.xsd b/tests/resources/simple_complex_content/simple_complex_content.xsd
index dc66cd3..62a6497 100644
--- a/tests/resources/simple_complex_content/simple_complex_content.xsd
+++ b/tests/resources/simple_complex_content/simple_complex_content.xsd
@@ -34,10 +34,12 @@
<xs:complexType name="subAddress">
<xs:choice>
<xs:element name="choice1" type="xs:string">
+ <xs:annotation name="final"/>
<xs:annotation name="nullable"/>
</xs:element>
<xs:element name="choice2" type="xs:string">
<xs:annotation name="nonnull"/>
+ <xs:annotation name="final"/>
</xs:element>
</xs:choice>
</xs:complexType>