-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore HCR Failures for current session #347 #558
base: master
Are you sure you want to change the base?
Conversation
Hi @jukzi , |
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaHotCodeReplaceListener.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/ErrorDialogWithToggle.java
Outdated
Show resolved
Hide resolved
As this seems to be new feature can it wait for M1? |
Yeah sure, no problem 👍 |
d780561
to
1a41681
Compare
1a41681
to
34717d0
Compare
This pull request changes some projects for the first time in this development cycle.
An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patch
Further information are available in Common Build Issues - Missing version increments. |
Hi @jukzi , can you try committing again ? |
/** | ||
* Preference storage for active debug session. | ||
*/ | ||
public static final Map<String, Object> debugSessionVariables = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wjy is this a static map and why it is a map at all? If with the the "session" the whole Eclipse session meant, no map is needed, a Boolean flag will be enough. If with the "session" a specific debug session meant, the code is plain wrong as it would affect all other debug sessions runnijg in parallel or after the current one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be used to store pref values only for current debug session. other pref values can also be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other pref values in the sense other features preferences value only for current debug session in future if it requires.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be used to store pref values only for current debug session
Then a static map is wrong. Try to start two sessions in parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other pref values in the sense other features preferences value only for current debug session in future if it requires.
If future requires, the code can be refactored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove static then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other pref values in the sense other features preferences value only for current debug session in future if it requires.
If future requires, the code can be refactored.
will replace it with boolean flag as you suggested since its more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasnt able to check without static but now I have modified it further to make it more debug sessions specific.
- Tested with parallel debug launches
024d81c
to
fe1273b
Compare
ba0149c
to
42d462f
Compare
@@ -43,25 +47,37 @@ public class ErrorDialogWithToggle extends ErrorDialog { | |||
/** | |||
* The message displayed to the user, with the toggle button | |||
*/ | |||
private String fToggleMessage= null; | |||
private String fToggleMessage1 = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style: please don't initialize fields to default values, java does it automatically, but during debugging you will jump from field to field just because of this meaningless instructions here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove default initialization
fStore.setValue(fPreferenceKey, !getToggleButton().getSelection()); | ||
if (fToggleButton2 != null) { | ||
try { | ||
JDIDebugTarget.hcrDebugSessionErrors.put(target.getName(), fToggleButton2.getSelection()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inappropriate place / dependency. The ErrorDialogWithToggle
has no relationship to JDIDebugTarget
and shouldn't have.
The HotCodeReplaceErrorDialog
class that extends this dialog is the right place for HCR related code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I couldn't find any ways to access same from JavaHotCodeReplaceListener class, which checks the boolean value.
/** | ||
* The preference store which will be affected by the toggle button | ||
*/ | ||
IPreferenceStore fStore= null; | ||
|
||
public ErrorDialogWithToggle(Shell parentShell, String dialogTitle, String message, IStatus status, String preferenceKey, String toggleMessage1, String toggleMessage2, IPreferenceStore store) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggleMessage2 should be documented to be optional, but ideally it should be in HotCodeReplaceErrorDialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will provide documentation like you suggested
/** | ||
* HCR failure alert pref for current debug session. | ||
*/ | ||
public static final Map<String, Boolean> hcrDebugSessionErrors = new ConcurrentHashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still can't unerstand why do you use static map here, if you want restrict errors dialog for the specific current session. But same target can be started multiple times!
Why not add a simple not static boolean field & getter on JDIDebugTarget
and instead of doing lookup on a non-inuque name only apply the new code for the known instances of the debug targets.
So NOT
failurePopUp = JDIDebugTarget.hcrDebugSessionErrors.getOrDefault(target.getName(), false);
but
if(target instanceof JDIDebugTarget jdiTarget){
failurePopUp = jdiTarget.shouldReportHcrErrors();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will do the same you suggested
47e421d
to
c40c922
Compare
Adds a checkbox to the HCR error alert box that allows users to ignore HCR failures only for the current debug session, rather than applying it to all future debug sessions. Fixes : eclipse-jdt#347
c40c922
to
ce76980
Compare
Enhancement : #347
Adds a checkbox to the HCR error alert box that allows users to ignore HCR failures only for the current debug session, rather than applying it to all future debug sessions.
Fixes : #347
What it does
How to test
Author checklist