Skip to content

Commit

Permalink
Use Java 11 language features where possible (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Jun 25, 2022
1 parent 8e186e7 commit 6a5c4fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void premain(String agentArguments, Instrumentation instrumentatio
} else if (t.startsWith("error=")) {
Listener.ERROR = new PrintWriter(new OutputStreamWriter(new FileOutputStream(t.substring(6)), StandardCharsets.UTF_8));
} else if (t.startsWith("listener=")) {
ActivityListener.LIST.add((ActivityListener) AgentMain.class.getClassLoader().loadClass(t.substring(9)).newInstance());
ActivityListener.LIST.add((ActivityListener) AgentMain.class.getClassLoader().loadClass(t.substring(9)).getDeclaredConstructor().newInstance());
} else if (t.equals("dumpatshutdown")) {
Runtime.getRuntime().addShutdownHook(new Thread("File handles dumping shutdown hook") {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testInstrumentations() throws Exception {
OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets.UTF_8);
PrintWriter pw = new PrintWriter(osw)) {
CheckClassAdapter.verify(classReader, false, pw);
errors = new String(baos.toByteArray(), StandardCharsets.UTF_8);
errors = baos.toString(StandardCharsets.UTF_8);
}
assertTrue("Verification failed for " + c + "\n" + errors, errors.isEmpty());
}
Expand Down

0 comments on commit 6a5c4fa

Please sign in to comment.