Skip to content

Commit 5c70fc3

Browse files
committed
[java] Fixing use of deprecated methods
1 parent 9923436 commit 5c70fc3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

java/client/src/org/openqa/selenium/remote/Augmenter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ protected <X> X performAugmentation(CompoundHandler handler, X from) {
147147
.asSubclass(from.getClass());
148148

149149
try {
150-
return (X) loaded.newInstance();
150+
return (X) loaded.getDeclaredConstructor().newInstance();
151151
} catch (ReflectiveOperationException e) {
152152
throw new RuntimeException("Unable to create subclass", e);
153153
}

java/client/src/org/openqa/selenium/support/PageFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private static <T> T instantiatePage(WebDriver driver, Class<T> pageClassToProxy
125125
Constructor<T> constructor = pageClassToProxy.getConstructor(WebDriver.class);
126126
return constructor.newInstance(driver);
127127
} catch (NoSuchMethodException e) {
128-
return pageClassToProxy.newInstance();
128+
return pageClassToProxy.getDeclaredConstructor().newInstance();
129129
}
130130
} catch (ReflectiveOperationException e) {
131131
throw new RuntimeException(e);

java/client/src/org/openqa/selenium/support/pagefactory/Annotations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public By buildBy() {
7070
try {
7171
builder = annotation.annotationType()
7272
.getAnnotation(PageFactoryFinder.class).value()
73-
.newInstance();
73+
.getDeclaredConstructor().newInstance();
7474
} catch (ReflectiveOperationException e) {
7575
// Fall through.
7676
}

0 commit comments

Comments
 (0)