8131347: new @BeanProperty annotation: inconsistent behavior for "enumerationValues"

Reviewed-by: avstepan
This commit is contained in:
Sergey Bylokhov 2016-12-15 20:09:13 +03:00
parent d845c9092c
commit 2c877752fe
2 changed files with 10 additions and 5 deletions

View File

@ -183,9 +183,10 @@ public class PropertyDescriptor extends FeatureDescriptor {
setShortDescription(description.toString());
}
Object values = info.get(PropertyInfo.Name.enumerationValues);
if (values != null) {
setValue(PropertyInfo.Name.enumerationValues.name(), values);
if (values == null) {
values = new Object[0];
}
setValue(PropertyInfo.Name.enumerationValues.name(), values);
this.baseName = base;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ import java.beans.PropertyDescriptor;
/**
* @test
* @bug 8130937
* @bug 8130937 8131347
* @summary Tests the booleans properties of the BeanProperty annotation
* @library ..
*/
@ -76,6 +76,9 @@ public final class TestBooleanBeanProperties {
if (getValue(pd, "visualUpdate") != isVS) {
throw new RuntimeException("required should be: " + isVS);
}
if (pd.getValue("enumerationValues") == null) {
throw new RuntimeException("enumerationValues should be empty array");
}
}
private static boolean getValue(PropertyDescriptor pd, String value) {
@ -107,7 +110,8 @@ public final class TestBooleanBeanProperties {
}
@BeanProperty(bound = true, expert = true, hidden = true,
preferred = true, required = true, visualUpdate = true)
preferred = true, required = true, visualUpdate = true,
enumerationValues = {})
public void setValue(int value) {
this.value = value;
}