|
1 | 1 | /* |
2 | | - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
@@ -198,14 +198,17 @@ protected int setBreakpoints(int id) { |
198 | 198 | return setBreakpointsFromTestSource(launchOptions.sourceFilename, id); |
199 | 199 | } |
200 | 200 |
|
201 | | - // transforms class with the specified id (see {@code ClassTransformer}) |
202 | | - // and executes "redefine" jdb command for {@code launchOptions.debuggeeClass}. |
203 | | - // returns reply for the command. |
| 201 | + // transforms class with the specified id (see {@code ClassTransformer}), |
| 202 | + // executes "redefine" jdb command for {@code launchOptions.debuggeeClass} |
| 203 | + // and updates source path by using "use" jdb command. |
| 204 | + // returns reply for the commands. |
204 | 205 | protected List<String> redefineClass(int id, String... compilerOptions) { |
205 | 206 | verifySourceFilename(); |
206 | 207 | String transformedClassFile = ClassTransformer.fromTestSource(launchOptions.sourceFilename) |
207 | 208 | .transform(id, launchOptions.debuggeeClass, compilerOptions); |
208 | | - return jdb.command(JdbCommand.redefine(launchOptions.debuggeeClass, transformedClassFile)); |
| 209 | + List<String> reply = jdb.command(JdbCommand.redefine(launchOptions.debuggeeClass, transformedClassFile)); |
| 210 | + reply.addAll(jdb.command(JdbCommand.use(Paths.get(transformedClassFile).getParent().toString()))); |
| 211 | + return reply; |
209 | 212 | } |
210 | 213 |
|
211 | 214 | // gets full test source path for the given test filename |
|
0 commit comments