-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: 4.3.2, 4.9.0
-
Component/s: POJO
-
None
Running this test code multiple times returns different results:
package org.bson.codecs.pojo;
import org.bson.codecs.pojo.annotations.BsonProperty;
public class Test {
public static final String TEST_ID = "testId";
public static final String BATCH_ID = "batchId";
@BsonProperty(TEST_ID)
private String testId;
@BsonProperty(BATCH_ID)
private String batchId;
public Test(String testId, String batchId) {
this.testId = testId;
this.batchId = batchId;
}
public String getTestId() {
return testId;
}
public void setTestId(String testId) {
this.testId = testId;
}
public boolean isTestId() {
return !testId.isEmpty();
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public boolean isBatchId() {
return !batchId.isEmpty();
}
public static void main(String[] args) {
PropertyModelBuilder<?> property1 = ClassModel.builder(Test.class).getProperty(BATCH_ID);
PropertyModelBuilder<?> property2 = ClassModel.builder(Test.class).getProperty(TEST_ID);
System.out.println(((PropertyAccessorImpl) property1.getPropertyAccessor()).getPropertyMetadata().getError());
System.out.println(((PropertyAccessorImpl) property2.getPropertyAccessor()).getPropertyMetadata().getError());
}
}
Results:{{{}
Property 'batchId' in Test, has differing data types: TypeData{type=String} and TypeData{type=Boolean}.
null{}}}
{{null
Property 'testId' in Test, has differing data types: TypeData{type=String} and TypeData{type=Boolean}.}}
{{Property 'batchId' in Test, has differing data types: TypeData{type=String} and TypeData{type=Boolean}.
Property 'testId' in Test, has differing data types: TypeData{type=String} and TypeData{type=Boolean}.}}
{{null
null}}