Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SougandhS
Copy link
Contributor

@SougandhS SougandhS commented Nov 11, 2024

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
image

image

What it does

How to test

Author checklist

@SougandhS
Copy link
Contributor Author

Hi @jukzi ,
Could u please check this too when you are free.

@jukzi
Copy link
Contributor

jukzi commented Nov 11, 2024

As this seems to be new feature can it wait for M1?

@SougandhS
Copy link
Contributor Author

As this seems to be new feature can it wait for M1?

Yeah sure, no problem 👍

@SougandhS SougandhS force-pushed the HCR_Ignore_this_session branch 2 times, most recently from d780561 to 1a41681 Compare November 11, 2024 12:37
@jukzi jukzi force-pushed the HCR_Ignore_this_session branch from 1a41681 to 34717d0 Compare November 26, 2024 14:03
@eclipse-jdt-bot
Copy link
Contributor

eclipse-jdt-bot commented Nov 26, 2024

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
org.eclipse.jdt.debug.ui/pom.xml

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
From 0349b257fde13d14d686530066272b272ced6329 Mon Sep 17 00:00:00 2001
From: Eclipse JDT Bot <[email protected]>
Date: Wed, 27 Nov 2024 11:45:24 +0000
Subject: [PATCH] Version bump(s) for 4.35 stream


diff --git a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
index e651afa8a..06269ace2 100644
--- a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.debug.ui; singleton:=true
-Bundle-Version: 3.13.600.qualifier
+Bundle-Version: 3.13.700.qualifier
 Bundle-Activator: org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.debug.ui/pom.xml b/org.eclipse.jdt.debug.ui/pom.xml
index dceebf96d..597b96d81 100644
--- a/org.eclipse.jdt.debug.ui/pom.xml
+++ b/org.eclipse.jdt.debug.ui/pom.xml
@@ -18,7 +18,7 @@
   </parent>
   <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.debug.ui</artifactId>
-  <version>3.13.600-SNAPSHOT</version>
+  <version>3.13.700-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
   <properties>
   	<defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>
-- 
2.47.0

Further information are available in Common Build Issues - Missing version increments.

@SougandhS
Copy link
Contributor Author

Hi @jukzi , can you try committing again ?

/**
* Preference storage for active debug session.
*/
public static final Map<String, Object> debugSessionVariables = new ConcurrentHashMap<>();
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will remove static then.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@SougandhS SougandhS force-pushed the HCR_Ignore_this_session branch 4 times, most recently from 024d81c to fe1273b Compare November 27, 2024 11:43
@SougandhS SougandhS force-pushed the HCR_Ignore_this_session branch from ba0149c to 42d462f Compare December 3, 2024 06:27
@@ -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;
Copy link
Member

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.

Copy link
Contributor Author

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());
Copy link
Member

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.

Copy link
Contributor Author

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) {
Copy link
Member

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

Copy link
Contributor Author

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<>();
Copy link
Member

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();
}

Copy link
Contributor Author

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

@SougandhS SougandhS force-pushed the HCR_Ignore_this_session branch 2 times, most recently from 47e421d to c40c922 Compare December 5, 2024 10:00
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
@SougandhS SougandhS force-pushed the HCR_Ignore_this_session branch from c40c922 to ce76980 Compare January 1, 2025 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please provide a "Ignore in this session" option if hot-code replace fails
4 participants