8079084: Behavior of BeanProperty.enumerationValues() contradicts spec
Reviewed-by: alexsch, malenkov
This commit is contained in:
parent
435c40f71b
commit
6a907dfc02
@ -125,7 +125,6 @@ public final class PropertyInfo {
|
||||
put(Name.visualUpdate, annotation.visualUpdate());
|
||||
put(Name.description, annotation.description());
|
||||
String[] values = annotation.enumerationValues();
|
||||
if (0 < values.length) {
|
||||
try {
|
||||
Object[] array = new Object[3 * values.length];
|
||||
int index = 0;
|
||||
@ -160,7 +159,6 @@ public final class PropertyInfo {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Class<?> getPropertyType() {
|
||||
return this.type;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2015, 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
|
||||
@ -20,12 +20,14 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.beans.BeanProperty;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.util.Arrays;
|
||||
/*
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 4058433
|
||||
* @summary Tests the BeanProperty annotation
|
||||
@ -34,7 +36,10 @@ import java.util.Arrays;
|
||||
*/
|
||||
public class TestBeanProperty {
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class<?>[] types = {B.class, BL.class, BLF.class, E.class, H.class, P.class, VU.class, D.class, EV.class, EVL.class, EVX.class};
|
||||
Class<?>[] types =
|
||||
{B.class, BL.class, BLF.class, E.class, H.class, P.class,
|
||||
VU.class, D.class, EVD.class, EVE.class, EV.class, EVL.class,
|
||||
EVX.class};
|
||||
for (Class<?> type : types) {
|
||||
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
|
||||
if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
|
||||
@ -77,6 +82,14 @@ public class TestBeanProperty {
|
||||
BeanUtils.reportPropertyDescriptor(pd);
|
||||
throw new Error("enumerationValues from another package");
|
||||
}
|
||||
if (EVD.class == type && !isEV(pd)) {
|
||||
BeanUtils.reportPropertyDescriptor(pd);
|
||||
throw new Error("EV:"+ pd.getValue("enumerationValues"));
|
||||
}
|
||||
if (EVE.class == type && !isEV(pd)) {
|
||||
BeanUtils.reportPropertyDescriptor(pd);
|
||||
throw new Error("EV:"+ pd.getValue("enumerationValues"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,6 +232,34 @@ public class TestBeanProperty {
|
||||
}
|
||||
}
|
||||
|
||||
public static class EVD {
|
||||
|
||||
private int value;
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@BeanProperty()
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EVE {
|
||||
|
||||
private int value;
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@BeanProperty(enumerationValues = {})
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EV {
|
||||
private int value;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user