aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSundong Ahn <sundongahn@google.com>2020-03-30 06:19:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-03-30 06:19:26 +0000
commit0be301d6033204d4668b2c26f84fd851dd7cf068 (patch)
tree78d04f8a5ef6a414b67dba731e2f4a6af9d0b4f0
parent1ab6c756e647992f3bf839b0ef8da692201f5e67 (diff)
parent4ae92fd3595abf9e48128e6d85a9279c63402bd3 (diff)
downloadxsdc-android11-qpr2-release.tar.gz
Change-Id: If18613fd8004a6a3bedb7302fe9f9f5d1b8a0408
-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>