Commit 25426aae authored by Asier Lostalé's avatar Asier Lostalé
Browse files

fixed ISSUE-39262: deprecation warnings on cli with jdk11 compiling src-test

Those warnings were caused by the usage of Field.isAccessible API which
was deprecated in JDK9. Now that minimum JDK has been raised to 11 by
FR-44064, it is possible to use Field.canAccess API, which was introduced
in JDK9, to replace the former.
parent 71d1708f
......@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2015-2018 Openbravo SLU
* All portions are Copyright (C) 2015-2020 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
......@@ -64,9 +64,7 @@ public class ParameterCdiTestRule<T> implements MethodRule {
throws Throwable {
Field targetField = getTargetField(target);
// replace isAccesible() with canAccess() when JDK9 becomes the minimum supported version
@SuppressWarnings("all")
boolean isAccesible = targetField.isAccessible();
boolean isAccesible = targetField.canAccess(target);
if (!isAccesible) {
targetField.setAccessible(true);
}
......
......@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2016-2018 Openbravo SLU
* All portions are Copyright (C) 2016-2020 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
......@@ -147,9 +147,7 @@ public class DisplayLogicAtServerLevelTest extends WeldBaseTest {
try {
evaluateDisplayLogicAtServerLevel = clazz
.getDeclaredMethod("evaluateDisplayLogicAtServerLevel", String.class, String.class);
// replace isAccesible() with canAccess() when JDK9 becomes the minimum supported version
@SuppressWarnings("all")
boolean originallyAccessible = evaluateDisplayLogicAtServerLevel.isAccessible();
boolean originallyAccessible = evaluateDisplayLogicAtServerLevel.canAccess(field);
evaluateDisplayLogicAtServerLevel.setAccessible(true);
boolean evaluatedDisplayLogic = (boolean) evaluateDisplayLogicAtServerLevel.invoke(field,
displayLogicEvaluatedInServerExpression, "0");
......
......@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2013-2018 Openbravo SLU
* All portions are Copyright (C) 2013-2020 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
......@@ -38,9 +38,7 @@ public class HiddenObjectHelper {
public static void initializeField(Object obj, String fieldName) throws Exception {
Field fld = getField(obj, fieldName);
// replace isAccesible() with canAccess() when JDK9 becomes the minimum supported version
@SuppressWarnings("all")
boolean originallyAccessible = fld.isAccessible();
boolean originallyAccessible = fld.canAccess(obj);
fld.setAccessible(true);
Object o = get(obj, fieldName);
......@@ -61,9 +59,7 @@ public class HiddenObjectHelper {
public static Object get(Object obj, String fieldName) throws Exception {
Field fld = getField(obj, fieldName);
// replace isAccesible() with canAccess() when JDK9 becomes the minimum supported version
@SuppressWarnings("all")
boolean originallyAccessible = fld.isAccessible();
boolean originallyAccessible = fld.canAccess(obj);
fld.setAccessible(true);
Object o = fld.get(obj);
......@@ -76,9 +72,7 @@ public class HiddenObjectHelper {
*/
public static void set(Object obj, String fieldName, Object value) throws Exception {
Field fld = getField(obj, fieldName);
// replace isAccesible() with canAccess() when JDK9 becomes the minimum supported version
@SuppressWarnings("all")
boolean originallyAccessible = fld.isAccessible();
boolean originallyAccessible = fld.canAccess(obj);
fld.setAccessible(true);
fld.set(obj, value);
fld.setAccessible(originallyAccessible);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment