Skip to content

Commit 073d353

Browse files
committed
Set the maven compiler plugin release config to version 8. Replace usages of Class.newInstance(), which is deprecated in Java 9.
1 parent cf2d6b8 commit 073d353

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

examples/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</licenses>
1818
<properties>
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
<java.version>1.8</java.version>
20+
<java.version>8</java.version>
2121
</properties>
2222
<dependencies>
2323
<dependency>
@@ -55,6 +55,7 @@
5555
<configuration>
5656
<source>${java.version}</source>
5757
<target>${java.version}</target>
58+
<release>${java.version}</release>
5859
</configuration>
5960
</plugin>
6061
</plugins>

gen/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</licenses>
1818
<properties>
1919
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20-
<java.version>1.8</java.version>
20+
<java.version>8</java.version>
2121
<exec.mainClass>com.softlayer.api.gen.Main</exec.mainClass>
2222
</properties>
2323
<dependencies>
@@ -70,6 +70,7 @@
7070
<configuration>
7171
<source>${java.version}</source>
7272
<target>${java.version}</target>
73+
<release>${java.version}</release>
7374
</configuration>
7475
</plugin>
7576
</plugins>

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</scm>
4646
<properties>
4747
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
48-
<java.version>1.8</java.version>
48+
<java.version>8</java.version>
4949
</properties>
5050
<repositories>
5151
<repository>
@@ -91,6 +91,7 @@
9191
<configuration>
9292
<source>${java.version}</source>
9393
<target>${java.version}</target>
94+
<release>${java.version}</release>
9495
</configuration>
9596
</plugin>
9697
<plugin>

src/main/java/com/softlayer/api/Mask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ protected <T extends Mask> T withSubMask(String name, Class<T> maskClass) {
2929
T subMask = (T) subMasks.get(name);
3030
if (subMask == null) {
3131
try {
32-
subMask = maskClass.newInstance();
32+
subMask = maskClass.getDeclaredConstructor().newInstance();
3333
} catch (Exception e) {
3434
throw new RuntimeException();
3535
}

src/main/java/com/softlayer/api/RestApiClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,12 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
449449
return Proxy.newProxyInstance(getClass().getClassLoader(),
450450
new Class<?>[] { method.getReturnType() }, asyncProxy);
451451
} else if ("withNewMask".equals(method.getName()) && noParams) {
452-
mask = (Mask) method.getReturnType().newInstance();
452+
mask = (Mask) method.getReturnType().getDeclaredConstructor().newInstance();
453453
maskString = null;
454454
return mask;
455455
} else if ("withMask".equals(method.getName()) && noParams) {
456456
if (mask == null) {
457-
mask = (Mask) method.getReturnType().newInstance();
457+
mask = (Mask) method.getReturnType().getDeclaredConstructor().newInstance();
458458
maskString = null;
459459
}
460460
return mask;

src/main/java/com/softlayer/api/json/GsonJsonMarshallerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ private Entity readForThisType(JsonReader in) throws IOException {
208208
// Begin/end object (and the first "complexType" property) are done outside of here
209209
Entity entity;
210210
try {
211-
entity = typeClass.newInstance();
212-
} catch (InstantiationException | IllegalAccessException e) {
211+
entity = typeClass.getDeclaredConstructor().newInstance();
212+
} catch (ReflectiveOperationException e) {
213213
throw new RuntimeException(e);
214214
}
215215
Map<String, Object> unknownProperties = new HashMap<>();

0 commit comments

Comments
 (0)