From e8dfd8ce54a2835721e576662de32c628ffcc892 Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Mon, 20 Apr 2020 13:37:38 +0200 Subject: [PATCH] 8243154: Fix deprecation warnings in failure handler Reviewed-by: dholmes --- make/test/BuildFailureHandler.gmk | 2 +- .../failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java | 4 ++-- .../classes/jdk/test/failurehandler/value/ValueHandler.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/make/test/BuildFailureHandler.gmk b/make/test/BuildFailureHandler.gmk index 40dcd4116ca..3af3c5b5d17 100644 --- a/make/test/BuildFailureHandler.gmk +++ b/make/test/BuildFailureHandler.gmk @@ -52,7 +52,7 @@ $(eval $(call SetupJavaCompilation, BUILD_FAILURE_HANDLER, \ SETUP := GENERATE_OLDBYTECODE, \ SRC := $(FH_BASEDIR)/src/share/classes $(FH_BASEDIR)/src/share/conf, \ BIN := $(FH_SUPPORT)/classes, \ - DISABLED_WARNINGS := deprecation serial try, \ + DISABLED_WARNINGS := serial try, \ COPY := .properties, \ CLASSPATH := $(JTREG_JAR) $(TOOLS_JAR), \ JAR := $(FH_JAR), \ diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java index 767e86648b8..7e1c2ebd8a9 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler { if (HAS_NATIVE_LIBRARY && "windows".equals(OS.current().family)) { try { Field field = process.getClass().getDeclaredField("handle"); - boolean old = field.isAccessible(); + boolean old = field.canAccess(process); try { field.setAccessible(true); long handle = field.getLong(process); diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueHandler.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueHandler.java index 971f11ef243..f2959fb804b 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueHandler.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ public final class ValueHandler { delimiter = delimiter == null ? " " : delimiter; Class parserClass = property.parser(); try { - field.set(object, parserClass.newInstance().parse( + field.set(object, parserClass.getDeclaredConstructor().newInstance().parse( field.getType(), value, delimiter)); } catch (ReflectiveOperationException | IllegalArgumentException e) { throw new InvalidValueException(