Skip to content

Commit e8bea65

Browse files
authored
Merge pull request #3383 from harawata/isaccessible-to-canaccess
Replace deprecated `isAccessible()` with `canAccess()`
2 parents 1c21b8d + 82b0f11 commit e8bea65

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/main/java/org/apache/ibatis/executor/loader/ResultLoaderMap.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2024 the original author or authors.
2+
* Copyright 2009-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -235,7 +235,7 @@ private Configuration getConfiguration() {
235235
+ FACTORY_METHOD + "] is not static.");
236236
}
237237

238-
if (!factoryMethod.isAccessible()) {
238+
if (!factoryMethod.canAccess(null)) {
239239
configurationObject = AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () -> {
240240
try {
241241
factoryMethod.setAccessible(true);

src/main/java/org/apache/ibatis/scripting/xmltags/OgnlMemberAccess.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2024 the original author or authors.
2+
* Copyright 2009-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public Object setup(OgnlContext context, Object target, Member member, String pr
4848
Object result = null;
4949
if (isAccessible(context, target, member, propertyName)) {
5050
AccessibleObject accessible = (AccessibleObject) member;
51-
if (!accessible.isAccessible()) {
51+
if (!accessible.canAccess(target)) {
5252
result = Boolean.FALSE;
5353
accessible.setAccessible(true);
5454
}

src/test/java/org/apache/ibatis/submitted/custom_collection_handling/CustomObjectFactory.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2024 the original author or authors.
2+
* Copyright 2009-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,13 +48,13 @@ private <T> T instantiateClass(Class<T> type, List<Class<?>> constructorArgTypes
4848
Constructor<T> constructor;
4949
if (constructorArgTypes == null || constructorArgs == null) {
5050
constructor = type.getDeclaredConstructor();
51-
if (!constructor.isAccessible()) {
51+
if (!constructor.canAccess(null)) {
5252
constructor.setAccessible(true);
5353
}
5454
return constructor.newInstance();
5555
}
5656
constructor = type.getDeclaredConstructor(constructorArgTypes.toArray(new Class[constructorArgTypes.size()]));
57-
if (!constructor.isAccessible()) {
57+
if (!constructor.canAccess(null)) {
5858
constructor.setAccessible(true);
5959
}
6060
return constructor.newInstance(constructorArgs.toArray(new Object[constructorArgs.size()]));

0 commit comments

Comments
 (0)