diff options
author | Sorin Basca <sorinbasca@google.com> | 2023-04-24 20:20:46 +0000 |
---|---|---|
committer | Sorin Basca <sorinbasca@google.com> | 2023-04-27 13:55:24 +0100 |
commit | 5352bb310d9910c5f2445375ec31ce05eba276b8 (patch) | |
tree | 238134d008177eed3ba497ad66ccc1c2feb5e58f /src/patches | |
parent | 1072bf42a1e5de2023e61dc0a64d44965d59e532 (diff) | |
parent | 49e794037c6be07053ce930f71f9c31b09180920 (diff) | |
download | snakeyaml-5352bb310d9910c5f2445375ec31ce05eba276b8.tar.gz |
Move snakeyaml to v1.32
Fixes: 277745486
Test: m snakeyaml testng TestParameterInjector tradefed-lib-core
Test: atest CtsLibcoreOjTestCases
Change-Id: Ib0fd20ff2b8fa7b865a3e6b8a8360e462fcb1d39
Diffstat (limited to 'src/patches')
-rw-r--r-- | src/patches/android/CompactConstructor.patch | 22 | ||||
-rw-r--r-- | src/patches/android/Constructor.patch | 24 | ||||
-rw-r--r-- | src/patches/android/PropertyTest.patch | 21 | ||||
-rw-r--r-- | src/patches/android/PropertyUtils.patch | 161 | ||||
-rw-r--r-- | src/patches/android/Representer.patch | 44 |
5 files changed, 84 insertions, 188 deletions
diff --git a/src/patches/android/CompactConstructor.patch b/src/patches/android/CompactConstructor.patch deleted file mode 100644 index c935ecdd..00000000 --- a/src/patches/android/CompactConstructor.patch +++ /dev/null @@ -1,22 +0,0 @@ -# HG changeset patch -# Parent 802af3ea9a2228c074259858b737e2cda0d22a7c -diff --git a/src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java b/src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java ---- a/src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java -+++ b/src/main/java/org/yaml/snakeyaml/extensions/compactnotation/CompactConstructor.java -@@ -15,7 +15,6 @@ - */ - package org.yaml.snakeyaml.extensions.compactnotation; - --import java.beans.IntrospectionException; - import java.util.HashMap; - import java.util.Iterator; - import java.util.List; -@@ -186,7 +185,7 @@ - * - * @throws IntrospectionException - */ -- protected String getSequencePropertyName(Class<?> bean) throws IntrospectionException { -+ protected String getSequencePropertyName(Class<?> bean) { - Set<Property> properties = getPropertyUtils().getProperties(bean); - for (Iterator<Property> iterator = properties.iterator(); iterator.hasNext();) { - Property property = iterator.next(); diff --git a/src/patches/android/Constructor.patch b/src/patches/android/Constructor.patch deleted file mode 100644 index 15886668..00000000 --- a/src/patches/android/Constructor.patch +++ /dev/null @@ -1,24 +0,0 @@ -# HG changeset patch -# Parent 6211618dbbb85e16ccdfea2c1c68e098ac1bc333 - -diff --git a/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java b/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java ---- a/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java -+++ b/src/main/java/org/yaml/snakeyaml/constructor/Constructor.java -@@ -15,7 +15,6 @@ - */ - package org.yaml.snakeyaml.constructor; - --import java.beans.IntrospectionException; - import java.math.BigDecimal; - import java.math.BigInteger; - import java.util.ArrayList; -@@ -303,8 +302,7 @@ - return object; - } - -- protected Property getProperty(Class<? extends Object> type, String name) -- throws IntrospectionException { -+ protected Property getProperty(Class<? extends Object> type, String name) { - return getPropertyUtils().getProperty(type, name); - } - } diff --git a/src/patches/android/PropertyTest.patch b/src/patches/android/PropertyTest.patch new file mode 100644 index 00000000..b01f2df6 --- /dev/null +++ b/src/patches/android/PropertyTest.patch @@ -0,0 +1,21 @@ +diff --git a/src/test/java/org/yaml/snakeyaml/introspector/PropertyTest.java b/src/test/java/org/yaml/snakeyaml/introspector/PropertyTest.java +--- a/src/test/java/org/yaml/snakeyaml/introspector/PropertyTest.java (revision 9c05d7250e565df10bdf0da92bf89a1c39e5c073) ++++ b/src/test/java/org/yaml/snakeyaml/introspector/PropertyTest.java (date 1662964689659) +@@ -32,17 +32,6 @@ + + public class PropertyTest { + +- @Test +- public void testMethodPropertyToString() throws IntrospectionException { +- for (PropertyDescriptor property : Introspector.getBeanInfo(TestBean1.class) +- .getPropertyDescriptors()) { +- if (property.getName().equals("text")) { +- MethodProperty prop = new MethodProperty(property); +- assertEquals("text of class java.lang.String", prop.toString()); +- } +- } +- } +- + @Test + public void testGetFieldPropertyAnnotation() { + PropertyUtils propertyUtils = new PropertyUtils(); diff --git a/src/patches/android/PropertyUtils.patch b/src/patches/android/PropertyUtils.patch index dc72ef3c..9a9d6013 100644 --- a/src/patches/android/PropertyUtils.patch +++ b/src/patches/android/PropertyUtils.patch @@ -1,12 +1,12 @@ -# HG changeset patch -# Parent 698e9f1d6348fc1066ceaac7d264cbbf63bdcd21 diff --git a/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java b/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java +index 8afc5761..208c9351 100644 --- a/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java +++ b/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java -@@ -15,11 +15,7 @@ +@@ -13,12 +13,7 @@ */ package org.yaml.snakeyaml.introspector; +-import java.beans.FeatureDescriptor; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; @@ -15,104 +15,69 @@ diff --git a/src/main/java/org/yaml/snakeyaml/introspector/PropertyUtils.java b/ import java.lang.reflect.Modifier; import java.util.Collection; import java.util.HashMap; -@@ -37,64 +33,31 @@ - private BeanAccess beanAccess = BeanAccess.DEFAULT; - private boolean allowReadOnlyProperties = false; - -- protected Map<String, Property> getPropertiesMap(Class<?> type, BeanAccess bAccess) -- throws IntrospectionException { -+ protected Map<String, Property> getPropertiesMap(Class<?> type, BeanAccess bAccess) { - if (propertiesCache.containsKey(type)) { - return propertiesCache.get(type); - } - - Map<String, Property> properties = new LinkedHashMap<String, Property>(); -- boolean inaccessableFieldsExist = false; -- switch (bAccess) { -- case FIELD: -- for (Class<?> c = type; c != null; c = c.getSuperclass()) { -- for (Field field : c.getDeclaredFields()) { -- int modifiers = field.getModifiers(); -- if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) -- && !properties.containsKey(field.getName())) { -- properties.put(field.getName(), new FieldProperty(field)); -- } -+ for (Class<?> c = type; c != null; c = c.getSuperclass()) { -+ for (Field field : c.getDeclaredFields()) { -+ int modifiers = field.getModifiers(); -+ if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) -+ && !properties.containsKey(field.getName())) { -+ properties.put(field.getName(), new FieldProperty(field)); - } - } -- break; -- default: -- // add JavaBean properties -- for (PropertyDescriptor property : Introspector.getBeanInfo(type) -- .getPropertyDescriptors()) { -- Method readMethod = property.getReadMethod(); -- if (readMethod == null || !readMethod.getName().equals("getClass")) { -- properties.put(property.getName(), new MethodProperty(property)); -- } -- } -+ } +@@ -65,47 +60,14 @@ public class PropertyUtils { + } -- // add public fields -- for (Class<?> c = type; c != null; c = c.getSuperclass()) { -- for (Field field : c.getDeclaredFields()) { -- int modifiers = field.getModifiers(); -- if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) { -- if (Modifier.isPublic(modifiers)) { -- properties.put(field.getName(), new FieldProperty(field)); -- } else { -- inaccessableFieldsExist = true; -- } -- } -- } -- } -- break; + Map<String, Property> properties = new LinkedHashMap<String, Property>(); +- boolean inaccessableFieldsExist = false; +- if (bAccess == BeanAccess.FIELD) { +- for (Class<?> c = type; c != null; c = c.getSuperclass()) { ++ for (Class<?> c = type; c != null; c = c.getSuperclass()) { + for (Field field : c.getDeclaredFields()) { +- int modifiers = field.getModifiers(); +- if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) +- && !properties.containsKey(field.getName())) { +- properties.put(field.getName(), new FieldProperty(field)); +- } - } -- if (properties.isEmpty() && inaccessableFieldsExist) { -- throw new YAMLException("No JavaBean properties found in " + type.getName()); +- } +- } else {// add JavaBean properties +- try { +- for (PropertyDescriptor property : Introspector.getBeanInfo(type) +- .getPropertyDescriptors()) { +- Method readMethod = property.getReadMethod(); +- if ((readMethod == null || !readMethod.getName().equals("getClass")) +- && !isTransient(property)) { +- properties.put(property.getName(), new MethodProperty(property)); +- } - } - propertiesCache.put(type, properties); - return properties; - } - -- public Set<Property> getProperties(Class<? extends Object> type) throws IntrospectionException { -+ public Set<Property> getProperties(Class<? extends Object> type) { - return getProperties(type, beanAccess); - } - -- public Set<Property> getProperties(Class<? extends Object> type, BeanAccess bAccess) -- throws IntrospectionException { -+ public Set<Property> getProperties(Class<? extends Object> type, BeanAccess bAccess) { - if (readableProperties.containsKey(type)) { - return readableProperties.get(type); - } -@@ -103,8 +66,7 @@ - return properties; - } - -- protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess bAccess) -- throws IntrospectionException { -+ protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess bAccess) { - Set<Property> properties = new TreeSet<Property>(); - Collection<Property> props = getPropertiesMap(type, bAccess).values(); - for (Property property : props) { -@@ -115,13 +77,11 @@ - return properties; +- } catch (IntrospectionException e) { +- throw new YAMLException(e); +- } +- +- // add public fields +- for (Class<?> c = type; c != null; c = c.getSuperclass()) { +- for (Field field : c.getDeclaredFields()) { +- int modifiers = field.getModifiers(); +- if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers)) { +- if (Modifier.isPublic(modifiers)) { +- properties.put(field.getName(), new FieldProperty(field)); +- } else { +- inaccessableFieldsExist = true; +- } +- } +- } +- } +- } +- if (properties.isEmpty() && inaccessableFieldsExist) { +- throw new YAMLException("No JavaBean properties found in " + type.getName()); ++ int modifiers = field.getModifiers(); ++ if (!Modifier.isStatic(modifiers) && !Modifier.isTransient(modifiers) ++ && !properties.containsKey(field.getName())) { ++ properties.put(field.getName(), new FieldProperty(field)); ++ } ++ } } + propertiesCache.put(type, properties); + return properties; +@@ -113,10 +75,6 @@ public class PropertyUtils { -- public Property getProperty(Class<? extends Object> type, String name) -- throws IntrospectionException { -+ public Property getProperty(Class<? extends Object> type, String name) { - return getProperty(type, name, beanAccess); - } + private static final String TRANSIENT = "transient"; -- public Property getProperty(Class<? extends Object> type, String name, BeanAccess bAccess) -- throws IntrospectionException { -+ public Property getProperty(Class<? extends Object> type, String name, BeanAccess bAccess) { - Map<String, Property> properties = getPropertiesMap(type, bAccess); - Property property = properties.get(name); - if (property == null || !property.isWritable()) { +- private boolean isTransient(FeatureDescriptor fd) { +- return Boolean.TRUE.equals(fd.getValue(TRANSIENT)); +- } +- + public Set<Property> getProperties(Class<? extends Object> type) { + return getProperties(type, beanAccess); + } diff --git a/src/patches/android/Representer.patch b/src/patches/android/Representer.patch deleted file mode 100644 index 187853ea..00000000 --- a/src/patches/android/Representer.patch +++ /dev/null @@ -1,44 +0,0 @@ -# HG changeset patch -# Parent 44449b0d7ff73bbda13c28f2ebd4e8257c67a181 -diff --git a/src/main/java/org/yaml/snakeyaml/representer/Representer.java b/src/main/java/org/yaml/snakeyaml/representer/Representer.java ---- a/src/main/java/org/yaml/snakeyaml/representer/Representer.java -+++ b/src/main/java/org/yaml/snakeyaml/representer/Representer.java -@@ -15,7 +15,6 @@ - */ - package org.yaml.snakeyaml.representer; - --import java.beans.IntrospectionException; - import java.util.ArrayList; - import java.util.Arrays; - import java.util.Iterator; -@@ -24,7 +23,6 @@ - import java.util.Set; - - import org.yaml.snakeyaml.DumperOptions.FlowStyle; --import org.yaml.snakeyaml.error.YAMLException; - import org.yaml.snakeyaml.introspector.Property; - import org.yaml.snakeyaml.nodes.MappingNode; - import org.yaml.snakeyaml.nodes.Node; -@@ -45,11 +43,7 @@ - - protected class RepresentJavaBean implements Represent { - public Node representData(Object data) { -- try { -- return representJavaBean(getProperties(data.getClass()), data); -- } catch (IntrospectionException e) { -- throw new YAMLException(e); -- } -+ return representJavaBean(getProperties(data.getClass()), data); - } - } - -@@ -233,8 +227,7 @@ - * - JavaBean to inspect the properties - * @return properties to serialise - */ -- protected Set<Property> getProperties(Class<? extends Object> type) -- throws IntrospectionException { -+ protected Set<Property> getProperties(Class<? extends Object> type) { - return getPropertyUtils().getProperties(type); - } - } |