diff options
author | Tor Norbye <tnorbye@google.com> | 2014-03-10 13:13:45 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-03-10 13:13:51 -0700 |
commit | 1fff8e2b7bbcfdea262d3782d4307ca6437da2a3 (patch) | |
tree | 2709e256856c1d80b5cf344b7b0c292a756a2842 /plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils | |
parent | 88f318c9bf709fa5700350636925f2c46d6ae08d (diff) | |
download | idea-1fff8e2b7bbcfdea262d3782d4307ca6437da2a3.tar.gz |
Snapshot ae49fc0ed43dd87b534931e62fceae2bcac4fdf1 from idea/134.1445 of git://git.jetbrains.org/idea/community.gitsnapshot-master
ae49fc0: scala 0.32.(593|562|558|550) and AngularJS 0.1.(8|9) marked as incompatible
c3a2e25: Remove unused variable
fe44c93: Multicaret XML: fix type handler for multicaret mode
94108b1: IDEA-121711 Breakpoints dialog: cannot select items in Field Watchpoints section
4933fb4: Add AngularJS plugin
c0ee8f0: IntelliJ Idea 13.1 artworks
95977a0: new inference: cleanup
b3b99f4: ensure order
e9d3421: update button on installed plugins panel
5237f29: IDEA-121151 Breakpoints dialog: Group by Package / File shows exception items in wrong branch
6289c57: show information about multiple carets in status bar (IDEA-80056)
9ac9b91: add getCaretCount method to caret model API (IDEA-80056)
37b836c: WEB-11122 we cannot trust editor width — it could be 0 in case of soft wrap even if editor has text
ad2e3a9: nashorn: frames view — correct presentation of stack frame (function name is not yet displayed)
35fd0fc: cleanup
a433603: Use new icons and fgs
f9e15e0: CPP-6: Parameter info highlighting is messed up + review CR-IC-4631
d158a03: editorPaintStart useless in our case
d22cffe: don't paint in the overlapped region
3181d9a: CR-IC-4638 EvaluateInConsoleFromTreeAction
aa9d729: refactoring branch actions
367266a: style: sort hg reference names in getNamesWithoutHashes, unnecessary ui model creation removed
f0aba00: style: ternary operator used instead of several if-statements; comment added; unnecessary pool thread removed
58d9042: IDEA-121096 The ability to delete Mercurial bookmark
1a11673: IDEA-109794 ability to push mercurial bookmark
e4edbe9: hg action dialog refactoring
d61ace7: optimization broke code (IDEA-118426)
0da53a2: add new plugins icons
fe4a2a0: plugin update icon
9f5335b: plugin restart icon
24aab3b: plugin icon with JB logo
43e5b58: IDEA-121589 Breakpoints dialog: breakpoint categories should be present in a fixed order
f1f1141: IDEA-121675 Nashorn: Debug: RunToCursor is always disabled when js file is active
5b29ebf: Merge remote-tracking branch 'origin/master'
6893d29: revert
21068c7: scene builder: embedder
14de5df: Merge branch 'python-fixes'
7a968d0: IDEA-121642 Breakpoints dialog: closing "Disabled until" hides preview
b3a39df: caret listeners API change (IDEA-80056)
d98f5f7: IDEA-103517 diff: fix diff invocation from history tab
de02a90: revert incorrect change: BuildManager was not notified about files changes at all
e3f3e5f: notnull
6b3a754: cleanup
39bfb97: notnull
0fdd39a: CAPACITY inlined
337138e: CR-IC-4638 we must use "XDebugger", but not "Debugger"
1f2dd56: cleanup
33b0145: IDEA-121675 Nashorn: Debug: RunToCursor is always disabled when js file is active
f4d0239: fix exception at completion when multiple carets are enabled (IDEA-80056)
bc22d75: Compare sys.path roots by virtual file, not by filename because of *.egg archives
90bd285: Extracted getSdkRootVirtualFile()
0eab6fd: test framework: refresh module file
0c1cf4d: Cleanup (pointless exceptions; field extracted; arrangement)
b5a2bae: Cleanup (unused class)
5455508: Cleanup (pointless exceptions dropped)
bc72137: cleanup
3ff0739: NotNull
911290e: cleanup
b770509: cleanup
7d78ad3: cleanup
effe895: cleanup
126f4a0: cleanup
0e49f4a: anonymous -> lambda/method ref: highlight as unused symbol new ClassReference
9860e6b: migration inspection: assign weak warning to produce annoyance
380c7a9: testdata for IDEA-121661
0fa7d08: IDEA-121658 Java 1.8: "Replace with forEach" quick fix is not suggested if for statement is not surrounded with braces
c692398: Local History change temporarily reverted
803d865: IDEA-121640 Breakpoints conversion: conditions and log message languages all turn to Java
d1194fb: IDEA-121643 Breakpoints conversion: exception breakpoint dependencies are lost
95069e7: IDEA-121644 Breakpoints conversion: wildcard method breakpoints get Method entry = Method exit = true
02387b0: IDEA-121632 DomStubBuilder#getStubVersion does not use DomFileDescription#getStubVersion
01a42e5: IDEA-121632 DomStubBuilder#getStubVersion does not use DomFileDescription#getStubVersion
d05d6cd: IDEA-121555 github: get host from url before comparison
314a555: Storyboard format
8181cdb: IDEA-82129 diff: fix synchronized scrolling in merge dialog for left-middle panels
7d76faf: diff: replace Pair by container class
6baec97: repeatCount mostly done
9f2cf02: cleanup — inline
5ff9d4f: improvements for multi-caret implementation of column mode (IDEA-80056)
46208da: EA-53845 added logging
fdecf55: IDEA-121409, IDEA-120908 revert GrReassignedInClosureLocalVariableInspection back to previous state. So it doesn't check plain assignments to locals
9b9ffdb: Merge branch 'master' of git.labs.intellij.net:idea/community
f2d2e79: IDEA-120027 - Import Git-cloud apps from sources - refactor out account selection panel
121f738: IDEA-120027 - Import Git-cloud apps from sources - refactor out deployment detector
989fa1b: IDEA-121635 Injected fragment editor fails with \r\n in text
cc11811: Fix cloning sdk additional data.
7cfb673: Merge remote-tracking branch 'origin/master'
f30ac9d: Merge remote-tracking branch 'origin/master'
e31638a: IDEA-121621 Java 1.8: "Replace with collect" quick fix inserts unresolved method reference
1ae653c: Fix update of terminal input action wrapper.
fb14201: IDEA-116760 Mousing over "tool popup" button causes funny behavior
ece8311: file and doc mod stamps should be equal after save
e30e9ff: EA-53865 - assert: CachedValueProvider$Result.<init>
b5deb1d: Merge remote-tracking branch 'origin/master'
94ae901: PY-12178 Support pull up / push down for properties
27fb3a4: Local History fix: load file children on fileCreated event
5de8d20: a test for IDEA-121301 Setting a breakpoint after navigation to a folded method
a337747: use origin fqn
2a60f15: support ColorUIResource
16fa597: Merge remote-tracking branch 'origin/master'
6dd7d9d: parameter info: proper highlighting for text with XML escaped chars, e.g "map<string, int> &x" +review CR-IC
a3141a4: Merge branch 'python-fixes'
c6947e3: IDEA-108454 (test added)
7ba0d53: Merge remote-tracking branch 'origin/master'
5b6bfba: Disable default breakpoints in env debugger tests.
de2bcc9: Better logging in debugger communication.
f65481f: ResumeAction -> DumbAware
5312f17: IDEA-121301 Setting a breakpoint after navigation to a folded method
b82ea0b: updater: use system look&feel
76b0d68: CR-IU-615 (reworked)
09d9083: WI-22345 Fragment editor: typing causes Throwable at CompletionAssertions.assertCommitSuccessful()
65e4c34: Merge remote-tracking branch 'origin/master'
53752af: fixed PY-12321 PyCharm fails to auto-complete inherited PyQt methods
93eaeb4: Merge remote-tracking branch 'origin/master'
0a93c40: IDEA-121551 please sign runnerw.exe and commit
ec8c8eb: Breakpoint remove should be executed in write action like breakpoint add in XDebuggerTestUtil.
49a5a3f: don't duplicate symlink in suggested interpreter path
f673815: Fix creation of remote sdk in tests.
7a6a957: fix entities resolve without root tag
bd73c79: completion for html5 entities without root tag
41aaf52: #WEB-11032 fixed
9483000: external build: added API to allow plugins extend external build launcher classpath
465090e: Storyboard format
53d95f8: fetch commandLine from processHandler instance if possible
329b1a7: Merge remote-tracking branch 'origin/master'
dd2e76a: PY-12178 Support pull up / push down for properties
550a7e4: EvaluateInConsole
62cf3bb: ActionUtil.getActions
b01a8f1: use SmartList
f95d39d: Merge remote-tracking branch 'origin/master'
b7dca13: added browse interpreter button to create virtual env dialog
64fccff: IDEA-121378 Groovy: inspections: Access to untyped expression reports this and super
1b0f4e8: IDEA-121420 ctrl+b on "def" keyword of a variable without explicit type with initializer should navigate to inferred type
ed39848: IDEA-121140 format spock tables in the end of a file
f2fea0a: external build: added API to prepare custom java compilation task and provide default options for java compiler
0203ec8: Merge remote-tracking branch 'origin/master'
5acf645: Merge remote-tracking branch 'origin/master'
18dbd58: Merge remote-tracking branch 'origin/master'
f8f3d97: lambda: do not try to annotate super method with Nullable from lambda body (IDEA-120205) annotation for super methods was removed by cdr
a4977be: lambda/method refs: provide super class navigation - ctrl-u/line markers (IDEA-120160)
f1dac13: Deprecated remote sdk api. Old legacy classes leaved for compatibility.
4a4d94f: Merge remote-tracking branch 'origin/master'
59525f3: prepared copy of log4j before exec updater to avoid similar issue: WEB-11207 Patch to 8.0 build 134.1361 fails on Win 8.1
179bdc5: support null-values
fe93f3f: Query only the first result of super and overring method searches for performance resaons
6b1189e: more diagnostics for EA-50865 - assert: CachedValueProvider$Result.<init>
5396644: IDEA-121387 Breakpoints dialog: Exception breakpoints: no language chooser for Condition
279b7c3: EA-52976 - assert: CodeFoldingManagerImpl.releaseFoldings
00dbd95: Reuse resolve context with type eval context from the current inspection session for performance reasons
5313d0b: WI-14345 Dictionary: Missing Word "Fundraising"
f4d98a3: IDEA-121505 Breakpoint properties popup: More link does not work if over tool window splitter
fa27e1a: IDEA-121508 Breakpoints in JSP scriptlets are ignored
957b622: CR-IC-4621 allow evaluation in global context (without suspend context)
363a27a: overrides
9ef0155: finalize
ad6c95a: cleanup — move DisabledActionHandler to platform +review
e98cb45: cleanup
19adc49: cleanup
539e45a: Multicaret: fix tests
ede0620: fixed memory leak
6b8002e: Cache return types of callables using TypeEvalContext.getReturnType()
9ca3e42: IDEA-121582 (less spam in log)
b9b76dc: java: type annotations
b428981: java: shorten references after refactoring
d728fd7: IDEA-121518 Cannot edit files in IDEA after project opening: initial folding in opening thread, assertions relaxed
5ed9d91: better diagnostics
b1ae53c: javadoc
2691cb0: external build: ignore irrelevant messages in stderr of javac server (e.g. warnings from log4j)
a487452: continue WEB-10187 inspect objects in console
1a5af0d: more correct and concrete javadoc — it is NOT text, it is just highlighting
fc8c136: IDEA-121531 False positive for "Named arguments are not allowed inside index operations"
7a0eff4: external build: extracted extension point to support custom java compilers
0c6f4d1: don't display expanders on disabled components
c34a068: Merge remote-tracking branch 'origin/master'
a71ff7a: Propose to launch vagrant instance on connection to non-running vagrant remote host (PY-8751).
2905258: NotNull annotation for parent component
ea5f0a5: no "loading components" progress for default project
80d6e1f: new inference: use site substitutor during return constraints processing (red code in Collectors)
b55527a: testdata for IDEA-118965
0cb0127: IDEA-121379 ("Remove braces from if statement" is not available on "if" keyword and condition of if-else construct)
2e88d04: revert optimization because it does not optimize
d4883f5: rebuild list on EDT only
139374a: quick evaluate should allow evaluation in global context (without suspend context)
9051157: cleanup
3419368: init WEB-10187 inspect objects in console
14490aa: overrides
f9eaaef: IDEA-115491 Fragment editor > Save as: provide default directory
a2007d9: IDEA-115490 Fragment editor > Save as: forbidden default name
282ebd2: FormatterTestCase should be available to plugin developers
c4ee509: IDEA-121553 Converted field and exception breakpoints are not available to user
60dfeb6: EA-41231 (better diagnostic)
cec4bb0: show options in create new project instead of show dialog
851c599: fix highlighter update on FileContentUtil.reparseFiles()
842cb01: avoid PSI tree change listener leaks in breakpoint popup
7e61326: avoid PSI tree change listener leaks
a445e2c: table greyer (ability to disable a table)
dff15af: IDEA-105047 Map help button and F1 of the Breakpoints dialog
06fbfa3: WEB-11122 LiveConsole: do not hide input/output
e7ed9a2: cleanup use EditorUtil.scrollToTheEnd
2b22f1a: IDEA-121445 Incomplete breakpoint background highlighting
6cb7fe8: use SmartList
132c8d9: cleanup
34499ed: cleanup
9f501ce: Merge remote-tracking branch 'origin/master'
bbb835a: IDEA-121530 New Mac Messages: 'Invalidate caches' message (with 4 buttons) has one button cut off - First part. The message should be re-layouted. Currently, where is an empty space in the top right part of the message.
524e89e: fix AIOOBE
ee029e5: EA-33362 - assert: DocumentImpl.createRangeMarker
e2b452b: Merge remote-tracking branch 'origin/master'
551e0c5: fixed PY-12228 Project Interpreter: not possible to remove default-located interpreter from the list
df34787: IDEA-121533 INRE at com.intellij.util.indexing.FileBasedIndexImpl.a
a45e0df: EA-41231 (diagnostic)
1e94edc: Shadows improvement
cc01459: WEB-11194 runnerw.exe not working on win XP
10543d4: EA-54083, EA-54446 (premature disposal of default project prevented)
f455420: Merge remote-tracking branch 'origin/master'
0878209: Merging more than one newline in multi-line strings (PY-5532).
e3a7ad9: Implement 'Select all occurrences' action
3b82bfe: fixed PY-12211 Virtualenv interpreters associated with the current project are unsorted
e700d39: Merge remote-tracking branch 'origin/master'
7683348: updated after review.
25d38b4: fixed - toggle method breakpoint action added new breakpoint
d11a471: EA-52809 - IAE: GrClosureType.<init>
e8a5a73: EA-53171 Extracted a separate class for caching type definition stuff. Used CachedValueManager for caching class members, caches depends on its type definition changes and out_of_code_block_modification due to many synthetic members of a class get invalidated independently from its class.
287c82f: Removed TypeEvalContext parameter from PyType.isBuiltin()
466cbf4: EA-54177 - assert: Alarm._addRequest
168a1bc: show paths for detected sdk
eb3695f: new inference: non wildcard parametrization: reject primitive bounds
ab2348a: new inference: diamond in lambda return workaround
7fa42a6: java 1.8, stream api migration: temp disable for generics methods
6087cba: java 1.8, stream api migration: convert to method refs
fb65345: java 1.8, stream api migration: shorten class names
4e6b18e: switch on inplace scene builder
bae5e2a: IDEA-110943 apply patch: Do not add "-" at the end of new file - Part2
2544895: IDEA-121502 Breakpoint condition language is reverted to default once breakpoint properties opened
d96e7b4: do resolve symlinks in suggested python sdks
a52288b: IDEA-110943 apply patch: Do not add "-" at the end of new file
de93417: IDEA-121371 diff: change action caption
7805c3d: Merge remote-tracking branch 'origin/master'
e77d5bb: Switched to @NotNull call site in Callable.getCallType() and PyCallableType.getCallType()
9b235a9: updated after review.
eb0b14f: Changed Callable.getCallType() with explicit 'null' call site to Callable.getReturnType()
dd898e2: Introduced Callable.getCallType() instead of PyFunctionImpl.getReturnTypeWithoutCallSite()
112519d: Merge remote-tracking branch 'origin/master'
4f8a937: IDEA-73814 Scratchpad
257ba94: updated after review.
032ad71: Inlined getGenericReturnType()
888edb9: IDEA-121491 Breakpoints inside anonymous class used in a field initializer
9e9e8e5: Cache call site independent return types of callables in TypeEvalContext
513e07d: EA-54475
27ffe06: CR-IC-4596 (formatting)
f0d970f: use correct concurrency primitive
90c2460: notnull
4c29f54: javadoc
9b88e07: Merge remote-tracking branch 'origin/master'
a456069: diamonds are not available at this language level - testdata fixed
0cab1e2: java 1.8, stream api migration: collect (to be continued)
3f5e08e: do not throw exception
578ac0e: fix indents in testdata
3f111dc: EA-53845 fixed NPE. ProjectRootManager obviously cannot be obtained if delegate.getProject() == null. Some @NotNull & @Nullable added in relative places
2ff02a9: cleanup
f90ee78: Added Callable.getReturnType() and PyTypeProvider.getReturnType()
54786f4: Renamed PyTypeProvider.getReturnType() to getCallType()
ed026c0: Renamed Callable.getReturnType() to getCallType()
1f721bb: Added PyCallableType.getReturnType() for forthcoming return types caching
f65c546: myWatchedProjectCount should be nonnegative
3c66f51: introduced idea.no.system.path.space.monitoring property to skip checks for free space because it fails for yet unrecognized reasons (IDEA-118718)
2fb4a97: JavaFX Scene Builder integration
956b0e3: Exclude ui-designer-core from plugins
8339440: IDEA-121423 Groovy: don't add type arguments to text for reference generating since it can contain lexical errors. Add type arguments to generated reference instead.
fd724d2: IDEA-121082 Enter License dialog: cannot enter data if JetBrains Account fails or returns several licenses
1e5e753: IDEA-121359 License dialog: Undo not working in textfields
cb0399a: check for closure parameters: use method call conversion rules
914d6d4: Groovy: inference of closure parameter types: checks for explicitly declared types.
9446712: Duplicated error messages in @CompileStatic context fixed. Recoursive visitor is replaced with simple visitor, so we don't go inside child psi elements which can be inside @CompileStatic context
b7ba76c: Groovy: Support all ClosureSignatureHints
8951234: FromString hint: support correcr format. it describes a whole signature inside a single string.
22d33a0: ClosureSignatureHint works for closures with several parameters without declared types
d6f0faf: FromString hint: support options with a single String arg instead of an array of Strings
f30ccd9: Groovy: update mock groovy-2.3 build
258c222: Groovy: infrastructure for @ClosureParams support. FromString closure signature hint is supported
965c9b8: redundant code
17ad0ad: EA-53885 - CCE: GrIntroduceParameterProcessor.findUsages in-place introduce parameter is supported only for methods right now
d1b1b43: EA-54370 - IAE: GrIntroduceHandlerBase.getAnchor anchor should be @Nullable to get appropriate log message in case of null
d677a38: some null checks and cleanup
e5b4876: diff: DiffFragment.unchanged -> isEqual() == true
61b2c2a: diff: cleanup
b4a0790: Merge remote-tracking branch 'origin/master'
ac6700b: IDEA-121418 Update to EAP 134.1342 fails with access denied
41a88a4: diff: remove code duplication
45caaf6: diff: move HighlightingMode logic to TextCompareProcessor
ea4d527: EA-54427 - IAE: DiffUtil.getFramingColor
a30e0c6: Merge branch 'two-factor-auth'
49a7d1c: Merge branch 'diff-string'
eed23e9: diff: fix patience diff
442a1ad: Changes according to CR-IC-4570 (using VirtualFileWithId) and CR-IC-4490 (double checked locking)
01d1d11: A standalone EnforcedPlainTextFileTypeManagerTest
8207bd5: java: shorten references after refactoring
5cd9656: EA-54400 (getChildren() consistency guaranteed)
87f8b0f: search indexed files first, then elsewhere (not only whole-words, IDEA-121444)
d7e9631: search whole-words-only in indexed files first, then elsewhere (IDEA-121444)
9dab141: extract project scanning functionality to FindInProjectTask
7bc8adb: FindInProjectUtil cleanup & shortening
fbf5bbe: GeneralCommandLine: 'warn' level changed to 'info' level
7647e15: fix compilation under 1.8
e268b4d: EA-54442 - assert: ComponentManagerImpl.getComponent
c2bee64: restore error on diamonds under 1.6 (IDEA-121377)
0407c16: new inference: cleanup
d8b3e5c: new inference: captures should stay closed inside nested calls
e683dc8: new inference: wildcard parametrization for lambda with formal params: assignability check for complete parametrization only
cfcc34b: IDEA-121251 (stray annotation highlighted)
b8e291a: better tracing resource problem
32c5c60: correctly serialize multiline conditions and log messages
e78e195: do not save null in text and extra text
055191e: use chunk.getPresentableShortName in FormsInstrumenter
6a70bb8: regression: IDEA-121390 Breakpoints: mute on / off: breakpoint appearance updates only on focus change
f23249b: avoid type warning
0d528ac: use trove collections
3c4c139: IDEA-120290 Deprecated methods in import popup.
10ab0f9: don't enumerate all chunk members in compiler status messages
8e74f05: IDEA-121433 ('Auto-unboxing' inspection misses cases)
3a48f58: Merge remote-tracking branch 'origin/master'
1c9512a: Deployment based remote interpreters.
9cfc582: New plugin description
362d96b: New plugin description
a80e03c: New plugin description
7a68bd8: New plugin description
b3d6fcf: issue a clear compilation error when there's no groovy library
6fa1f58: IDEA-117325 Coloring of variable disappears when variable reassigned a value inside an if(){}
35040d4: IDEA-121253 Allow to edit/add contract annotation for library method at usage location
d5e833a: Merge remote-tracking branch 'origin/master'
a047666: new inference: non wildcard parametrization against the spec
ef581ff: restored method breakpoints notification
903d9cf: IDEA-121187 ("Method names differ only by case" is reported even if methods are different not only by case, but by signature as well)
59b0d0e: New plugin description
32e6a78: New plugin description
4da6bed: New plugin description
8f245e8: Merge branch 'python-fixes'
d99cf43: new "'ThreadLocalRandom' instance might be shared" inspection
728b702: improve description
b074b52: allow to set process handler
097ec87: Merge remote-tracking branch 'origin/master'
5ffd591: 'default charset for property files' option won't be ignored anymore
1234810: IDEA-120811 compile-server process hung with 0 CPU
a77644f: IDEA-117380 Can't remove multiple Maven projects at the same time
ff6b7d9: IDEA-121389 Breakpoint tooltip: duplicated information and red color
87346e3: Merge remote-tracking branch 'origin/master'
f26a54a: there is no template stuff in python community
e5552d8: fixed pycharm community detection
69cc1ef: remove GppCompilerTest
833bcfd: initialize LineSet before document changes
0ca5300: more tracing for myWatchedProjectsCount
99d35bf: IDEA-121393 Breakpoint: enabled breakpoint does not update its icon appearance
88b3931: License dialog: we don't need JBA availability check if actual license is JBA.
8fd9111: Fix for JToggleButton (we had no specific UI for Darcula/IntelliJ before)
f4ca614: Rename undo selection action
69b5912: Saving and loading of remote interpreters settings.
e7fd0b6: IDEA-121392 Breakpoint popup: click aside popup loses Suspend = Yes value
780a50b: IDEA-111432 Mnemonics changed for "Preserve case" and "Whole project"
a91ad4a: Don't require PsiFile.getText() for detecting Python charset declaration
3ca9628: remove ControlFlowUtils duplication
a1e2bb8: Remove unused ConditionalUtils
7b53c99: remove SideEffectChecker duplication
bcf9217: remove VariableAccessUtils duplication
a8412d2: plugin advertiser disabled for broken plugins (IDEA-121374)
2994241: Don't crawl down the tree for performance reasons, use cached globals
ba5925e: fixed ContextTest.testXDebugger test
0a6c9ae: test fixed
5690776: save memory on detected line separator
0b40c67: notnull
ed02fc9: optimisation
94f1638: javadoc
d37c7a9: EA-54432 - IAE: XDependentBreakpointManager.getMasterBreakpoint
df6f6f5: do not save empty condition and log message in breakpoints
a7c29b4: LanguageConsoleImpl calls createFile during initialization, so, inherited class cannot override it properly
cf066de: default methods: do not warn about protected methods from Object
5dd3ae6: Merge branch 'python-fixes'
229a0e9: CR-IC-4571 EditorExtensions.xml is overkill
018e061: WEB-4379 Smart step into does not give me all the methods
e79dc61: style
00e2508: IDEA-119238 Git and Hg Amend Commit: amend message updated for multi-root selection changes
e6d6bbb: Merge remote-tracking branch 'origin/master'
58d0444: IDEA-121383 Intellij EAP 1342 Does not start on Mac
39a393c: initialize default breakpoints for new project in tests
25e8977: prepare to fix WEB-4379 Smart step into does not give me all the methods, WEB-4440 Make debugger step inside the anonymous function of the $.each statement by default (or make it at least optional)
dda01ac: overrides, notnull
b6791ca: overrides
f1fef2c: correction to editor fixture to fix failing tests (IDEA-80056)
22985e2: load document LineSet lazily
13e43be: more debugging for GroovyCompilerTest
fdaed62: use IJ index-building classloader to speedup groovyc resolve when it's advantageous
80c7763: testdata fixed
e7cb908: new inference: method refs: apply reference rules first
cf7dff4: Support segue's
22a0e5f: compilation fix
e2c60e5: compilation fix
66a8ded: new inference: method refs: accept qualifier substitutor when nothing more could be inferred
e0f2061: select in project view: preserve registration order to prevent select in Packages by default
b31b23c: new inference: temp solution to exclude inference results from nested call of the same method on the outer level
5dd7e06: new inference: support for nested same method calls
fa6672f: new inference: simplify target type calculation
cbe62cc: new inference: guard fixed
a0f4efc: cleanup after batch folding operation end even in case of exception: to avoid observing invalid fold regions on subsequent batch folding operations
d63786d: allow non java xbreakpoints to be used in debugger-impl
600736c: preserve non java breakpoints in the BreakpointManager
bb586ed: java-xbreakpoints: do not save empty log message
bce82af: java-xbreakpoints: do not save empty conditions
1e9b8fb: java-xbreakpoints: rewrote breakpoints defaults
8541a5c: removed useless string conversion
2991835: java-xbreakpoints: support suspend policy defaults
d3a084dd: java-xbreakpoints: language selection support in condition and log expression
c7b3ad3: renamed attributes for exception breakpoint
b4df1c9: IDEA-121126 Debugger: mute breakpoints: Throwable at ApplicationImpl.assertReadAccessAllowed()
c388cfa: more clear breakpoint serialization format
3391b3b: fixed field and method breakpoints display name
d4f39df: java move to xbreakpoints: - cleanup after review
59b01e4: java move to xbreakpoints: - fixed old any exception breakpoint load
ca6bcc4: java move to xbreakpoints: - fixed breakpoint groupping
525d80d: java move to xbreakpoints 4: - fixed old breakpoints class deserialization
b903d10: java move to xbreakpoints 3: - breakpoint properties serialization fixes - import old java breakpoint - leave a copy for backward compatibility
d492412: java move to xbreakpoints 2: - cleanup - fixed tests - support run to cursor and smart step into - support add field/method breakpoint actions
7a3a6cf: java move to xbreakpoints: - removed java own breakpoints UI - added UI for java filters - added support for all kinds of java breakpoints
88189cc: New plugin description
17c097a: SlimEnterHandler should pass processing
f8d1847: New plugin description
2af38ae: new "Lambda parameter hides field" inspection
1f37c79: fix "Extract parameter as local variable" quickfix for expression lambda's
5fa2222: optimization for inspections tree filtering
a3bbf91: IDEA-105837 Intellij Idea caches maven snapshot dependencies forever
399fdef: fix multi-caret completion issues, make TypedHandlers supporting block selection work also with multiple carets (IDEA-80056)
a3258e2: IDEA-121283 Multiple Carets: Alt-J keyboard shortcut should be changed for Mac
13c7ba0: improve stub-psi-mismatch diagnostic: add language
140bfa4: test from jps modules extracted to separate modules to get rid of cyclic dependencies involving JPS modules
c367db2: 'Select in -> Project Structure' should select corresponding module when invoked on iml file
75feb75: EA-54419 (severity lowered)
93287e7: fixed PY-12248 Project Interpreters: redundant add virtualenv dialog on creating venv from project creation dialog
279985e: Faster isInBuilitins check that doesn't require resolve for non-builtin names
62df9b7: removed generate skeletons action
0cfaba5: New plugin description
2a39a63: IDEA-121285 Maven: missing classifier in managed dependency
16748dc: lazy icons for groovy elements
53ae56b: correct server log location in GroovyCompilerTest
13bfcb5: why does GroovyCompilerTest blink on TC?
5c2b079: IDEA-81276 Show the current program execution point does not bring hidden windows to front
9df88a0: overrides, notnull
4ecfba9: Merge remote-tracking branch 'origin/master'
eb1027b: fixed PY-12251 Project Interpreters: Create virtualenv from settings doesn't update warnigns about python package management tools
08190b2: IDEA-116029 in-place introduce variable name suggestions popup disappears before I can select anything
abf9500: Switched to potentially faster PyBuiltinCache.isInBuilins
7eebbf4: Fix for IDEA-121307 Cannot create new file (StubVirtualFile throws an exception on isDirectory)
daada4c: fixed PY-12257 IOOBE: CreateVirtualEnvDialog.setupDialog
2533839: do not duplicate existing sdks in create virtualenv
b649cb8b: Deprecated PyUtil.getConcealingParent
f16a6dd: Cleanup
ad552ed: CR-IC-4539
64d19ef: Moved isInBuiltins check for expressions to PyBuiltinCache
7113820: Github: do not provide Login/Password AuthData to Git on TwoFactor enabled
9194fc6: Renamed PyBuiltinCache.hasInBuiltins to isBuiltin
a4fef1b: LazyRangeMarkerFactory as project service — reapplied, add missed to RichPlatformPlugin.xml
82a44a6: Github: inspection warnings
92e93ca: Github: AtomicRef -> Ref
6a683af: Github: codereview
16d681e: Github: rewrite AuthDataHolder
741c46d: Github: do not rethrow exception twice
a33d7ef: Github: enable twofactor authorization
1f9c6da: EA-51130 (use data class' loader to register data flavor)
6f684e8: IDEA-121338 Multiple Carets: Menu items for multiple cursors are empty
50ad473: Revert: LazyRangeMarkerFactory as project service (b51fb7bf126a8c95ebf2223fb51c4b1d3faaa558)
e2b1588: ability to create OpenFileDescriptor using RangeMarker +review
d0ade84: LineColumnLazyMarker must compute delegate on start/end offset request +review
b51fb7b: LazyRangeMarkerFactory as project service +review
7cb4315: cleanup
104549e: update action presentations even if there are no mouse or key events
14e2cd6: fixed PY-12259 Assertion error on collecting Python installations on Mac
487e7c3: fixed PY-12261 Memory leak detected in python sdk details dialog
7e47f0e: UsefulTestCase.assertExists/assertDoesntExist for io.File
52ec148: platform: mute system notifications in tests and headless mode
5d41414: Switched from ArrayList to array for annotators for performance reasons
3174f1f: Merge remote-tracking branch 'origin/master'
340bdef: reverted nack template language selection to template language configurable (we don't have any template stuff in community edition)
ec14400: optimized icons
c741b28: Merge remote-tracking branch 'origin/master'
da79a3f: fixed PY-12267 Project Interpreters: inconsistent path separators for virtualenvs and base interpreters
abc49c3: added application root to the SDK search path on window (Education Edition attempt)
e1f5eb1: diff: do not create LineSeparator string every time
a7478db: diff: fix typo
41eed85: diff: rewrite DiffFragment
61dd3cd: diff: unify LineTokenizers
5ca37a6: diff: DiffString
c99c548: diff: fix patience diff
3717b9a: PY-12178 Support pull up / push down for properties (not ready yet: only properties excluded from other managers)
ad37f51: Merge remote-tracking branch 'origin/master'
eac76aa: fixed PY-12270 Project Interpreters: interpreter gets duplicated when hitting apply in multi-project settings window
094ac61: Merge remote-tracking branch 'origin/master'
5d4d015: Merge branch 'PY-10179' of https://github.com/Amarchuk/intellij-community into Amarchuk-PY-10179
be55f15: Merge remote-tracking branch 'origin/master'
68cfa2b: UI to create remote interpreter based on Vagrant.
150483d: fixed PY-12271 Project Interpreter: not able to set interpreter from Project Interpreters dialog when there are duplicated items in the list
40dd069: fixed PY-12272 Project Interpreter Setting Page: invalid alignment for multiproject list and packages table
3d19968: fix multi-line string with single quotes problem PY-12223
bf7f424: fix problem with single quote in project path http://youtrack.jetbrains.com/issue/PY-10179
Change-Id: I85e3d2231109799aab216989c887e0e48c87badb
Diffstat (limited to 'plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils')
6 files changed, 124 insertions, 96 deletions
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java index 278c07e980c0..3741d260dae6 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ControlFlowUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ public class ControlFlowUtils { } else if (statement instanceof PsiExpressionListStatement || statement instanceof PsiEmptyStatement || statement instanceof PsiAssertStatement || statement instanceof PsiDeclarationStatement || - statement instanceof PsiSwitchLabelStatement) { + statement instanceof PsiSwitchLabelStatement || statement instanceof PsiForeachStatement) { return true; } else if (statement instanceof PsiExpressionStatement) { @@ -63,9 +63,6 @@ public class ControlFlowUtils { else if (statement instanceof PsiForStatement) { return forStatementMayCompleteNormally((PsiForStatement)statement); } - else if (statement instanceof PsiForeachStatement) { - return foreachStatementMayCompleteNormally((PsiForeachStatement)statement); - } else if (statement instanceof PsiWhileStatement) { return whileStatementMayCompleteNormally((PsiWhileStatement)statement); } @@ -130,10 +127,6 @@ public class ControlFlowUtils { return Boolean.TRUE != value; } - private static boolean foreachStatementMayCompleteNormally(@NotNull PsiForeachStatement loopStatement) { - return true; - } - private static boolean switchStatementMayCompleteNormally(@NotNull PsiSwitchStatement switchStatement) { if (statementIsBreakTarget(switchStatement)) { return true; @@ -524,7 +517,7 @@ public class ControlFlowUtils { } } - private static class SystemExitFinder extends JavaRecursiveElementVisitor { + private static class SystemExitFinder extends JavaRecursiveElementWalkingVisitor { private boolean m_found = false; @@ -564,7 +557,7 @@ public class ControlFlowUtils { } } - private static class ReturnFinder extends JavaRecursiveElementVisitor { + private static class ReturnFinder extends JavaRecursiveElementWalkingVisitor { private boolean m_found = false; @@ -587,7 +580,7 @@ public class ControlFlowUtils { } } - private static class BreakFinder extends JavaRecursiveElementVisitor { + private static class BreakFinder extends JavaRecursiveElementWalkingVisitor { private boolean m_found = false; private final PsiStatement m_target; @@ -637,7 +630,7 @@ public class ControlFlowUtils { } } - private static class ContinueFinder extends JavaRecursiveElementVisitor { + private static class ContinueFinder extends JavaRecursiveElementWalkingVisitor { private boolean m_found = false; private final PsiStatement m_target; @@ -687,7 +680,7 @@ public class ControlFlowUtils { } } - private static class MethodCallFinder extends JavaRecursiveElementVisitor { + private static class MethodCallFinder extends JavaRecursiveElementWalkingVisitor { private final String containingClassName; private final PsiType returnType; @@ -728,7 +721,7 @@ public class ControlFlowUtils { } } - private static class ContinueToAncestorFinder extends JavaRecursiveElementVisitor { + private static class ContinueToAncestorFinder extends JavaRecursiveElementWalkingVisitor { private final PsiStatement statement; private boolean found = false; diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ExpectedTypeUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ExpectedTypeUtils.java index c14da9f55373..ad5ecc2351f3 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ExpectedTypeUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ExpectedTypeUtils.java @@ -153,86 +153,59 @@ public class ExpectedTypeUtils { } @Override - public void visitBinaryExpression(@NotNull PsiBinaryExpression binaryExpression) { - final PsiExpression rhs = binaryExpression.getROperand(); - if (rhs == null) { - expectedType = null; - return; - } - final PsiExpression lhs = binaryExpression.getLOperand(); - PsiType lhsType = lhs.getType(); - if (lhsType == null) { - expectedType = null; - return; - } - PsiType rhsType = rhs.getType(); - if (rhsType == null) { - expectedType = null; - return; + public void visitPolyadicExpression(@NotNull PsiPolyadicExpression polyadicExpression) { + final PsiExpression[] operands = polyadicExpression.getOperands(); + for (PsiExpression operand : operands) { + if (operand == null || operand.getType() == null) { + expectedType = null; + return; + } } - final IElementType tokenType = binaryExpression.getOperationTokenType(); - final PsiType type = binaryExpression.getType(); + final IElementType tokenType = polyadicExpression.getOperationTokenType(); + final PsiType type = polyadicExpression.getType(); + final PsiType wrappedExpressionType = wrappedExpression.getType(); if (TypeUtils.isJavaLangString(type) || isArithmeticOperation(tokenType) || isBooleanOperation(tokenType)) { expectedType = type; } else if (isShiftOperation(tokenType)) { - if (lhs == wrappedExpression) { - expectedType = unaryNumericPromotion(lhsType); - } - else { - expectedType = unaryNumericPromotion(rhsType); - } + expectedType = unaryNumericPromotion(wrappedExpressionType); } - else if (ComparisonUtils.isEqualityComparison(binaryExpression)) { + else if (ComparisonUtils.isEqualityComparison(polyadicExpression)) { // JLS 15.21.1 Numerical Equality Operators == and != - final PsiType wrappedExpressionType = wrappedExpression.getType(); if (TypeConversionUtil.isPrimitiveAndNotNull(wrappedExpressionType)) { expectedType = wrappedExpressionType; - return; } - if (lhs == wrappedExpression) { - if (TypeConversionUtil.isPrimitiveAndNotNull(rhsType)) { + else if (operands.length > 2) { + expectedType = PsiPrimitiveType.getUnboxedType(wrappedExpressionType); + } + else if (operands[0] == wrappedExpression) { + if (TypeConversionUtil.isPrimitiveAndNotNull(operands[1].getType())) { expectedType = PsiPrimitiveType.getUnboxedType(wrappedExpressionType); - return; } - expectedType = TypeUtils.getObjectType(wrappedExpression); + else { + expectedType = TypeUtils.getObjectType(wrappedExpression); + } } else { - if (TypeConversionUtil.isPrimitiveAndNotNull(lhsType)) { + if (TypeConversionUtil.isPrimitiveAndNotNull(operands[0].getType())) { expectedType = PsiPrimitiveType.getUnboxedType(wrappedExpressionType); - return; - } - expectedType = TypeUtils.getObjectType(wrappedExpression); + } + else { + expectedType = TypeUtils.getObjectType(wrappedExpression); + } } } else if (ComparisonUtils.isComparisonOperation(tokenType)) { - if (lhs == wrappedExpression && !TypeConversionUtil.isPrimitiveAndNotNull(lhsType)) { - lhsType = PsiPrimitiveType.getUnboxedType(lhsType); - if (lhsType == null) { - expectedType = null; - return; - } + if (operands.length != 2) { + expectedType = null; + return; } - if (rhs == wrappedExpression && !TypeConversionUtil.isPrimitiveAndNotNull(rhsType)) { - rhsType = PsiPrimitiveType.getUnboxedType(rhsType); - if (rhsType == null) { - expectedType = null; + else if (!TypeConversionUtil.isPrimitiveAndNotNull(wrappedExpressionType)) { + if (PsiPrimitiveType.getUnboxedType(wrappedExpressionType) == null) { return; } } - // JLS 5.6.2 Binary Numeric Promotion - if (PsiType.DOUBLE.equals(lhsType) || PsiType.DOUBLE.equals(rhsType)) { - expectedType = PsiType.DOUBLE; - } - else if (PsiType.FLOAT.equals(lhsType) || PsiType.FLOAT.equals(rhsType)) { - expectedType = PsiType.FLOAT; - } - else if (PsiType.LONG.equals(lhsType) || PsiType.LONG.equals(rhsType)) { - expectedType = PsiType.LONG; - } - else { - expectedType = PsiType.INT; - } + expectedType = TypeConversionUtil.binaryNumericPromotion(operands[0].getType(), operands[1].getType()); } else { expectedType = null; diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java index 6301e83eb0fd..8d52a8619dc5 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/ImportUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.codeStyle.JavaCodeStyleSettingsFacade; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.*; +import com.intellij.psi.util.InheritanceUtil; import com.siyeh.HardcodedMethodConstants; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -247,20 +247,22 @@ public class ImportUtils { continue; } final PsiElement element = importReference.resolve(); - if (element == null || !(element instanceof PsiPackage)) { + if (!(element instanceof PsiPackage)) { continue; } final PsiPackage aPackage = (PsiPackage)element; - if (!strict) { - return aPackage.containsClassNamed(shortName); + if (!strict && aPackage.containsClassNamed(shortName)) { + return true; } - final PsiClass[] classes = aPackage.findClassByShortName(shortName, file.getResolveScope()); - for (final PsiClass aClass : classes) { - final String qualifiedClassName = aClass.getQualifiedName(); - if (qualifiedClassName == null || fqName.equals(qualifiedClassName)) { - continue; + else { + final PsiClass[] classes = aPackage.findClassByShortName(shortName, file.getResolveScope()); + for (final PsiClass aClass : classes) { + final String qualifiedClassName = aClass.getQualifiedName(); + if (qualifiedClassName == null || fqName.equals(qualifiedClassName)) { + continue; + } + return containsConflictingReference(file, qualifiedClassName); } - return containsConflictingReference(file, qualifiedClassName); } } return hasJavaLangImportConflict(fqName, file); diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/SideEffectChecker.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/SideEffectChecker.java index af04c02d6e79..5063ef7c2ea7 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/SideEffectChecker.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/SideEffectChecker.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ public class SideEffectChecker { return visitor.mayHaveSideEffects(); } - private static class SideEffectsVisitor extends JavaRecursiveElementVisitor { + private static class SideEffectsVisitor extends JavaRecursiveElementWalkingVisitor { private boolean mayHaveSideEffects = false; diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAccessUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAccessUtils.java index e097d58f8301..b8e7b7c183d8 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAccessUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAccessUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2012 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,9 @@ import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; import java.util.Set; public class VariableAccessUtils { @@ -446,4 +449,43 @@ public class VariableAccessUtils { } return child; } + + public static Set<PsiVariable> collectUsedVariables(PsiElement context) { + if (context == null) { + return Collections.emptySet(); + } + final VariableCollectingVisitor visitor = new VariableCollectingVisitor(); + context.accept(visitor); + return visitor.getUsedVariables(); + } + + public static boolean isAnyVariableAssigned(@NotNull Collection<PsiVariable> variables, @Nullable PsiElement context) { + if (context == null) { + return false; + } + final VariableAssignedVisitor visitor = new VariableAssignedVisitor(variables, true); + context.accept(visitor); + return visitor.isAssigned(); + } + + private static class VariableCollectingVisitor extends JavaRecursiveElementVisitor { + + private final Set<PsiVariable> usedVariables = new HashSet(); + + @Override + public void visitReferenceExpression( + PsiReferenceExpression expression) { + super.visitReferenceExpression(expression); + final PsiElement target = expression.resolve(); + if (!(target instanceof PsiVariable)) { + return; + } + final PsiVariable variable = (PsiVariable)target; + usedVariables.add(variable); + } + + public Set<PsiVariable> getUsedVariables() { + return usedVariables; + } + } }
\ No newline at end of file diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java index 0a22ef3fde97..279400f3a653 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2013 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2014 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,25 @@ import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.TypeConversionUtil; import org.jetbrains.annotations.NotNull; +import java.util.Collection; +import java.util.Collections; + public class VariableAssignedVisitor extends JavaRecursiveElementWalkingVisitor { - @NotNull private final PsiVariable variable; + @NotNull private final Collection<PsiVariable> variables; private final boolean recurseIntoClasses; private final boolean checkUnaryExpressions; private boolean assigned = false; private PsiElement excludedElement = null; + public VariableAssignedVisitor(@NotNull Collection<PsiVariable> variables, boolean recurseIntoClasses) { + this.variables = variables; + checkUnaryExpressions = true; + this.recurseIntoClasses = recurseIntoClasses; + } + public VariableAssignedVisitor(@NotNull PsiVariable variable, boolean recurseIntoClasses) { - this.variable = variable; + variables = Collections.singleton(variable); final PsiType type = variable.getType(); checkUnaryExpressions = TypeConversionUtil.isNumericType(type); this.recurseIntoClasses = recurseIntoClasses; @@ -58,8 +67,11 @@ public class VariableAssignedVisitor extends JavaRecursiveElementWalkingVisitor } super.visitAssignmentExpression(assignment); final PsiExpression lhs = assignment.getLExpression(); - if (VariableAccessUtils.evaluatesToVariable(lhs, variable)) { - assigned = true; + for (PsiVariable variable : variables) { + if (VariableAccessUtils.evaluatesToVariable(lhs, variable)) { + assigned = true; + break; + } } } @@ -85,8 +97,11 @@ public class VariableAssignedVisitor extends JavaRecursiveElementWalkingVisitor return; } final PsiExpression operand = prefixExpression.getOperand(); - if (VariableAccessUtils.evaluatesToVariable(operand, variable)) { - assigned = true; + for (PsiVariable variable : variables) { + if (VariableAccessUtils.evaluatesToVariable(operand, variable)) { + assigned = true; + break; + } } } @@ -104,8 +119,11 @@ public class VariableAssignedVisitor extends JavaRecursiveElementWalkingVisitor return; } final PsiExpression operand = postfixExpression.getOperand(); - if (VariableAccessUtils.evaluatesToVariable(operand, variable)) { - assigned = true; + for (PsiVariable variable : variables) { + if (VariableAccessUtils.evaluatesToVariable(operand, variable)) { + assigned = true; + break; + } } } |