aws / aws/aws-sdk-java-v2

DynamoDB Enhanced Client: @DynamoDbIgnore fails in some property mapping scenarios

Aperta
#7,328 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug dynamodb-enhanced p2
Lingua principale
Java
Stelle
2.6k
Fork
1k
Merge medio
2g 9h
PR unite (30g)
51

Descrizione

### Describe the bug

The DynamoDB Enhanced Client fails to recognize a valid setter when a bean has both `getA()` and `isA()` methods, even when `isA()` is annotated with `@DynamoDbIgnore`.

### Regression Issue

- [x] Select this option if this issue appears to be a regression.

### Expected Behavior

`a` should be mapped using:

```text
getA(): int
setA(int): void
```

and `isA()` should be ignored because of `@DynamoDbIgnore`.

### Current Behavior

The `setA(int)` setter is not recognized, and the `a` attribute is not mapped correctly.

This appears to be caused by the interaction between JavaBeans property introspection and the two getters:

```text
getA(): int
isA(): boolean
```

Even though `isA()` is annotated with `@DynamoDbIgnore`, it still affects property discovery.

### Reproduction Steps

```java
@DynamoDbBean
public class Foo {
private int a;

@DynamoDbAttribute("A")
public int getA() {
return a;
}

public void setA(int a) {
this.a = a;
}

@DynamoDbIgnore
public boolean isA() {
return false;
}
}
```

### Possible Solution

_No response_

### Additional Information/Context

The same class is mapped correctly by the AWS SDK for Java v1, which does not rely on the same JavaBeans property conventions as the v2 Enhanced Client.

### AWS Java SDK version used

2.51.3

### JDK version used

11.0.32.1

### Operating System and version

Windows 11

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal codice del bean e del mapping delle proprietà di AWS SDK v2 Enhanced Client, concentrandoti sull’introspezione dei JavaBeans e su come viene applicato @DynamoDbIgnore. Riproduci il problema con la classe Foo fornita nella versione 2.51.3; il lavoro è completato quando getA()/setA(int) mappa l’attributo A mentre isA() annotato viene ignorato, con un test di regressione che copra lo scenario.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.