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

Fix possible InaccessibleObjectExceptions during debugging session #7633

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

mbien
Copy link
Member

@mbien mbien commented Aug 2, 2024

Opening the popup table during a breakpoint for a variable can cause reflection exceptions due to JDK module encapsulation.

e.g for a java.util.Date field:
image
click on the > symbol

java.lang.reflect.InaccessibleObjectException: Unable to make field long sun.util.calendar.BaseCalendar$Date.cachedFixedDateJan1 accessible: module java.base does not "opens sun.util.calendar" to unnamed module @493e76e4
	at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:388)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:364)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:312)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:177)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.setFieldsValues(VariableMirrorTranslator.java:253)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.createMirrorObject(VariableMirrorTranslator.java:239)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.createMirrorObject(VariableMirrorTranslator.java:114)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.setFieldsValues(VariableMirrorTranslator.java:261)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.createMirrorObject(VariableMirrorTranslator.java:239)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.createMirrorObject(VariableMirrorTranslator.java:114)
	at org.netbeans.modules.debugger.jpda.models.VariableMirrorTranslator.createMirrorObject(VariableMirrorTranslator.java:95)
	at org.netbeans.modules.debugger.jpda.models.AbstractVariable.createMirrorObject(AbstractVariable.java:463)
	at org.netbeans.modules.debugger.jpda.ui.models.VariablesTableModel.getValueOf(VariablesTableModel.java:193)
	at org.netbeans.modules.debugger.jpda.ui.models.VariablesTableModel.getValueAt(VariablesTableModel.java:158)
	at org.netbeans.spi.viewmodel.Models$DelegatingTableModel.getValueAt(Models.java:2249)
	at org.netbeans.modules.debugger.jpda.ui.models.NumericDisplayFilter.getValueAt(NumericDisplayFilter.java:112)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1439)
	at org.netbeans.modules.debugger.jpda.ui.models.VariablesTreeModelFilter.getValueAt(VariablesTreeModelFilter.java:530)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1439)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1441)
	at org.netbeans.spi.viewmodel.Models$CompoundTableModel.getValueAt(Models.java:1441)
	at org.netbeans.spi.viewmodel.Models$CompoundModel.getValueAt(Models.java:4563)
[catch] at org.netbeans.modules.viewmodel.TreeModelNode$MyProperty.run(TreeModelNode.java:1883)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)

Opening the popup table during a breakpoint for a variable can cause
reflection exceptions due to JDK module encapsulation.

e.g for a java.util.Date field:
Unable to make field long 
sun.util.calendar.BaseCalendar$Date.cachedFixedDateJan1 accessible:
module java.base does not "opens sun.util.calendar" to unnamed module
@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) debugger labels Aug 2, 2024
@mbien mbien added this to the NB23 milestone Aug 2, 2024
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

Makes sense to me. Thank you for fixing this!

@ebarboni ebarboni merged commit f6423d2 into apache:delivery Aug 6, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) debugger Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants