Mercurial > hg > openjdk > jdk9 > jdk
changeset 16953:0cbd3417cc9d
8178077: jshell tool: crash on ctrl-up or ctrl-down
Summary: When looking up a private method, using the ConsoleReader.class, instead of getClass(), which may return a subclass.
Reviewed-by: rfield
author | jlahoda |
---|---|
date | Thu, 06 Apr 2017 16:17:03 +0200 |
parents | c89044066843 |
children | 98dd9af9e290 |
files | src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Thu Apr 06 14:38:15 2017 +0100 +++ b/src/jdk.internal.le/share/classes/jdk/internal/jline/extra/EditingHistory.java Thu Apr 06 16:17:03 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,7 +74,7 @@ //in.resetPromptLine(in.getPrompt(), in.getHistory().current().toString(), -1); //but that would mean more re-writing on the screen, (and prints an additional //empty line), so using setBuffer directly: - Method setBuffer = in.getClass().getDeclaredMethod("setBuffer", String.class); + Method setBuffer = ConsoleReader.class.getDeclaredMethod("setBuffer", String.class); setBuffer.setAccessible(true); setBuffer.invoke(in, in.getHistory().current().toString());