Skip to content

Commit 947f9c4

Browse files
Avoid attempt to create property accessor for array and inaccessible types.
Original Pull Request: #3318
1 parent 2d7fba5 commit 947f9c4

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/main/java/org/springframework/data/aot/AotMappingContext.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.springframework.data.aot;
1717

18+
import java.lang.reflect.InaccessibleObjectException;
19+
1820
import org.apache.commons.logging.Log;
1921
import org.apache.commons.logging.LogFactory;
2022
import org.springframework.data.mapping.Association;
@@ -53,16 +55,22 @@ class AotMappingContext extends
5355
*/
5456
public void contribute(Class<?> entityType) {
5557

56-
BasicPersistentEntity<?, AotPersistentProperty> entity = getPersistentEntity(entityType);
58+
try {
59+
BasicPersistentEntity<?, AotPersistentProperty> entity = getPersistentEntity(entityType);
5760

58-
if (entity != null) {
61+
if (entity != null && !entity.getType().isArray()) {
5962

60-
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
61-
if (instantiator instanceof EntityInstantiatorSource source) {
62-
source.getInstantiatorFor(entity);
63-
}
63+
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
64+
if (instantiator instanceof EntityInstantiatorSource source) {
65+
source.getInstantiatorFor(entity);
66+
}
6467

65-
propertyAccessorFactory.initialize(entity);
68+
propertyAccessorFactory.initialize(entity);
69+
}
70+
} catch (InaccessibleObjectException exception) {
71+
if(logger.isInfoEnabled()) {
72+
logger.info("Unable to contribute bytecode accessor for [%s]".formatted(entityType), exception);
73+
}
6674
}
6775
}
6876

0 commit comments

Comments
 (0)