src/share/classes/java/beans/MetaData.java
Print this page
@@ -54,10 +54,12 @@
import javax.swing.border.MatteBorder;
import javax.swing.plaf.ColorUIResource;
import sun.swing.PrintColorUIResource;
+import java.util.Objects;
+
/*
* Like the <code>Intropector</code>, the <code>MetaData</code> class
* contains <em>meta</em> objects that describe the way
* classes should express their state in terms of their
* own public APIs.
@@ -132,11 +134,11 @@
Expression newGetExp = new Expression(newInstance, "get", new Object[]{index});
try {
Object oldValue = oldGetExp.getValue();
Object newValue = newGetExp.getValue();
out.writeExpression(oldGetExp);
- if (!MetaData.equals(newValue, out.get(oldValue))) {
+ if (!Objects.equals(newValue, out.get(oldValue))) {
// System.out.println("Not equal: " + newGetExp + " != " + actualGetExp);
// invokeStatement(Array.class, "set", new Object[]{oldInstance, index, oldValue}, out);
DefaultPersistenceDelegate.invokeStatement(oldInstance, "set", new Object[]{index, oldValue}, out);
}
}
@@ -633,11 +635,11 @@
Expression newGetExp = new Expression(newInstance, "get", new Object[]{index});
try {
Object oldValue = oldGetExp.getValue();
Object newValue = newGetExp.getValue();
out.writeExpression(oldGetExp);
- if (!MetaData.equals(newValue, out.get(oldValue))) {
+ if (!Objects.equals(newValue, out.get(oldValue))) {
invokeStatement(oldInstance, "set", new Object[]{index, oldValue}, out);
}
}
catch (Exception e) {
out.getExceptionListener().exceptionThrown(e);
@@ -673,11 +675,11 @@
Expression newGetExp = new Expression(newInstance, "get", new Object[]{oldKey});
try {
Object oldValue = oldGetExp.getValue();
Object newValue = newGetExp.getValue();
out.writeExpression(oldGetExp);
- if (!MetaData.equals(newValue, out.get(oldValue))) {
+ if (!Objects.equals(newValue, out.get(oldValue))) {
invokeStatement(oldInstance, "put", new Object[]{oldKey, oldValue}, out);
} else if ((newValue == null) && !newMap.containsKey(oldKey)) {
// put oldValue(=null?) if oldKey is absent in newMap
invokeStatement(oldInstance, "put", new Object[]{oldKey, oldValue}, out);
}
@@ -897,21 +899,21 @@
// null to defined values after the Windows are made visible -
// special case them for now.
if (!(oldInstance instanceof java.awt.Window)) {
Object oldBackground = c.isBackgroundSet() ? c.getBackground() : null;
Object newBackground = c2.isBackgroundSet() ? c2.getBackground() : null;
- if (!MetaData.equals(oldBackground, newBackground)) {
+ if (!Objects.equals(oldBackground, newBackground)) {
invokeStatement(oldInstance, "setBackground", new Object[] { oldBackground }, out);
}
Object oldForeground = c.isForegroundSet() ? c.getForeground() : null;
Object newForeground = c2.isForegroundSet() ? c2.getForeground() : null;
- if (!MetaData.equals(oldForeground, newForeground)) {
+ if (!Objects.equals(oldForeground, newForeground)) {
invokeStatement(oldInstance, "setForeground", new Object[] { oldForeground }, out);
}
Object oldFont = c.isFontSet() ? c.getFont() : null;
Object newFont = c2.isFontSet() ? c2.getFont() : null;
- if (!MetaData.equals(oldFont, newFont)) {
+ if (!Objects.equals(oldFont, newFont)) {
invokeStatement(oldInstance, "setFont", new Object[] { oldFont }, out);
}
}
// Bounds
@@ -1304,14 +1306,10 @@
internalPersistenceDelegates.put("java.util.JumboEnumSet", new java_util_EnumSet_PersistenceDelegate());
internalPersistenceDelegates.put("java.util.RegularEnumSet", new java_util_EnumSet_PersistenceDelegate());
}
- /*pp*/ static boolean equals(Object o1, Object o2) {
- return (o1 == null) ? (o2 == null) : o1.equals(o2);
- }
-
public synchronized static PersistenceDelegate getPersistenceDelegate(Class type) {
if (type == null) {
return nullPersistenceDelegate;
}
if (Enum.class.isAssignableFrom(type)) {