diff options
author | Tor Norbye <tnorbye@google.com> | 2014-04-10 10:54:17 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-04-10 10:54:39 -0700 |
commit | a3e39abd38575b02d52f05e041d797023938b6d6 (patch) | |
tree | 9791aa0988b9461354c1b1476b43bcb6b9ea7da4 /java/debugger/impl/src | |
parent | 1fff8e2b7bbcfdea262d3782d4307ca6437da2a3 (diff) | |
download | idea-a3e39abd38575b02d52f05e041d797023938b6d6.tar.gz |
Snapshot 1fff8e2b7bbcfdea262d3782d4307ca6437da2a3 from idea/136.1153 of git://git.jetbrains.org/idea/community.git
38fcfd7: try more times to connect.
6ee4e80: Merge remote-tracking branch 'origin/master'
85a331b: Cleanup.
8e1582f: Logging an error in case of absent name.
a33ddd0: Add javadoc for RemoteConnectionType.
c9cea5a9: introduce OrphanGuardian interface
cadf1a7: Revert "hide on UI changes"
62aa21e: avoid status bar update on internal method invoke
c22e314: nashorn conditional breakpoints
f03bc43: cleanup
9372f19: Merge remote-tracking branch 'origin/master'
94f10a8: PY-12367 loop variable should be able to reuse on else clause
1b02460: Merge remote-tracking branch 'origin/master'
c5294ef: hide on UI changes
3259502: fix NavBar blinking and resizing on Color Scheme change due to async tweaking in updateUI
97eddb8: Cosmetic changes
fede9f0: IDEA-122004 Good code red: surefire.forkNumber in pom.xml
ce5b97b: fix UI artifacts after exiting from Presentation Mode
6937b4d: StatusBar doesn't change when perform Prefs -> Appearance -> Custom fonts
30d235a: IdeRepaintManager.checkThreadViolations fix during readExternal()
7346c3a: [log] IDEA-118576 Don't show focus border
cc3e0c5: [log] IDEA-115902 Fix visual artifact on multi-repo indicator
1146cb6: Merge remote-tracking branch 'origin/master'
b991bf2d: PY-11948 Run manage.py Task ignores environment variables defined for Django Console (and Python Console)
4e41daa: IDEA-122035 accept "tip" as a branch name
d8382bb: remove unneeded read actions
d348434: Merge remote-tracking branch 'origin/master'
6248e48: moved unittest tests to env tests
ee3f4a5: IDEA-121966 Multiple-Cursor Jumpy
f8e6cc5: moved doctest tests to env tests
914621c: IDEA-121295 If property part of new property - unable to introduce new property - Maven
db3f6c7: replace tuple with list quick fix for tuple item assignment inspection
e7cd951: Presentation Mode: common font-size fix for all toolwindows with trees
12f048b: Wrap with Exception quick fix for Raising a string exception inspection
0f5ec0d: Propose change signature quick fix for Method signature does not match signature of overridden method inspection
07ecf4d: cleanup
6ac6f4d: IDEA-122049 Mac messages: in some cases parent window is incorrectly detected
5ee2cf2: added remove return statement quick fix for the return from init inspection
1f0a076: IDEA-121995 Code selection is reseted on last line with space if Allow placement of caret inside tabs is enabled
54936df: added rename argument quick fix for the Incorrect call arguments inspection
45020ac: move quick fix to proper place
e909581: IDEA-105935 Facets excluded from detection are still added on maven reimport
57c3cd7: Optimize MavenImporter.getSuitableImporters()
f0d0f8e: do not build VFS for excluded directories
34c32ea: added remove argument quick fix to the Incorrect call arguments inspection
09f5de3: extract variables and method
a145844: EA-54755 - NPE: FoldingUtil.findFoldRegionStartingAtLine
c37d1ba: libs for project templates
f7fad4d: IDEA-88443 (Run Inspection by Name: Inspections with same name are only shown once)
8521b4b: improve description
b65fdb0: show problematic plugins
13cfa13: extract method
06cf300: Merge branch 'master' of git.labs.intellij.net:idea/community
4c2734f: after uninstall of a plugin the button should show "Restart"
1dbe26d: IDEA-121807 - Tomcat Logs doesn't show
02ad525: init nashorn conditional breakpoints
6cd525c: cleanup
1a0161e: cleanup
e939ebe: reverted fix for IDEA-121961 because of failing test
8b32345: after installation of a plugin the button still shows "Install"
e6e0d7d: Merge branch 'master' of git.labs.intellij.net:idea/community
1cb358a: IDEA-85098 Intellij is not supporting groovy-eclipse-compiler
fd27d3b: IDEA-120027 - Import Git-cloud apps from sources - register VCS roots
787d068: filter by custom/bundled
b5950b4: IDEA-120027 - Import Git-cloud apps from sources - single account for all run configurations
53f918f: align text and make header bg match to html bg
cf75116: IDEA-121695 Add managed dependency info on hover over icon
2e5effd: IDEA-121762 Navigate->Select in: for Spring MVC Controller
e301c4e: [log] IDEA-118328 Fix already disposed
5a621a4: updated plugin should have MODIFIED foreground
b46a3bb: hide description on custom plugin panel
f8155ad: add description label
6c9c9f6: added change signature refactoring quick fix to the Incompatible signatures of _new_ and _init_ inspection
bb243be: cleanup
35312e5: Merge remote-tracking branch 'origin/master'
e02ca9c: comment testdata
11cea86: New messages are implemented for jdk7 and latter jdk versions for now.
753497a3: Merge remote-tracking branch 'origin/master'
ec60260: Merge remote-tracking branch 'origin/master'
2a91bce: highlight both incompatible signatures
a314614: Merge remote-tracking branch 'origin/master'
fefdeaf: Merge remote-tracking branch 'origin/master'
4afd85f: Merge branch 'python-fixes'
4b797eb: cleanup
168dbd0: IDEA-117493 Native crash in Mac launcher
88ed475: diff: do not show 'No changes' panel when 'Can not show diff' should be shown
a148809: Merge remote-tracking branch 'origin/master'
88c7d65: lambda completion: strip unnecessary parenthesis, generate parameter names as for override/implement (IDEA-121947)
f738b51: diamonds: incompatible error due to cls class in default package fixed - cls file doesn't process declarations! = need to switch to mirror (IDEA-121866)
2fefd8b: abstract method overrides abstract: distinguish between covariant returns (IDEA-121930)
d851893: testdata for IDEA-121999
b89dc39: testdata for IDEA-121884
7d747c8: new inference: most specific with same functional interface presence
465325a: new inference: nested varargs
144684b: java 8: accept diamonds in method calls
4112118: new inference: choose most specifics between 2 varargs methods
1ee2942: new inference: raw inner class method qualifier fixed (IDEA-121909)
912e13d: add junit4.jar together with hamcrest (IDEA-119626)
10760d9: new inference: process varargs as separate method candidate/separate phase
69c6b7b: java 8 compatibility
62328cf: inspections: completely ignore currently unresolved scopes
fb20169: new inference: reject varargs as method reference target
0f40eb9: new inference: exact method reference is not pertinent to applicability when target type is type parameter
f64d239: rename suggestions: suggest new names for non-variables (IDEA-121982)
05289e4: Guess Python language level from SDKs of opened projects if it's not available for PSI elements
c1346de: codestyle cleanup
ee5f16e: added Add Exception base class quick fix to the Exception doesn't inherit from standard ''Exception'' class inspection
5b8ebf6: EA-54668 - NPE: Breakpoint.setLogEnabled
90c4e07: codestyle cleanup
61b1cb2: do not store reference to PsiElement in qFix, codestyle cleanup, cleanup deprecated method usage
28cc4de: Fix mappings initialization.
41c9f6f: NotNull annotations and checks.
4334ce2: Cleanup (pointless exceptions; field extracted; formatting)
278b8d6: IDEA-121928 Grails 2.3.7 reloading is broken in IntelliJ 13.0.2
bb5986d: IDEA-121938 (serialPersistentFields trips "MismatchedReadAndWriteOfArray" inspection)
93974a3: fix description
58a3377: IDEA-121920 (X/X can be replaced with X - incorrect arithmetic)
7f73d5e: Merge remote-tracking branch 'origin/master'
177f404: Fixed Nullable/NotNull annotations.
f058695: IDEA-54387 (type annotations in introduce parameter)
6bf6d11: Cleanup (pointless exceptions; typos; formatting)
e5fb46b: VcsIntegrationEnablerTest implemented for mock test vcs
c6a1054: IDEA-121990 Filter by old branch fails with exception if full graph is not loaded
7a73eee: IDEA-121961 Debugger: evaluate from variables doesn't include context
e2eaf0d: Support 'overwrite' parameter for maven-resources-plugin.
2acd338: rebase several problems fixed
2ace00e: cleanup deprecated method usage
298c646: @NotNull getStatementList
20269f4: do not store reference to PyFile in add function quickfix
5bd7108: code style cleanup
546c689: get rid of deprecated functions use
85b572b: do not store reference to PsiElement in add field quickfix
a3343a3: Merge remote-tracking branch 'origin/master'
f96d241: turn java messages on
d2d3aa0: IDEA-116134 Inherited maven resource filtering is not applied
532e079: do not suggest python run configuration for scratch files
fc9c134: fix ui under darcula
b00e8a2: [log] IDEA-121992 Recalculate old heads values
813b0dc: Merge remote-tracking branch 'origin/master'
8d41286: Package method for checking version added
4155d62: code style cleanup
757f50b: code style cleanup
f5ac410: cleanup
37c7fca: removed state from add super call quickfix, added tests
08e2f55: refactoring - following CR-IC-4721
c415007: Cleanup (formatting; javadoc)
64c651e: IDEA-54397 (type annotations in override/implement)
3f3e064: IDEA-54396 (type annotations in "Wrap Return Value")
b360456: IDEA-104026 (Java type annotation formatting)
744d7c8: java: "wrap return value" bean formatting fixed
1540e54: Cleanup (pointless exceptions; formatting; nullability)
fb7c097: IDEA-121834 (generic exception substituted)
378b22a: added format specifier quick fix for the python string format inspection
041748c: Package method for checking version addded
35cc71f: eclipse compiler updated to the latest version
7c1a2d6: [git log] Add icon for deep compare function
741e9b9: [log] IDEA-121875 Enable manual commits sorting in VCS that support it
ee27725: make mouse shortcut for adding/removing carets configurable (IDEA-80056)
2ba4ece: Merge remote-tracking branch 'origin/master'
8dd9cc4: added remove dictionary key quick fix for the Dictionary contains duplicate keys inspection
f0a66f7: [log] Fix HashImpl equals
5bd2cdd: [log] HashImpl: remove the caching map
0affa6a: dom: use ReflectionUtil.getClass{Public,Declared}Methods to skip synthetic methods (which change from one java version to another)
aea8f6d: added move except clause quick fix for the Bad except clauses order inspection
39ca570: IDEA-121935 (Inspections: Overloaded variable argument method: every non-problematic method adds a warning)
8d172ac: IDEA-121952 (Java 1.8: "Interface may be annotated with @FunctionalInterface" inspection reports already annotated interfaces)
b1977ea: added Remove assignment quick fix for the Assigning function call that doesn't return anything inspection
81ca41b: test fixed
b6b5a68: fixed PY-11981 "PEP 8 naming convention violation" inspection treats class attributes as function variables
f791db7: fixed PY-10342 Instance attribute defined outside init: detect functions called in init
4d76bdb: Statement list cannot be null
f839260: Merge remote-tracking branch 'origin/master'
6f6d813: fixed PY-12033 PyAbstractClass invalid warning for properties.
85d52dd: IDEA-118296 Impossible to "Prevent App Nap" for the 133.* in MacOSX 10.9 (Mavericks)
c748cef: artwork update for 13.1
2ee2888: attempt to clarify the inspection description
c517b2c: add test
5a0f6fb: Merge remote-tracking branch 'origin/master'
4b96dbf: IDEA-116029 in-place introduce variable name suggestions popup disappears before I can select anything PARTIAL ROLLBACK, fix to be continued...
bd199f1: Merge remote-tracking branch 'origin/master'
b3dfff9: partially reverting 10f6a0f: psi depedent index get buffering status updates because they are applied to unsaved committed documents
255512d: Merge remote-tracking branch 'origin/master'
fa8f612: Move ssh connection provider to remote-run.
1357e2b: use a more memory-efficient structure to hold a long indexed file list
a0885a9: Merge remote-tracking branch 'origin/master'
23b20a8: Merge remote-tracking branch 'origin/master'
69c9865: fix test
bbf4741: - Removed dependency on remote-run in vagrant plugin (PY-12254). - New api for path mappings providers (old left for compatibility with RubyMine and PhpStorm) - Fix launching of Python console for remote interpreter.
e5d9dff: add -> keyword to cpp and make sure it's lexed correctly (IDEA-121906)
5e71180: add a proxy test that fails on java 8
ffa6350: enable new nashorn variables view by default
c60c038: style: remove unnecessary method
965aafa: for unsaved documents with committed state and psi backed index use the same logic as for unsaved documents with plain index
8c56a6b: github tests with wrong notifications fixed
8ce415d: [log] Fix tests. (fix wrong line separators)
ff002de: [log] Remake VcsLogJoiner without recursion.
7ac6e11: [log] IDEA-118947 Implement special highlighting for cherry-pick
881645a: [log] Add ability to listen to possible filter changes
eff05ea: [log] Add ability to reuse branches filter popup
d282a0e: [log] Expose VcsLogRefs into API
3d81303: [log] Expose the VcsLogFilterUi to the API, let set filter value
a54504c: [log] repaint ui after adding highlighter
542550f: [log] make constants final
7066854: [log] Introduce VcsLogDataProvider to the API as part of VcsLogDataHolder
e10b40f: [log] Expose VcsLogUI & DataPack to the vcs-log-api
55c79a0: [log] Make it possible to add VcsLogHighlighters to the log table.
0bca3c6: [log] Remove obsolete CommitCell & its Renderer
61e2ecc: renderValue — add XValue parameter to simplify, why we need to create
b6738e4: Merge branch 'master' of git.labs.intellij.net:idea/community
8e48244: IDEA-119822 - Support Heroku Debug
1052ef2: less garbage
35a1eba: optimisation: use AtomicLazyNullableValue to avoid extra indirection and save memory
cce38ff: cleanup
799041b: notnull
f60abae: NPE protection
e6806dd: remove old code commented code
d7464ee: support run configurations
5717d3a: make public and refactor to make accessible from Search Everywhere
20d9cb0: make public
010566a: IDEA-58818 (SSR: strange highlighting of try-catch in preview pane)
4e1ef49: cleanup
52a92f2: Gradle: detect Scala plugin presence dynamically (to avoid cyclical plugin dependency)
0333bd1: Local History: do not load ignored files and folders into VFS
4fbcf60: cleanup
7a80e9c: fix duplicates and wrong order in search everywhere
48d4765: Platform: check and warn when trying to edit non-project files (do not update notifications, when not necessary)
8358761: IDEA-121898 (Add Don't ignore String for inspection "Number costructor..")
5e097fa: IDEA-121088 (Java Inspections: Type may be weakened readObject() writeObject())
68b7c88: add fourth checkbox to description
cbff651: Platform: check and warn when trying to edit non-project files (disabled in tests)
c0847ee: Merge remote-tracking branch 'origin/master'
590f153: Platform: check and warn when trying to edit non-project files
14a5a6b: gradient colors for buttons
ba067df: initial
774559b: cleanup
9a337d5: IDEA-121494 (Inspection "method overrides private method" can be improved)
cc18c42: add table header with sorters
a4d8900: always use gradient
c559f14: diff: fix UnknownFileType detection
87113dc: re-arrange downloads label
311ff47: github: remove usage of deprecated VcsNotifier API
c3b9b90: [log] IDEA-117553 Optimize details loading: don't parse Changes at once
645caac: 134->136
1168c7b: Cleanup (common method; pointless assertion; formatting)
66eaa91: nashorn: continue variables presentation simplify V8Scope
3627c46: dfa: treat different constants with same values as same (IDEA-121837)
8084cb0: Rebase feature for update project implemented
fc56bcb: Increment hours in comments
044acff: IDEA-121835 "Breakpoints" UI looks clumsy
aa2b1cb: always fold long command line in console (IDEA-121453)
6de56f5: some CharSequence utility methods
defc8ce: IDEA-121800 Live templates are shown in 'Find in Path' dialog if 'autopopup completion' is enabled
dccb826: new inference: cache substitutor for outer call conflict resolution
a5adf26: IDEA-88643 delete item from list of breakpoints by pressing delete key: selection should not return to position 1.
424cffe: [git log] IDEA-121818 Accept HEAD as branch name
a393838: [log] IDEA-121817 Fix keeping selection
70c52ca: [log] Remove the obsolete NoGraphTableModel & simplify the code which used to use it
f41b964: [log] unused
611e758: StringExpressionHelper: JSF->Java-Analysis
54fccb5: IDEA-121828 (Add single member static import intention should be available on incomplete code)
6d2515c: fix IDEA-112499 for single member static imports
811fdf5: fix IDEA-112499 for on demand imports
b52ec5f: IDEA-121784 (Add on demand static import intention not available when single-member static import present)
8853670: IDEA-119908 Smart Step doesn't work for classes generated with java 8
e36425ec: Moved LanguageLevel.forFile() to PyUtil.getLanguageLevelForVirtualFile()
8870abb: Get Python language level from PsiElements where possible instead VirtualFiles
7438ce8: added create property quick fix for the property access inspection
ead71e4: IDEA-121645 Breakpoints conversion: disabled condition is just lost
60fa43c: use constant for history id
15cb81b: continue decouple xdebugger ex ui — XValue/XStackFrame impl
8238972: added Make public quick fix for the protected member access inspection
f471666: fixed NPE in BreakpointManager.getPsiFile
aae9011: Merge branch 'python-fixes'
155f99a: added create property quick fix
d9ae792: IDEA-121806 Breakpoints fail after file modification
e7713c6: test fixed
b5b1518: cleanup
1f2f49e: Platform: do not reverse tabs order on project reopening (IDEA-121816) + new tabs should open on the right (OC-3490)
2b21896: enable multiple carets by default (IDEA-80056)
44646fe: comment added for CPP-147 fix
6da7645: EA-54287 (diagnostic)
eab3611: fixed code style
25c45d1: added rename quick fix to the protected member inspection
d29cdc8: Merge remote-tracking branch 'origin/master'
2527c3a: Merge remote-tracking branch 'origin/master'
6f729cf: EnforcedPlainTextFileTypeManager: pass project as a parameter [CR-IC-4656]
8e176ce: EnforcedPlainTextFileTypeManager: Fix broken file status update sequence (PhpCompletionTest.testExcludedFiles()) [CR-IC-4656]
a5f3040: Use HttpMethod#hasBeenUsed to prevent NPE, if server response was not received
218756a: Merge remote-tracking branch 'origin/master'
3b799e4: filtering templates by frameworks
2670f2d: yellow code
6a440f7: IDEA-121259 Generated toString() placed in incorrect class
3588589: IDEA-121803 (Windows date/time format translation error)
c49bd80: svn: Perform saving all documents during move/rename in SvnFileSystemListener only if operations are related to files under svn - otherwise it could break functionality not related to svn (like renaming file under git) if svn plugin is enabled
b6f778a: disable test navigation outside test roots
43d2b2e: default mapping for SelectAllOccurrences action (IDEA-80056)
da2374a: if facet has associated framework show 'add facet' instead of 'add framework support' dialog in Project Structure (IDEA-120643, IDEA-113833)
594cad9: WEB-10567 Implemented a way to stop run configurations when starting incompatible ones. The idea is that some run configurations may implement CompatibilityAwareRunProfile.isCompatibleWith method and signal that they are not compatible with the run configuration being started so a dialog is displayed to a user and the user can choose to stop incompatible configurations. +review CR-IC
b814f54: IDEA-121403 Live Template: "Surround with tag" should not be applicable while editing XmlAttributeValue
8db0857: better category name
40c45ca: do not add generic builder for "category" templates (e.g. Java FX)
79feee3: EditorActionHandler API cleanup (IDEA-80056)
f4bbcbc: notify listener on task cancellation
a53cccd: IDEA-71048 (test fixed)
4b6b959: system.out removed
3b408e6: Merge remote-tracking branch 'origin/master'
38bdd09: Open terminal in folder that was dragged to it from project view (IDEA-115145).
4586d4a: IDEA-71048 (system date/time formats on Windows)
6a119d1: platform: batch load system date/time formats
c4e7e1f: Cleanup (pointless exceptions; formatting)
177a1d9: drop deprecated stuff
e5740c5: Return true from dispatch in case of event processing.
38764d4: Merge remote-tracking branch 'origin/master'
8f8ef28: IDEA-114457 Undocked 'project' tool window doesn't always automatically hide when I double-click to open a file Animation fix (don't freeze EDT, use Animator), request focus fix.
5ac6d6f: cleanup
e02f4ef: Terminal should override IDE shortcuts by default (IDEA-118837).
fd85821: Merge remote-tracking branch 'origin/master'
026cf99: PY-12022 Clicking "Rerun" button of "Run manage.py Task..." doesn't stop current process
eb2b2db: don't treat live template complete() as second basic completion invocation (HtmlCompletionTest.testXhtmlCompletionInHtml)
6ebe750: dumb-aware actions in the Messages panel
557cca9: IDEA-108072 (Don't suggest to add on-demand static import for the current class)
8d6f72b: IDEA-121756 Don't provide postfix completion options in java string literals
c738a20: IDEA-89020 Disappears value of the variables standing next in Live templates IDEA-121634 Live Template: template is broken with 3+ variables and leading space
31dbd88: use constant empty array (following CR-IC-4606)
8537206: Extract RSS parsing logic and thus remove Atlassian plugin sources completely
1f4a22c: Fix Flex tests + IDEA-121771 <fx:Script> tag autocomplete broken
b08a89d: cache scope attribute keys to reduce daemon garbage
ddd7530: IDEA-121609 Cannot find '+' + using Find in Path
f723320: Merge branch 'master' of git.labs.intellij.net:idea/community
c66ea39: Local History fix: load file children on fileCreated event (second try)
1c7fa2c: IDEA-120027 - Import Git-cloud apps from sources - Heroku
5eab7d1: try single member static import first in live templates
364298f: IDEA-121738 Shift-click in gutter doesn't create 'no suspend' breakpoint anymore
a0a8fe7: fixed editBreakpoint
912e749: diff: do not apply single change multiple times
3403bab: IDEA-12609 diff: do not consider equal changes as conflict
5379407: diff: do not create empty change on applying modified part of 'modified - deleted' conflict
a0c4ea5: diff: rewrite MergeBuilder and MergeList
fc8f64b: merge: rewrite MergeBuilder
90390cf: merge: add test
0adb7cc: @NotNull
bbe7af5: move Inject SQL tip to intelliLang-java
f14856e: speeding up 'Synchronizing output directories': avoid unnecessary rootsChanges events if many output directories were created during compilation (ZD-22766, IDEA-116757)
06b2ee3: fixed PY-11293 namedtuple underscore-methods are not protected
f00ecc2: Merge remote-tracking branch 'origin/master'
2a07097: [git log] don't query ALL when branches to query are specified
397158b: VcsNotifier methods renamed according to their notification groups
24ce9d6: Exception throw for Unit Test mode removed from GitBranchOperation
6ef9934: CPP-147 PSI is build for files from another project +review CR-IC
64ab58d: nullability
c221e1a: cleanup
0d4f12a: nashorn: initial getReceiverVariable impl
5ab90de: continue nashorn: variables view
c750301: nullability
86d092e: nullability
c97dd80: IDEA-98746 Annoying editor tab tooltips Step 2: clicks will hide tooltips & affect the point below; true "contains" for balloons
060290a0: make carets retain valid positions on Tab width changes, when multiple carets are enabled (IDEA-80056)
7325dffa: Changed default language level to Python 2.7
fd361c4: Merge remote-tracking branch 'origin/master'
1a931f9: lambda: unhandled exceptions inside method body should be treated as those inside anonymous classes (IDEA-121741)
a042720: stream migration inspection: preserve comments (IDEA-121679)
b060c81: stream migration inspection: collapse only primitive new initializers (IDEA-121745)
4d87683: fixed PY-12113 Questionable "access to a protected member of a class" inspection in tests
90d0740: IDEA-98746 Annoying editor tab tooltips Step 1: new setting has been added (Editor -> Editor Tabs -> Show tabs tooltip)
e50b960: [git] remove unused MultipleContentsRevision
70bb70d: [log] Added time measurements to the VCS log
66fb815: renamed resolveWithoutImplicits to getResolveContext (which is more meaningfull)
e1ce2db: [log] Synchonize access to the VcsUserRegistry
a29e2b1: [log] DRY
082b273: [log] prohibit repaint during collapse/expand all branches
6f4a2d5: [log] fireTableStructureChanged if graph changes after some action
23396b0: [log] rename updateUI to repaintUI; unwrap: it shouldn't be executed not from EDT.
347647a: [log] handle answer
a631891: [log] No need to set default cursor
8475418: [log] let handleAnswer be in the single place: VcsLogUI.
43f775c: [log] Add support of getContainingBranches method.
480d1ab: [log] Fix wrong collapse branch nodes.
758c07e: [log] Fix bug related with not load commit node.
a944fe6: [log] Create JumpToNotLoadCommitActionRequest.
610219e: [log] VcsLogSorted fixed.
2d748d6: [log] Disabled selection of relative commits.
03a2a25: [log] Fix performance of collapse all action.
75ff6e6: [log] Add LinearBranchesExpansionAction support. (But collapse all may need more time).
6eaa9bf: [log] Add several debug messages.
45da0e7: [log] Disable draw harmonics in filters.
aeff40e: [log] Add graph for filters.
12bb25e: [log] Don't fail for fresh repositories without commits
bfbc9e4: [log] Don't make graph with always-false filters
33a3bf2: some automatic changes in community modules
ca7f8d3: remove unused
cc1b58a: [log] no filter => null, enable new graph by default, temporary return null if no commits match
c153674: [log] temp diagnostics: why graph sometimes disappear
ab4b7ac: [log] VcsLogSorter stub
8a62c27: [log] temp diagnostics: why graph sometimes disappear
4fd20fc: [log] Fix crash, when mouse over empty row.
8af46ee: [log] Add CollapsedMutableGraph.
6cc0435: [log] Add FragmentGenerator.
0859662: [log] Added highlighting relative commits.
8922251: [log] Extract dfs to DfsUtil.
fe36f19: [log] Simple painter fix.
3e9f31b: [log] Fix not load commit node.
90c7bd1: [log] Fix case when not using new graph for filtering & using old graph facade
b6ed824: [log] IDEA-117157 Filter by multiple branches
eeefcfa: [log] use new graph for filtering commits (disabled by default)
56f381b: [git log] Support filtering by several branches
0cfc872: [log] Fix author column width calculation
20aeb1a: [log] Optimize case with filters: read & store commits without details
01121ba: [log] Add arrow highlighted when mouse over.
4421f12: [log] Add GraphActionDispatcher.
ecdc992: [log] Fix Image overflow.
52db2ef: [log] Fix GraphCellGeneratorImpl.
863d8c7: [log] Fix Branch color.
04a0bc7: [log] Use new GraphFacade
dfc41b0: [log] Temp fix SimpleGraphCellPainter
4f028e7: [log] Copy GraphCellPainter from old log.
62dd4f6: [log] Fix graph, when not all log loaded.
84790b5: [log] Add GraphCellGenerator.
3bf48c4: [log] Add MutableGraph and simple Impl
232fe7f: [log] Add PermanentGraph & Layout
413a6a9: [log] Add GraphFlags
3e4e166: [log] Add IntToIntMap, AbstractIntToIntMap, TreeIntToIntMap and TestTreeIntToIntMap
7642e8a: [log] Get rid of VcsLogDataHolder#getDataPack: pass DataPack manually
435fffb: [log] Explicitly pass VcsLogDataHolder & VcsLogUiProperties
270649b: [log] VcsUserRegistry: return a copy of users map, to avoid CCME
5dd7cd9: [log] Extract graph facade building into separate class
691077d: GraphColorManager initial implementation
a615943: [log] remove no more needed dependencies from vcs-log-graph
be34c32: [log] DataPack: create GraphFacadeImpl instance in build
584e37d: [log] Move GraphFacade implementation to vcs-log-graph module
4e968e1: [log] remove unused stuff from the DataPack.
bfcb3f4: Override paintComponent() instead of paint().
99d52e8: [log] Delegate graph painting to the GraphFacade
c152a29: Move clicks & hovers to the GraphFacade
a00646d: GraphColorManager: more methods + javadocs
98b80a1: rename & check link listener first
54a50ae: GraphAnswer interface
f9b9890: rename to GraphFacade
055f10b: optimize search commit by part of hash
d1b69d1: remove getVisibleCommits since we've got getVisibleCommitCount & getCommitAtRow
411a76f: javadocs
bb8b897: optimize getOneOfHeads: store it in Branch instead of the VirtualFile.
cd4728b: Transition to GraphFacade, step 4: click to row
a74518c: Transition to GraphFacade, step 3: expansion actions
9311f2f: Transition to GraphFacade, step 2: setVisibleBranches
89dd596: Transition to GraphFacade, step 1: getVisibleCommits(), getRoot()
e852593: remove unused methods
8661db5: GraphColorManager
81488e4: some javadocs & GraphInfoProvider extraction
039520b: Graph Black Box refactoring initial step
fce20a5: IDEA-121764 Debugger does not show null values
e14e913: IDEA-121739 Debugger doesn't stop on breakpoints in some anonymous classes
675fa42: fix tests. Rebinding for 'def' reference should do nothing because it references to an inferred variable's type or to a variable itself.
5a54361: IDEA-116134 Inherited maven resource filtering is not applied
1766d06: Groovy: fix parameter info
812d0d6: Groovy: remove redundant GrDefaultAnnotationValue psi.
2bc747e: Groovy: import static intention should be available on argument list
cdfdf8d: IDEA-121662 Unify Groovy and Java Intention behavior
82a4f0d: IDEA-121318 optimizing whether place is child of import statement. Actually place can be a child of an import statement only if it is a GrCodeReferenceElement.
400d1ff: one big comparator for ratings, downloads, updates and status
dbe0372: memory leak fixed
3d017bc: Remove unused SOAP classes generated from WSDL. Leave only basic authorization in legacy connector
d6528d3: vcs notification structure refactored and common integration enabler provided f or mercurial vcs IDEA-120440
71e985b: IDEA-118548 Fixed locale settings for Mac - so svn launched from IDEA should get correct locale
5f70222: IDEA-121403 Live Template: "Surround with tag" should not be applicable while editing XmlAttributeValue
0e90d93: avoid boxing/unboxing (following CR-IC-4606)
754e7d9: remote table header
99540a3: register all sorters for available plugins table
60861dd: new sorters
ae5ff21: Merge branch 'python-fixes'
455db27: Fixed names of live templates for dict comprehensions (PY-12307)
b2bbf8b: Typo
4569a1c: Don't suggest the initial name if un-pluralization failed (PY-12308)
816b0e4: Don't suggest collection names in live templates that aren't valid Python identifier (PY-12308)
b8412c1: refactor to support multiple sorters
2814c77: Add bundle for common task messages
a4b56a6: java: formatting of type annotations inside type elements
0813c3c: java: type cast intention fixed
37ec0df: update appinfo files
6ff02b1: optimization for breakpoint set in folded code
09c6a8d: method refs: search for potentially applicable members in supers (IDEA-121737)
5412fbc: overload resolution: grab lambda from nested parenthesis as well as conditional expressions
0c7adaa: java: split multi-catch intention simplified; test data made adequate
4969888: java: no annotations needed in type cast
1687a22: Cleanup (unneeded test data)
333e542: Dictionary extended
9da8f7d: IDEA-121384 Breakpoints dialog: for method breakpoint created in dialog new branch is created
20a0571: notnull
dd09f59: notnull
8aab3af: notnull
9e433b6: data race
6c89ea9: cleanup
da637a4: IDEA-84705 Live Template: should be possible to reset the changes made in default templates
ae81974: Merge remote-tracking branch 'origin/master'
f86ac6f: new inference: use equals bounds during incorporation
e07fdee: testdata for IDEA-118965
46112ee: new inference: cache lambda functional type during expression constraints reduction (IDEA-121315)
5029b3f: new inference: do not prefer specifics based on void return type for both void and value compatible lambdas
a70f823: new inference: postpone argument types calculation
2149ea3: Fixed project leak
1608a84: svn: Perform special check if svn repository supports "merge-info" tracking only when corresponding registry key is set
9142df3: classes from old build system API marked as deprecated (to be removed in IDEA 14)
9b4f8c02: svn: Refactored SvnUtil - removed duplicate methods for checking if svn repository supports "merge-info" tracking
d334d41: IDEA-121688 Added CommitEventType.failedOutOfDate; do not fail if could not convert SVNEventAction to CommitEventType (just log warning)
70aed3f: Merge remote-tracking branch 'origin/master'
ba09765: missing test data
76591fd: dfa: comparison with other variables shouldn't affect a variable's nullability status
2c6cea6: IDEA-121698 Automatically make variables accessed from outer scopes final
6166a0e: don't flush fields for pure method and getter calls (IDEA-117449)
80049df: mention method name in edit contract intention text
c1b03f0: dfa: variables shouldn't be marked unknown if they don't have known constant values
1fd57b4: Close terminal tabs with middle click (IDEA-112321).
6ee5d4f: Terminal should sign as xterm-256color (IDEA-118841).
1cd41f0: Merge remote-tracking branch 'origin/master'
8d167c6: Fix the locale on mac only for pycharm processes creation.
96c2016: IDEA-54434 (type annotations in Convert to Atomic/ThreadLocal)
9ae9623: java: formatting of type annotations inside references
50bf5a3: Cleanup (pointless exceptions; formatting)
d44fab7: fix for exception with list of indexed ids merging
39c8f52: Merge remote-tracking branch 'origin/master'
bd3cf45: Launch terminal with fixed locale (IDEA-116401, IDEA-118832, IDEA-120131).
1b0bc5f: fixed regress introduced by c5819e4 : remove stale index data for removed files that were scheduled to update lazily
61d11c8: nashorn: x variables view
a5c886b: cleanup
4433f97: use SingleAlarm
6822332: Fix locale env vars on mac (IDEA-121713).
8d82a44: IDEA-52034 Implemented option to authenticate svn+ssh repositories using ssh agent (for SVNKit integration) (inspired by @charles-dyfis-net pull request - see issue comments for details)
90b352d: svn: Refactored SSHCredentialsDialog - removed unnecessary code
7f5f956: svn: Updating license info related to svn4idea plugin
cb98865: svn: Upgraded to SVNKit 1.7.11
9d57fb2: Upgraded jna-utils (= platform = jna-platform) to 3.4.0 (now it corresponds to currently used jna 3.4.0) (both jna and jna-utils are downloaded from https://github.com/twall/jna/releases/tag/3.4.0)
d9267b7: Added jsch-agent-proxy library to community
b51333a: IDEA-75033 Implemented feature to automatically switch directory on new branch creation
ee584ce: svn: Refactored AutoSvnUpdater - utility method to run svn updates
97e7ceb: svn: Removed unused classes
d62789b: svn: Refactored SvnConfigurationState - simplify java version checks
7eff048: svn: Make "command line" integration be primary for default svn settings
Change-Id: Idc5975266870a8ad22b9cdd88181a4b53387735f
Diffstat (limited to 'java/debugger/impl/src')
77 files changed, 939 insertions, 431 deletions
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/AdjustArrayRangeAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/AdjustArrayRangeAction.java index bb74b8eccc45..3a821fb10c0f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/AdjustArrayRangeAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/AdjustArrayRangeAction.java @@ -32,6 +32,7 @@ import com.intellij.openapi.ui.DialogWrapper; import org.jetbrains.annotations.Nullable; public class AdjustArrayRangeAction extends DebuggerAction { + @Override public void actionPerformed(AnActionEvent e) { DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext()); if(debuggerContext == null) { @@ -73,6 +74,7 @@ public class AdjustArrayRangeAction extends DebuggerAction { if(editor.getExitCode() == DialogWrapper.OK_EXIT_CODE) { debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(debuggerContext.getSuspendContext()) { + @Override public void contextAction() throws Exception { final ValueDescriptorImpl nodeDescriptor = (ValueDescriptorImpl)selectedNode.getDescriptor(); final Renderer lastRenderer = nodeDescriptor.getLastRenderer(); @@ -92,6 +94,7 @@ public class AdjustArrayRangeAction extends DebuggerAction { } } + @Override public void update(AnActionEvent e) { boolean enable = false; DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext()); @@ -139,10 +142,12 @@ public class AdjustArrayRangeAction extends DebuggerAction { myTitle = title; } + @Override public String getDisplayName() { return myTitle; } + @Override public String getHelpTopic() { return null; } diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java index 4235b6923d3a..c08bfd51dbbd 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java @@ -45,11 +45,13 @@ import java.util.List; * Time: 4:39:53 PM */ public class CustomizeContextViewAction extends DebuggerAction{ + @Override public void actionPerformed(AnActionEvent e) { final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); Disposable disposable = Disposer.newDisposable(); final CompositeConfigurable configurable = new TabbedConfigurable(disposable) { + @Override protected List<Configurable> createConfigurables() { ArrayList<Configurable> array = new ArrayList<Configurable>(); array.add(new DebuggerDataViewsConfigurable(project)); @@ -57,15 +59,18 @@ public class CustomizeContextViewAction extends DebuggerAction{ return array; } + @Override public void apply() throws ConfigurationException { super.apply(); NodeRendererSettings.getInstance().fireRenderersChanged(); } + @Override public String getDisplayName() { return DebuggerBundle.message("title.customize.data.views"); } + @Override public String getHelpTopic() { return null; } @@ -85,6 +90,7 @@ public class CustomizeContextViewAction extends DebuggerAction{ editor.show(); } + @Override public void update(AnActionEvent e) { DebuggerTree tree = getTree(e.getDataContext()); e.getPresentation().setVisible(tree instanceof FrameVariablesTree || tree instanceof WatchDebuggerTree); diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java index a0a2146aca6f..8904331bfaba 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/JavaSmartStepIntoHandler.java @@ -22,6 +22,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; +import com.intellij.util.Range; import com.intellij.util.containers.OrderedSet; import com.intellij.util.text.CharArrayUtil; import org.jetbrains.annotations.NotNull; @@ -79,6 +80,8 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { //noinspection unchecked final List<SmartStepTarget> targets = new OrderedSet<SmartStepTarget>(); + final Range<Integer> lines = new Range<Integer>(doc.getLineNumber(element.getTextOffset()), doc.getLineNumber(element.getTextOffset() + element.getTextLength())); + final PsiElementVisitor methodCollector = new JavaRecursiveElementVisitor() { final Stack<PsiMethod> myContextStack = new Stack<PsiMethod>(); final Stack<String> myParamNameStack = new Stack<String>(); @@ -92,12 +95,12 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { @Override public void visitAnonymousClass(PsiAnonymousClass aClass) { for (PsiMethod psiMethod : aClass.getMethods()) { - targets.add(new MethodSmartStepTarget(psiMethod, getCurrentParamName(), psiMethod.getBody(), true)); + targets.add(new MethodSmartStepTarget(psiMethod, getCurrentParamName(), psiMethod.getBody(), true, lines)); } } public void visitLambdaExpression(PsiLambdaExpression expression) { - targets.add(new LambdaSmartStepTarget(expression, getCurrentParamName(), expression.getBody(), myNextLambdaExpressionOrdinal++)); + targets.add(new LambdaSmartStepTarget(expression, getCurrentParamName(), expression.getBody(), myNextLambdaExpressionOrdinal++, lines)); } @Override @@ -141,7 +144,8 @@ public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler { expression instanceof PsiMethodCallExpression? ((PsiMethodCallExpression)expression).getMethodExpression().getReferenceNameElement() : expression instanceof PsiNewExpression? ((PsiNewExpression)expression).getClassOrAnonymousClassReference() : expression, - false + false, + lines )); } try { diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java index 5dde5d8ea13d..f62bd84982d9 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java @@ -23,7 +23,6 @@ import com.intellij.debugger.engine.MethodFilter; import com.intellij.debugger.impl.DebuggerSession; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.ShortcutSet; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.fileEditor.TextEditor; @@ -137,11 +136,12 @@ public abstract class JvmSmartStepIntoHandler { protected MethodFilter createMethodFilter(SmartStepTarget stepTarget) { if (stepTarget instanceof MethodSmartStepTarget) { final PsiMethod method = ((MethodSmartStepTarget)stepTarget).getMethod(); - return stepTarget.needsBreakpointRequest()? new AnonymousClassMethodFilter(method) : new BasicStepMethodFilter(method); + return stepTarget.needsBreakpointRequest()? new AnonymousClassMethodFilter(method, stepTarget.getCallingExpressionLines()) : + new BasicStepMethodFilter(method, stepTarget.getCallingExpressionLines()); } if (stepTarget instanceof LambdaSmartStepTarget) { final LambdaSmartStepTarget lambdaTarget = (LambdaSmartStepTarget)stepTarget; - return new LambdaMethodFilter(lambdaTarget.getLambda(), lambdaTarget.getOrdinal()); + return new LambdaMethodFilter(lambdaTarget.getLambda(), lambdaTarget.getOrdinal(), stepTarget.getCallingExpressionLines()); } return null; } diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/LambdaSmartStepTarget.java b/java/debugger/impl/src/com/intellij/debugger/actions/LambdaSmartStepTarget.java index da90bafd2a41..dec71630764e 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/LambdaSmartStepTarget.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/LambdaSmartStepTarget.java @@ -17,6 +17,7 @@ package com.intellij.debugger.actions; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiLambdaExpression; +import com.intellij.util.Range; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,8 +29,8 @@ public class LambdaSmartStepTarget extends SmartStepTarget{ private final PsiLambdaExpression myLambda; private final int myOrdinal; - public LambdaSmartStepTarget(@NotNull PsiLambdaExpression lambda, @Nullable String label, @Nullable PsiElement highlightElement, int ordinal) { - super(label, highlightElement, true); + public LambdaSmartStepTarget(@NotNull PsiLambdaExpression lambda, @Nullable String label, @Nullable PsiElement highlightElement, int ordinal, Range<Integer> lines) { + super(label, highlightElement, true, lines); myLambda = lambda; myOrdinal = ordinal; } diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/MethodSmartStepTarget.java b/java/debugger/impl/src/com/intellij/debugger/actions/MethodSmartStepTarget.java index 461f89a6d594..69281e66c9bd 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/MethodSmartStepTarget.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/MethodSmartStepTarget.java @@ -17,6 +17,7 @@ package com.intellij.debugger.actions; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiMethod; +import com.intellij.util.Range; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,15 +25,11 @@ import org.jetbrains.annotations.Nullable; * @author Eugene Zhuravlev * Date: 10/25/13 */ -public class MethodSmartStepTarget extends SmartStepTarget{ +public class MethodSmartStepTarget extends SmartStepTarget { private final PsiMethod myMethod; - public MethodSmartStepTarget(@NotNull PsiMethod method) { - this(method, null, null, false); - } - - public MethodSmartStepTarget(@NotNull PsiMethod method, @Nullable String label, @Nullable PsiElement highlightElement, boolean needBreakpointRequest) { - super(label, highlightElement, needBreakpointRequest); + public MethodSmartStepTarget(@NotNull PsiMethod method, @Nullable String label, @Nullable PsiElement highlightElement, boolean needBreakpointRequest, Range<Integer> lines) { + super(label, highlightElement, needBreakpointRequest, lines); myMethod = method; } diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java b/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java index f16557bd2c0e..ed758c902784 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/SmartStepTarget.java @@ -16,6 +16,7 @@ package com.intellij.debugger.actions; import com.intellij.psi.PsiElement; +import com.intellij.util.Range; import org.jetbrains.annotations.Nullable; /** @@ -26,11 +27,13 @@ public abstract class SmartStepTarget { private final PsiElement myHighlightElement; private final String myLabel; private final boolean myNeedBreakpointRequest; + private final Range<Integer> myExpressionLines; - protected SmartStepTarget(@Nullable String label, @Nullable PsiElement highlightElement, boolean needBreakpointRequest) { + protected SmartStepTarget(@Nullable String label, @Nullable PsiElement highlightElement, boolean needBreakpointRequest, Range<Integer> expressionLines) { myHighlightElement = highlightElement; myLabel = label; myNeedBreakpointRequest = needBreakpointRequest; + myExpressionLines = expressionLines; } @Nullable @@ -46,4 +49,8 @@ public abstract class SmartStepTarget { public boolean needsBreakpointRequest() { return myNeedBreakpointRequest; } + + public Range<Integer> getCallingExpressionLines() { + return myExpressionLines; + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/AnonymousClassMethodFilter.java b/java/debugger/impl/src/com/intellij/debugger/engine/AnonymousClassMethodFilter.java index 7f8436b3de69..aca3ff02d620 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/AnonymousClassMethodFilter.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/AnonymousClassMethodFilter.java @@ -19,6 +19,7 @@ import com.intellij.debugger.SourcePosition; import com.intellij.psi.PsiCodeBlock; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiStatement; +import com.intellij.util.Range; import org.jetbrains.annotations.Nullable; /** @@ -30,8 +31,8 @@ public class AnonymousClassMethodFilter extends BasicStepMethodFilter implements private final SourcePosition myBreakpointPosition; private final int myLastStatementLine; - public AnonymousClassMethodFilter(PsiMethod psiMethod) { - super(psiMethod); + public AnonymousClassMethodFilter(PsiMethod psiMethod, Range<Integer> lines) { + super(psiMethod, lines); SourcePosition firstStatementPosition = null; SourcePosition lastStatementPosition = null; final PsiCodeBlock body = psiMethod.getBody(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/BasicStepMethodFilter.java b/java/debugger/impl/src/com/intellij/debugger/engine/BasicStepMethodFilter.java index 89e1dec399fa..1e3fa9bcd452 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/BasicStepMethodFilter.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/BasicStepMethodFilter.java @@ -18,6 +18,7 @@ package com.intellij.debugger.engine; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.psi.PsiMethod; +import com.intellij.util.Range; import com.sun.jdi.Location; import com.sun.jdi.Method; import org.jetbrains.annotations.NotNull; @@ -27,18 +28,20 @@ import org.jetbrains.annotations.Nullable; * @author Eugene Zhuravlev * Date: 10/26/13 */ -public class BasicStepMethodFilter implements MethodFilter{ +public class BasicStepMethodFilter implements MethodFilter { @NotNull protected final JVMName myDeclaringClassName; @NotNull private final String myTargetMethodName; @Nullable protected final JVMName myTargetMethodSignature; + private final Range<Integer> myCallingExpressionLines; - public BasicStepMethodFilter(PsiMethod psiMethod) { + public BasicStepMethodFilter(PsiMethod psiMethod, Range<Integer> callingExpressionLines) { myDeclaringClassName = JVMNameUtil.getJVMQualifiedName(psiMethod.getContainingClass()); myTargetMethodName = psiMethod.isConstructor() ? "<init>" : psiMethod.getName(); myTargetMethodSignature = JVMNameUtil.getJVMSignature(psiMethod); + myCallingExpressionLines = callingExpressionLines; } @NotNull @@ -71,4 +74,9 @@ public class BasicStepMethodFilter implements MethodFilter{ } return false; } + + @Override + public Range<Integer> getCallingExpressionLines() { + return myCallingExpressionLines; + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java index 399c55fd00e5..250186e74ae9 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java @@ -17,9 +17,11 @@ package com.intellij.debugger.engine; import com.intellij.debugger.NoDataException; import com.intellij.debugger.PositionManager; -import com.intellij.debugger.PositionManagerEx; import com.intellij.debugger.SourcePosition; +import com.intellij.debugger.engine.evaluation.EvaluationContext; +import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.requests.ClassPrepareRequestor; +import com.intellij.util.ThreeState; import com.intellij.xdebugger.frame.XStackFrame; import com.sun.jdi.Location; import com.sun.jdi.ReferenceType; @@ -100,10 +102,10 @@ public class CompoundPositionManager extends PositionManagerEx { @Nullable @Override - public XStackFrame createStackFrame(@NotNull Location location) { + public XStackFrame createStackFrame(@NotNull StackFrameProxyImpl frame, @NotNull DebugProcessImpl debugProcess, @NotNull Location location) { for (PositionManager positionManager : myPositionManagers) { if (positionManager instanceof PositionManagerEx) { - XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(location); + XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(frame, debugProcess, location); if (xStackFrame != null) { return xStackFrame; } @@ -111,4 +113,20 @@ public class CompoundPositionManager extends PositionManagerEx { } return null; } + + @Override + public ThreeState evaluateCondition(@NotNull EvaluationContext context, + @NotNull StackFrameProxyImpl frame, + @NotNull Location location, + @NotNull String expression) { + for (PositionManager positionManager : myPositionManagers) { + if (positionManager instanceof PositionManagerEx) { + ThreeState result = ((PositionManagerEx)positionManager).evaluateCondition(context, frame, location, expression); + if (result != ThreeState.UNSURE) { + return result; + } + } + } + return ThreeState.UNSURE; + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/ContextUtil.java b/java/debugger/impl/src/com/intellij/debugger/engine/ContextUtil.java index 26903c87ca4f..4ad9b0004266 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/ContextUtil.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/ContextUtil.java @@ -137,8 +137,8 @@ public class ContextUtil { } @Nullable - public static PsiElement getContextElement(final SourcePosition position) { - return position == null ? null :position.getElementAt(); + public static PsiElement getContextElement(@Nullable SourcePosition position) { + return position == null ? null : position.getElementAt(); } public static boolean isJspImplicit(PsiElement element) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index b660d5f1ed6e..2570d9a01f8d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -72,12 +72,12 @@ import com.intellij.util.EventDispatcher; import com.intellij.util.StringBuilderSpinAllocator; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.containers.HashMap; import com.sun.jdi.*; import com.sun.jdi.connect.*; import com.sun.jdi.request.EventRequest; import com.sun.jdi.request.EventRequestManager; import com.sun.jdi.request.StepRequest; -import gnu.trove.THashMap; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -119,7 +119,10 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb private Map<String, Connector.Argument> myArguments; private final List<NodeRenderer> myRenderers = new ArrayList<NodeRenderer>(); - private final Map<Type, NodeRenderer> myNodeRenderersMap = new THashMap<Type, NodeRenderer>(); + + // we use null key here + private final Map<Type, NodeRenderer> myNodeRenderersMap = new HashMap<Type, NodeRenderer>(); + private final NodeRendererSettingsListener mySettingsListener = new NodeRendererSettingsListener() { @Override public void renderersChanged() { @@ -905,8 +908,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException; - public E start(EvaluationContextImpl evaluationContext, Method method) throws EvaluateException { + return start(evaluationContext, method, false); + } + + public E start(EvaluationContextImpl evaluationContext, Method method, boolean internalEvaluate) throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); SuspendContextImpl suspendContext = evaluationContext.getSuspendContext(); SuspendManagerUtil.assertSuspendContext(suspendContext); @@ -921,11 +927,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb final ThreadReference invokeThreadRef = invokeThread.getThreadReference(); myEvaluationDispatcher.getMulticaster().evaluationStarted(suspendContext); - beforeMethodInvocation(suspendContext, method); + beforeMethodInvocation(suspendContext, method, internalEvaluate); Object resumeData = null; try { - for (final SuspendContextImpl suspendingContext : suspendingContexts) { + for (SuspendContextImpl suspendingContext : suspendingContexts) { final ThreadReferenceProxyImpl suspendContextThread = suspendingContext.getThread(); if (suspendContextThread != invokeThread) { if (LOG.isDebugEnabled()) { @@ -944,11 +950,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb while (true) { try { return invokeMethodAndFork(suspendContext); - } + } catch (ClassNotLoadedException e) { ReferenceType loadedClass; try { - loadedClass = evaluationContext.isAutoLoadClasses()? loadClass(evaluationContext, e.className(), evaluationContext.getClassLoader()) : null; + loadedClass = evaluationContext.isAutoLoadClasses() ? loadClass(evaluationContext, e.className(), evaluationContext.getClassLoader()) : null; } catch (EvaluateException ignored) { loadedClass = null; @@ -995,7 +1001,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb LOG.debug("getVirtualMachine().clearCaches()"); } getVirtualMachineProxy().clearCaches(); - afterMethodInvocation(suspendContext); + afterMethodInvocation(suspendContext, internalEvaluate); myEvaluationDispatcher.getMulticaster().evaluationFinished(suspendContext); } @@ -1084,13 +1090,13 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb } @Override - public Value invokeMethod(final EvaluationContext evaluationContext, final ObjectReference objRef, final Method method, final List args) throws EvaluateException { + public Value invokeMethod(@NotNull EvaluationContext evaluationContext, @NotNull ObjectReference objRef, @NotNull Method method, final List args) throws EvaluateException { return invokeInstanceMethod(evaluationContext, objRef, method, args, 0); } @Override - public Value invokeInstanceMethod(final EvaluationContext evaluationContext, final ObjectReference objRef, final Method method, - final List args, final int invocationOptions) throws EvaluateException { + public Value invokeInstanceMethod(@NotNull EvaluationContext evaluationContext, @NotNull final ObjectReference objRef, final Method method, + final List args, final int invocationOptions) throws EvaluateException { final ThreadReference thread = getEvaluationThread(evaluationContext); return new InvokeCommand<Value>(args) { @Override @@ -1115,9 +1121,16 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb public Value invokeMethod(final EvaluationContext evaluationContext, final ClassType classType, final Method method, final List args) throws EvaluateException { + return invokeMethod(evaluationContext, classType, method, args, false); + } + public Value invokeMethod(@NotNull EvaluationContext evaluationContext, + @NotNull final ClassType classType, + @NotNull final Method method, + final List args, + boolean internalEvaluate) throws EvaluateException { final ThreadReference thread = getEvaluationThread(evaluationContext); - InvokeCommand<Value> invokeCommand = new InvokeCommand<Value>(args) { + return new InvokeCommand<Value>(args) { @Override protected Value invokeMethod(int invokePolicy, final List args) throws InvocationException, ClassNotLoadedException, @@ -1128,8 +1141,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb } return classType.invokeMethod(thread, method, args, invokePolicy); } - }; - return invokeCommand.start((EvaluationContextImpl)evaluationContext, method); + }.start((EvaluationContextImpl)evaluationContext, method, internalEvaluate); } @Override @@ -1176,25 +1188,29 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb clearCashes(suspendContext.getSuspendPolicy()); } - private void beforeMethodInvocation(SuspendContextImpl suspendContext, Method method) { + private void beforeMethodInvocation(SuspendContextImpl suspendContext, Method method, boolean internalEvaluate) { if (LOG.isDebugEnabled()) { LOG.debug( "before invocation in thread " + suspendContext.getThread().name() + " method " + (method == null ? "null" : method.name())); } - if (method != null) { - showStatusText(DebuggerBundle.message("progress.evaluating", DebuggerUtilsEx.methodName(method))); - } - else { - showStatusText(DebuggerBundle.message("title.evaluating")); + if (!internalEvaluate) { + if (method != null) { + showStatusText(DebuggerBundle.message("progress.evaluating", DebuggerUtilsEx.methodName(method))); + } + else { + showStatusText(DebuggerBundle.message("title.evaluating")); + } } } - private void afterMethodInvocation(SuspendContextImpl suspendContext) { + private void afterMethodInvocation(SuspendContextImpl suspendContext, boolean internalEvaluate) { if (LOG.isDebugEnabled()) { LOG.debug("after invocation in thread " + suspendContext.getThread().name()); } - showStatusText(""); + if (!internalEvaluate) { + showStatusText(""); + } } @Override diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java index 4f4eb3f3ffc2..abe71077bc9f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebuggerManagerThreadImpl.java @@ -37,15 +37,16 @@ import org.jetbrains.annotations.TestOnly; * @author lex */ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerCommandImpl> implements DebuggerManagerThread, Disposable { - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.DebuggerManagerThreadImpl"); + private static final Logger LOG = Logger.getInstance(DebuggerManagerThreadImpl.class); public static final int COMMAND_TIMEOUT = 3000; - private static final int RESTART_TIMEOUT = 500; + private volatile boolean myDisposed; DebuggerManagerThreadImpl(@NotNull Disposable parent) { Disposer.register(parent, this); } + @Override public void dispose() { myDisposed = true; } @@ -63,6 +64,7 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma LOG.assertTrue(isManagerThread(), "Should be invoked in manager thread, use DebuggerManagerThreadImpl.getInstance(..).invoke..."); } + @Override public void invokeAndWait(DebuggerCommandImpl managerCommand) { LOG.assertTrue(!isManagerThread(), "Should be invoked outside manager thread, use DebuggerManagerThreadImpl.getInstance(..).invoke..."); super.invokeAndWait(managerCommand); @@ -77,6 +79,7 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma } } + @Override public boolean pushBack(DebuggerCommandImpl managerCommand) { final boolean pushed = super.pushBack(managerCommand); if (!pushed) { @@ -85,6 +88,7 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma return pushed; } + @Override public boolean schedule(DebuggerCommandImpl managerCommand) { final boolean scheduled = super.schedule(managerCommand); if (!scheduled) { @@ -106,6 +110,7 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma if (currentCommand != null) { final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD); alarm.addRequest(new Runnable() { + @Override public void run() { try { if (currentCommand == myEvents.getCurrentEvent()) { @@ -135,10 +140,11 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma } + @Override public void processEvent(@NotNull DebuggerCommandImpl managerCommand) { assertIsManagerThread(); try { - if(myEvents.isClosed()) { + if (myEvents.isClosed()) { managerCommand.notifyCancelled(); } else { @@ -161,14 +167,17 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma public void startProgress(final DebuggerCommandImpl command, final ProgressWindowWithNotification progressWindow) { progressWindow.addListener(new ProgressIndicatorListenerAdapter() { + @Override public void cancelled() { command.release(); } }); ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { + @Override public void run() { ProgressManager.getInstance().runProcess(new Runnable() { + @Override public void run() { invokeAndWait(command); } @@ -193,10 +202,12 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma } super.invokeAndWait(new DebuggerCommandImpl() { + @Override protected void action() throws Exception { switchToRequest(request); } + @Override protected void commandCancelled() { if (LOG.isDebugEnabled()) { LOG.debug("Event queue was closed, killing request"); @@ -207,14 +218,17 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma } } + @Override public void invokeCommand(final DebuggerCommand command) { if(command instanceof SuspendContextCommand) { SuspendContextCommand suspendContextCommand = (SuspendContextCommand)command; schedule(new SuspendContextCommandImpl((SuspendContextImpl)suspendContextCommand.getSuspendContext()) { + @Override public void contextAction() throws Exception { command.action(); } + @Override protected void commandCancelled() { command.commandCancelled(); } @@ -222,10 +236,12 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma } else { schedule(new DebuggerCommandImpl() { + @Override protected void action() throws Exception { command.action(); } + @Override protected void commandCancelled() { command.commandCancelled(); } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/LambdaMethodFilter.java b/java/debugger/impl/src/com/intellij/debugger/engine/LambdaMethodFilter.java index c51326bd5a19..043b103ee734 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/LambdaMethodFilter.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/LambdaMethodFilter.java @@ -22,6 +22,7 @@ import com.intellij.psi.PsiCodeBlock; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiLambdaExpression; import com.intellij.psi.PsiStatement; +import com.intellij.util.Range; import com.sun.jdi.Location; import com.sun.jdi.Method; import org.jetbrains.annotations.Nullable; @@ -36,9 +37,11 @@ public class LambdaMethodFilter implements BreakpointStepMethodFilter{ @Nullable private final SourcePosition myFirstStatementPosition; private final int myLastStatementLine; + private final Range<Integer> myCallingExpressionLines; - public LambdaMethodFilter(PsiLambdaExpression lambda, int expressionOrdinal) { + public LambdaMethodFilter(PsiLambdaExpression lambda, int expressionOrdinal, Range<Integer> callingExpressionLines) { myLambdaOrdinal = expressionOrdinal; + myCallingExpressionLines = callingExpressionLines; SourcePosition firstStatementPosition = null; SourcePosition lastStatementPosition = null; @@ -78,4 +81,9 @@ public class LambdaMethodFilter implements BreakpointStepMethodFilter{ final Method method = location.method(); return method.name().startsWith(LAMBDA_METHOD_PREFIX) && (!vm.canGetSyntheticAttribute() || method.isSynthetic()); } + + @Override + public Range<Integer> getCallingExpressionLines() { + return myCallingExpressionLines; + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/MethodFilter.java b/java/debugger/impl/src/com/intellij/debugger/engine/MethodFilter.java index 665d52fb81f8..18ece3d40f0f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/MethodFilter.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/MethodFilter.java @@ -16,8 +16,10 @@ package com.intellij.debugger.engine; import com.intellij.debugger.engine.evaluation.EvaluateException; +import com.intellij.util.Range; import com.sun.jdi.Location; public interface MethodFilter { boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException; + Range<Integer> getCallingExpressionLines(); } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerEx.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerEx.java new file mode 100644 index 000000000000..b05e8b41589f --- /dev/null +++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerEx.java @@ -0,0 +1,35 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.debugger.engine; + +import com.intellij.debugger.PositionManager; +import com.intellij.debugger.engine.evaluation.EvaluationContext; +import com.intellij.debugger.jdi.StackFrameProxyImpl; +import com.intellij.util.ThreeState; +import com.intellij.xdebugger.frame.XStackFrame; +import com.sun.jdi.Location; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public abstract class PositionManagerEx implements PositionManager { + @Nullable + public abstract XStackFrame createStackFrame(@NotNull StackFrameProxyImpl frame, @NotNull DebugProcessImpl debugProcess, @NotNull Location location); + + public abstract ThreeState evaluateCondition(@NotNull EvaluationContext context, + @NotNull StackFrameProxyImpl frame, + @NotNull Location location, + @NotNull String expression); +} diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java index cd6944c31952..b3e371d7e327 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java @@ -29,7 +29,6 @@ import com.intellij.openapi.util.NullableComputable; import com.intellij.openapi.util.Ref; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; import com.sun.jdi.AbsentInformationException; import com.sun.jdi.Location; @@ -258,14 +257,43 @@ public class PositionManagerImpl implements PositionManager { private static int getNestingDepth(PsiClass aClass) { int depth = 0; - PsiClass enclosing = PsiTreeUtil.getParentOfType(aClass, PsiClass.class, true); + PsiClass enclosing = getEnclosingClass(aClass); while (enclosing != null) { depth++; - enclosing = PsiTreeUtil.getParentOfType(enclosing, PsiClass.class, true); + enclosing = getEnclosingClass(enclosing); } return depth; } + /** + * See IDEA-121739 + * Anonymous classes inside other anonymous class parameters list should belong to parent class + * Inner in = new Inner(new Inner2(){}) {}; + * Parent of Inner2 sub class here is not Inner sub class + */ + private static PsiClass getEnclosingClass(PsiElement element) { + if (element == null) { + return null; + } + + element = element.getParent(); + PsiElement previous = null; + + while (element != null) { + if (PsiClass.class.isInstance(element) && !(previous instanceof PsiExpressionList)) { + //noinspection unchecked + return (PsiClass)element; + } + if (element instanceof PsiFile) { + return null; + } + previous = element; + element = element.getParent(); + } + + return null; + } + @Nullable private ReferenceType findNested(final ReferenceType fromClass, final int currentDepth, final PsiClass classToFind, final int requiredDepth, final SourcePosition position) { final VirtualMachineProxyImpl vmProxy = myDebugProcess.getVirtualMachineProxy(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/RequestHint.java b/java/debugger/impl/src/com/intellij/debugger/engine/RequestHint.java index 7a184270988d..a225ab0695c2 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/RequestHint.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/RequestHint.java @@ -91,6 +91,7 @@ public class RequestHint { } } + @NotNull public DebugProcess getDebugProcess() { return suspendContext.getDebugProcess(); } @@ -136,6 +137,16 @@ public class RequestHint { return myMethodFilter instanceof BreakpointStepMethodFilter || myTargetMethodMatched; } + private boolean isOnTheSameLine(SourcePosition locationPosition) { + if (myMethodFilter == null) { + return myPosition.getLine() == locationPosition.getLine(); + } + else { + return locationPosition.getLine() >= myMethodFilter.getCallingExpressionLines().getFrom() && + locationPosition.getLine() <= myMethodFilter.getCallingExpressionLines().getTo(); + } + } + public int getNextStepDepth(final SuspendContextImpl context) { try { if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) { @@ -155,7 +166,7 @@ public class RequestHint { } } final boolean filesEqual = myPosition.getFile().equals(locationPosition.getFile()); - if (filesEqual && myPosition.getLine() == locationPosition.getLine() && myFrameCount == frameCount) { + if (filesEqual && isOnTheSameLine(locationPosition) && myFrameCount == frameCount) { return myDepth; } if (myDepth == StepRequest.STEP_INTO) { @@ -165,7 +176,7 @@ public class RequestHint { return STOP; } // check if we are still at the line from which the stepping begun - if (myFrameCount == frameCount && myPosition.getLine() != locationPosition.getLine()) { + if (myFrameCount == frameCount && !isOnTheSameLine(locationPosition)) { return STOP; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java index c8536bef1702..a0a81d649040 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java @@ -50,12 +50,12 @@ public abstract class SuspendContextImpl implements SuspendContext { protected Set<ThreadReferenceProxyImpl> myResumedThreads; private final EventSet myEventSet; - private volatile boolean myIsResumed; + private volatile boolean myIsResumed; public ConcurrentLinkedQueue<SuspendContextCommandImpl> myPostponedCommands = new ConcurrentLinkedQueue<SuspendContextCommandImpl>(); - public volatile boolean myInProgress; - private final HashSet<ObjectReference> myKeptReferences = new HashSet<ObjectReference>(); - private EvaluationContextImpl myEvaluationContext = null; + public volatile boolean myInProgress; + private final HashSet<ObjectReference> myKeptReferences = new HashSet<ObjectReference>(); + private EvaluationContextImpl myEvaluationContext = null; SuspendContextImpl(@NotNull DebugProcessImpl debugProcess, int suspendPolicy, int eventVotes, EventSet set) { myDebugProcess = debugProcess; @@ -82,7 +82,7 @@ public abstract class SuspendContextImpl implements SuspendContext { try { objectReference.enableCollection(); } - catch (UnsupportedOperationException e) { + catch (UnsupportedOperationException ignored) { // ignore: some J2ME implementations does not provide this operation } } @@ -115,25 +115,30 @@ public abstract class SuspendContextImpl implements SuspendContext { return myEventSet; } + @Override + @NotNull public DebugProcessImpl getDebugProcess() { assertNotResumed(); return myDebugProcess; } + @Override public StackFrameProxyImpl getFrameProxy() { assertNotResumed(); try { return myThread != null && myThread.frameCount() > 0 ? myThread.frame(0) : null; } - catch (EvaluateException e) { + catch (EvaluateException ignored) { return null; } } + @Override public ThreadReferenceProxyImpl getThread() { return myThread; } + @Override public int getSuspendPolicy() { assertNotResumed(); return mySuspendPolicy; @@ -145,7 +150,7 @@ public abstract class SuspendContextImpl implements SuspendContext { } public boolean isExplicitlyResumed(ThreadReferenceProxyImpl thread) { - return myResumedThreads != null ? myResumedThreads.contains(thread) : false; + return myResumedThreads != null && myResumedThreads.contains(thread); } public boolean suspends(ThreadReferenceProxyImpl thread) { @@ -194,7 +199,7 @@ public abstract class SuspendContextImpl implements SuspendContext { try { reference.disableCollection(); } - catch (UnsupportedOperationException e) { + catch (UnsupportedOperationException ignored) { // ignore: some J2ME implementations does not provide this operation } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java index de161f121d9e..576f781dc368 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java @@ -21,6 +21,7 @@ import com.sun.jdi.InternalException; import com.sun.jdi.ObjectCollectedException; import com.sun.jdi.event.EventSet; import com.sun.jdi.request.EventRequest; +import org.jetbrains.annotations.NotNull; import java.util.*; @@ -33,7 +34,7 @@ public class SuspendManagerImpl implements SuspendManager { private final LinkedList<SuspendContextImpl> myEventContexts = new LinkedList<SuspendContextImpl>(); /** * contexts, paused at breakpoint or another debugger event requests. Note that thread, explicitly paused by user is not considered as - * "paused at breakpoint" and JDI prohibits data queries on its stackframes + * "paused at breakpoint" and JDI prohibits data queries on its stack frames */ private final LinkedList<SuspendContextImpl> myPausedContexts = new LinkedList<SuspendContextImpl>(); private final Set<ThreadReferenceProxyImpl> myFrozenThreads = Collections.synchronizedSet(new HashSet<ThreadReferenceProxyImpl>()); @@ -42,9 +43,10 @@ public class SuspendManagerImpl implements SuspendManager { public int suspends = 0; - public SuspendManagerImpl(DebugProcessImpl debugProcess) { + public SuspendManagerImpl(@NotNull DebugProcessImpl debugProcess) { myDebugProcess = debugProcess; myDebugProcess.addDebugProcessListener(new DebugProcessAdapterImpl() { + @Override public void processDetached(DebugProcessImpl process, boolean closedByUser) { myEventContexts.clear(); myPausedContexts.clear(); @@ -53,8 +55,10 @@ public class SuspendManagerImpl implements SuspendManager { }); } + @Override public SuspendContextImpl pushSuspendContext(final int suspendPolicy, int nVotes) { SuspendContextImpl suspendContext = new SuspendContextImpl(myDebugProcess, suspendPolicy, nVotes, null) { + @Override protected void resumeImpl() { if (LOG.isDebugEnabled()) { LOG.debug("Start resuming..."); @@ -71,9 +75,9 @@ public class SuspendManagerImpl implements SuspendManager { catch (InternalException e) { //InternalException 13 means that there are running threads that we are trying to resume //On MacOS it happened that native thread didn't stop while some java thread reached breakpoint + //noinspection StatementWithEmptyBody if (/*Patches.MAC_RESUME_VM_HACK && */e.errorCode() == 13) { //Its funny, but second resume solves the problem - continue; } else { LOG.error(e); @@ -108,8 +112,10 @@ public class SuspendManagerImpl implements SuspendManager { return suspendContext; } + @Override public SuspendContextImpl pushSuspendContext(final EventSet set) { SuspendContextImpl suspendContext = new SuspendContextImpl(myDebugProcess, set.suspendPolicy(), set.size(), set) { + @Override protected void resumeImpl() { if (LOG.isDebugEnabled()) { LOG.debug("Start resuming eventSet " + set.toString() + " suspendPolicy = " + set.suspendPolicy() + ",size = " + set.size()); @@ -138,14 +144,13 @@ public class SuspendManagerImpl implements SuspendManager { catch (ObjectCollectedException e) { // according to error reports set.resume() may throw this if one of the threads has been collected LOG.info(e); - continue; } catch (InternalException e) { //InternalException 13 means that there are running threads that we are trying to resume //On MacOS it happened that native thread didn't stop while some java thread reached breakpoint + //noinspection StatementWithEmptyBody if (/*Patches.MAC_RESUME_VM_HACK && */e.errorCode() == 13 && set.suspendPolicy() == EventRequest.SUSPEND_ALL) { //Its funny, but second resume solves the problem - continue; } else { LOG.error(e); @@ -172,6 +177,7 @@ public class SuspendManagerImpl implements SuspendManager { } } + @Override public void resume(SuspendContextImpl context) { SuspendManagerUtil.prepareForResume(context); @@ -182,6 +188,7 @@ public class SuspendManagerImpl implements SuspendManager { myDebugProcess.clearCashes(suspendPolicy); } + @Override public void popFrame(SuspendContextImpl suspendContext) { popContext(suspendContext); SuspendContextImpl newSuspendContext = pushSuspendContext(suspendContext.getSuspendPolicy(), 0); @@ -189,6 +196,7 @@ public class SuspendManagerImpl implements SuspendManager { notifyPaused(newSuspendContext); } + @Override public SuspendContextImpl getPausedContext() { return !myPausedContexts.isEmpty() ? myPausedContexts.getFirst() : null; } @@ -216,15 +224,18 @@ public class SuspendManagerImpl implements SuspendManager { return myEventContexts.contains(suspendContext); } + @Override public List<SuspendContextImpl> getEventContexts() { DebuggerManagerThreadImpl.assertIsManagerThread(); return Collections.unmodifiableList(myEventContexts); } + @Override public boolean isFrozen(ThreadReferenceProxyImpl thread) { return myFrozenThreads.contains(thread); } + @Override public boolean isSuspended(ThreadReferenceProxyImpl thread) throws ObjectCollectedException{ DebuggerManagerThreadImpl.assertIsManagerThread(); @@ -249,6 +260,7 @@ public class SuspendManagerImpl implements SuspendManager { return suspended && (thread == null || thread.isSuspended()); } + @Override public void suspendThread(SuspendContextImpl context, ThreadReferenceProxyImpl thread) { LOG.assertTrue(thread != context.getThread(), "Thread is already suspended at the breakpoint"); @@ -258,6 +270,7 @@ public class SuspendManagerImpl implements SuspendManager { } } + @Override public void resumeThread(SuspendContextImpl context, ThreadReferenceProxyImpl thread) { LOG.assertTrue(thread != context.getThread(), "Use resume() instead of resuming breakpoint thread"); LOG.assertTrue(!context.isExplicitlyResumed(thread)); @@ -269,12 +282,14 @@ public class SuspendManagerImpl implements SuspendManager { thread.resume(); } + @Override public void freezeThread(ThreadReferenceProxyImpl thread) { if (myFrozenThreads.add(thread)) { thread.suspend(); } } + @Override public void unfreezeThread(ThreadReferenceProxyImpl thread) { if (myFrozenThreads.remove(thread)) { thread.resume(); @@ -310,6 +325,7 @@ public class SuspendManagerImpl implements SuspendManager { myDebugProcess.myDebugProcessDispatcher.getMulticaster().paused(suspendContext); } + @Override public void voteResume(SuspendContextImpl suspendContext) { if (LOG.isDebugEnabled()) { LOG.debug("Resume voted"); @@ -317,6 +333,7 @@ public class SuspendManagerImpl implements SuspendManager { processVote(suspendContext); } + @Override public void voteSuspend(SuspendContextImpl suspendContext) { suspendContext.myIsVotedForResume = false; processVote(suspendContext); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerUtil.java b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerUtil.java index e53f9d5a520e..8113121d3e1d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerUtil.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerUtil.java @@ -19,8 +19,6 @@ import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.openapi.diagnostic.Logger; import java.util.HashSet; -import java.util.Iterator; -import java.util.ListIterator; import java.util.Set; public class SuspendManagerUtil { @@ -36,9 +34,8 @@ public class SuspendManagerUtil { } public static SuspendContextImpl findContextByThread(SuspendManager suspendManager, ThreadReferenceProxyImpl thread) { - for (ListIterator<SuspendContextImpl> iterator = ((SuspendManagerImpl) suspendManager).getPausedContexts().listIterator(); iterator.hasNext();) { - SuspendContextImpl context = iterator.next(); - if(context.getThread() == thread) { + for (SuspendContextImpl context : ((SuspendManagerImpl)suspendManager).getPausedContexts()) { + if (context.getThread() == thread) { return context; } } @@ -78,8 +75,7 @@ public class SuspendManagerUtil { LOG.assertTrue(context.myResumedThreads == null); if(data.myResumedThreads != null) { - for (Iterator<ThreadReferenceProxyImpl> iterator = data.myResumedThreads.iterator(); iterator.hasNext();) { - ThreadReferenceProxyImpl resumedThreads = iterator.next(); + for (ThreadReferenceProxyImpl resumedThreads : data.myResumedThreads) { resumedThreads.resume(); } context.myResumedThreads = data.myResumedThreads; @@ -101,8 +97,7 @@ public class SuspendManagerUtil { LOG.debug("Resuming SuspendContextImpl..."); } if(context.myResumedThreads != null) { - for (Iterator<ThreadReferenceProxyImpl> iterator = context.myResumedThreads.iterator(); iterator.hasNext();) { - ThreadReferenceProxyImpl resumedThreads = iterator.next(); + for (ThreadReferenceProxyImpl resumedThreads : context.myResumedThreads) { resumedThreads.suspend(); } context.myResumedThreads = null; diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/EvaluationContextImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/EvaluationContextImpl.java index 24babfd066b5..b6ca9eafe1f1 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/EvaluationContextImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/EvaluationContextImpl.java @@ -23,51 +23,58 @@ import com.intellij.openapi.project.Project; import com.sun.jdi.ClassLoaderReference; import com.sun.jdi.Value; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -/** - * User: lex - * Date: Aug 28, 2003 - * Time: 2:02:29 PM - */ public final class EvaluationContextImpl implements EvaluationContext{ private final Value myThisObject; private final SuspendContextImpl mySuspendContext; private final StackFrameProxyImpl myFrameProxy; private boolean myAutoLoadClasses = true; - public EvaluationContextImpl(@NotNull SuspendContextImpl suspendContext, StackFrameProxyImpl frameProxy, Value thisObject) { + public EvaluationContextImpl(@NotNull SuspendContextImpl suspendContext, StackFrameProxyImpl frameProxy, @Nullable Value thisObject) { myThisObject = thisObject; myFrameProxy = frameProxy; mySuspendContext = suspendContext; } + @Nullable + @Override public Value getThisObject() { return myThisObject; } + @NotNull + @Override public SuspendContextImpl getSuspendContext() { return mySuspendContext; } + @Override public StackFrameProxyImpl getFrameProxy() { return myFrameProxy; } + @NotNull + @Override public DebugProcessImpl getDebugProcess() { return getSuspendContext().getDebugProcess(); } + @Override public Project getProject() { DebugProcessImpl debugProcess = getDebugProcess(); - return debugProcess != null ? debugProcess.getProject() : null; + return debugProcess.getProject(); } + @Override public EvaluationContextImpl createEvaluationContext(Value value) { final EvaluationContextImpl copy = new EvaluationContextImpl(getSuspendContext(), getFrameProxy(), value); copy.setAutoLoadClasses(myAutoLoadClasses); return copy; } + @Nullable + @Override public ClassLoaderReference getClassLoader() throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); return myFrameProxy != null ? myFrameProxy.getClassLoader() : null; diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java index 4eda8984e285..e8db7893e16a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/TextWithImportsImpl.java @@ -73,14 +73,17 @@ public final class TextWithImportsImpl implements TextWithImports{ return Trinity.create(split[0], split.length > 1 ? split[1] : "", split.length > 2 ? FileTypeManager.getInstance().getStdFileType(split[2]) : null); } + @Override public CodeFragmentKind getKind() { return myKind; } + @Override public String getText() { return myText; } + @Override public @NotNull String getImports() { return myImports; } @@ -97,6 +100,7 @@ public final class TextWithImportsImpl implements TextWithImports{ return getText(); } + @Override public String toExternalForm() { String result = myText; if (StringUtil.isNotEmpty(myImports) || myFileType != null) { @@ -112,15 +116,17 @@ public final class TextWithImportsImpl implements TextWithImports{ return myText.hashCode(); } + @Override public boolean isEmpty() { - final String text = getText(); - return text == null || "".equals(text.trim()); + return StringUtil.isEmptyOrSpaces(getText()); } + @Override public void setText(String newText) { myText = newText; } + @Override public FileType getFileType() { return myFileType; } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BinaryExpressionEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BinaryExpressionEvaluator.java index db00e47f9295..14d46e7f361b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BinaryExpressionEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BinaryExpressionEvaluator.java @@ -21,6 +21,7 @@ package com.intellij.debugger.engine.evaluation.expression; import com.intellij.debugger.DebuggerBundle; +import com.intellij.debugger.engine.DebuggerUtils; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; @@ -45,10 +46,12 @@ class BinaryExpressionEvaluator implements Evaluator { myExpectedType = expectedType; } + @Override public Modifier getModifier() { return null; } + @Override public Object evaluate(EvaluationContextImpl context) throws EvaluateException { Value leftResult = (Value)myLeftOperand.evaluate(context); return evaluateOperation(leftResult, myOpType, myRightOperand, myExpectedType, context); @@ -72,12 +75,12 @@ class BinaryExpressionEvaluator implements Evaluator { } Value rightResult = (Value)rightOperand.evaluate(context); if (opType == JavaTokenType.PLUS) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 + v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { final double v1 = ((PrimitiveValue)leftResult).doubleValue(); final double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 + v2); @@ -88,19 +91,19 @@ class BinaryExpressionEvaluator implements Evaluator { return DebuggerUtilsEx.createValue(vm, expectedType, v1 + v2); } if (leftResult instanceof StringReference || rightResult instanceof StringReference) { - String v1 = DebuggerUtilsEx.getValueAsString(context, leftResult); - String v2 = DebuggerUtilsEx.getValueAsString(context, rightResult); + String v1 = DebuggerUtils.getValueAsString(context, leftResult); + String v2 = DebuggerUtils.getValueAsString(context, rightResult); return vm.mirrorOf(v1 + v2); } throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "+")); } else if (opType == JavaTokenType.MINUS) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 - v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 - v2); @@ -113,12 +116,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "-")); } else if (opType == JavaTokenType.ASTERISK) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 * v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 * v2); @@ -131,12 +134,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "*")); } else if (opType == JavaTokenType.DIV) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { long v1 = ((PrimitiveValue)leftResult).longValue(); long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 / v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 / v2); @@ -149,12 +152,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "/")); } else if (opType == JavaTokenType.PERC) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { long v1 = ((PrimitiveValue)leftResult).longValue(); long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 % v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 % v2); @@ -167,7 +170,7 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "%")); } else if (opType == JavaTokenType.LTLT) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v2 = ((PrimitiveValue)rightResult).longValue(); if (leftResult instanceof ByteValue) { return DebuggerUtilsEx.createValue(vm, expectedType, ((ByteValue)leftResult).byteValue() << v2); @@ -186,7 +189,7 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "<<")); } else if (opType == JavaTokenType.GTGT) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v2 = ((PrimitiveValue)rightResult).longValue(); if (leftResult instanceof ByteValue) { return DebuggerUtilsEx.createValue(vm, expectedType, ((ByteValue)leftResult).byteValue() >> v2); @@ -205,7 +208,7 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", ">>")); } else if (opType == JavaTokenType.GTGTGT) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v2 = ((PrimitiveValue)rightResult).longValue(); if (leftResult instanceof ByteValue) { return DebuggerUtilsEx.createValue(vm, expectedType, ((ByteValue)leftResult).byteValue() >>> v2); @@ -224,7 +227,7 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", ">>>")); } else if (opType == JavaTokenType.AND) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { long v1 = ((PrimitiveValue)leftResult).longValue(); long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 & v2); @@ -242,7 +245,7 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "&")); } else if (opType == JavaTokenType.OR) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { long v1 = ((PrimitiveValue)leftResult).longValue(); long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 | v2); @@ -260,7 +263,7 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "|")); } else if (opType == JavaTokenType.XOR) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { long v1 = ((PrimitiveValue)leftResult).longValue(); long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 ^ v2); @@ -282,17 +285,17 @@ class BinaryExpressionEvaluator implements Evaluator { return DebuggerUtilsEx.createValue(vm, expectedType, true); } if (leftResult == null) { - return DebuggerUtilsEx.createValue(vm, expectedType, rightResult.equals(leftResult)); + return DebuggerUtilsEx.createValue(vm, expectedType, rightResult.equals(null)); } if (rightResult == null) { - return DebuggerUtilsEx.createValue(vm, expectedType, leftResult.equals(rightResult)); + return DebuggerUtilsEx.createValue(vm, expectedType, leftResult.equals(null)); } - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 == v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 == v2); @@ -332,14 +335,14 @@ class BinaryExpressionEvaluator implements Evaluator { } else if (opType == JavaTokenType.NE) { if (leftResult == null && rightResult == null) return DebuggerUtilsEx.createValue(vm, expectedType, false); - if (leftResult == null) return DebuggerUtilsEx.createValue(vm, expectedType, !rightResult.equals(leftResult)); - if (rightResult == null) return DebuggerUtilsEx.createValue(vm, expectedType, !leftResult.equals(rightResult)); - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (leftResult == null) return DebuggerUtilsEx.createValue(vm, expectedType, !rightResult.equals(null)); + if (rightResult == null) return DebuggerUtilsEx.createValue(vm, expectedType, !leftResult.equals(null)); + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 != v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 != v2); @@ -362,12 +365,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "!=")); } else if (opType == JavaTokenType.LT) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 < v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 < v2); @@ -380,12 +383,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "<")); } else if (opType == JavaTokenType.GT) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 > v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 > v2); @@ -398,12 +401,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", ">")); } else if (opType == JavaTokenType.LE) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 <= v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 <= v2); @@ -416,12 +419,12 @@ class BinaryExpressionEvaluator implements Evaluator { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.incompatible.types", "<=")); } else if (opType == JavaTokenType.GE) { - if (DebuggerUtilsEx.isInteger(leftResult) && DebuggerUtilsEx.isInteger(rightResult)) { + if (DebuggerUtils.isInteger(leftResult) && DebuggerUtils.isInteger(rightResult)) { final long v1 = ((PrimitiveValue)leftResult).longValue(); final long v2 = ((PrimitiveValue)rightResult).longValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 >= v2); } - if (DebuggerUtilsEx.isNumeric(leftResult) && DebuggerUtilsEx.isNumeric(rightResult)) { + if (DebuggerUtils.isNumeric(leftResult) && DebuggerUtils.isNumeric(rightResult)) { double v1 = ((PrimitiveValue)leftResult).doubleValue(); double v2 = ((PrimitiveValue)rightResult).doubleValue(); return DebuggerUtilsEx.createValue(vm, expectedType, v1 >= v2); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BlockStatementEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BlockStatementEvaluator.java index 464aa6ea4f35..57b1a44bb3c5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BlockStatementEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/BlockStatementEvaluator.java @@ -28,6 +28,7 @@ public class BlockStatementEvaluator implements Evaluator { myStatements = statements; } + @Override public Object evaluate(EvaluationContextImpl context) throws EvaluateException { Object result = context.getSuspendContext().getDebugProcess().getVirtualMachineProxy().mirrorOf(); for (Evaluator statement : myStatements) { @@ -36,6 +37,7 @@ public class BlockStatementEvaluator implements Evaluator { return result; } + @Override public Modifier getModifier() { return myStatements.length > 0 ? myStatements[myStatements.length - 1].getModifier() : null; } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ConditionalExpressionEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ConditionalExpressionEvaluator.java index 3514d357610b..7eacd4ace313 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ConditionalExpressionEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ConditionalExpressionEvaluator.java @@ -20,10 +20,10 @@ */ package com.intellij.debugger.engine.evaluation.expression; -import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; +import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil; -import com.intellij.debugger.DebuggerBundle; +import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; import com.sun.jdi.BooleanValue; import com.sun.jdi.Value; @@ -38,10 +38,12 @@ class ConditionalExpressionEvaluator implements Evaluator { myElseEvaluator = elseEvaluator; } + @Override public Modifier getModifier() { return null; } + @Override public Object evaluate(EvaluationContextImpl context) throws EvaluateException { Value condition = (Value)myConditionEvaluator.evaluate(context); if (condition == null || !(condition instanceof BooleanValue)) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java index ef444ea8d7ff..aa88a0bcf43a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java @@ -59,7 +59,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder { return ourInstance; } - public static ExpressionEvaluator build(final TextWithImports text, final PsiElement contextElement, final SourcePosition position) throws EvaluateException { + public static ExpressionEvaluator build(final TextWithImports text, @Nullable PsiElement contextElement, final SourcePosition position) throws EvaluateException { if (contextElement == null) { throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS; } @@ -68,17 +68,16 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder { CodeFragmentFactory factory = DebuggerEditorImpl.findAppropriateFactory(text, contextElement); PsiCodeFragment codeFragment = new CodeFragmentFactoryContextWrapper(factory).createCodeFragment(text, contextElement, project); - if(codeFragment == null) { + if (codeFragment == null) { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", text.getText())); } codeFragment.forceResolveScope(GlobalSearchScope.allScope(project)); DebuggerUtils.checkSyntax(codeFragment); - EvaluatorBuilder evaluatorBuilder = factory.getEvaluatorBuilder(); - - return evaluatorBuilder.build(codeFragment, position); + return factory.getEvaluatorBuilder().build(codeFragment, position); } + @Override public ExpressionEvaluator build(final PsiElement codeFragment, final SourcePosition position) throws EvaluateException { return new Builder(position).buildElement(codeFragment); } @@ -339,7 +338,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder { @NotNull PsiType rType, @NotNull IElementType operation, @NotNull PsiType expressionExpectedType) { - // handle unboxing if neccesary + // handle unboxing if necessary if (isUnboxingInBinaryExpressionApplicable(lType, rType, operation)) { if (rType instanceof PsiClassType && UnBoxingEvaluator.isTypeUnboxable(rType.getCanonicalText())) { rResult = new UnBoxingEvaluator(rResult); @@ -995,12 +994,12 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder { /** * Handles unboxing and numeric promotion issues for - * - array diumention expressions + * - array dimension expressions * - array index expression * - unary +, -, and ~ operations * @param operandExpressionType - * @param operandEvaluator @return operandEvaluator possibly 'wrapped' with neccesary unboxing and type-casting evaluators to make returning value - * sutable for mentioned contexts + * @param operandEvaluator @return operandEvaluator possibly 'wrapped' with necessary unboxing and type-casting evaluators to make returning value + * suitable for mentioned contexts */ private static Evaluator handleUnaryNumericPromotion(final PsiType operandExpressionType, Evaluator operandEvaluator) { final PsiPrimitiveType unboxedType = PsiPrimitiveType.getUnboxedType(operandExpressionType); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ExpressionEvaluatorImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ExpressionEvaluatorImpl.java index 4b974c183b54..66fd0eb3971e 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ExpressionEvaluatorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/ExpressionEvaluatorImpl.java @@ -15,11 +15,11 @@ */ package com.intellij.debugger.engine.evaluation.expression; +import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil; import com.intellij.debugger.engine.evaluation.EvaluationContext; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; -import com.intellij.debugger.DebuggerBundle; import com.intellij.openapi.diagnostic.Logger; import com.sun.jdi.Value; @@ -40,16 +40,19 @@ public class ExpressionEvaluatorImpl implements ExpressionEvaluator { } //call evaluate before + @Override public Value getValue() { return myValue; } //call evaluate before + @Override public Modifier getModifier() { return myEvaluator.getModifier(); } // EvaluationContextImpl should be at the same stackFrame as it was in the call to EvaluatorBuilderImpl.build + @Override public Value evaluate(final EvaluationContext context) throws EvaluateException { if (!context.getDebugProcess().isAttached()) { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("error.vm.disconnected")); @@ -61,22 +64,24 @@ public class ExpressionEvaluatorImpl implements ExpressionEvaluator { Object value = myEvaluator.evaluate((EvaluationContextImpl)context); - if(value != null && !(value instanceof Value)) { + if (value != null && !(value instanceof Value)) { throw EvaluateExceptionUtil .createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", "")); } - myValue = (Value) value; + myValue = (Value)value; return myValue; } catch (Throwable/*IncompatibleThreadStateException*/ e) { if (LOG.isDebugEnabled()) { LOG.debug(e); } - if(e instanceof EvaluateException) + if (e instanceof EvaluateException) { throw ((EvaluateException)e); - else + } + else { throw EvaluateExceptionUtil.createEvaluateException(e); + } } } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LocalVariableEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LocalVariableEvaluator.java index ce060c0bfd26..b02ec96fad31 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LocalVariableEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LocalVariableEvaluator.java @@ -53,6 +53,7 @@ class LocalVariableEvaluator implements Evaluator { myParameterIndex = parameterIndex; } + @Override public Object evaluate(EvaluationContextImpl context) throws EvaluateException { StackFrameProxyImpl frameProxy = context.getFrameProxy(); if (frameProxy == null) { @@ -109,37 +110,45 @@ class LocalVariableEvaluator implements Evaluator { } } + @Override public Modifier getModifier() { Modifier modifier = null; if (myEvaluatedVariable != null && myContext != null) { modifier = new Modifier() { + @Override public boolean canInspect() { return true; } + @Override public boolean canSetValue() { return true; } + @Override public void setValue(Value value) throws ClassNotLoadedException, InvalidTypeException { StackFrameProxyImpl frameProxy = myContext.getFrameProxy(); try { + assert frameProxy != null; frameProxy.setValue(myEvaluatedVariable, value); } catch (EvaluateException e) { - LOG.error(e); + LOG.error(e); } } + @Override public Type getExpectedType() throws ClassNotLoadedException { try { return myEvaluatedVariable.getType(); - } catch (EvaluateException e) { + } + catch (EvaluateException e) { LOG.error(e); return null; } } + @Override public NodeDescriptorImpl getInspectItem(Project project) { return new LocalVariableDescriptorImpl(project, myEvaluatedVariable); } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java index a4f9a8d55d48..ed1ad4c2ab46 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java @@ -22,6 +22,7 @@ package com.intellij.debugger.engine.evaluation.expression; import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.engine.DebugProcessImpl; +import com.intellij.debugger.engine.DebuggerUtils; import com.intellij.debugger.engine.JVMName; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil; @@ -53,10 +54,12 @@ public class MethodEvaluator implements Evaluator { myArgumentEvaluators = argumentEvaluators; } + @Override public Modifier getModifier() { return null; } + @Override public Object evaluate(EvaluationContextImpl context) throws EvaluateException { if(!context.getDebugProcess().isAttached()) return null; DebugProcessImpl debugProcess = context.getDebugProcess(); @@ -126,7 +129,7 @@ public class MethodEvaluator implements Evaluator { if (requiresSuperObject && (referenceType instanceof ClassType)) { _refType = ((ClassType)referenceType).superclass(); } - final Method jdiMethod = DebuggerUtilsEx.findMethod(_refType, myMethodName, signature); + final Method jdiMethod = DebuggerUtils.findMethod(_refType, myMethodName, signature); if (jdiMethod == null) { throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.no.instance.method", methodName)); } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerCommandImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerCommandImpl.java index 038ff6db1b2a..3bfedcecfafe 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerCommandImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerCommandImpl.java @@ -26,6 +26,7 @@ public abstract class DebuggerCommandImpl extends DebuggerTaskImpl { protected void commandCancelled() { } + @Override public Priority getPriority() { return Priority.LOW; } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java index aaf363184e93..e53e92f5d6b8 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/events/DebuggerContextCommandImpl.java @@ -22,14 +22,16 @@ import com.intellij.debugger.impl.DebuggerContextImpl; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.openapi.diagnostic.Logger; import com.sun.jdi.ObjectCollectedException; +import org.jetbrains.annotations.NotNull; public abstract class DebuggerContextCommandImpl extends SuspendContextCommandImpl { - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.events.DebuggerContextCommandImpl"); + private static final Logger LOG = Logger.getInstance(DebuggerContextCommandImpl.class); private final DebuggerContextImpl myDebuggerContext; - protected DebuggerContextCommandImpl(DebuggerContextImpl debuggerContext) { + protected DebuggerContextCommandImpl(@NotNull DebuggerContextImpl debuggerContext) { super(debuggerContext.getSuspendContext()); + myDebuggerContext = debuggerContext; } @@ -37,15 +39,15 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm return myDebuggerContext; } + @Override public final void contextAction() throws Exception { final SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager(); - final ThreadReferenceProxyImpl debuggerContextThread = myDebuggerContext.getThreadProxy(); final boolean isSuspendedByContext; try { isSuspendedByContext = suspendManager.isSuspended(debuggerContextThread); } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { notifyCancelled(); return; } @@ -59,7 +61,7 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm else { // there are no suspend context currently registered SuspendContextImpl suspendContextForThread = SuspendManagerUtil.findContextByThread(suspendManager, debuggerContextThread); - if(suspendContextForThread != null) { + if (suspendContextForThread != null) { suspendContextForThread.postponeCommand(this); } else { @@ -68,5 +70,5 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm } } - abstract public void threadAction (); + abstract public void threadAction(); } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java index 739c96270cca..e3bdc6703859 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java @@ -17,33 +17,32 @@ package com.intellij.debugger.engine.events; import com.intellij.debugger.engine.DebuggerManagerThreadImpl; import com.intellij.debugger.engine.SuspendContextImpl; +import com.intellij.debugger.engine.managerThread.SuspendContextCommand; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.containers.Stack; +import org.jetbrains.annotations.Nullable; /** - * Created by IntelliJ IDEA. - * User: lex - * Date: Feb 24, 2004 - * Time: 7:01:31 PM * Performs contextAction when evaluation is available in suspend context */ public abstract class SuspendContextCommandImpl extends DebuggerCommandImpl { - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.SuspendContextCommand"); + private static final Logger LOG = Logger.getInstance(SuspendContextCommand.class); + private final SuspendContextImpl mySuspendContext; - protected SuspendContextCommandImpl(SuspendContextImpl suspendContext) { + protected SuspendContextCommandImpl(@Nullable SuspendContextImpl suspendContext) { mySuspendContext = suspendContext; } public abstract void contextAction() throws Exception; + @Override public final void action() throws Exception { - if(LOG.isDebugEnabled()) { + if (LOG.isDebugEnabled()) { LOG.debug("trying " + this); } final SuspendContextImpl suspendContext = getSuspendContext(); - if (suspendContext == null) { if (LOG.isDebugEnabled()) { LOG.debug("skip processing - context is null " + this); @@ -52,12 +51,12 @@ public abstract class SuspendContextCommandImpl extends DebuggerCommandImpl { return; } - if(suspendContext.myInProgress) { + if (suspendContext.myInProgress) { suspendContext.postponeCommand(this); } else { try { - if(!suspendContext.isResumed()) { + if (!suspendContext.isResumed()) { suspendContext.myInProgress = true; contextAction(); } @@ -65,7 +64,7 @@ public abstract class SuspendContextCommandImpl extends DebuggerCommandImpl { notifyCancelled(); } } - finally{ + finally { suspendContext.myInProgress = false; if (suspendContext.isResumed()) { for (SuspendContextCommandImpl postponed = suspendContext.pollPostponedCommand(); postponed != null; postponed = suspendContext.pollPostponedCommand()) { @@ -90,6 +89,7 @@ public abstract class SuspendContextCommandImpl extends DebuggerCommandImpl { } } + @Nullable public SuspendContextImpl getSuspendContext() { return mySuspendContext; } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java index 640f76cad628..6c3568c29347 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java @@ -47,16 +47,23 @@ public final class DebuggerContextImpl implements DebuggerContext { private boolean myInitialized; @Nullable - private final DebuggerSession myDebuggerSession; - private final DebugProcessImpl myDebugProcess; - private final SuspendContextImpl mySuspendContext; + private final DebuggerSession myDebuggerSession; + private final DebugProcessImpl myDebugProcess; + private final SuspendContextImpl mySuspendContext; private final ThreadReferenceProxyImpl myThreadProxy; - private StackFrameProxyImpl myFrameProxy; - private SourcePosition mySourcePosition; - private PsiElement myContextElement; - - private DebuggerContextImpl(@Nullable DebuggerSession session, DebugProcessImpl debugProcess, SuspendContextImpl context, ThreadReferenceProxyImpl threadProxy, StackFrameProxyImpl frameProxy, SourcePosition position, PsiElement contextElement, boolean initialized) { + private StackFrameProxyImpl myFrameProxy; + private SourcePosition mySourcePosition; + private PsiElement myContextElement; + + private DebuggerContextImpl(@Nullable DebuggerSession session, + @Nullable DebugProcessImpl debugProcess, + @Nullable SuspendContextImpl context, + ThreadReferenceProxyImpl threadProxy, + StackFrameProxyImpl frameProxy, + SourcePosition position, + PsiElement contextElement, + boolean initialized) { LOG.assertTrue(frameProxy == null || threadProxy == null || threadProxy == frameProxy.threadProxy()); LOG.assertTrue(debugProcess != null || frameProxy == null && threadProxy == null); myDebuggerSession = session; @@ -74,6 +81,7 @@ public final class DebuggerContextImpl implements DebuggerContext { return myDebuggerSession; } + @Nullable @Override public DebugProcessImpl getDebugProcess() { return myDebugProcess; @@ -133,7 +141,10 @@ public final class DebuggerContextImpl implements DebuggerContext { return new EvaluationContextImpl(getSuspendContext(), frameProxy, objectReference); } - public static DebuggerContextImpl createDebuggerContext(DebuggerSession session, SuspendContextImpl context, ThreadReferenceProxyImpl threadProxy, StackFrameProxyImpl frameProxy) { + public static DebuggerContextImpl createDebuggerContext(@Nullable DebuggerSession session, + @Nullable SuspendContextImpl context, + ThreadReferenceProxyImpl threadProxy, + StackFrameProxyImpl frameProxy) { LOG.assertTrue(frameProxy == null || threadProxy == null || threadProxy == frameProxy.threadProxy()); LOG.assertTrue(session == null || session.getProcess() != null); return new DebuggerContextImpl(session, session != null ? session.getProcess() : null, context, threadProxy, frameProxy, null, null, context == null); @@ -153,7 +164,7 @@ public final class DebuggerContextImpl implements DebuggerContext { } } - if(myFrameProxy != null) { + if (myFrameProxy != null) { PsiDocumentManager.getInstance(getProject()).commitAndRunReadAction(new Runnable() { @Override public void run() { diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java index c60a3b220906..f5404cd65023 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java @@ -81,6 +81,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent private final MyDebuggerStateManager myDebuggerStateManager = new MyDebuggerStateManager(); private final DebuggerContextListener mySessionListener = new DebuggerContextListener() { + @Override public void changeEvent(DebuggerContextImpl newContext, int event) { final DebuggerSession session = newContext.getDebuggerSession(); @@ -110,14 +111,17 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent }; @NonNls private static final String DEBUG_KEY_NAME = "idea.xdebug.key"; + @Override public void addClassNameMapper(final NameMapper mapper) { myNameMappers.add(mapper); } + @Override public void removeClassNameMapper(final NameMapper mapper) { myNameMappers.remove(mapper); } + @Override public String getVMClassQualifiedName(@NotNull final PsiClass aClass) { for (NameMapper nameMapper : myNameMappers) { final String qName = nameMapper.getQualifiedName(aClass); @@ -128,10 +132,12 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent return aClass.getQualifiedName(); } + @Override public void addDebuggerManagerListener(DebuggerManagerListener listener) { myDispatcher.addListener(listener); } + @Override public void removeDebuggerManagerListener(DebuggerManagerListener listener) { myDispatcher.removeListener(listener); } @@ -141,6 +147,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent myBreakpointManager = new BreakpointManager(myProject, startupManager, this); if (!project.isDefault()) { colorsManager.addEditorColorsListener(new EditorColorsListener() { + @Override public void globalSchemeChange(EditorColorsScheme scheme) { getBreakpointManager().updateBreakpointsUI(); } @@ -148,6 +155,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } } + @Override public DebuggerSession getSession(DebugProcess process) { ApplicationManager.getApplication().assertIsDispatchThread(); for (final DebuggerSession debuggerSession : getSessions()) { @@ -156,6 +164,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent return null; } + @Override public Collection<DebuggerSession> getSessions() { synchronized (mySessions) { final Collection<DebuggerSession> values = mySessions.values(); @@ -163,15 +172,19 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } } + @Override public void disposeComponent() { } + @Override public void initComponent() { } + @Override public void projectClosed() { } + @Override public void projectOpened() { myBreakpointManager.init(); } @@ -193,6 +206,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent myBreakpointManager.writeExternal(element); } + @Override public DebuggerSession attachVirtualMachine(Executor executor, ProgramRunner runner, ModuleRunProfile profile, @@ -209,10 +223,12 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent pollConnection)); } + @Override public DebuggerSession attachVirtualMachine(DebugEnvironment environment) throws ExecutionException { ApplicationManager.getApplication().assertIsDispatchThread(); final DebugProcessEvents debugProcess = new DebugProcessEvents(myProject); debugProcess.addDebugProcessListener(new DebugProcessAdapter() { + @Override public void processAttached(final DebugProcess process) { process.removeDebugProcessListener(this); for (Function<DebugProcess, PositionManager> factory : myCustomPositionManagerFactories) { @@ -229,10 +245,12 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } } + @Override public void processDetached(final DebugProcess process, final boolean closedByUser) { debugProcess.removeDebugProcessListener(this); } + @Override public void attachException(final RunProfileState state, final ExecutionException exception, final RemoteConnection remoteConnection) { @@ -263,6 +281,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent // RemoteProcessHandler on the other hand will call debugProcess.stop() as a part of destroyProcess() and detachProcess() implementation, // so we shouldn't add the listener to avoid calling stop() twice processHandler.addProcessListener(new ProcessAdapter() { + @Override public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) { final DebugProcessImpl debugProcess = getDebugProcess(event.getProcessHandler()); if (debugProcess != null) { @@ -283,6 +302,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } + @Override public DebugProcessImpl getDebugProcess(final ProcessHandler processHandler) { synchronized (mySessions) { DebuggerSession session = mySessions.get(processHandler); @@ -298,6 +318,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } } + @Override public void addDebugProcessListener(final ProcessHandler processHandler, final DebugProcessListener listener) { DebugProcessImpl debugProcess = getDebugProcess(processHandler); if (debugProcess != null) { @@ -305,6 +326,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } else { processHandler.addProcessListener(new ProcessAdapter() { + @Override public void startNotified(ProcessEvent event) { DebugProcessImpl debugProcess = getDebugProcess(processHandler); if (debugProcess != null) { @@ -316,6 +338,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } } + @Override public void removeDebugProcessListener(final ProcessHandler processHandler, final DebugProcessListener listener) { DebugProcessImpl debugProcess = getDebugProcess(processHandler); if (debugProcess != null) { @@ -323,6 +346,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } else { processHandler.addProcessListener(new ProcessAdapter() { + @Override public void startNotified(ProcessEvent event) { DebugProcessImpl debugProcess = getDebugProcess(processHandler); if (debugProcess != null) { @@ -334,31 +358,38 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent } } + @Override public boolean isDebuggerManagerThread() { return DebuggerManagerThreadImpl.isManagerThread(); } + @Override @NotNull public String getComponentName() { return "DebuggerManager"; } + @Override public BreakpointManager getBreakpointManager() { return myBreakpointManager; } + @Override public DebuggerContextImpl getContext() { return getContextManager().getContext(); } + @Override public DebuggerStateManager getContextManager() { return myDebuggerStateManager; } + @Override public void registerPositionManagerFactory(final Function<DebugProcess, PositionManager> factory) { myCustomPositionManagerFactories.add(factory); } + @Override public void unregisterPositionManagerFactory(final Function<DebugProcess, PositionManager> factory) { myCustomPositionManagerFactories.remove(factory); } @@ -473,6 +504,7 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent final String _debuggeeRunProperties = debuggeeRunProperties; ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override @SuppressWarnings({"HardCodedStringLiteral"}) public void run() { JavaSdkUtil.addRtJar(parameters.getClassPath()); @@ -575,10 +607,12 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent private static class MyDebuggerStateManager extends DebuggerStateManager { private DebuggerSession myDebuggerSession; + @Override public DebuggerContextImpl getContext() { return myDebuggerSession == null ? DebuggerContextImpl.EMPTY_CONTEXT : myDebuggerSession.getContextManager().getContext(); } + @Override public void setState(final DebuggerContextImpl context, int state, int event, String description) { ApplicationManager.getApplication().assertIsDispatchThread(); myDebuggerSession = context.getDebuggerSession(); diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java index aa2b4793ec42..f68436fbda52 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java @@ -60,20 +60,20 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { /** * @param context - * @return all CodeFragmentFactoryProviders that provide code fragment factories sutable in the context given + * @return all CodeFragmentFactoryProviders that provide code fragment factories suitable in the context given */ public static List<CodeFragmentFactory> getCodeFragmentFactories(@Nullable PsiElement context) { - final DefaultCodeFragmentFactory defaultFactry = DefaultCodeFragmentFactory.getInstance(); + final DefaultCodeFragmentFactory defaultFactory = DefaultCodeFragmentFactory.getInstance(); final CodeFragmentFactory[] providers = ApplicationManager.getApplication().getExtensions(CodeFragmentFactory.EXTENSION_POINT_NAME); final List<CodeFragmentFactory> suitableFactories = new ArrayList<CodeFragmentFactory>(providers.length); if (providers.length > 0) { for (CodeFragmentFactory factory : providers) { - if (factory != defaultFactry && factory.isContextAccepted(context)) { + if (factory != defaultFactory && factory.isContextAccepted(context)) { suitableFactories.add(factory); } } } - suitableFactories.add(defaultFactry); // let default factory be the last one + suitableFactories.add(defaultFactory); // let default factory be the last one return suitableFactories; } @@ -122,9 +122,8 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { return superClass; } } - List<InterfaceType> ifaces = classType.allInterfaces(); - for (Iterator<InterfaceType> it = ifaces.iterator(); it.hasNext();) { - InterfaceType iface = it.next(); + List<InterfaceType> interfaces = classType.allInterfaces(); + for (InterfaceType iface : interfaces) { ReferenceType superClass = getSuperClass(baseQualifiedName, iface); if (superClass != null) { return superClass; @@ -134,8 +133,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { if (checkedType instanceof InterfaceType) { List<InterfaceType> list = ((InterfaceType)checkedType).superinterfaces(); - for (Iterator<InterfaceType> it = list.iterator(); it.hasNext();) { - InterfaceType superInterface = it.next(); + for (InterfaceType superInterface : list) { ReferenceType superClass = getSuperClass(baseQualifiedName, superInterface); if (superClass != null) { return superClass; @@ -246,9 +244,9 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { return ClassFilter.EMPTY_ARRAY; } List<ClassFilter> classFiltersList = new ArrayList<ClassFilter>(children.size()); - for (Iterator i = children.iterator(); i.hasNext();) { + for (Object aChildren : children) { final ClassFilter classFilter = new ClassFilter(); - classFilter.readExternal((Element)i.next()); + classFilter.readExternal((Element)aChildren); classFiltersList.add(classFilter); } return classFiltersList.toArray(new ClassFilter[classFiltersList.size()]); @@ -268,12 +266,8 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { } final Set<ClassFilter> f1 = new HashSet<ClassFilter>(Math.max((int) (filters1.length/.75f) + 1, 16)); final Set<ClassFilter> f2 = new HashSet<ClassFilter>(Math.max((int) (filters2.length/.75f) + 1, 16)); - for (ClassFilter filter : filters1) { - f1.add(filter); - } - for (ClassFilter aFilters2 : filters2) { - f2.add(aFilters2); - } + Collections.addAll(f1, filters1); + Collections.addAll(f2, filters2); return f2.equals(f1); } @@ -284,13 +278,11 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { if(l1.size() != l2.size()) return false; Iterator<Element> i1 = l1.iterator(); - Iterator<Element> i2 = l2.iterator(); - while (i2.hasNext()) { + for (Element aL2 : l2) { Element elem1 = i1.next(); - Element elem2 = i2.next(); - if(!elementsEqual(elem1, elem2)) return false; + if (!elementsEqual(elem1, aL2)) return false; } return true; } @@ -302,13 +294,11 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { if(l1.size() != l2.size()) return false; Iterator<Attribute> i1 = l1.iterator(); - Iterator<Attribute> i2 = l2.iterator(); - while (i2.hasNext()) { + for (Attribute aL2 : l2) { Attribute attr1 = i1.next(); - Attribute attr2 = i2.next(); - if (!Comparing.equal(attr1.getName(), attr2.getName()) || !Comparing.equal(attr1.getValue(), attr2.getValue())) { + if (!Comparing.equal(attr1.getName(), aL2.getName()) || !Comparing.equal(attr1.getValue(), aL2.getValue())) { return false; } } @@ -322,10 +312,10 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { if (!Comparing.equal(e1.getName(), e2.getName())) { return false; } - if (!elementListsEqual ((List<Element>)e1.getChildren(), (List<Element>)e2.getChildren())) { + if (!elementListsEqual (e1.getChildren(), e2.getChildren())) { return false; } - if (!attributeListsEqual((List<Attribute>)e1.getAttributes(), (List<Attribute>)e2.getAttributes())) { + if (!attributeListsEqual(e1.getAttributes(), e2.getAttributes())) { return false; } return true; @@ -410,6 +400,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { @Nullable public static CodeFragmentFactory getEffectiveCodeFragmentFactory(final PsiElement psiContext) { final CodeFragmentFactory factory = ApplicationManager.getApplication().runReadAction(new Computable<CodeFragmentFactory>() { + @Override public CodeFragmentFactory compute() { final List<CodeFragmentFactory> codeFragmentFactories = getCodeFragmentFactories(psiContext); // the list always contains at least DefaultCodeFragmentFactory @@ -469,7 +460,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { case '[': return getSignature() + "[]"; case '(': - StringBuffer result = new StringBuffer("("); + StringBuilder result = new StringBuilder("("); String separator = ""; while (peek() != ')') { result.append(separator); @@ -501,16 +492,18 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils { public static String methodName(final String className, final String methodName, final String signature) { try { return new SigReader(signature) { + @Override String getMethodName() { return methodName; } + @Override String getClassName() { return className; } }.getSignature(); } - catch (Exception e) { + catch (Exception ignored) { if (LOG.isDebugEnabled()) { LOG.debug("Internal error : unknown signature" + signature); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java b/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java index 8e782c5ac0a0..72f9abf97af3 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/InvokeThread.java @@ -39,6 +39,7 @@ public abstract class InvokeThread<E extends PrioritizedTask> { myOwner = owner; } + @Override public void run() { synchronized (this) { while (myRequestFuture == null) { @@ -144,10 +145,10 @@ public abstract class InvokeThread<E extends PrioritizedTask> { processEvent(myEvents.get()); } - catch (VMDisconnectedException e) { + catch (VMDisconnectedException ignored) { break; } - catch (EventQueueClosedException e) { + catch (EventQueueClosedException ignored) { break; } catch (RuntimeException e) { @@ -174,7 +175,7 @@ public abstract class InvokeThread<E extends PrioritizedTask> { } if (LOG.isDebugEnabled()) { - LOG.debug("Request " + this.toString() + " exited"); + LOG.debug("Request " + toString() + " exited"); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/SimpleStackFrameContext.java b/java/debugger/impl/src/com/intellij/debugger/impl/SimpleStackFrameContext.java index 207c5be2742a..528af2307105 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/SimpleStackFrameContext.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/SimpleStackFrameContext.java @@ -15,9 +15,10 @@ */ package com.intellij.debugger.impl; -import com.intellij.debugger.engine.StackFrameContext; import com.intellij.debugger.engine.DebugProcess; +import com.intellij.debugger.engine.StackFrameContext; import com.intellij.debugger.engine.jdi.StackFrameProxy; +import org.jetbrains.annotations.NotNull; /** * @author Eugene Zhuravlev @@ -32,10 +33,13 @@ public final class SimpleStackFrameContext implements StackFrameContext{ myProcess = process; } + @Override public StackFrameProxy getFrameProxy() { return myProxy; } + @Override + @NotNull public DebugProcess getDebugProcess() { return myProcess; } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArgValueData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArgValueData.java index 3595167f297d..de291e781f5c 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArgValueData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArgValueData.java @@ -18,6 +18,7 @@ package com.intellij.debugger.impl.descriptors.data; import com.intellij.debugger.ui.impl.watch.ArgumentValueDescriptorImpl; import com.intellij.openapi.project.Project; import com.sun.jdi.Value; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ArgValueData extends DescriptorData<ArgumentValueDescriptorImpl>{ @@ -33,7 +34,7 @@ public class ArgValueData extends DescriptorData<ArgumentValueDescriptorImpl>{ myDisplayName = displayName; } - protected ArgumentValueDescriptorImpl createDescriptorImpl(Project project) { + protected ArgumentValueDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new ArgumentValueDescriptorImpl(project, myIndex, myValue, myDisplayName); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArrayItemData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArrayItemData.java index 7973da61baef..5fc1d293b91a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArrayItemData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ArrayItemData.java @@ -36,7 +36,7 @@ public final class ArrayItemData extends DescriptorData<ArrayElementDescriptorIm myIndex = idx; } - protected ArrayElementDescriptorImpl createDescriptorImpl(Project project) { + protected ArrayElementDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new ArrayElementDescriptorImpl(project, myArray, myIndex); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/DescriptorData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/DescriptorData.java index 41f918140896..3332fba80f35 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/DescriptorData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/DescriptorData.java @@ -18,6 +18,7 @@ package com.intellij.debugger.impl.descriptors.data; import com.intellij.debugger.ui.tree.NodeDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; +import org.jetbrains.annotations.NotNull; public abstract class DescriptorData <T extends NodeDescriptor> implements DescriptorKey<T>{ private static final Key DESCRIPTOR_DATA = new Key("DESCRIPTOR_DATA"); @@ -25,13 +26,13 @@ public abstract class DescriptorData <T extends NodeDescriptor> implements Descr protected DescriptorData() { } - public T createDescriptor(Project project) { + public T createDescriptor(@NotNull Project project) { T descriptor = createDescriptorImpl(project); descriptor.putUserData(DESCRIPTOR_DATA, this); return descriptor; } - protected abstract T createDescriptorImpl(Project project); + protected abstract T createDescriptorImpl(@NotNull Project project); public abstract boolean equals(Object object); diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/FieldData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/FieldData.java index 8392489d8f83..d6b863ca74a0 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/FieldData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/FieldData.java @@ -30,7 +30,7 @@ public final class FieldData extends DescriptorData<FieldDescriptorImpl>{ myField = field; } - protected FieldDescriptorImpl createDescriptorImpl(Project project) { + protected FieldDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new FieldDescriptorImpl(project, myObjRef, myField); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/LocalData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/LocalData.java index 3e401a0dc052..576717649d9d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/LocalData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/LocalData.java @@ -19,6 +19,7 @@ import com.intellij.debugger.jdi.LocalVariableProxyImpl; import com.intellij.debugger.ui.impl.watch.LocalVariableDescriptorImpl; import com.intellij.openapi.project.Project; import com.intellij.util.StringBuilderSpinAllocator; +import org.jetbrains.annotations.NotNull; public class LocalData extends DescriptorData<LocalVariableDescriptorImpl>{ private final LocalVariableProxyImpl myLocalVariable; @@ -28,7 +29,7 @@ public class LocalData extends DescriptorData<LocalVariableDescriptorImpl>{ myLocalVariable = localVariable; } - protected LocalVariableDescriptorImpl createDescriptorImpl(Project project) { + protected LocalVariableDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new LocalVariableDescriptorImpl(project, myLocalVariable); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/MethodReturnValueData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/MethodReturnValueData.java index 1139b2f96d01..f0ffbd751995 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/MethodReturnValueData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/MethodReturnValueData.java @@ -41,7 +41,7 @@ public final class MethodReturnValueData extends DescriptorData<MethodReturnValu return myMethod; } - protected MethodReturnValueDescriptorImpl createDescriptorImpl(Project project) { + protected MethodReturnValueDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new MethodReturnValueDescriptorImpl(project, myMethod, myReturnValue); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StackFrameData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StackFrameData.java index 6dc840042a9a..dd1619ea2c70 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StackFrameData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StackFrameData.java @@ -21,27 +21,30 @@ import com.intellij.debugger.ui.impl.watch.NodeManagerImpl; import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; +import org.jetbrains.annotations.NotNull; public class StackFrameData extends DescriptorData<StackFrameDescriptorImpl>{ private final StackFrameProxyImpl myFrame; private final FrameDisplayKey myDisplayKey; private final MethodsTracker myMethodsTracker; - public StackFrameData(StackFrameProxyImpl frame) { + public StackFrameData(@NotNull StackFrameProxyImpl frame) { super(); + myFrame = frame; myDisplayKey = new FrameDisplayKey(NodeManagerImpl.getContextKeyForFrame(frame)); myMethodsTracker = new MethodsTracker(); - } - protected StackFrameDescriptorImpl createDescriptorImpl(Project project) { + @Override + protected StackFrameDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new StackFrameDescriptorImpl(myFrame, myMethodsTracker); } public boolean equals(Object object) { - if(!(object instanceof StackFrameData)) return false; - + if (!(object instanceof StackFrameData)) { + return false; + } return ((StackFrameData)object).myFrame == myFrame; } @@ -49,6 +52,7 @@ public class StackFrameData extends DescriptorData<StackFrameDescriptorImpl>{ return myFrame.hashCode(); } + @Override public DisplayKey<StackFrameDescriptorImpl> getDisplayKey() { return myDisplayKey; } @@ -74,6 +78,5 @@ public class StackFrameData extends DescriptorData<StackFrameDescriptorImpl>{ public int hashCode() { return myContextKey == null? 0 : myContextKey.hashCode(); } - } - + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticData.java index 178954b54a8d..327279e27513 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticData.java @@ -34,7 +34,7 @@ public final class StaticData extends DescriptorData<StaticDescriptorImpl>{ return myRefType; } - protected StaticDescriptorImpl createDescriptorImpl(Project project) { + protected StaticDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new StaticDescriptorImpl(myRefType); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticFieldData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticFieldData.java index adfbd3a6314a..156d6647b65f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticFieldData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/StaticFieldData.java @@ -27,7 +27,7 @@ public final class StaticFieldData extends DescriptorData<FieldDescriptorImpl>{ myField = field; } - protected FieldDescriptorImpl createDescriptorImpl(Project project) { + protected FieldDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new FieldDescriptorImpl(project, null, myField); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThisData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThisData.java index 9a7afd6ec4b6..43648960b75a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThisData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThisData.java @@ -18,12 +18,13 @@ package com.intellij.debugger.impl.descriptors.data; import com.intellij.debugger.ui.impl.watch.ThisDescriptorImpl; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; +import org.jetbrains.annotations.NotNull; public final class ThisData extends DescriptorData<ThisDescriptorImpl>{ private static final Key THIS = new Key("THIS"); - protected ThisDescriptorImpl createDescriptorImpl(Project project) { + protected ThisDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new ThisDescriptorImpl(project); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadData.java index 543ce5327d53..2d1da9aef60c 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadData.java @@ -18,6 +18,7 @@ package com.intellij.debugger.impl.descriptors.data; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; public class ThreadData extends DescriptorData<ThreadDescriptorImpl> { private final ThreadReferenceProxyImpl myThread; @@ -26,7 +27,7 @@ public class ThreadData extends DescriptorData<ThreadDescriptorImpl> { myThread = thread; } - protected ThreadDescriptorImpl createDescriptorImpl(Project project) { + protected ThreadDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new ThreadDescriptorImpl(myThread); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadGroupData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadGroupData.java index fef933316a8e..fd2a62f2982d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadGroupData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThreadGroupData.java @@ -18,6 +18,7 @@ package com.intellij.debugger.impl.descriptors.data; import com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl; import com.intellij.debugger.ui.impl.watch.ThreadGroupDescriptorImpl; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; public class ThreadGroupData extends DescriptorData<ThreadGroupDescriptorImpl>{ private final ThreadGroupReferenceProxyImpl myThreadGroup; @@ -27,7 +28,7 @@ public class ThreadGroupData extends DescriptorData<ThreadGroupDescriptorImpl>{ myThreadGroup = threadGroup; } - protected ThreadGroupDescriptorImpl createDescriptorImpl(Project project) { + protected ThreadGroupDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new ThreadGroupDescriptorImpl(myThreadGroup); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThrownExceptionValueData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThrownExceptionValueData.java index 5c8610255f22..6ca40003b85a 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThrownExceptionValueData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/ThrownExceptionValueData.java @@ -28,7 +28,7 @@ public final class ThrownExceptionValueData extends DescriptorData<ThrownExcepti myExceptionObj = exceptionObj; } - protected ThrownExceptionValueDescriptorImpl createDescriptorImpl(Project project) { + protected ThrownExceptionValueDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new ThrownExceptionValueDescriptorImpl(project, myExceptionObj); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/UserExpressionData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/UserExpressionData.java index 5553d3b782fe..c48eca313be5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/UserExpressionData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/UserExpressionData.java @@ -20,6 +20,7 @@ import com.intellij.debugger.ui.impl.watch.UserExpressionDescriptorImpl; import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl; import com.intellij.debugger.ui.tree.UserExpressionDescriptor; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; public class UserExpressionData extends DescriptorData<UserExpressionDescriptor>{ private final ValueDescriptorImpl myParentDescriptor; @@ -35,7 +36,7 @@ public class UserExpressionData extends DescriptorData<UserExpressionDescriptor> myText = text; } - protected UserExpressionDescriptorImpl createDescriptorImpl(Project project) { + protected UserExpressionDescriptorImpl createDescriptorImpl(@NotNull Project project) { return new UserExpressionDescriptorImpl(project, myParentDescriptor, myTypeName, myName, myText); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/WatchItemData.java b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/WatchItemData.java index 4b44a0d060db..902973048f30 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/WatchItemData.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/descriptors/data/WatchItemData.java @@ -19,6 +19,7 @@ import com.intellij.debugger.engine.evaluation.TextWithImports; import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor; import com.intellij.openapi.project.Project; import com.sun.jdi.Value; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -34,7 +35,7 @@ public final class WatchItemData extends DescriptorData<WatchItemDescriptor>{ myValue = value; } - protected WatchItemDescriptor createDescriptorImpl(final Project project) { + protected WatchItemDescriptor createDescriptorImpl(@NotNull final Project project) { return new WatchItemDescriptor(project, myText, myValue); } diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariableProxyImpl.java b/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariableProxyImpl.java index 0ccda00e2a4b..cca6b8029865 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariableProxyImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariableProxyImpl.java @@ -40,6 +40,7 @@ public class LocalVariableProxyImpl extends JdiProxy implements LocalVariablePro myVariable = variable; } + @Override protected void clearCaches() { myVariable = null; myVariableType = null; @@ -47,10 +48,9 @@ public class LocalVariableProxyImpl extends JdiProxy implements LocalVariablePro public LocalVariable getVariable() throws EvaluateException { checkValid(); - if(myVariable == null) { + if (myVariable == null) { myVariable = myFrame.visibleVariableByNameInt(myVariableName); - - if(myVariable == null) { + if (myVariable == null) { //myFrame is not this variable's frame throw EvaluateExceptionUtil.createEvaluateException(new IncompatibleThreadStateException()); } @@ -75,7 +75,7 @@ public class LocalVariableProxyImpl extends JdiProxy implements LocalVariablePro } public boolean equals(Object o) { - if(o instanceof LocalVariableProxyImpl) { + if (o instanceof LocalVariableProxyImpl) { LocalVariableProxyImpl proxy = (LocalVariableProxyImpl)o; return Comparing.equal(proxy.myFrame, myFrame) && myVariableName.equals(proxy.myVariableName); } diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/ObjectReferenceProxyImpl.java b/java/debugger/impl/src/com/intellij/debugger/jdi/ObjectReferenceProxyImpl.java index 4e395995fe5d..373404b9a0a7 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/ObjectReferenceProxyImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/ObjectReferenceProxyImpl.java @@ -87,7 +87,7 @@ public class ObjectReferenceProxyImpl extends JdiProxy { try { myIsCollected = Boolean.valueOf(VirtualMachineProxyImpl.isCollected(myObjectReference)); } - catch (VMDisconnectedException e) { + catch (VMDisconnectedException ignored) { myIsCollected = Boolean.TRUE; } } @@ -128,7 +128,7 @@ public class ObjectReferenceProxyImpl extends JdiProxy { if(this == o) return true; ObjectReference ref = myObjectReference; - return ref != null && ref.equals(((ObjectReferenceProxyImpl)o).myObjectReference); + return ref.equals(((ObjectReferenceProxyImpl)o).myObjectReference); } @@ -139,9 +139,10 @@ public class ObjectReferenceProxyImpl extends JdiProxy { /** * The advice to the proxy to clear cached data. */ + @Override protected void clearCaches() { if (Boolean.FALSE.equals(myIsCollected)) { - // clearing cache makes sence only if the object has not been collected yet + // clearing cache makes sense only if the object has not been collected yet myIsCollected = null; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java b/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java index 5fed47929af3..94ff89a4dc31 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java @@ -26,11 +26,15 @@ import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil; import com.intellij.debugger.engine.jdi.StackFrameProxy; import com.intellij.openapi.diagnostic.Logger; import com.sun.jdi.*; +import gnu.trove.THashMap; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.jdi.StackFrameProxyImpl"); @@ -43,7 +47,7 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { private ObjectReference myThisReference; private ClassLoaderReference myClassLoader; private Boolean myIsObsolete = null; - private Map<LocalVariable,Value> myAllValues; + private Map<LocalVariable, Value> myAllValues; public StackFrameProxyImpl(ThreadReferenceProxyImpl threadProxy, @NotNull StackFrame frame, int fromBottomIndex /* 1-based */) { super(threadProxy.getVirtualMachine()); @@ -107,7 +111,7 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { checkValid(); - if(myStackFrame == null) { + if (myStackFrame == null) { try { final ThreadReference threadRef = myThreadProxy.getThreadReference(); myStackFrame = threadRef.frame(getFrameIndex()); @@ -252,6 +256,12 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { return variable != null ? new LocalVariableProxyImpl(this, variable) : null; } + @Nullable + public Value visibleValueByName(@NotNull String name) throws EvaluateException { + LocalVariable variable = visibleVariableByNameInt(name); + return variable != null ? getValue(new LocalVariableProxyImpl(this, variable)) : null; + } + protected LocalVariable visibleVariableByNameInt(String name) throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); InvalidStackFrameException error = null; @@ -283,8 +293,7 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { InvalidStackFrameException error = null; for (int attempt = 0; attempt < 2; attempt++) { try { - final Map<LocalVariable, Value> allValues = getAllValues(); - return allValues.get(localVariable.getVariable()); + return getAllValues().get(localVariable.getVariable()); } catch (InvalidStackFrameException e) { error = e; @@ -332,13 +341,8 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { checkValid(); if (myAllValues == null) { try { - final StackFrame stackFrame = getStackFrame(); - final Map<LocalVariable, Value> values = stackFrame.getValues(stackFrame.visibleVariables()); - myAllValues = new HashMap<LocalVariable, Value>(values.size()); - for (final LocalVariable variable : values.keySet()) { - final Value value = values.get(variable); - myAllValues.put(variable, value); - } + StackFrame stackFrame = getStackFrame(); + myAllValues = new THashMap<LocalVariable, Value>(stackFrame.getValues(stackFrame.visibleVariables())); } catch (InconsistentDebugInfoException ignored) { clearCaches(); diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/ThreadReferenceProxyImpl.java b/java/debugger/impl/src/com/intellij/debugger/jdi/ThreadReferenceProxyImpl.java index 594e7a2ddd60..74b17865270d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/ThreadReferenceProxyImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/ThreadReferenceProxyImpl.java @@ -35,14 +35,15 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp // cached data private String myName; private int myFrameCount = -1; - // stackframes, 0 - bottom + // stack frames, 0 - bottom private final List<StackFrameProxyImpl> myFramesFromBottom = new ArrayList<StackFrameProxyImpl>(); //cache build on the base of myFramesFromBottom 0 - top, initially nothing is cached private List<StackFrameProxyImpl> myFrames = null; private ThreadGroupReferenceProxyImpl myThreadGroupProxy; - public static Comparator<ThreadReferenceProxyImpl> ourComparator = new Comparator<ThreadReferenceProxyImpl>() { + public static final Comparator<ThreadReferenceProxyImpl> ourComparator = new Comparator<ThreadReferenceProxyImpl>() { + @Override public int compare(ThreadReferenceProxyImpl th1, ThreadReferenceProxyImpl th2) { return th1.name().compareToIgnoreCase(th2.name()); } @@ -52,11 +53,13 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp super(virtualMachineProxy, threadReference); } + @Override public ThreadReference getThreadReference() { DebuggerManagerThreadImpl.assertIsManagerThread(); return (ThreadReference)getObjectReference(); } + @Override public VirtualMachineProxyImpl getVirtualMachine() { DebuggerManagerThreadImpl.assertIsManagerThread(); return (VirtualMachineProxyImpl) myTimer; @@ -68,10 +71,10 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { myName = getThreadReference().name(); } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { myName = ""; } - catch (IllegalThreadStateException e) { + catch (IllegalThreadStateException ignored) { myName = "zombie"; } } @@ -84,7 +87,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { return getThreadReference().suspendCount(); } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { return 0; } } @@ -106,7 +109,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { threadRefString = getThreadReference().toString() ; } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { threadRefString = "[thread collected]"; } return "ThreadReferenceProxyImpl: " + threadRefString + " " + super.toString(); @@ -127,6 +130,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp } } + @Override protected void clearCaches() { DebuggerManagerThreadImpl.assertIsManagerThread(); myName = null; @@ -139,7 +143,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { return getThreadReference().status(); } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { return ThreadReference.THREAD_STATUS_ZOMBIE; } } @@ -152,7 +156,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { threadGroupRef = getThreadReference().threadGroup(); } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { threadGroupRef = null; } myThreadGroupProxy = getVirtualMachineProxy().getThreadGroupReferenceProxy(threadGroupRef); @@ -160,6 +164,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp return myThreadGroupProxy; } + @Override public int frameCount() throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); checkValid(); @@ -168,7 +173,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { myFrameCount = threadReference.frameCount(); } - catch(ObjectCollectedException e) { + catch(ObjectCollectedException ignored) { myFrameCount = 0; } catch (IncompatibleThreadStateException e) { @@ -176,7 +181,7 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp try { isSuspended = threadReference.isSuspended(); } - catch (Throwable th) { + catch (Throwable ignored) { // unable to determine whether the thread is actually suspended, so propagating original exception throw EvaluateExceptionUtil.createEvaluateException(e); } @@ -207,12 +212,11 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp myFrames = new ArrayList<StackFrameProxyImpl>(frameCount()); for (ListIterator<StackFrameProxyImpl> iterator = myFramesFromBottom.listIterator(frameCount()); iterator.hasPrevious();) { - StackFrameProxyImpl stackFrameProxy = iterator.previous(); - myFrames.add(stackFrameProxy); + myFrames.add(iterator.previous()); } } } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { return Collections.emptyList(); } return myFrames; @@ -234,13 +238,13 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp int index = myFramesFromBottom.size() + 1; for (ListIterator<StackFrame> iterator = frames.listIterator(count - myFramesFromBottom.size()); iterator.hasPrevious();) { - StackFrame stackFrame = iterator.previous(); - myFramesFromBottom.add(new StackFrameProxyImpl(this, stackFrame, index)); + myFramesFromBottom.add(new StackFrameProxyImpl(this, iterator.previous(), index)); index++; } } } + @Override public StackFrameProxyImpl frame(int i) throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); final ThreadReference threadReference = getThreadReference(); @@ -255,10 +259,10 @@ public final class ThreadReferenceProxyImpl extends ObjectReferenceProxyImpl imp } return myFramesFromBottom.get(frameCount - i - 1); } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { return null; } - catch (IllegalThreadStateException e) { + catch (IllegalThreadStateException ignored) { return null; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerEditorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerEditorImpl.java index 1395654a06d1..1d10602e3b8f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerEditorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerEditorImpl.java @@ -44,6 +44,7 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.reference.SoftReference; import com.intellij.ui.ClickListener; import com.intellij.util.containers.ContainerUtil; +import com.intellij.xdebugger.impl.XDebuggerHistoryManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -74,12 +75,15 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{ private WeakReference<ListPopup> myPopup; private final PsiTreeChangeListener myPsiListener = new PsiTreeChangeAdapter() { + @Override public void childRemoved(@NotNull PsiTreeChangeEvent event) { checkContext(); } + @Override public void childReplaced(@NotNull PsiTreeChangeEvent event) { checkContext(); } + @Override public void childMoved(@NotNull PsiTreeChangeEvent event) { checkContext(); } @@ -178,6 +182,7 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{ public abstract JComponent getPreferredFocusedComponent(); + @Override public void setContext(@Nullable PsiElement context) { myContext = context; @@ -204,6 +209,7 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{ protected abstract void updateEditorUi(); + @Override public PsiElement getContext() { return myContext; } @@ -212,6 +218,7 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{ return myProject; } + @Override public void requestFocus() { getPreferredFocusedComponent().requestFocus(); } @@ -258,13 +265,14 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{ return myCurrentDocument; } + @Override public String getRecentsId() { return myRecentsId; } public void addRecent(TextWithImports text) { - if(getRecentsId() != null && text != null && !"".equals(text.getText())){ - DebuggerRecents.getInstance(getProject()).addRecent(getRecentsId(), text); + if(getRecentsId() != null && text != null && !text.isEmpty()){ + XDebuggerHistoryManager.getInstance(getProject()).addRecentExpression(getRecentsId(), text.getText()); } } @@ -282,6 +290,7 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{ } } + @Override public void dispose() { PsiManager.getInstance(myProject).removePsiTreeChangeListener(myPsiListener); myCurrentDocument = null; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java index 479c9331893b..455debbd20d7 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerExpressionComboBox.java @@ -30,6 +30,7 @@ import com.intellij.psi.PsiElement; import com.intellij.ui.EditorComboBoxEditor; import com.intellij.ui.EditorComboBoxRenderer; import com.intellij.ui.EditorTextField; +import com.intellij.xdebugger.impl.XDebuggerHistoryManager; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; @@ -37,7 +38,6 @@ import javax.swing.*; import javax.swing.plaf.basic.ComboPopup; import java.awt.*; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; /** @@ -180,10 +180,10 @@ public class DebuggerExpressionComboBox extends DebuggerEditorImpl { final String recentsId = getRecentsId(); if (recentsId != null) { final List<TextWithImports> result = new ArrayList<TextWithImports>(); - LinkedList<TextWithImports> recents = DebuggerRecents.getInstance(getProject()).getRecents(getRecentsId()); - for (final TextWithImports evaluationText : recents) { - if (evaluationText.getText().indexOf('\n') == -1) { - result.add(evaluationText); + List<String> recents = XDebuggerHistoryManager.getInstance(getProject()).getRecentExpressions(getRecentsId()); + for (String evaluationText : recents) { + if (evaluationText.indexOf('\n') == -1) { + result.add(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, evaluationText)); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java index 6ed904d74bb9..52bcf8acce32 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java @@ -59,6 +59,7 @@ import com.intellij.ui.components.panels.Wrapper; import com.intellij.util.Alarm; import com.sun.jdi.ObjectCollectedException; import com.sun.jdi.VMDisconnectedException; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.border.EmptyBorder; @@ -102,6 +103,7 @@ public class FramesPanel extends UpdatableDebuggerView { myFramesList.addListSelectionListener(myFramesListener); myFramesList.addMouseListener(new MouseAdapter() { + @Override public void mousePressed(final MouseEvent e) { int index = myFramesList.locationToIndex(e.getPoint()); if (index >= 0 && myFramesList.isSelectedIndex(index)) { @@ -140,6 +142,7 @@ public class FramesPanel extends UpdatableDebuggerView { return toolbar; } + @Override public DebuggerStateManager getContextManager() { return myStateManager; } @@ -151,6 +154,7 @@ public class FramesPanel extends UpdatableDebuggerView { myIsEnabled = enabled; } + @Override public void valueChanged(ListSelectionEvent e) { if (!myIsEnabled || e.getValueIsAdjusting()) { return; @@ -169,6 +173,7 @@ public class FramesPanel extends UpdatableDebuggerView { private void registerThreadsPopupMenu(final JList framesList) { final PopupHandler popupHandler = new PopupHandler() { + @Override public void invokePopup(Component comp, int x, int y) { DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction(DebuggerActions.THREADS_PANEL_POPUP); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(DebuggerActions.THREADS_PANEL_POPUP, group); @@ -177,6 +182,7 @@ public class FramesPanel extends UpdatableDebuggerView { }; framesList.addMouseListener(popupHandler); registerDisposable(new Disposable() { + @Override public void dispose() { myThreadsCombo.removeItemListener(myThreadsListener); framesList.removeMouseListener(popupHandler); @@ -191,6 +197,7 @@ public class FramesPanel extends UpdatableDebuggerView { myIsEnabled = enabled; } + @Override public void itemStateChanged(ItemEvent e) { if (!myIsEnabled) return; if (e.getStateChange() == ItemEvent.SELECTED) { @@ -202,6 +209,7 @@ public class FramesPanel extends UpdatableDebuggerView { private final AtomicBoolean myPerformFullRebuild = new AtomicBoolean(false); + @Override protected void rebuild(int event) { myRebuildAlarm.cancelAllRequests(); final boolean isRefresh = event == DebuggerSession.EVENT_REFRESH || @@ -211,12 +219,12 @@ public class FramesPanel extends UpdatableDebuggerView { myPerformFullRebuild.set(true); } myRebuildAlarm.addRequest(new Runnable() { + @Override public void run() { try { doRebuild(!myPerformFullRebuild.getAndSet(false)); } - catch (VMDisconnectedException e) { - // ignored + catch (VMDisconnectedException ignored) { } } }, 100, ModalityState.NON_MODAL); @@ -298,6 +306,7 @@ public class FramesPanel extends UpdatableDebuggerView { return descriptors; } + @Override public void threadAction() { if (myRefreshOnly && myThreadDescriptorsToUpdate.length != myThreadsCombo.getItemCount()) { // there is no sense in refreshing combobox if thread list has changed since creation of this command @@ -329,6 +338,7 @@ public class FramesPanel extends UpdatableDebuggerView { descriptor.updateRepresentation(evaluationContext, DescriptorLabelListener.DUMMY_LISTENER); } DebuggerInvocationUtil.swingInvokeLater(getProject(), new Runnable() { + @Override public void run() { try { myThreadsListener.setEnabled(false); @@ -346,6 +356,7 @@ public class FramesPanel extends UpdatableDebuggerView { } } + @Override protected void commandCancelled() { if (!DebuggerManagerThreadImpl.isManagerThread()) { return; @@ -372,6 +383,7 @@ public class FramesPanel extends UpdatableDebuggerView { private void refillThreadsCombo(final ThreadReferenceProxyImpl threadToSelect) { final List<ThreadDescriptorImpl> threadItems = createThreadDescriptorsList(); DebuggerInvocationUtil.swingInvokeLater(getProject(), new Runnable() { + @Override public void run() { try { myThreadsListener.setEnabled(false); @@ -400,9 +412,11 @@ public class FramesPanel extends UpdatableDebuggerView { myDebuggerContext = debuggerContext; } + @Override public void contextAction() throws Exception { updateFrameList(myDebuggerContext.getThreadProxy()); DebuggerInvocationUtil.swingInvokeLater(getProject(), new Runnable() { + @Override public void run() { try { myFramesListener.setEnabled(false); @@ -425,7 +439,7 @@ public class FramesPanel extends UpdatableDebuggerView { return; } } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { return; } @@ -462,11 +476,13 @@ public class FramesPanel extends UpdatableDebuggerView { myDebuggerContext = debuggerContext; } + @Override public void contextAction() throws Exception { final ThreadReferenceProxyImpl thread = myDebuggerContext.getThreadProxy(); try { if(!getSuspendContext().getDebugProcess().getSuspendManager().isSuspended(thread)) { DebuggerInvocationUtil.swingInvokeLater(getProject(), new Runnable() { + @Override public void run() { try { myFramesListener.setEnabled(false); @@ -491,7 +507,7 @@ public class FramesPanel extends UpdatableDebuggerView { return; } } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { return; } @@ -499,7 +515,7 @@ public class FramesPanel extends UpdatableDebuggerView { try { frames = thread.frames(); } - catch (EvaluateException e) { + catch (EvaluateException ignored) { frames = Collections.emptyList(); } @@ -601,7 +617,7 @@ public class FramesPanel extends UpdatableDebuggerView { private final long myTimestamp; private final IndexCounter myCounter; - public AppendFrameCommand(SuspendContextImpl suspendContext, StackFrameProxyImpl frame, EvaluationContextImpl evaluationContext, + public AppendFrameCommand(@NotNull SuspendContextImpl suspendContext, @NotNull StackFrameProxyImpl frame, EvaluationContextImpl evaluationContext, MethodsTracker tracker, int indexToInsert, final boolean isContextFrame, final long timestamp, IndexCounter counter) { super(suspendContext); myFrame = frame; @@ -613,12 +629,14 @@ public class FramesPanel extends UpdatableDebuggerView { myCounter = counter; } + @Override public void contextAction() throws Exception { final StackFrameDescriptorImpl descriptor = new StackFrameDescriptorImpl(myFrame, myTracker); descriptor.setContext(myEvaluationContext); descriptor.updateRepresentation(myEvaluationContext, DescriptorLabelListener.DUMMY_LISTENER); final Project project = getProject(); DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() { + @Override public void run() { try { myFramesListener.setEnabled(false); @@ -650,6 +668,7 @@ public class FramesPanel extends UpdatableDebuggerView { } } + @Override public void requestFocus() { myFramesList.requestFocus(); } @@ -672,6 +691,7 @@ public class FramesPanel extends UpdatableDebuggerView { myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES; } + @Override public void update(final AnActionEvent e) { super.update(e); final Presentation presentation = e.getPresentation(); @@ -679,10 +699,12 @@ public class FramesPanel extends UpdatableDebuggerView { presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff); } + @Override public boolean isSelected(AnActionEvent e) { return !myShouldShow; } + @Override public void setSelected(AnActionEvent e, boolean enabled) { myShouldShow = !enabled; DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java index 46f1515f1ea5..3b300fca2257 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java @@ -31,6 +31,7 @@ import com.intellij.openapi.options.Configurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.xdebugger.AbstractDebuggerSession; +import com.intellij.xdebugger.breakpoints.XBreakpoint; import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule; import com.intellij.xdebugger.impl.DebuggerSupport; import com.intellij.xdebugger.impl.actions.DebuggerActionHandler; @@ -41,6 +42,7 @@ import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem; import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider; import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler; import com.intellij.xdebugger.impl.settings.DebuggerSettingsPanelProvider; +import com.intellij.xdebugger.impl.ui.DebuggerUIUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -194,7 +196,7 @@ public class JavaDebuggerSupport extends DebuggerSupport { @NotNull @Override public EditBreakpointActionHandler getEditBreakpointAction() { - return DISABLED_EDIT; + return X_EDIT; } @Override @@ -374,10 +376,10 @@ public class JavaDebuggerSupport extends DebuggerSupport { } }; - private static final EditBreakpointActionHandler DISABLED_EDIT = new EditBreakpointActionHandler() { + private static final EditBreakpointActionHandler X_EDIT = new EditBreakpointActionHandler() { @Override protected void doShowPopup(Project project, JComponent component, Point whereToShow, Object breakpoint) { - + DebuggerUIUtil.showXBreakpointEditorBalloon(project, whereToShow, component, false, (XBreakpoint)breakpoint); } @Override diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java index bbbcf8ef1265..e013d7ccdcfb 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java @@ -41,9 +41,12 @@ import com.intellij.psi.PsiElement; import com.intellij.ui.AppUIUtil; import com.intellij.ui.classFilter.ClassFilter; import com.intellij.util.StringBuilderSpinAllocator; +import com.intellij.util.ThreeState; import com.intellij.xdebugger.breakpoints.SuspendPolicy; import com.intellij.xdebugger.breakpoints.XBreakpoint; import com.intellij.xdebugger.breakpoints.XLineBreakpoint; +import com.intellij.xdebugger.impl.XDebuggerHistoryManager; +import com.intellij.xdebugger.impl.breakpoints.ui.DefaultLogExpressionComboBoxPanel; import com.sun.jdi.*; import com.sun.jdi.event.LocatableEvent; import org.jdom.Element; @@ -130,11 +133,12 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements @Nullable public String getShortClassName() { final String className = getClassName(); - if (className != null) { - final int dotIndex = className.lastIndexOf('.'); - return dotIndex >= 0 && dotIndex + 1 < className.length()? className.substring(dotIndex + 1) : className; + if (className == null) { + return null; } - return className; + + final int dotIndex = className.lastIndexOf('.'); + return dotIndex >= 0 && dotIndex + 1 < className.length() ? className.substring(dotIndex + 1) : className; } @Nullable @@ -297,8 +301,8 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements } public boolean evaluateCondition(final EvaluationContextImpl context, LocatableEvent event) throws EvaluateException { - if(isCountFilterEnabled()) { - final DebugProcessImpl debugProcess = context.getDebugProcess(); + final DebugProcessImpl debugProcess = context.getDebugProcess(); + if (isCountFilterEnabled()) { debugProcess.getVirtualMachineProxy().suspend(); debugProcess.getRequestsManager().deleteRequest(this); ((Breakpoint)this).createRequest(debugProcess); @@ -308,7 +312,7 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements Value value = context.getThisObject(); if (value != null) { // non-static ObjectReference reference = (ObjectReference)value; - if(!hasObjectID(reference.uniqueID())) { + if (!hasObjectID(reference.uniqueID())) { return false; } } @@ -319,40 +323,52 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements if (!typeMatchesClassFilters(typeName)) return false; } - if (isConditionEnabled() && !getCondition().getText().isEmpty()) { - try { - ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(context.getProject(), new EvaluatingComputable<ExpressionEvaluator>() { - public ExpressionEvaluator compute() throws EvaluateException { - final SourcePosition contextSourcePosition = ContextUtil.getSourcePosition(context); - // IMPORTANT: calculate context psi element basing on the location where the exception - // has been hit, not on the location where it was set. (For line breakpoints these locations are the same, however, - // for method, exception and field breakpoints these locations differ) - PsiElement contextPsiElement = ContextUtil.getContextElement(contextSourcePosition); - if (contextPsiElement == null) { - contextPsiElement = getEvaluationElement(); // as a last resort - } - return EvaluatorBuilderImpl.build(getCondition(), contextPsiElement, contextSourcePosition); - } - }); - final Value value = evaluator.evaluate(context); - if (!(value instanceof BooleanValue)) { - throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.boolean.expected")); - } - if(!((BooleanValue)value).booleanValue()) { - return false; + if (!isConditionEnabled() || getCondition().getText().isEmpty()) { + return true; + } + + StackFrameProxyImpl frame = context.getFrameProxy(); + if (frame != null) { + Location location = frame.location(); + if (location != null) { + ThreeState result = debugProcess.getPositionManager().evaluateCondition(context, frame, location, getCondition().getText()); + if (result != ThreeState.UNSURE) { + return result == ThreeState.YES; } } - catch (EvaluateException ex) { - if(ex.getCause() instanceof VMDisconnectedException) { - return false; + } + + try { + ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(context.getProject(), new EvaluatingComputable<ExpressionEvaluator>() { + @Override + public ExpressionEvaluator compute() throws EvaluateException { + final SourcePosition contextSourcePosition = ContextUtil.getSourcePosition(context); + // IMPORTANT: calculate context psi element basing on the location where the exception + // has been hit, not on the location where it was set. (For line breakpoints these locations are the same, however, + // for method, exception and field breakpoints these locations differ) + PsiElement contextPsiElement = ContextUtil.getContextElement(contextSourcePosition); + if (contextPsiElement == null) { + contextPsiElement = getEvaluationElement(); // as a last resort + } + return EvaluatorBuilderImpl.build(getCondition(), contextPsiElement, contextSourcePosition); } - throw EvaluateExceptionUtil.createEvaluateException( - DebuggerBundle.message("error.failed.evaluating.breakpoint.condition", getCondition(), ex.getMessage()) - ); + }); + final Value value = evaluator.evaluate(context); + if (!(value instanceof BooleanValue)) { + throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.boolean.expected")); + } + if (!((BooleanValue)value).booleanValue()) { + return false; } - return true; } - + catch (EvaluateException ex) { + if (ex.getCause() instanceof VMDisconnectedException) { + return false; + } + throw EvaluateExceptionUtil.createEvaluateException( + DebuggerBundle.message("error.failed.evaluating.breakpoint.condition", getCondition(), ex.getMessage()) + ); + } return true; } @@ -421,24 +437,30 @@ public abstract class Breakpoint<P extends JavaBreakpointProperties> implements requestor.readTo(parentNode, this); try { setEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "ENABLED"))); - } catch (Exception e) { + } + catch (Exception ignored) { } try { setLogEnabled(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_ENABLED"))); - } catch (Exception e) { + } + catch (Exception ignored) { } try { - if (Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED"))) { - String logMessage = JDOMExternalizerUtil.readField(parentNode, LOG_MESSAGE_OPTION_NAME); - if (logMessage != null) { - setLogMessage(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, logMessage)); + String logMessage = JDOMExternalizerUtil.readField(parentNode, LOG_MESSAGE_OPTION_NAME); + if (logMessage != null && !logMessage.isEmpty()) { + TextWithImportsImpl text = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, logMessage); + XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(DefaultLogExpressionComboBoxPanel.HISTORY_KEY, text.getText()); + if (Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "LOG_EXPRESSION_ENABLED"))) { + setLogMessage(text); } } - } catch (Exception e) { + } + catch (Exception ignored) { } try { setRemoveAfterHit(Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "REMOVE_AFTER_HIT"))); - } catch (Exception e) { + } + catch (Exception ignored) { } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java index 76c55c7b4ae9..ac2778805ef6 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java @@ -44,9 +44,7 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.*; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; -import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiField; -import com.intellij.psi.PsiFile; import com.intellij.util.Alarm; import com.intellij.util.EventDispatcher; import com.intellij.xdebugger.XDebuggerManager; @@ -56,6 +54,7 @@ import com.intellij.xdebugger.impl.DebuggerSupport; import com.intellij.xdebugger.impl.XDebugSessionImpl; import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl; import com.intellij.xdebugger.impl.breakpoints.XDependentBreakpointManager; +import com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl; import com.sun.jdi.InternalException; import com.sun.jdi.ThreadReference; import com.sun.jdi.request.*; @@ -173,13 +172,16 @@ public class BreakpointManager { DebuggerInvocationUtil.swingInvokeLater(myProject, new Runnable() { @Override public void run() { - final RangeHighlighter highlighter = ((BreakpointWithHighlighter)breakpoint).getHighlighter(); - if (highlighter != null) { - final GutterIconRenderer renderer = highlighter.getGutterIconRenderer(); - if (renderer != null) { - DebuggerSupport.getDebuggerSupport(JavaDebuggerSupport.class).getEditBreakpointAction().editBreakpoint( - myProject, editor, breakpoint, renderer - ); + XBreakpoint xBreakpoint = breakpoint.myXBreakpoint; + if (xBreakpoint instanceof XLineBreakpointImpl) { + RangeHighlighter highlighter = ((XLineBreakpointImpl)xBreakpoint).getHighlighter(); + if (highlighter != null) { + GutterIconRenderer renderer = highlighter.getGutterIconRenderer(); + if (renderer != null) { + DebuggerSupport.getDebuggerSupport(JavaDebuggerSupport.class).getEditBreakpointAction().editBreakpoint( + myProject, editor, breakpoint.myXBreakpoint, renderer + ); + } } } } @@ -1056,14 +1058,4 @@ public class BreakpointManager { public String setProperty(String name, String value) { return myUIProperties.put(name, value); } - - public static PsiFile getPsiFile(XBreakpoint xBreakpoint, Project project) { - try { - final Document document = FileDocumentManager.getInstance().getDocument(xBreakpoint.getSourcePosition().getFile()); - return PsiDocumentManager.getInstance(project).getPsiFile(document); - } catch (Exception e) { - LOG.error(e); - } - return null; - } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java index 8cd1bfbe8151..63ec571d6d24 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java @@ -293,14 +293,25 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti @Override public void reload() { ApplicationManager.getApplication().assertReadAccessAllowed(); - final XSourcePosition position = myXBreakpoint.getSourcePosition(); - try { - final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(position.getFile()); - mySourcePosition = SourcePosition.createFromOffset(psiFile, position.getOffset()); - } catch (Exception e) { + XSourcePosition position = myXBreakpoint.getSourcePosition(); + PsiFile psiFile = getPsiFile(); + if (position != null && psiFile != null) { + mySourcePosition = SourcePosition.createFromLine(psiFile, position.getLine()); + reload(psiFile); + } + else { mySourcePosition = null; } - reload(BreakpointManager.getPsiFile(myXBreakpoint, myProject)); + } + + @Nullable + public PsiFile getPsiFile() { + ApplicationManager.getApplication().assertReadAccessAllowed(); + XSourcePosition position = myXBreakpoint.getSourcePosition(); + if (position != null) { + return PsiManager.getInstance(myProject).findFile(position.getFile()); + } + return null; } @Override diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java index 496292881354..c4175eb0b6af 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FilteredRequestorImpl.java @@ -29,6 +29,8 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; import com.intellij.psi.PsiElement; import com.intellij.ui.classFilter.ClassFilter; +import com.intellij.xdebugger.impl.XDebuggerHistoryManager; +import com.intellij.xdebugger.impl.breakpoints.ui.DefaultConditionComboBoxPanel; import com.sun.jdi.event.LocatableEvent; import org.jdom.Element; import org.jetbrains.annotations.NonNls; @@ -130,6 +132,9 @@ public class FilteredRequestorImpl implements JDOMExternalizable, FilteredReques breakpoint.setCountFilter(COUNT_FILTER); breakpoint.setCondition(CONDITION_ENABLED ? myCondition : null); + if (myCondition != null && !myCondition.isEmpty()) { + XDebuggerHistoryManager.getInstance(myProject).addRecentExpression(DefaultConditionComboBoxPanel.HISTORY_KEY, myCondition.getText()); + } breakpoint.setClassFiltersEnabled(CLASS_FILTERS_ENABLED); breakpoint.setClassFilters(getClassFilters()); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java index af7d6755523a..e41127e9bf97 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java @@ -153,7 +153,6 @@ public class StepIntoBreakpoint extends RunToCursorBreakpoint { if (pos != null) { final StepIntoBreakpoint breakpoint = new StepIntoBreakpoint(project, pos, filter); breakpoint.init(); - breakpoint.setLogEnabled(false); return breakpoint; } return null; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java index c04f1bf63d67..1bd00d1c5576 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreePanel.java @@ -24,13 +24,12 @@ import com.intellij.debugger.impl.DebuggerStateManager; import com.intellij.debugger.ui.impl.watch.DebuggerTree; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.keymap.KeymapManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy; import com.intellij.ui.PopupHandler; -import com.intellij.util.Alarm; +import com.intellij.util.SingleAlarm; import com.intellij.xdebugger.impl.actions.XDebuggerActions; import com.sun.jdi.VMDisconnectedException; @@ -41,7 +40,21 @@ import java.awt.event.KeyEvent; public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements DataProvider { public static final DataKey<DebuggerTreePanel> DATA_KEY = DataKey.create("DebuggerPanel"); - private final Alarm myRebuildAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD); + private final SingleAlarm myRebuildAlarm = new SingleAlarm(new Runnable() { + @Override + public void run() { + try { + final DebuggerContextImpl context = getContext(); + if(context.getDebuggerSession() != null) { + getTree().rebuild(context); + } + } + catch (VMDisconnectedException ignored) { + } + + } + }, 100); + protected DebuggerTree myTree; public DebuggerTreePanel(Project project, DebuggerStateManager stateManager) { @@ -80,24 +93,9 @@ public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements protected abstract DebuggerTree createTreeView(); - @Override protected void rebuild(int event) { - myRebuildAlarm.cancelAllRequests(); - myRebuildAlarm.addRequest(new Runnable() { - @Override - public void run() { - try { - final DebuggerContextImpl context = getContext(); - if(context.getDebuggerSession() != null) { - getTree().rebuild(context); - } - } - catch (VMDisconnectedException ignored) { - // ignored - } - } - }, 100, ModalityState.NON_MODAL); + myRebuildAlarm.cancelAndRequest(); } @Override diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java index 788cb17b477e..5694eb1cba67 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/FrameVariablesTree.java @@ -52,9 +52,12 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.text.CharArrayUtil; import com.intellij.util.ui.tree.TreeModelAdapter; import com.intellij.xdebugger.XDebuggerBundle; +import com.intellij.xdebugger.frame.XStackFrame; import com.sun.jdi.*; import gnu.trove.TIntObjectHashMap; import gnu.trove.TObjectProcedure; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.event.TreeModelEvent; import javax.swing.tree.TreeModel; @@ -62,13 +65,22 @@ import javax.swing.tree.TreePath; import java.util.*; public class FrameVariablesTree extends DebuggerTree { - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.impl.FrameDebuggerTree"); + private static final Logger LOG = Logger.getInstance(FrameVariablesTree.class); + private boolean myAnyNewLocals; private boolean myAutoWatchMode = false; - public FrameVariablesTree(Project project) { + private final VariablesPanel myVariablesPanel; + + public FrameVariablesTree(@NotNull Project project) { + this(project, null); + } + + public FrameVariablesTree(@NotNull Project project, @Nullable VariablesPanel variablesPanel) { super(project); + getEmptyText().setText(XDebuggerBundle.message("debugger.variables.not.available")); + myVariablesPanel = variablesPanel; } public boolean isAutoWatchMode() { @@ -110,7 +122,7 @@ public class FrameVariablesTree extends DebuggerTree { @Override - protected DebuggerCommandImpl getBuildNodeCommand(final DebuggerTreeNodeImpl node) { + protected DebuggerCommandImpl getBuildNodeCommand(@NotNull DebuggerTreeNodeImpl node) { if (node.getDescriptor() instanceof StackFrameDescriptorImpl) { return new BuildFrameTreeVariablesCommand(node); } @@ -121,7 +133,21 @@ public class FrameVariablesTree extends DebuggerTree { public BuildFrameTreeVariablesCommand(DebuggerTreeNodeImpl stackNode) { super(stackNode); } - + + @Override + public void threadAction() { + if (myVariablesPanel != null) { + StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor(); + XStackFrame xStackFrame = stackDescriptor.getXStackFrame(); + myVariablesPanel.stackChanged(xStackFrame); + if (xStackFrame != null) { + return; + } + } + + super.threadAction(); + } + @Override protected void buildVariables(final StackFrameDescriptorImpl stackDescriptor, final EvaluationContextImpl evaluationContext) throws EvaluateException { final DebuggerContextImpl debuggerContext = getDebuggerContext(); @@ -129,6 +155,7 @@ public class FrameVariablesTree extends DebuggerTree { if (sourcePosition == null) { return; } + try { if (!ViewsGeneralSettings.getInstance().ENABLE_AUTO_EXPRESSIONS && !myAutoWatchMode) { // optimization @@ -165,9 +192,7 @@ public class FrameVariablesTree extends DebuggerTree { catch (EvaluateException e) { if (e.getCause() instanceof AbsentInformationException) { final StackFrameProxyImpl frame = stackDescriptor.getFrameProxy(); - if (frame == null) { - throw e; - } + final Collection<Value> argValues = frame.getArgumentValues(); int index = 0; for (Value argValue : argValues) { @@ -206,6 +231,7 @@ public class FrameVariablesTree extends DebuggerTree { } try { final Location location = frame.location(); + LOG.assertTrue(location != null); final Method method = location.method(); final Location methodLocation = method.location(); if (methodLocation == null || methodLocation.codeIndex() < 0) { @@ -252,9 +278,6 @@ public class FrameVariablesTree extends DebuggerTree { private static Map<String, LocalVariableProxyImpl> getVisibleVariables(final StackFrameDescriptorImpl stackDescriptor) throws EvaluateException { final StackFrameProxyImpl frame = stackDescriptor.getFrameProxy(); - if (frame == null) { - return Collections.emptyMap(); - } final Map<String, LocalVariableProxyImpl> vars = new HashMap<String, LocalVariableProxyImpl>(); for (LocalVariableProxyImpl localVariableProxy : frame.visibleVariables()) { vars.put(localVariableProxy.name(), localVariableProxy); @@ -413,7 +436,6 @@ public class FrameVariablesTree extends DebuggerTree { try { StackFrameProxyImpl frame = debuggerContext.getFrameProxy(); - if (frame != null) { NodeManagerImpl nodeManager = getNodeFactory(); rootNode = nodeManager.createNode(nodeManager.getStackFrameDescriptor(null, frame), debuggerContext.createEvaluationContext()); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java index af482239ab27..dc80f8b139af 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java @@ -23,26 +23,48 @@ import com.intellij.debugger.impl.DebuggerStateManager; import com.intellij.debugger.ui.impl.watch.DebuggerTree; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.project.Project; +import com.intellij.ui.AppUIUtil; import com.intellij.ui.ScrollPaneFactory; +import com.intellij.util.SystemProperties; +import com.intellij.xdebugger.XSourcePosition; +import com.intellij.xdebugger.evaluation.EvaluationMode; +import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; +import com.intellij.xdebugger.frame.XStackFrame; +import com.intellij.xdebugger.impl.frame.XVariablesViewBase; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; -public class VariablesPanel extends DebuggerTreePanel implements DataProvider{ - +public class VariablesPanel extends DebuggerTreePanel implements DataProvider { @NonNls private static final String HELP_ID = "debugging.debugFrame"; + private static final String TREE = "tree"; + private static final String X_TREE = "xTree"; + private final JPanel myCards; + private final MyXVariablesView myXTree; + public VariablesPanel(Project project, DebuggerStateManager stateManager, Disposable parent) { super(project, stateManager); - setBorder(null); + setBorder(null); final FrameVariablesTree frameTree = getFrameTree(); - add(ScrollPaneFactory.createScrollPane(frameTree), BorderLayout.CENTER); + myCards = new JPanel(new CardLayout()); + myCards.add(frameTree, TREE); + + myXTree = new MyXVariablesView(project); + registerDisposable(myXTree); + myCards.add(myXTree.getTree(), X_TREE); + + add(ScrollPaneFactory.createScrollPane(myCards), BorderLayout.CENTER); registerDisposable(DebuggerAction.installEditAction(frameTree, DebuggerActions.EDIT_NODE_SOURCE)); overrideShortcut(frameTree, DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy()); @@ -51,21 +73,25 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider{ new ValueNodeDnD(myTree, parent); } + @Override protected DebuggerTree createTreeView() { - return new FrameVariablesTree(getProject()); + return new FrameVariablesTree(getProject(), SystemProperties.getBooleanProperty("java.debugger.xTree", true) ? this : null); } + @Override protected void changeEvent(DebuggerContextImpl newContext, int event) { if (event != DebuggerSession.EVENT_THREADS_REFRESH) { super.changeEvent(newContext, event); } } + @Override protected ActionPopupMenu createPopupMenu() { ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(DebuggerActions.FRAME_PANEL_POPUP); return ActionManager.getInstance().createActionPopupMenu(DebuggerActions.FRAME_PANEL_POPUP, group); } + @Override public Object getData(String dataId) { if (PlatformDataKeys.HELP_ID.is(dataId)) { return HELP_ID; @@ -73,9 +99,51 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider{ return super.getData(dataId); } - public FrameVariablesTree getFrameTree() { - return (FrameVariablesTree) getTree(); + return (FrameVariablesTree)getTree(); } + public void stackChanged(@Nullable final XStackFrame xStackFrame) { + AppUIUtil.invokeOnEdt(new Runnable() { + @Override + public void run() { + myXTree.stackChanged(xStackFrame); + ((CardLayout)(myCards.getLayout())).show(myCards, xStackFrame == null ? TREE : X_TREE); + } + }); + } + + private static final class MyXVariablesView extends XVariablesViewBase { + private XStackFrame myCurrentXStackFrame; + + public MyXVariablesView(@NotNull Project project) { + super(project, new XDebuggerEditorsProvider() { + @NotNull + @Override + public FileType getFileType() { + throw new UnsupportedOperationException(); + } + + @NotNull + @Override + public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode mode) { + throw new UnsupportedOperationException(); + } + }, null); + } + + public void stackChanged(@Nullable XStackFrame stackFrame) { + if (myCurrentXStackFrame != null) { + saveCurrentTreeState(stackFrame); + } + + myCurrentXStackFrame = stackFrame; + if (stackFrame == null) { + getTree().setSourcePosition(null); + } + else { + buildTreeAndRestoreState(stackFrame); + } + } + } } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java index 8d9cefcb25f7..78d1f9194bfb 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java @@ -53,10 +53,12 @@ public abstract class WatchPanel extends DebuggerTreePanel { return ScrollPaneFactory.createScrollPane(tree); } + @Override protected DebuggerTree createTreeView() { return new WatchDebuggerTree(getProject()); } + @Override protected void changeEvent(DebuggerContextImpl newContext, int event) { if (event == DebuggerSession.EVENT_THREADS_REFRESH) { return; @@ -74,10 +76,12 @@ public abstract class WatchPanel extends DebuggerTreePanel { rebuildIfVisible(event); } + @Override protected ActionPopupMenu createPopupMenu() { return null; } + @Override public Object getData(String dataId) { if (PlatformDataKeys.HELP_ID.is(dataId)) { return HELP_ID; diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java index 39c2775df018..e5d5b79ebd29 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTree.java @@ -68,7 +68,7 @@ import java.util.*; import java.util.List; public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvider { - private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.impl.watch.DebuggerTree"); + private static final Logger LOG = Logger.getInstance(DebuggerTree.class); protected static final Key<Rectangle> VISIBLE_RECT = Key.create("VISIBLE_RECT"); public static final DataKey<DebuggerTree> DATA_KEY = DataKey.create("DebuggerTree"); @@ -85,6 +85,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi myNodeManager = createNodeManager(project); final TreeBuilder model = new TreeBuilder(this) { + @Override public void buildChildren(TreeBuilderNode node) { final DebuggerTreeNodeImpl debuggerTreeNode = (DebuggerTreeNodeImpl)node; if (debuggerTreeNode.getDescriptor() instanceof DefaultNodeDescriptor) { @@ -93,24 +94,29 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi buildNode(debuggerTreeNode); } + @Override public boolean isExpandable(TreeBuilderNode builderNode) { return DebuggerTree.this.isExpandable((DebuggerTreeNodeImpl)builderNode); } }; model.setRoot(getNodeFactory().getDefaultNode()); model.addTreeModelListener(new TreeModelListener() { + @Override public void treeNodesChanged(TreeModelEvent event) { hideTooltip(); } + @Override public void treeNodesInserted(TreeModelEvent event) { hideTooltip(); } + @Override public void treeNodesRemoved(TreeModelEvent event) { hideTooltip(); } + @Override public void treeStructureChanged(TreeModelEvent event) { hideTooltip(); } @@ -126,6 +132,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi return new NodeManagerImpl(project, this); } + @Override public void dispose() { myNodeManager.dispose(); myDebuggerContext = DebuggerContextImpl.EMPTY_CONTEXT; @@ -137,8 +144,9 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi return descriptor.isExpandable(); } + @Override public Object getData(String dataId) { - if (DebuggerTree.DATA_KEY.is(dataId)) { + if (DATA_KEY.is(dataId)) { return this; } return null; @@ -234,6 +242,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi } } + @Override public void scrollRectToVisible(Rectangle aRect) { // see IDEADEV-432 aRect.width += aRect.x; @@ -336,9 +345,11 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi myDebuggerContext = context; saveState(); process.getManagerThread().schedule(new DebuggerCommandImpl() { + @Override protected void action() throws Exception { getNodeFactory().setHistoryByContext(context); } + @Override public Priority getPriority() { return Priority.NORMAL; } @@ -371,6 +382,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi protected abstract static class RefreshDebuggerTreeCommand extends SuspendContextCommandImpl { private final DebuggerContextImpl myDebuggerContext; + @Override public Priority getPriority() { return Priority.NORMAL; } @@ -399,6 +411,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi myNode = node; } + @Override public Priority getPriority() { return Priority.NORMAL; } @@ -409,6 +422,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi protected void updateUI(final boolean scrollToVisible) { DebuggerInvocationUtil.swingInvokeLater(getProject(), new Runnable() { + @Override public void run() { myNode.removeAllChildren(); for (DebuggerTreeNode debuggerTreeNode : myChildren) { @@ -425,31 +439,28 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi super(stackNode); } - public final void threadAction() { + @Override + public void threadAction() { try { final StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor(); final StackFrameProxyImpl frame = stackDescriptor.getFrameProxy(); - if (frame == null) { - return; - } - final Location location = frame.location(); - - final ObjectReference thisObjectReference = frame.thisObject(); final DebuggerContextImpl debuggerContext = getDebuggerContext(); final EvaluationContextImpl evaluationContext = debuggerContext.createEvaluationContext(); - if (!debuggerContext.isEvaluationPossible()) { myChildren.add(myNodeManager.createNode(MessageDescriptor.EVALUATION_NOT_POSSIBLE, evaluationContext)); } + final Location location = frame.location(); + LOG.assertTrue(location != null); + + final ObjectReference thisObjectReference = frame.thisObject(); final NodeDescriptor descriptor; if (thisObjectReference != null) { descriptor = myNodeManager.getThisDescriptor(stackDescriptor, thisObjectReference); } else { - final ReferenceType type = location.method().declaringType(); - descriptor = myNodeManager.getStaticDescriptor(stackDescriptor, type); + descriptor = myNodeManager.getStaticDescriptor(stackDescriptor, location.method().declaringType()); } myChildren.add(myNodeManager.createNode(descriptor, evaluationContext)); @@ -483,10 +494,8 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi // add last method return value if any final Pair<Method, Value> methodValuePair = debuggerContext.getDebugProcess().getLastExecutedMethod(); if (methodValuePair != null) { - final ValueDescriptorImpl returnValueDescriptor = - myNodeManager.getMethodReturnValueDescriptor(stackDescriptor, methodValuePair.getFirst(), methodValuePair.getSecond()); - final DebuggerTreeNodeImpl methodReturnValueNode = myNodeManager.createNode(returnValueDescriptor, evaluationContext); - myChildren.add(1, methodReturnValueNode); + ValueDescriptorImpl returnValueDescriptor = myNodeManager.getMethodReturnValueDescriptor(stackDescriptor, methodValuePair.getFirst(), methodValuePair.getSecond()); + myChildren.add(1, myNodeManager.createNode(returnValueDescriptor, evaluationContext)); } // add context exceptions for (Pair<Breakpoint, Event> pair : DebuggerUtilsEx.getEventDescriptors(getSuspendContext())) { @@ -526,12 +535,10 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi protected void buildVariables(final StackFrameDescriptorImpl stackDescriptor, final EvaluationContextImpl evaluationContext) throws EvaluateException { final StackFrameProxyImpl frame = stackDescriptor.getFrameProxy(); - if (frame != null) { - for (final LocalVariableProxyImpl local : frame.visibleVariables()) { - final LocalVariableDescriptorImpl localVariableDescriptor = myNodeManager.getLocalVariableDescriptor(stackDescriptor, local); - final DebuggerTreeNodeImpl variableNode = myNodeManager.createNode(localVariableDescriptor, evaluationContext); - myChildren.add(variableNode); - } + for (final LocalVariableProxyImpl local : frame.visibleVariables()) { + final LocalVariableDescriptorImpl localVariableDescriptor = myNodeManager.getLocalVariableDescriptor(stackDescriptor, local); + final DebuggerTreeNodeImpl variableNode = myNodeManager.createNode(localVariableDescriptor, evaluationContext); + myChildren.add(variableNode); } } } @@ -541,6 +548,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi super(node); } + @Override public void threadAction() { final DebuggerTreeNodeImpl node = getNode(); ValueDescriptorImpl descriptor = (ValueDescriptorImpl)node.getDescriptor(); @@ -563,19 +571,23 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi } } + @Override public NodeManagerImpl getNodeManager() { return myNodeManager; } + @Override public NodeManagerImpl getDescriptorManager() { return myNodeManager; } + @Override public ValueDescriptorImpl getParentDescriptor() { return (ValueDescriptorImpl)getNode().getDescriptor(); } + @Override public void setChildren(final List<DebuggerTreeNode> children) { myChildren.addAll(children); updateUI(false); @@ -587,6 +599,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi super(node); } + @Override public void threadAction() { final StaticDescriptorImpl sd = (StaticDescriptorImpl)getNode().getDescriptor(); final ReferenceType refType = sd.getType(); @@ -609,6 +622,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi super(threadNode); } + @Override public void threadAction() { ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl)getNode().getDescriptor()); ThreadReferenceProxyImpl threadProxy = threadDescriptor.getThreadReference(); @@ -653,6 +667,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi myNode = node; } + @Override protected void action() throws Exception { ThreadGroupDescriptorImpl groupDescriptor = (ThreadGroupDescriptorImpl)myNode.getDescriptor(); ThreadGroupReferenceProxyImpl threadGroup = groupDescriptor.getThreadGroupReference(); @@ -701,6 +716,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi protected void updateUI(final boolean scrollToVisible) { DebuggerInvocationUtil.swingInvokeLater(getProject(), new Runnable() { + @Override public void run() { myNode.removeAllChildren(); for (DebuggerTreeNode debuggerTreeNode : myChildren) { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeImpl.java index b6877dc6acc3..ed9f76ff3db8 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/DebuggerTreeNodeImpl.java @@ -29,7 +29,6 @@ import com.intellij.debugger.ui.impl.tree.TreeBuilderNode; import com.intellij.debugger.ui.tree.DebuggerTreeNode; import com.intellij.debugger.ui.tree.NodeDescriptor; import com.intellij.debugger.ui.tree.ValueDescriptor; -import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; import com.intellij.debugger.ui.tree.render.DescriptorLabelListener; import com.intellij.debugger.ui.tree.render.NodeRenderer; import com.intellij.openapi.application.ApplicationManager; @@ -37,6 +36,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.ui.SimpleColoredText; import com.intellij.util.containers.HashMap; +import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -54,10 +54,12 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre myTree = tree; } + @Override public DebuggerTreeNodeImpl getParent() { return (DebuggerTreeNodeImpl) super.getParent(); } + @Override protected TreeBuilder getTreeBuilder() { return myTree.getMutableModel(); } @@ -70,14 +72,17 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre return myText != null? myText.toString() : ""; } + @Override public NodeDescriptorImpl getDescriptor() { return (NodeDescriptorImpl)getUserObject(); } + @Override public Project getProject() { return getTree().getProject(); } + @Override public void setRenderer(NodeRenderer renderer) { ((ValueDescriptorImpl) getDescriptor()).setRenderer(renderer); calcRepresentation(); @@ -110,6 +115,7 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre return myMarkupTooltipText; } + @Override public void clear() { removeAllChildren(); myIcon = null; @@ -129,10 +135,12 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre myText = DebuggerTreeRenderer.getDescriptorText(context, MessageDescriptor.EVALUATING, false); context.getDebugProcess().getManagerThread().invoke(new DebuggerContextCommandImpl(context) { + @Override public void threadAction() { runnable.run(); } + @Override protected void commandCancelled() { clear(); getDescriptor().clear(); @@ -141,6 +149,7 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre labelChanged(); childrenChanged(true); } + @Override public Priority getPriority() { return Priority.NORMAL; } @@ -157,8 +166,10 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre public void calcLabel() { final DebuggerContextImpl context = getTree().getDebuggerContext(); update(context, new Runnable() { + @Override public void run() { getDescriptor().updateRepresentation(context.createEvaluationContext(), new DescriptorLabelListener() { + @Override public void labelChanged() { updateCaches(); DebuggerTreeNodeImpl.this.labelChanged(); @@ -171,8 +182,10 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre public void calcRepresentation() { final DebuggerContextImpl context = getTree().getDebuggerContext(); update(context, new Runnable() { + @Override public void run() { getDescriptor().updateRepresentation(context.createEvaluationContext(), new DescriptorLabelListener() { + @Override public void labelChanged() { updateCaches(); DebuggerTreeNodeImpl.this.labelChanged(); @@ -187,21 +200,23 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre update( context, new Runnable() { + @Override public void run() { EvaluationContextImpl evaluationContext = context.createEvaluationContext(); getDescriptor().setContext(evaluationContext); getDescriptor().updateRepresentation(evaluationContext, new DescriptorLabelListener() { + @Override public void labelChanged() { updateCaches(); DebuggerTreeNodeImpl.this.labelChanged(); } }); - DebuggerTreeNodeImpl.this.childrenChanged(true); + childrenChanged(true); } }, false); } - private void invoke(Runnable r) { + private static void invoke(Runnable r) { if(ApplicationManager.getApplication().isDispatchThread()) { r.run(); } @@ -212,6 +227,7 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre public void labelChanged() { invoke(new Runnable() { + @Override public void run() { updateCaches(); getTree().getMutableModel().nodeChanged(DebuggerTreeNodeImpl.this); @@ -221,6 +237,7 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre public void childrenChanged(final boolean scrollToVisible) { invoke(new Runnable() { + @Override public void run() { getTree().getMutableModel().nodeStructureChanged(DebuggerTreeNodeImpl.this); getTree().restoreState(DebuggerTreeNodeImpl.this); @@ -255,6 +272,7 @@ public class DebuggerTreeNodeImpl extends TreeBuilderNode implements DebuggerTre protected static DebuggerTreeNodeImpl createNode(DebuggerTree tree, NodeDescriptorImpl descriptor, EvaluationContextImpl evaluationContext) { final DebuggerTreeNodeImpl node = new DebuggerTreeNodeImpl(tree, descriptor); descriptor.updateRepresentationNoNotify(evaluationContext, new DescriptorLabelListener() { + @Override public void labelChanged() { node.updateCaches(); node.labelChanged(); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/LocalVariableDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/LocalVariableDescriptorImpl.java index 96f0dc6ff61f..f93ab91056b8 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/LocalVariableDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/LocalVariableDescriptorImpl.java @@ -44,7 +44,6 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements private boolean myIsPrimitive; private boolean myIsNewLocal = true; - private boolean myIsVisible = true; public LocalVariableDescriptorImpl(Project project, @NotNull LocalVariableProxyImpl local) { @@ -54,6 +53,7 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements myLocalVariable = local; } + @Override public LocalVariableProxyImpl getLocalVariable() { return myLocalVariable; } @@ -83,13 +83,15 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements return myIsNewLocal; } + @Override public boolean isPrimitive() { return myIsPrimitive; } + @Override public Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException { - myIsVisible = myFrameProxy.isLocalVariableVisible(getLocalVariable()); - if (myIsVisible) { + boolean isVisible = myFrameProxy.isLocalVariableVisible(getLocalVariable()); + if (isVisible) { final String typeName = getLocalVariable().typeName(); myTypeName = typeName; myIsPrimitive = DebuggerUtils.isPrimitiveType(typeName); @@ -103,6 +105,7 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements myIsNewLocal = aNew; } + @Override public void displayAs(NodeDescriptor descriptor) { super.displayAs(descriptor); if(descriptor instanceof LocalVariableDescriptorImpl) { @@ -110,10 +113,12 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements } } + @Override public String getName() { return myLocalVariable.name(); } + @Override public String calcValueName() { final ClassRenderer classRenderer = NodeRendererSettings.getInstance().getClassRenderer(); StringBuilder buf = StringBuilderSpinAllocator.alloc(); @@ -130,6 +135,7 @@ public class LocalVariableDescriptorImpl extends ValueDescriptorImpl implements } } + @Override public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException { PsiElementFactory elementFactory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory(); try { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java index 6f2aa4e09f0d..dbcd11cdea64 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/MessageDescriptor.java @@ -30,21 +30,21 @@ public class MessageDescriptor extends NodeDescriptorImpl { private int myKind; private String myMessage; - public static MessageDescriptor DEBUG_INFO_UNAVAILABLE = new MessageDescriptor(DebuggerBundle.message("message.node.debug.info.not.available")); - public static MessageDescriptor LOCAL_VARIABLES_INFO_UNAVAILABLE = new MessageDescriptor( + public static final MessageDescriptor DEBUG_INFO_UNAVAILABLE = new MessageDescriptor(DebuggerBundle.message("message.node.debug.info.not.available")); + public static final MessageDescriptor LOCAL_VARIABLES_INFO_UNAVAILABLE = new MessageDescriptor( DebuggerBundle.message("message.node.local.variables.debug.info.not.available") ); - public static MessageDescriptor ALL_ELEMENTS_IN_VISIBLE_RANGE_ARE_NULL = new MessageDescriptor( + public static final MessageDescriptor ALL_ELEMENTS_IN_VISIBLE_RANGE_ARE_NULL = new MessageDescriptor( DebuggerBundle.message("message.node.all.array.elements.null")); - public static MessageDescriptor ALL_ELEMENTS_IN_RANGE_ARE_NULL = new MessageDescriptor( + public static final MessageDescriptor ALL_ELEMENTS_IN_RANGE_ARE_NULL = new MessageDescriptor( DebuggerBundle.message("message.node.all.elements.null")); - public static MessageDescriptor ARRAY_IS_EMPTY = new MessageDescriptor(DebuggerBundle.message("message.node.empty.array")); - public static MessageDescriptor CLASS_HAS_NO_FIELDS = new MessageDescriptor(DebuggerBundle.message("message.node.class.has.no.fields")); - public static MessageDescriptor OBJECT_COLLECTED = new MessageDescriptor(DebuggerBundle.message("message.node.object.collected")); - public static MessageDescriptor EVALUATING = new MessageDescriptor(XDebuggerUIConstants.COLLECTING_DATA_MESSAGE); - public static MessageDescriptor THREAD_IS_RUNNING = new MessageDescriptor(DebuggerBundle.message("message.node.thread.running")); - public static MessageDescriptor THREAD_IS_EMPTY = new MessageDescriptor(DebuggerBundle.message("message.node.thread.has.no.frames")); - public static MessageDescriptor EVALUATION_NOT_POSSIBLE = new MessageDescriptor(DebuggerBundle.message("message.node.evaluation.not.possible", WARNING)); + public static final MessageDescriptor ARRAY_IS_EMPTY = new MessageDescriptor(DebuggerBundle.message("message.node.empty.array")); + public static final MessageDescriptor CLASS_HAS_NO_FIELDS = new MessageDescriptor(DebuggerBundle.message("message.node.class.has.no.fields")); + public static final MessageDescriptor OBJECT_COLLECTED = new MessageDescriptor(DebuggerBundle.message("message.node.object.collected")); + public static final MessageDescriptor EVALUATING = new MessageDescriptor(XDebuggerUIConstants.COLLECTING_DATA_MESSAGE); + public static final MessageDescriptor THREAD_IS_RUNNING = new MessageDescriptor(DebuggerBundle.message("message.node.thread.running")); + public static final MessageDescriptor THREAD_IS_EMPTY = new MessageDescriptor(DebuggerBundle.message("message.node.thread.has.no.frames")); + public static final MessageDescriptor EVALUATION_NOT_POSSIBLE = new MessageDescriptor(DebuggerBundle.message("message.node.evaluation.not.possible", WARNING)); public MessageDescriptor(String message) { this(message, INFORMATION); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java index a98afc7c9eb8..54e4826f8d1d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/NodeDescriptorFactoryImpl.java @@ -32,6 +32,7 @@ import com.intellij.debugger.ui.tree.UserExpressionDescriptor; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.sun.jdi.*; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.HashMap; @@ -97,6 +98,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { final MarkedDescriptorTree displayDescriptorTree = new MarkedDescriptorTree(); tree.dfst(new DescriptorTree.DFSTWalker() { + @Override public void visit(NodeDescriptor parent, NodeDescriptor child) { final DescriptorData<NodeDescriptor> descriptorData = DescriptorData.getDescriptorData(child); descriptorTree.addChild(parent, child, descriptorData); @@ -130,10 +132,12 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { return descriptorTree; } + @Override public ArrayElementDescriptorImpl getArrayItemDescriptor(NodeDescriptor parent, ArrayReference array, int index) { return getDescriptor(parent, new ArrayItemData(array, index)); } + @Override public FieldDescriptorImpl getFieldDescriptor(NodeDescriptor parent, ObjectReference objRef, Field field) { final DescriptorData<FieldDescriptorImpl> descriptorData; if (objRef == null ) { @@ -148,6 +152,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { return getDescriptor(parent, descriptorData); } + @Override public LocalVariableDescriptorImpl getLocalVariableDescriptor(NodeDescriptor parent, LocalVariableProxy local) { return getDescriptor(parent, new LocalData((LocalVariableProxyImpl)local)); } @@ -156,7 +161,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { return getDescriptor(parent, new ArgValueData(index, value, name)); } - public StackFrameDescriptorImpl getStackFrameDescriptor(NodeDescriptorImpl parent, StackFrameProxyImpl frameProxy) { + public StackFrameDescriptorImpl getStackFrameDescriptor(@Nullable NodeDescriptorImpl parent, @NotNull StackFrameProxyImpl frameProxy) { return getDescriptor(parent, new StackFrameData(frameProxy)); } @@ -184,6 +189,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { return getDescriptor(parent, new ThreadGroupData(group)); } + @Override public UserExpressionDescriptor getUserExpressionDescriptor(NodeDescriptor parent, final DescriptorData<UserExpressionDescriptor> data) { return getDescriptor(parent, data); } @@ -232,6 +238,7 @@ public class NodeDescriptorFactoryImpl implements NodeDescriptorFactory { super(descriportTree); } + @Override protected NodeDescriptor getSearched(NodeDescriptor parent) { NodeDescriptor searched = super.getSearched(parent); if(searched == null) { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java index 8e11e545dcd0..2b6f292e0d38 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java @@ -16,10 +16,7 @@ package com.intellij.debugger.ui.impl.watch; import com.intellij.debugger.SourcePosition; -import com.intellij.debugger.engine.ContextUtil; -import com.intellij.debugger.engine.DebugProcess; -import com.intellij.debugger.engine.DebuggerManagerThreadImpl; -import com.intellij.debugger.engine.DebuggerUtils; +import com.intellij.debugger.engine.*; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; import com.intellij.debugger.jdi.StackFrameProxyImpl; @@ -38,6 +35,7 @@ import com.intellij.util.ui.TextTransferable; import com.intellij.xdebugger.frame.XStackFrame; import com.intellij.xdebugger.impl.ui.tree.ValueMarkup; import com.sun.jdi.*; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -61,8 +59,9 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac private Icon myIcon = AllIcons.Debugger.StackFrame; - public StackFrameDescriptorImpl(StackFrameProxyImpl frame, final MethodsTracker tracker) { + public StackFrameDescriptorImpl(@NotNull StackFrameProxyImpl frame, @NotNull MethodsTracker tracker) { myFrame = frame; + try { myUiIndex = frame.getFrameIndex(); myLocation = frame.location(); @@ -102,7 +101,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac myIsInLibraryContent = false; } - myXStackFrame = myLocation == null ? null : getDebugProcess().getPositionManager().createStackFrame(myLocation); + myXStackFrame = myLocation == null ? null : ((DebugProcessImpl)getDebugProcess()).getPositionManager().createStackFrame(frame, (DebugProcessImpl)getDebugProcess(), myLocation); + } + + @Nullable + public XStackFrame getXStackFrame() { + return myXStackFrame; } public int getUiIndex() { @@ -110,10 +114,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac } @Override + @NotNull public StackFrameProxyImpl getFrameProxy() { return myFrame; } + @NotNull @Override public DebugProcess getDebugProcess() { return myFrame.getVirtualMachine().getDebugProcess(); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java index ec762c3ace72..5e9c81732613 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java @@ -76,7 +76,8 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements myProject = project; } - public boolean isArray() { + @Override + public boolean isArray() { return myValue instanceof ArrayReference; } @@ -84,11 +85,13 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements return myIsDirty; } - public boolean isLvalue() { + @Override + public boolean isLvalue() { return myIsLvalue; } - public boolean isNull() { + @Override + public boolean isNull() { return myValue == null; } @@ -97,6 +100,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements return myValue instanceof StringReference; } + @Override public boolean isPrimitive() { return myValue instanceof PrimitiveValue; } @@ -113,6 +117,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements myShowIdLabel = showIdLabel; } + @Override public Value getValue() { // the following code makes sense only if we do not use ObjectReference.enableCollection() / disableCollection() // to keep temporary objects @@ -124,6 +129,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements final Semaphore semaphore = new Semaphore(); semaphore.down(); evalContext.getDebugProcess().getManagerThread().invoke(new SuspendContextCommandImpl(evalContext.getSuspendContext()) { + @Override public void contextAction() throws Exception { // re-setting the context will cause value recalculation try { @@ -134,6 +140,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements } } + @Override protected void commandCancelled() { semaphore.up(); } @@ -145,12 +152,14 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements return myValue; } + @Override public boolean isExpandable() { return myIsExpandable; } public abstract Value calcValue(EvaluationContextImpl evaluationContext) throws EvaluateException; + @Override public final void setContext(EvaluationContextImpl evaluationContext) { DebuggerManagerThreadImpl.assertIsManagerThread(); myStoredEvaluationContext = evaluationContext; @@ -170,7 +179,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements myIsDirty = (value == null) ? myValue != null : !value.equals(myValue); } } - catch (ObjectCollectedException e) { + catch (ObjectCollectedException ignored) { myIsDirty = true; } } @@ -227,6 +236,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements return exceptionObj; } + @Override public void setAncestor(NodeDescriptor oldDescriptor) { super.setAncestor(oldDescriptor); myIsNew = false; @@ -237,6 +247,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements myIsLvalue = value; } + @Override protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener){ DebuggerManagerThreadImpl.assertIsManagerThread(); @@ -288,18 +299,21 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements } + @Override public String setValueLabel(String label) { final String customLabel = getCustomLabel(label); myValueLabel = customLabel; return setLabel(calcValueName() + " = " + customLabel); } + @Override public String setValueLabelFailed(EvaluateException e) { final String label = setFailed(e); setValueLabel(label); return label; } + @Override public Icon setValueIcon(Icon icon) { return myValueIcon = icon; } @@ -311,6 +325,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements public abstract String calcValueName(); + @Override public void displayAs(NodeDescriptor descriptor) { if (descriptor instanceof ValueDescriptorImpl) { ValueDescriptorImpl valueDescriptor = (ValueDescriptorImpl)descriptor; @@ -370,6 +385,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements //use 'this' to reference parent node //for ex. FieldDescriptorImpl should return //this.fieldName + @Override public abstract PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException; public static String getIdLabel(ObjectReference objRef) { @@ -425,12 +441,14 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements } //Context is set to null + @Override public void clear() { super.clear(); setValueLabel(""); myIsExpandable = false; } + @Override @Nullable public ValueMarkup getMarkup(final DebugProcess debugProcess) { final Value value = getValue(); @@ -444,6 +462,7 @@ public abstract class ValueDescriptorImpl extends NodeDescriptorImpl implements return null; } + @Override public void setMarkup(final DebugProcess debugProcess, @Nullable final ValueMarkup markup) { final Value value = getValue(); if (value instanceof ObjectReference) { |