Skip to content

Commit b0f7868

Browse files
committed
Build using JDK 8
1 parent f1ee2e4 commit b0f7868

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040

4141
<properties>
4242
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
43-
<maven.compiler.release>11</maven.compiler.release>
43+
<maven.compiler.source>8</maven.compiler.source>
44+
<maven.compiler.target>8</maven.compiler.target>
4445
<xcodeScheme>Debug</xcodeScheme>
4546
</properties>
4647

src/main/java/ca/weblite/nativeutils/NativeUtils.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ public static Path extractFromJar(String path, Class<?> source) throws IOExcepti
9494
temp.toFile().deleteOnExit();
9595

9696
// Open and check input stream
97-
InputStream is = source.getResourceAsStream(path);
98-
if (is == null) {
99-
throw new FileNotFoundException("File " + path + " was not found inside JAR.");
100-
}
101-
102-
try (is; OutputStream out = Files.newOutputStream(temp, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING)) {
103-
is.transferTo(out);
97+
try (InputStream is = source.getResourceAsStream(path)) {
98+
if (is == null) {
99+
throw new FileNotFoundException("File " + path + " was not found inside JAR.");
100+
}
101+
try (OutputStream out = Files.newOutputStream(temp, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING)) {
102+
byte[] buffer = new byte[1024];
103+
int len;
104+
while ((len = is.read(buffer)) != -1) {
105+
out.write(buffer, 0, len);
106+
}
107+
}
104108
}
105109

106110
return temp;

src/main/java/ca/weblite/objc/Client.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ public Message[] buildMessageChain(Object... parameters){
498498
}
499499
messages.add(buffer);
500500
}
501-
502-
return messages.toArray(Message[]::new);
501+
502+
return messages.toArray(new Message[messages.size()]);
503503
}
504504

505505

src/main/java/ca/weblite/objc/foundation/NSRange.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.sun.jna.Structure;
44

5+
import java.util.ArrayList;
56
import java.util.List;
67

78
/**
@@ -62,6 +63,9 @@ public int getLength() {
6263

6364
@Override
6465
protected List<String> getFieldOrder() {
65-
return List.of("location","length");
66+
List<String> order = new ArrayList<>();
67+
order.add("location");
68+
order.add("length");
69+
return order;
6670
}
6771
}

0 commit comments

Comments
 (0)