summaryrefslogtreecommitdiff
path: root/java/java-tests
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-04-10 10:54:17 -0700
committerTor Norbye <tnorbye@google.com>2014-04-10 10:54:39 -0700
commita3e39abd38575b02d52f05e041d797023938b6d6 (patch)
tree9791aa0988b9461354c1b1476b43bcb6b9ea7da4 /java/java-tests
parent1fff8e2b7bbcfdea262d3782d4307ca6437da2a3 (diff)
downloadidea-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/java-tests')
-rw-r--r--java/java-tests/testData/codeInsight/clsHighlighting/IDEA121866.java5
-rw-r--r--java/java-tests/testData/codeInsight/clsHighlighting/libs/IDEA121866.jarbin0 -> 373 bytes
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall-out.java12
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall.java12
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution-out.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam-out.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam.java9
-rw-r--r--java/java-tests/testData/codeInsight/completion/smartType/InstanceofedInsideAnonymous-out.java2
-rw-r--r--java/java-tests/testData/codeInsight/completion/variables/locals/TestResult4.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResources.java29
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA91626.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/IDEA97294.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java26
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IncorporationWithEqualsBoundsSubstitution.java14
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallConflictResolution.java23
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/VarargsOnNonPertinentPlace.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityRawGenerics.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityReturnValueResolution1.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ConflictResolution.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/BothVarargs.java14
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121884.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121999.java21
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/MostSpecificForSameFunctionalTypes.java33
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedLambdaSpecifics.java19
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedVarargs.java46
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118965comment.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA121315.java22
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AmbiguityVarargs.java20
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/ExactMethodReferencePertinentToApplicabilityCheck.java30
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/RawInnerClassQualifier.java26
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SuperClassPotentiallyApplicableMembers.java39
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterConflict.java15
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent2.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterOwnMember.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleImportPresent.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleIncompleteCode.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleMethod.java14
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleSuperMethod.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeConflict.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent2.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeOwnMember.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleImportPresent.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleIncompleteCode.java6
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleMethod.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleSuperMethod.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/afterLambdaInternal.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaExternal.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaInternal.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoArray.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoPrimitive.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoRefType.java5
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoTypeParam.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoValued.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoWildcard.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoPrimitive.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoRefType.java5
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoTypeParam.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoValued.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoWildcard.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterTypeAnnotated.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeTypeAnnotated.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4junit.java2
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListComment.java16
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListNonTrivialInitializer.java20
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalComments.java11
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListComment.java18
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListNonTrivialInitializer.java21
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalComments.java13
-rw-r--r--java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString.java5
-rw-r--r--java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString_after.java5
-rw-r--r--java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument.java5
-rw-r--r--java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument_after.java5
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNullableShouldNotAffectNullity.java15
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/GettersAndPureNoFlushing.java31
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/SameComparisonTwice.java38
-rw-r--r--java/java-tests/testData/inspection/dataFlow/fixture/UnusedCallDoesNotMakeUnknown.java14
-rw-r--r--java/java-tests/testData/refactoring/introduceParameter/afterTypeAnnotation.java14
-rw-r--r--java/java-tests/testData/refactoring/introduceParameter/beforeTypeAnnotation.java15
-rw-r--r--java/java-tests/testData/refactoring/renameInplace/NameSuggestion.java7
-rw-r--r--java/java-tests/testData/refactoring/renameInplace/NameSuggestion_after.java7
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/generics/after/Wrapper.java2
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/after/Test.java4
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/before/Test.java2
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/innerClass/after/Test.java12
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/innerClass/before/Test.java12
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/after/Test.java10
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/before/Test.java10
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/simple/after/Wrapper.java2
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/after/Test.java14
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/before/Test.java12
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Test.java10
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Wrapper.java13
-rw-r--r--java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/before/Test.java11
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics15HighlightingTest.java30
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics18HighlightingTest.java27
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/ClsGenericsHighlightingTest.java16
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy9
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy38
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy90
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java2
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java13
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java4
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java12
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java24
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java8
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java16
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToThrowsTest.java8
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy6
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy87
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java20
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java6
-rw-r--r--java/java-tests/testSrc/com/intellij/find/FindManagerTest.java15
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java81
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterWrapTest.java101
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java7
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java325
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/RenameMembersInplaceTest.java18
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/WrapReturnValueTest.java113
123 files changed, 1616 insertions, 639 deletions
diff --git a/java/java-tests/testData/codeInsight/clsHighlighting/IDEA121866.java b/java/java-tests/testData/codeInsight/clsHighlighting/IDEA121866.java
new file mode 100644
index 000000000000..fe3235c55df9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/clsHighlighting/IDEA121866.java
@@ -0,0 +1,5 @@
+class IDEA121866 {
+ {
+ A<String> a = new A<>();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/clsHighlighting/libs/IDEA121866.jar b/java/java-tests/testData/codeInsight/clsHighlighting/libs/IDEA121866.jar
new file mode 100644
index 000000000000..0151e3545391
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/clsHighlighting/libs/IDEA121866.jar
Binary files differ
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall-out.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall-out.java
new file mode 100644
index 000000000000..f8768f665909
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall-out.java
@@ -0,0 +1,12 @@
+class A<T> {
+ A(T... t) {
+ }
+
+ {
+ bar(new A<>(<caret>) );
+ }
+
+ <T> void bar(A<T> s) {}
+
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall.java b/java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall.java
new file mode 100644
index 000000000000..9e776bb6baba
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/DiamondsInsideMethodCall.java
@@ -0,0 +1,12 @@
+class A<T> {
+ A(T... t) {
+ }
+
+ {
+ bar(new <caret> );
+ }
+
+ <T> void bar(A<T> s) {}
+
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution-out.java b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution-out.java
new file mode 100644
index 000000000000..5412eabcf355
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution-out.java
@@ -0,0 +1,9 @@
+interface I<T> {
+ void m(T t);
+}
+
+class Test {
+ public static void main(String[] args) {
+ I<String> i = s -> <caret>
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution.java b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution.java
new file mode 100644
index 000000000000..6e57fe289d79
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionNameSubstitution.java
@@ -0,0 +1,9 @@
+interface I<T> {
+ void m(T t);
+}
+
+class Test {
+ public static void main(String[] args) {
+ I<String> i = <caret>
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam-out.java b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam-out.java
new file mode 100644
index 000000000000..96fd5f16074b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam-out.java
@@ -0,0 +1,9 @@
+interface I {
+ void m(int x);
+}
+
+class Test {
+ public static void main(String[] args) {
+ I i = x -> <caret>
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam.java b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam.java
new file mode 100644
index 000000000000..7de98c3770c7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/InLambdaPositionSingleParam.java
@@ -0,0 +1,9 @@
+interface I {
+ void m(int x);
+}
+
+class Test {
+ public static void main(String[] args) {
+ I i = <caret>
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/InstanceofedInsideAnonymous-out.java b/java/java-tests/testData/codeInsight/completion/smartType/InstanceofedInsideAnonymous-out.java
index 3cfb17dfc9a6..7b4d91ff6e20 100644
--- a/java/java-tests/testData/codeInsight/completion/smartType/InstanceofedInsideAnonymous-out.java
+++ b/java/java-tests/testData/codeInsight/completion/smartType/InstanceofedInsideAnonymous-out.java
@@ -1,6 +1,6 @@
class C{
{
- Object o;
+ final Object o;
if (o instanceof Foo) {
new Runnable() {
public void run() {
diff --git a/java/java-tests/testData/codeInsight/completion/variables/locals/TestResult4.java b/java/java-tests/testData/codeInsight/completion/variables/locals/TestResult4.java
index cc417f518b5d..fa9a5487bedd 100644
--- a/java/java-tests/testData/codeInsight/completion/variables/locals/TestResult4.java
+++ b/java/java-tests/testData/codeInsight/completion/variables/locals/TestResult4.java
@@ -10,7 +10,7 @@ package codeInsight.completion.variables.locals;
public class TestSource4 {
int aaa = 0;
public static void foo(){
- int abc = 0;
+ final int abc = 0;
class Inner1{
int sbe=abc<caret>
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResources.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResources.java
index b21f42ccaf4c..289dc6167f68 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResources.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/TryWithResources.java
@@ -1,18 +1,3 @@
-/*
- * Copyright 2000-2012 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.
- */
class C {
static class E extends Exception { }
static class E1 extends E { }
@@ -25,7 +10,15 @@ class C {
@Override public void close() throws E3 { }
}
- static interface I extends AutoCloseable { }
+ interface I extends AutoCloseable { }
+
+ interface Gen<E extends Exception> extends AutoCloseable {
+ @Override void close() throws E;
+
+ class Impl implements Gen<E2> {
+ @Override public void close() throws E2 { }
+ }
+ }
void m1() {
try (MyResource r = new MyResource()) { r.doSomething(); }
@@ -90,4 +83,8 @@ class C {
MyResource r;
try (MyResource r1 = <error descr="Variable 'r' might not have been initialized">r</error>) { }
}
+
+ void m5() {
+ try (<error descr="Unhandled exception from auto-closeable resource: C.E2">Gen<E2> gen = new Gen.Impl()</error>) { }
+ }
} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA91626.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA91626.java
index ff29729bc977..d8db681dd0de 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA91626.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA91626.java
@@ -11,7 +11,7 @@ class Test {
}
static void foo2(final A<? extends Integer> bar) {
- bar._<error descr="'_(capture<? extends java.lang.Integer>...)' in 'Test.A' cannot be applied to '(java.lang.String)'">("")</error>;
+ bar._<error descr="Cannot resolve method '_(java.lang.String)'">("")</error>;
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/IDEA97294.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/IDEA97294.java
index 04fd969b5309..525afaa530e0 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/IDEA97294.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/IDEA97294.java
@@ -13,12 +13,12 @@ class SortedOp<T> implements StatefulOp<T, T> {
}
}
-class Usage<T> {
- public <E, S extends BaseStream<E>> S pipeline(IntermediateOp<T, E> newOp) { return null; }
- public <R> R pipeline(TerminalOp<T, R> terminal) { return null;}
+class Usage<Ts> {
+ public <E, S extends BaseStream<E>> S pipeline(IntermediateOp<Ts, E> newOp) { return null; }
+ public <R> R pipeline(TerminalOp<Ts, R> terminal) { return null;}
- public Stream<T> sorted(Comparator<? super T> comparator) {
+ public Stream<Ts> sorted(Comparator<? super Ts> comparator) {
return pipeline(new SortedOp<>(comparator));
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java
new file mode 100644
index 000000000000..2826e5802e91
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/diamond/Varargs.java
@@ -0,0 +1,26 @@
+class A<T> {
+ A(T... t) {
+ }
+
+ {
+ A<String> a = new A<>("a", "b");
+ foo(new A<>("", ""));
+ bar(new A<>("", ""));
+ bar(new A<>(get()));
+ //bar(new A<>(get( ), ""));
+ }
+
+ void foo(A<String> s) {}
+ <T> void bar(A<T> s) {}
+
+ <K> K get() {return null;}
+
+ <M> A<M> s(M... m) {
+ return null;
+ }
+
+ {
+ bar(s(get()));
+ bar(s(get(), ""));
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IncorporationWithEqualsBoundsSubstitution.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IncorporationWithEqualsBoundsSubstitution.java
new file mode 100644
index 000000000000..5f85bc0d79eb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/IncorporationWithEqualsBoundsSubstitution.java
@@ -0,0 +1,14 @@
+abstract class Test {
+ abstract <Tf extends String> Tf foo(Class<Tf> c);
+ abstract <Tf1> Tf1 foo1(Class<Tf1> c);
+
+ abstract <U> Class<? extends U> bar(Class<U> clazz);
+ abstract <U1> Class<U1> bar1(Class<U1> clazz);
+
+ {
+ foo(bar(String.class));
+ foo(bar1(String.class));
+ foo1(bar(String.class));
+ foo1(bar1(String.class));
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallConflictResolution.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallConflictResolution.java
new file mode 100644
index 000000000000..dd04a51b2703
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/OuterCallConflictResolution.java
@@ -0,0 +1,23 @@
+import java.util.*;
+
+class Test {
+
+
+ void m(Runnable p) { }
+ void m(List<Runnable> p) { }
+
+ {
+ m(foo());
+ m<error descr="Cannot resolve method 'm(java.lang.Object)'">(bar())</error>;
+ }
+
+ <T> List<T> foo() {
+ return null;
+ }
+
+ <T> T bar() {
+ return null;
+ }
+
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/VarargsOnNonPertinentPlace.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/VarargsOnNonPertinentPlace.java
new file mode 100644
index 000000000000..4d10bd47b5eb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/VarargsOnNonPertinentPlace.java
@@ -0,0 +1,8 @@
+abstract class Im {
+ public static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
+ public abstract <T> T createProxy(final Class<T> superClass, final Class... otherInterfaces);
+
+ void f(Class<?> implementation, Class rawType, boolean isInterface) {
+ createProxy(implementation, isInterface ? new Class[]{rawType} : EMPTY_CLASS_ARRAY);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityRawGenerics.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityRawGenerics.java
index 6c664dd9e65a..595787704437 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityRawGenerics.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityRawGenerics.java
@@ -22,6 +22,6 @@ class AmbiguityRawGenerics {
<Z> void foo(I3<Z> s) { }
void bar() {
- foo<error descr="Ambiguous method call: both 'AmbiguityRawGenerics.foo(I1)' and 'AmbiguityRawGenerics.foo(I2)' match">(()-> { throw new RuntimeException(); })</error>;
+ foo<error descr="Ambiguous method call: both 'AmbiguityRawGenerics.foo(I)' and 'AmbiguityRawGenerics.foo(I1)' match">(()-> { throw new RuntimeException(); })</error>;
}
} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityReturnValueResolution1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityReturnValueResolution1.java
index fab979466120..a6abf3db299a 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityReturnValueResolution1.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguityReturnValueResolution1.java
@@ -1,4 +1,4 @@
-public class Test {
+class Test {
interface II {
int _();
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ConflictResolution.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ConflictResolution.java
index 2c39efa13400..0cc3741e0f61 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ConflictResolution.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ConflictResolution.java
@@ -1,7 +1,7 @@
class Demo {
public void f1() {
- f2<error descr="'f2()' in 'Demo' cannot be applied to '(int, <lambda expression>)'">(2, input -> input)</error>;
+ f2(2, <error descr="Target type of a lambda conversion must be an interface">input -> input</error>);
}
public void f2() {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/BothVarargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/BothVarargs.java
new file mode 100644
index 000000000000..c4cfbcdd426c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/BothVarargs.java
@@ -0,0 +1,14 @@
+import java.util.List;
+
+abstract class StreamMain {
+ public abstract <T> Iterable<T> concat(final Iterable<? extends T>... iterables);
+ public abstract <T> Iterable<T> concat(final List<? extends T>... iterables);
+
+
+ public final List<String> errorFixesToShow = null;
+ public final List<String> inspectionFixesToShow = null;
+
+ {
+ concat(errorFixesToShow, inspectionFixesToShow);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121884.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121884.java
new file mode 100644
index 000000000000..e823de324ef5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121884.java
@@ -0,0 +1,17 @@
+class Main {
+ interface MyCall {
+ void call(int n);
+ }
+ interface MyCallRet {
+ int call(int n);
+ }
+ public static void caller(MyCall c) {
+ c.call(2);
+ }
+ public static void caller(MyCallRet c) {
+ c.call(3);
+ }
+ public static void main(String[] args) {
+ caller( (int n) -> { System.out.println(" " + n); } );
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121999.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121999.java
new file mode 100644
index 000000000000..79994326c61a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA121999.java
@@ -0,0 +1,21 @@
+import java.util.function.Supplier;
+
+class LambdaTest {
+
+ static {
+ int <warning descr="Variable 'i' is never used">i</warning> = doSync(() -> foo());
+ int <warning descr="Variable 'i1' is never used">i1</warning> = doSync(LambdaTest::foo);
+ }
+
+ public static <T> T doSync(Supplier<T> <warning descr="Parameter 'block' is never used">block</warning>) {
+ return null;
+ }
+
+ public static void doSync(Runnable <warning descr="Parameter 'block' is never used">block</warning>) {
+ }
+
+ public static int foo() {
+ return 0;
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/MostSpecificForSameFunctionalTypes.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/MostSpecificForSameFunctionalTypes.java
new file mode 100644
index 000000000000..14cba01e1550
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/MostSpecificForSameFunctionalTypes.java
@@ -0,0 +1,33 @@
+abstract class HighlightTestInfo {
+ protected final String[] filePaths;
+ public HighlightTestInfo(Disposable <warning descr="Parameter 'buf' is never used">buf</warning>, String... filePaths) {
+ this.filePaths = filePaths;
+ }
+
+ protected abstract HighlightTestInfo doTest();
+}
+
+class StreamMain {
+ private Disposable <warning descr="Private field 'testRootDisposable' is never assigned">testRootDisposable</warning>;
+
+ public HighlightTestInfo testFile(String... filePath) {
+ return new HighlightTestInfo(getTestRootDisposable(), filePath) {
+ public HighlightTestInfo doTest() {
+ return this;
+ }
+ };
+ }
+
+ public Disposable getTestRootDisposable() {
+ return testRootDisposable;
+ }
+}
+
+interface Disposable {
+ void dispose();
+
+ interface Parent extends Disposable {
+ void beforeTreeDispose();
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedLambdaSpecifics.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedLambdaSpecifics.java
new file mode 100644
index 000000000000..be47ffbc83b8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedLambdaSpecifics.java
@@ -0,0 +1,19 @@
+class Test {
+
+ interface A<T> {
+ T a();
+ }
+
+ interface B<T> {
+ T b();
+ }
+
+ private void m(A<Integer> <warning descr="Parameter 'a' is never used">a</warning>) { }
+ private void <warning descr="Private method 'm(Test.B<java.lang.String>)' is never used">m</warning>(B<String> <warning descr="Parameter 'b' is never used">b</warning>) { }
+
+ {
+ m((() -> 42));
+ m(true ? () -> 42 : () -> 42);
+ m(true ? null : (() -> 42));
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedVarargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedVarargs.java
new file mode 100644
index 000000000000..55f2e00f76ba
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/NestedVarargs.java
@@ -0,0 +1,46 @@
+import java.util.List;
+
+abstract class StreamMain {
+ public abstract <T> Iterable<T> concat(final Iterable<? extends T>... iterables);
+ public abstract <T> Iterable<T> concat(final List<? extends T>... iterables);
+
+ public final List<String> errorFixesToShow = null;
+ public final List<String> inspectionFixesToShow = null;
+
+ void foo() {
+ exists(concat(errorFixesToShow, inspectionFixesToShow), "");
+ }
+
+ public abstract <T> boolean exists(T[] iterable, T t);
+ public abstract <T> boolean exists(Iterable<T> iterable, T t);
+
+}
+
+
+abstract class StreamMainComplexSecendArgument {
+ public abstract <T> Iterable<T> concat(final Iterable<? extends T>... iterables);
+ public abstract <T> Iterable<T> concat(final List<? extends T>... iterables);
+
+
+ public final List<String> errorFixesToShow = null;
+ public final List<String> inspectionFixesToShow = null;
+
+ void foo() {
+ Condition<String> condition = new Condition<String>() {
+ @Override
+ public boolean value(String s) {
+ return false;
+ }
+ };
+ exists(concat(errorFixesToShow, inspectionFixesToShow), condition);
+ }
+
+ public abstract <T> boolean exists(T[] iterable, Condition<T> condition);
+
+ public abstract <T> boolean exists(Iterable<T> iterable, Condition<T> condition);
+
+
+ interface Condition<T> {
+ boolean value(T t);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118965comment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118965comment.java
new file mode 100644
index 000000000000..501e5f8d51cc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA118965comment.java
@@ -0,0 +1,13 @@
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class IDEA118965 {
+ {
+ Stream<String> words = Arrays.asList("one", "one", "two").stream();
+ List<Map.Entry<String,Integer>> res = words.collect(Collectors.toMap(w -> w, w -> 1, (a, b) -> a + b))
+ .entrySet().stream().filter(e -> e.getValue() > 1).collect(Collectors.toList());
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA121315.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA121315.java
new file mode 100644
index 000000000000..1c22302f2523
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA121315.java
@@ -0,0 +1,22 @@
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class IDEA121315 {
+ class Issue {
+ Long getId() {
+ return 1l;
+ }
+ }
+
+ <T> T id(T i) {
+ return i;
+ }
+
+ void foo(Stream<Issue> map){
+ Map<Long, Issue> id2Issue = map.collect(Collectors.toMap(null, p -> id(p)));
+ Map<Long, Issue> id2Issue1 = map.collect(Collectors.toMap(null, p -> p));
+ Map<Long, Issue> id2Issue2 = map.collect(Collectors.toMap(null, this::id));
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AmbiguityVarargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AmbiguityVarargs.java
new file mode 100644
index 000000000000..bb3a6432e895
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AmbiguityVarargs.java
@@ -0,0 +1,20 @@
+class Test {
+
+ interface IntMapper {
+ int map();
+ }
+
+ interface LongMapper {
+ long map();
+ }
+
+ void m(IntMapper im1, IntMapper... im) { }
+ void m(LongMapper... lm) { }
+
+ {
+ m<error descr="Ambiguous method call: both 'Test.m(IntMapper, IntMapper...)' and 'Test.m(LongMapper...)' match">(this ::ii)</error>;
+ }
+
+ int ii() {return 0;}
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/ExactMethodReferencePertinentToApplicabilityCheck.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/ExactMethodReferencePertinentToApplicabilityCheck.java
new file mode 100644
index 000000000000..c76e109aa0ff
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/ExactMethodReferencePertinentToApplicabilityCheck.java
@@ -0,0 +1,30 @@
+
+import java.util.*;
+
+class Test {
+ {
+ List<UnaryOperator<String>> a = asList(String::intern);
+ }
+
+ public static <Ta> List<Ta> asList(Ta a) {
+ return null;
+ }
+
+ interface UnaryOperator<T> {
+ T apply(T t);
+ }
+}
+
+class TestVarargs {
+ {
+ List<UnaryOperator<String>> a = asList(String::intern);
+ }
+
+ public static <Ta> List<Ta> asList(Ta... a) {
+ return null;
+ }
+
+ interface UnaryOperator<T> {
+ T apply(T t);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/RawInnerClassQualifier.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/RawInnerClassQualifier.java
new file mode 100644
index 000000000000..25b85d7de9a9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/RawInnerClassQualifier.java
@@ -0,0 +1,26 @@
+import java.util.Collections;
+import java.util.Map;
+import java.util.Optional;
+
+
+class StreamMain {
+ public static void main(final String... args) {
+ x(Collections.<Integer, String>emptyMap().entrySet().stream().
+ filter(entry -> 0 == entry.getKey() % 2).
+ findFirst().
+ map(Map.Entry::getValue).
+ orElse("Bob!"), true);
+ }
+
+ public static void x(final String s, final boolean b) {
+ System.out.println(s);
+ }
+}
+
+class StreamMainSimplified {
+ public static void main(Optional<Map.Entry<Integer, String>> first) {
+ String s = first.map(Map.Entry::getValue).orElse("Bob!");
+ String s1 = first.map((e) -> e.getValue()).orElse("Bob!");
+ }
+
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SuperClassPotentiallyApplicableMembers.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SuperClassPotentiallyApplicableMembers.java
new file mode 100644
index 000000000000..d9f05fb8a075
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/SuperClassPotentiallyApplicableMembers.java
@@ -0,0 +1,39 @@
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+interface Base {
+ int getInt(String a);
+ int getInt();
+
+ void foo();
+}
+
+abstract class ABase implements Base {
+ @Override
+ public int getInt(String a) {
+ return 0;
+ }
+
+ @Override
+ public int getInt() {
+ return 0;
+ }
+}
+
+class Impl extends ABase {
+ @Override
+ public int getInt() {
+ return 0;
+ }
+
+ @Override
+ public void foo() {
+ List<String> strs = Arrays.asList("one", "two");
+
+ List<Integer> withMethodRef = strs
+ .stream()
+ .map(this::getInt)
+ .collect( Collectors.toList());
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterConflict.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterConflict.java
deleted file mode 100644
index fe1cbb4cfcf2..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterConflict.java
+++ /dev/null
@@ -1,15 +0,0 @@
-// "Add on demand static import for 'test.Bar'" "true"
-package test;
-
-import static test.Bar.*;
-
-class Bar {
- public static final void f() {}
-}
-public class Foo {
- public static final void f(int i) {}
-
- {
- <caret>Bar.f(); // invoke 'add on demand static import' for Bar class here. The call is now done to other method.
- }
-} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent.java
new file mode 100644
index 000000000000..3da923ad88c8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent.java
@@ -0,0 +1,10 @@
+// "Add on demand static import for 'java.lang.Math'" "true"
+package test;
+
+import static java.lang.Math.*;
+import static java.lang.Math.abs;
+
+public class C {{
+ abs(1.0);
+ max(1, 2);
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent2.java
new file mode 100644
index 000000000000..987661ba26bd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterImportPresent2.java
@@ -0,0 +1,9 @@
+// "Add on demand static import for 'java.lang.Math'" "true"
+package test;
+
+import static java.lang.Math.*;
+
+public class C {{
+ abs(1.0);
+ max(1, 2);
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterOwnMember.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterOwnMember.java
new file mode 100644
index 000000000000..926689ce7891
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterOwnMember.java
@@ -0,0 +1,10 @@
+// "Add on demand static import for 'test.Foo'" "true"
+package test;
+
+class Foo {
+ public static void m() {}
+
+ public static void main(String[] args) {
+ m();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleImportPresent.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleImportPresent.java
new file mode 100644
index 000000000000..aeb54782cd2c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleImportPresent.java
@@ -0,0 +1,8 @@
+// "Add static import for 'java.lang.Math.abs'" "true"
+package test;
+
+import static java.lang.Math.abs;
+
+public class X {{
+ abs(1.0);
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleIncompleteCode.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleIncompleteCode.java
new file mode 100644
index 000000000000..b0b13008d588
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleIncompleteCode.java
@@ -0,0 +1,8 @@
+// "Add static import for 'java.lang.Math.abs'" "true"
+package test;
+
+import static java.lang.Math.abs;
+
+class X {{
+ abs();
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleMethod.java
deleted file mode 100644
index 7a212101e730..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleMethod.java
+++ /dev/null
@@ -1,14 +0,0 @@
-// "Add static import for 'test.Bar.f'" "true"
-package test;
-
-import static test.Bar.f;
-
-class Bar {
- public static final void f() {}
-}
-public class Foo {
- public static final void f(int i) {}
- {
- Bar.<caret>f();
- }
-} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleSuperMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleSuperMethod.java
deleted file mode 100644
index f408a05c9e60..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/afterSingleSuperMethod.java
+++ /dev/null
@@ -1,17 +0,0 @@
-// "Add static import for 'test.Bar.f'" "true"
-package test;
-
-import static test.Bar.f;
-
-class Bar {
- public static final void f() {}
-}
-public class Foo extends FooSuper{
- {
- Bar.<caret>f();
- }
-}
-
-class FooSuper {
- public static final void f(int i) {}
-} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeConflict.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeConflict.java
index 09af9dce48f1..e9da55cac8ff 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeConflict.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeConflict.java
@@ -1,4 +1,4 @@
-// "Add on demand static import for 'test.Bar'" "true"
+// "Add on demand static import for 'test.Bar'" "false"
package test;
class Bar {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent.java
new file mode 100644
index 000000000000..9a8cb7547c2e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent.java
@@ -0,0 +1,9 @@
+// "Add on demand static import for 'java.lang.Math'" "true"
+package test;
+
+import static java.lang.Math.abs;
+
+public class C {{
+ abs(1.0);
+ <caret>Math.max(1, 2);
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent2.java
new file mode 100644
index 000000000000..6ba0ba6a840d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeImportPresent2.java
@@ -0,0 +1,9 @@
+// "Add on demand static import for 'java.lang.Math'" "true"
+package test;
+
+import static java.lang.Math.*;
+
+public class C {{
+ abs(1.0);
+ <caret>Math.max(1, 2);
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeOwnMember.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeOwnMember.java
new file mode 100644
index 000000000000..fba407683654
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeOwnMember.java
@@ -0,0 +1,10 @@
+// "Add on demand static import for 'test.Foo'" "true"
+package test;
+
+class Foo {
+ public static void m() {}
+
+ public static void main(String[] args) {
+ Foo<caret>.m();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleImportPresent.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleImportPresent.java
new file mode 100644
index 000000000000..1636ec79b66e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleImportPresent.java
@@ -0,0 +1,8 @@
+// "Add static import for 'java.lang.Math.abs'" "true"
+package test;
+
+import static java.lang.Math.abs;
+
+public class X {{
+ Math.abs<caret>(1.0);
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleIncompleteCode.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleIncompleteCode.java
new file mode 100644
index 000000000000..462713c98f66
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleIncompleteCode.java
@@ -0,0 +1,6 @@
+// "Add static import for 'java.lang.Math.abs'" "true"
+package test;
+
+class X {{
+ Math.abs<caret>();
+}} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleMethod.java
index e199b822fbee..db823f144fe3 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleMethod.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleMethod.java
@@ -1,4 +1,4 @@
-// "Add static import for 'test.Bar.f'" "true"
+// "Add static import for 'test.Bar.f'" "false"
package test;
class Bar {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleSuperMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleSuperMethod.java
index e6cdb19c0d79..bfa85a2dca1e 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleSuperMethod.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addOnDemandStaticImport/beforeSingleSuperMethod.java
@@ -1,4 +1,4 @@
-// "Add static import for 'test.Bar.f'" "true"
+// "Add static import for 'test.Bar.f'" "false"
package test;
class Bar {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/afterLambdaInternal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/afterLambdaInternal.java
new file mode 100644
index 000000000000..056c098fcf7e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/afterLambdaInternal.java
@@ -0,0 +1,12 @@
+// "Add Exception to Method Signature" "true"
+class C {
+ interface I {
+ void a() throws InterruptedException;
+ }
+
+ {
+ I i = () -> {
+ Thread.sleep(2000);
+ };
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaExternal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaExternal.java
new file mode 100644
index 000000000000..5aac457b22ef
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaExternal.java
@@ -0,0 +1,9 @@
+// "Add Exception to Method Signature" "false"
+class C {
+
+ public static void main(String[] args) throws InterruptedException {
+ new Thread(( ) -> {
+ Thread.sl<caret>eep(2000);
+ }).start();
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaInternal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaInternal.java
new file mode 100644
index 000000000000..9c62d2b6cff1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows/beforeLambdaInternal.java
@@ -0,0 +1,12 @@
+// "Add Exception to Method Signature" "true"
+class C {
+ interface I {
+ void a();
+ }
+
+ {
+ I i = () -> {
+ Thread.sl<caret>eep(2000);
+ };
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoArray.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoArray.java
index 659a3bb0b844..dc9c06ca5329 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoArray.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoArray.java
@@ -7,6 +7,6 @@ import static java.lang.annotation.ElementType.*;
class C {
{
Object o = null;
- @TA int @TA [] a = (@TA int @TA[]) o;
+ @TA int @TA [] a = (int[]) o;
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoPrimitive.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoPrimitive.java
deleted file mode 100644
index 8cd2a01d46e8..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoPrimitive.java
+++ /dev/null
@@ -1,12 +0,0 @@
-// "Cast to 'int'" "true"
-import java.lang.annotation.*;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { }
-
-class C {
- {
- Object o = null;
- @TA <caret>int i = (@TA int) o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoRefType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoRefType.java
index 28420d1f46ea..d1b92436866a 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoRefType.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoRefType.java
@@ -1,5 +1,6 @@
-// "Cast to 'java.lang.Integer'" "true"
+// "Cast to 'java.util.List<java.lang.Integer>'" "true"
import java.lang.annotation.*;
+import java.util.*;
import static java.lang.annotation.ElementType.*;
@Target({TYPE_USE}) @interface TA { }
@@ -7,6 +8,6 @@ import static java.lang.annotation.ElementType.*;
class C {
{
Object o = null;
- @TA <caret>Integer i = (@TA Integer) o;
+ @TA List<@TA Integer> i = (List<Integer>) o;
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoTypeParam.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoTypeParam.java
deleted file mode 100644
index 6fa421e10993..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoTypeParam.java
+++ /dev/null
@@ -1,13 +0,0 @@
-// "Cast to 'java.util.List<java.lang.String>'" "true"
-import java.lang.annotation.*;
-import java.util.List;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { }
-
-class C {
- {
- Object o = null;
- @TA <caret>List<@TA String> l = (@TA List<@TA String>) o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoValued.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoValued.java
deleted file mode 100644
index bfedf89bc35f..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoValued.java
+++ /dev/null
@@ -1,12 +0,0 @@
-// "Cast to 'int'" "true"
-import java.lang.annotation.*;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { String value() default ""; }
-
-class C {
- {
- Object o = null;
- @TA("wtf") <caret>int i = (@TA("wtf") int) o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoWildcard.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoWildcard.java
deleted file mode 100644
index a114746c145d..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTypeAnnoWildcard.java
+++ /dev/null
@@ -1,13 +0,0 @@
-// "Cast to 'java.util.List<? extends java.lang.String>'" "true"
-import java.lang.annotation.*;
-import java.util.List;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { }
-
-class C {
- {
- Object o = null;
- @TA List<@TA ? extends @TA String> l = (@TA List<@TA ? extends @TA String>) o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoPrimitive.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoPrimitive.java
deleted file mode 100644
index 5d17c26ca97a..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoPrimitive.java
+++ /dev/null
@@ -1,12 +0,0 @@
-// "Cast to 'int'" "true"
-import java.lang.annotation.*;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { }
-
-class C {
- {
- Object o = null;
- @TA <caret>int i = o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoRefType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoRefType.java
index 7948738bb264..7c95d5eae896 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoRefType.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoRefType.java
@@ -1,5 +1,6 @@
-// "Cast to 'java.lang.Integer'" "true"
+// "Cast to 'java.util.List<java.lang.Integer>'" "true"
import java.lang.annotation.*;
+import java.util.*;
import static java.lang.annotation.ElementType.*;
@Target({TYPE_USE}) @interface TA { }
@@ -7,6 +8,6 @@ import static java.lang.annotation.ElementType.*;
class C {
{
Object o = null;
- @TA <caret>Integer i = o;
+ @TA <caret>List<@TA Integer> i = o;
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoTypeParam.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoTypeParam.java
deleted file mode 100644
index 33b2d0be44da..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoTypeParam.java
+++ /dev/null
@@ -1,13 +0,0 @@
-// "Cast to 'java.util.List<java.lang.String>'" "true"
-import java.lang.annotation.*;
-import java.util.List;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { }
-
-class C {
- {
- Object o = null;
- @TA <caret>List<@TA String> l = o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoValued.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoValued.java
deleted file mode 100644
index 726856c931b7..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoValued.java
+++ /dev/null
@@ -1,12 +0,0 @@
-// "Cast to 'int'" "true"
-import java.lang.annotation.*;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { String value() default ""; }
-
-class C {
- {
- Object o = null;
- @TA("wtf") <caret>int i = o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoWildcard.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoWildcard.java
deleted file mode 100644
index 84a9df6fad0a..000000000000
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTypeAnnoWildcard.java
+++ /dev/null
@@ -1,13 +0,0 @@
-// "Cast to 'java.util.List<? extends java.lang.String>'" "true"
-import java.lang.annotation.*;
-import java.util.List;
-import static java.lang.annotation.ElementType.*;
-
-@Target({TYPE_USE}) @interface TA { }
-
-class C {
- {
- Object o = null;
- @TA <caret>List<@TA ? extends @TA String> l = o;
- }
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterTypeAnnotated.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterTypeAnnotated.java
new file mode 100644
index 000000000000..9e123de77cae
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/afterTypeAnnotated.java
@@ -0,0 +1,17 @@
+// "Implement Methods" "true"
+import java.lang.annotation.*;
+import java.util.*;
+
+@Target(ElementType.TYPE_USE)
+@interface TA { int value() default 0; }
+
+interface I {
+ @TA List<@TA String> i(@TA int p1, @TA(1) int @TA(2) [] p2 @TA(3) []) throws @TA IllegalArgumentException;
+}
+
+class C implements I {
+ @Override
+ public @TA List<@TA String> i(@TA int p1, @TA(1) int @TA(2) [] @TA(3) [] p2) throws @TA IllegalArgumentException {
+ return null;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeTypeAnnotated.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeTypeAnnotated.java
new file mode 100644
index 000000000000..f19a1097082a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/implementMethods/beforeTypeAnnotated.java
@@ -0,0 +1,13 @@
+// "Implement Methods" "true"
+import java.lang.annotation.*;
+import java.util.*;
+
+@Target(ElementType.TYPE_USE)
+@interface TA { int value() default 0; }
+
+interface I {
+ @TA List<@TA String> i(@TA int p1, @TA(1) int @TA(2) [] p2 @TA(3) []) throws @TA IllegalArgumentException;
+}
+
+<caret>class C implements I {
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest.java
index 2421a3518dbe..8c5e48133c24 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest.java
@@ -1,4 +1,4 @@
-// "Add 'junit.jar' to classpath" "true"
+// "Add junit to classpath" "true"
package x;
public class DoTest extends TestCase<caret>{
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4.java
index 9856b2d9b0f3..6747302b815b 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4.java
@@ -1,4 +1,4 @@
-// "Add 'junit.jar' to classpath" "true"
+// "Add junit to classpath" "true"
package x;
public class DoTest4 {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4junit.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4junit.java
index 8a776a67fffd..d196e93cb9ea 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4junit.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/orderEntry/A/src/x/DoTest4junit.java
@@ -1,4 +1,4 @@
-// "Add 'junit.jar' to classpath" "true"
+// "Add junit to classpath" "true"
package x;
public class DoTest4junit {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListComment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListComment.java
new file mode 100644
index 000000000000..a9b24a5a2005
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListComment.java
@@ -0,0 +1,16 @@
+// "Replace with collect" "true"
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class Collect {
+ class Person {
+ String getName() {
+ return "";
+ }
+ }
+
+ void collectNames(List<Person> persons){
+ List<String> names = persons.stream().map(Person::getName).collect(Collectors.toList());
+ //some comment
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListNonTrivialInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListNonTrivialInitializer.java
new file mode 100644
index 000000000000..641617eb642b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectArrayListNonTrivialInitializer.java
@@ -0,0 +1,20 @@
+// "Replace with collect" "true"
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class Collect {
+ class Person {
+ String getName() {
+ return "";
+ }
+ }
+
+ ArrayList<String> foo() {
+ return new ArrayList<>();
+ }
+
+ void collectNames(List<Person> persons){
+ List<String> names = foo();
+ names.addAll(persons.stream().map(Person::getName).collect(Collectors.toList()));
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalComments.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalComments.java
new file mode 100644
index 000000000000..c1bbf0a0924b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterNormalComments.java
@@ -0,0 +1,11 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+ List<String> foo = new ArrayList<>();
+ {
+ //some comment
+ foo.forEach(System.out::println);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListComment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListComment.java
new file mode 100644
index 000000000000..c26fa6954bd6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListComment.java
@@ -0,0 +1,18 @@
+// "Replace with collect" "true"
+import java.util.*;
+
+public class Collect {
+ class Person {
+ String getName() {
+ return "";
+ }
+ }
+
+ void collectNames(List<Person> persons){
+ List<String> names = new ArrayList<>();
+ for (Person person : pers<caret>ons) {
+ //some comment
+ names.add(person.getName());
+ }
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListNonTrivialInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListNonTrivialInitializer.java
new file mode 100644
index 000000000000..6a276c0033ce
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectArrayListNonTrivialInitializer.java
@@ -0,0 +1,21 @@
+// "Replace with collect" "true"
+import java.util.*;
+
+public class Collect {
+ class Person {
+ String getName() {
+ return "";
+ }
+ }
+
+ ArrayList<String> foo() {
+ return new ArrayList<>();
+ }
+
+ void collectNames(List<Person> persons){
+ List<String> names = foo();
+ for (Person person : pers<caret>ons) {
+ names.add(person.getName());
+ }
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalComments.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalComments.java
new file mode 100644
index 000000000000..f394dd7d9696
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeNormalComments.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+ List<String> foo = new ArrayList<>();
+ {
+ for (String s : fo<caret>o) {
+ //some comment
+ System.out.println(s);
+ }
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString.java
new file mode 100644
index 000000000000..8e2d4d8e59cb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ Integer string = (Integer.parseInt("test.test.cast<caret>"));
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString_after.java
new file mode 100644
index 000000000000..f51c17698074
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/insideString_after.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ Integer string = (Integer.parseInt("test.test.cast <caret>"));
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument.java
new file mode 100644
index 000000000000..29bd8830d679
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ Integer string = (Integer.parseInt("test.test".cast<caret>));
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument_after.java
new file mode 100644
index 000000000000..61720cad312a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/cast/singleArgument_after.java
@@ -0,0 +1,5 @@
+public class Foo {
+ void m(Object o) {
+ Integer string = (Integer.parseInt((() "test.test")<caret>));
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNullableShouldNotAffectNullity.java b/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNullableShouldNotAffectNullity.java
new file mode 100644
index 000000000000..c57e9696bd5f
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNullableShouldNotAffectNullity.java
@@ -0,0 +1,15 @@
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+class Bar3 {
+
+ public void main2(Object o1, Object o2) {
+ if (o1 == null) {
+ System.out.println();
+ }
+ if (o1 != o2 || o2.hashCode() == 3) {
+
+ }
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/GettersAndPureNoFlushing.java b/java/java-tests/testData/inspection/dataFlow/fixture/GettersAndPureNoFlushing.java
new file mode 100644
index 000000000000..bab8354ee7b4
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/GettersAndPureNoFlushing.java
@@ -0,0 +1,31 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Doo {
+
+ @Nullable
+ Object getMethod() {return null;}
+
+ boolean isSomething() { return false;}
+
+ @Contract(pure=true)
+ boolean pureSomething() { return false;}
+
+ public void main2() {
+ if (getMethod() == null && !isSomething()) {
+ return;
+ } else {
+ System.out.println(<warning descr="Method invocation 'getMethod().hashCode()' may produce 'java.lang.NullPointerException'">getMethod().hashCode()</warning>);
+ }
+ }
+
+ public void main3() {
+ if (getMethod() == null && !pureSomething()) {
+ return;
+ } else {
+ System.out.println(<warning descr="Method invocation 'getMethod().hashCode()' may produce 'java.lang.NullPointerException'">getMethod().hashCode()</warning>);
+ }
+ }
+
+}
+
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/SameComparisonTwice.java b/java/java-tests/testData/inspection/dataFlow/fixture/SameComparisonTwice.java
new file mode 100644
index 000000000000..52abf5b39e46
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/SameComparisonTwice.java
@@ -0,0 +1,38 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.Nullable;
+
+class Doo {
+
+ static final int TYPE_1 = 20;
+ static final int TYPE_2 = 20;
+
+ public static void failedSecondCondition(int type) {
+ if(type != TYPE_1) {
+ return;
+ }
+
+ if(<warning descr="Condition 'type != TYPE_2' is always 'false'">type != TYPE_2</warning>) {
+ System.out.println();
+ }
+ }
+
+
+}
+
+class Doo2 {
+
+ static final int TYPE_1 = 200;
+ static final int TYPE_2 = 200;
+
+ public static void failedSecondCondition(int type) {
+ if(type != TYPE_1) {
+ return;
+ }
+
+ if(<warning descr="Condition 'type != TYPE_2' is always 'false'">type != TYPE_2</warning>) {
+ System.out.println();
+ }
+ }
+
+
+}
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/UnusedCallDoesNotMakeUnknown.java b/java/java-tests/testData/inspection/dataFlow/fixture/UnusedCallDoesNotMakeUnknown.java
new file mode 100644
index 000000000000..288cc07a51b1
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/UnusedCallDoesNotMakeUnknown.java
@@ -0,0 +1,14 @@
+import org.jetbrains.annotations.Nullable;
+
+class Doo {
+
+ @Nullable
+ Object getMethod() {
+ return null;
+ }
+
+ public void main(String[] args) {
+ Object method = getMethod();
+ System.out.println(<warning descr="Method invocation 'getMethod().hashCode()' may produce 'java.lang.NullPointerException'">getMethod().hashCode()</warning>);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/introduceParameter/afterTypeAnnotation.java b/java/java-tests/testData/refactoring/introduceParameter/afterTypeAnnotation.java
new file mode 100644
index 000000000000..a14b989bbc89
--- /dev/null
+++ b/java/java-tests/testData/refactoring/introduceParameter/afterTypeAnnotation.java
@@ -0,0 +1,14 @@
+import java.lang.annotation.*;
+
+@Target(value = ElementType.TYPE_USE)
+public @interface TA { }
+
+class Test {
+ void m(@TA String anObject) {
+ System.out.println(anObject);
+ }
+
+ void use() {
+ m("smth");
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/introduceParameter/beforeTypeAnnotation.java b/java/java-tests/testData/refactoring/introduceParameter/beforeTypeAnnotation.java
new file mode 100644
index 000000000000..949419221d40
--- /dev/null
+++ b/java/java-tests/testData/refactoring/introduceParameter/beforeTypeAnnotation.java
@@ -0,0 +1,15 @@
+import java.lang.annotation.*;
+
+@Target(value = ElementType.TYPE_USE)
+public @interface TA { }
+
+class Test {
+ void m() {
+ @TA String <caret>v = "smth";
+ System.out.println(v);
+ }
+
+ void use() {
+ m();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/renameInplace/NameSuggestion.java b/java/java-tests/testData/refactoring/renameInplace/NameSuggestion.java
new file mode 100644
index 000000000000..947f2728a872
--- /dev/null
+++ b/java/java-tests/testData/refactoring/renameInplace/NameSuggestion.java
@@ -0,0 +1,7 @@
+class MyTest {
+
+ static class Foo {
+ }
+
+ static Foo get<caret>_i() { return null; }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/renameInplace/NameSuggestion_after.java b/java/java-tests/testData/refactoring/renameInplace/NameSuggestion_after.java
new file mode 100644
index 000000000000..dd78c8b995ea
--- /dev/null
+++ b/java/java-tests/testData/refactoring/renameInplace/NameSuggestion_after.java
@@ -0,0 +1,7 @@
+class MyTest {
+
+ static class Foo {
+ }
+
+ static Foo getI() { return null; }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/generics/after/Wrapper.java b/java/java-tests/testData/refactoring/wrapReturnValue/generics/after/Wrapper.java
index 0b351ee1aee6..79bfc1a8ede3 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/generics/after/Wrapper.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/generics/after/Wrapper.java
@@ -5,9 +5,7 @@ public class Wrapper<T> {
this.value = value;
}
-
public T getValue() {
return value;
}
-
}
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/after/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/after/Test.java
index a7c2a2dad00e..2cb2b1e94530 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/after/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/after/Test.java
@@ -1,5 +1,5 @@
abstract class Test {
- abstract Wrapper foo();
+ abstract Wrapper foo();
public class Wrapper {
private final String value;
@@ -8,10 +8,8 @@ abstract class Test {
this.value = value;
}
-
public String getValue() {
return value;
}
-
}
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/before/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/before/Test.java
index 5b11736b28d4..e883ab1004fa 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/before/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/hierarchy/before/Test.java
@@ -1,3 +1,3 @@
abstract class Test {
- abstract String foo();
+ abstract String foo();
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/after/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/after/Test.java
index 59509c2700b8..4d933a44c247 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/after/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/after/Test.java
@@ -1,11 +1,11 @@
class Test {
Wrapper foo() {
- return new Wrapper("");
- }
+ return new Wrapper("");
+ }
- void bar() {
- String s = foo().getValue();
- }
+ void bar() {
+ String s = foo().getValue();
+ }
public class Wrapper {
private final String value;
@@ -14,10 +14,8 @@ class Test {
this.value = value;
}
-
public String getValue() {
return value;
}
-
}
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/before/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/before/Test.java
index 029bda94dc51..7d4f5f239652 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/before/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/innerClass/before/Test.java
@@ -1,9 +1,9 @@
class Test {
- String foo() {
- return "";
- }
+ String foo() {
+ return "";
+ }
- void bar() {
- String s = foo();
- }
+ void bar() {
+ String s = foo();
+ }
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/after/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/after/Test.java
index f74dbb90ad34..541d37adb883 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/after/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/after/Test.java
@@ -1,9 +1,9 @@
class Test {
Wrapper foo() {
- return new Wrapper((o) -> {
- return 0;
- });
- }
+ return new Wrapper((o) -> {
+ return 0;
+ });
+ }
public class Wrapper {
private final Comparable<String> value;
@@ -12,10 +12,8 @@ class Test {
this.value = value;
}
-
public Comparable<String> getValue() {
return value;
}
-
}
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/before/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/before/Test.java
index bbc57c1c8095..e8936135daa4 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/before/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/returnInsideLambda/before/Test.java
@@ -1,7 +1,7 @@
class Test {
- Comparable<String> foo() {
- return (o) -> {
- return 0;
- };
- }
+ Comparable<String> foo() {
+ return (o) -> {
+ return 0;
+ };
+ }
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/simple/after/Wrapper.java b/java/java-tests/testData/refactoring/wrapReturnValue/simple/after/Wrapper.java
index 35fba31a1e74..f41758e35766 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/simple/after/Wrapper.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/simple/after/Wrapper.java
@@ -5,9 +5,7 @@ public class Wrapper {
this.value = value;
}
-
public String getValue() {
return value;
}
-
}
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/after/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/after/Test.java
index 035212c0a74e..810e741d28b4 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/after/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/after/Test.java
@@ -1,11 +1,11 @@
class Test {
- static Wrapper foo() {
- return new Wrapper("");
- }
+ static Wrapper foo() {
+ return new Wrapper("");
+ }
- void bar() {
- String s = foo().getValue();
- }
+ void bar() {
+ String s = foo().getValue();
+ }
public static class Wrapper {
private final String value;
@@ -14,10 +14,8 @@ class Test {
this.value = value;
}
-
public String getValue() {
return value;
}
-
}
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/before/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/before/Test.java
index d406379d1e43..9dc5783d11f5 100644
--- a/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/before/Test.java
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/staticMethodInnerClass/before/Test.java
@@ -1,9 +1,9 @@
class Test {
- static String foo() {
- return "";
- }
+ static String foo() {
+ return "";
+ }
- void bar() {
- String s = foo();
- }
+ void bar() {
+ String s = foo();
+ }
} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Test.java
new file mode 100644
index 000000000000..894943706ffd
--- /dev/null
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Test.java
@@ -0,0 +1,10 @@
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE_USE})
+@interface TA { }
+
+class Test {
+ Wrapper foo() {
+ return new Wrapper(null);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Wrapper.java b/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Wrapper.java
new file mode 100644
index 000000000000..754c77ab22c4
--- /dev/null
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/after/Wrapper.java
@@ -0,0 +1,13 @@
+import java.util.List;
+
+public class Wrapper {
+ private final List<String> value;
+
+ public Wrapper(@TA List<@TA String> value) {
+ this.value = value;
+ }
+
+ public @TA List<@TA String> getValue() {
+ return value;
+ }
+}
diff --git a/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/before/Test.java b/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/before/Test.java
new file mode 100644
index 000000000000..3fc443dad610
--- /dev/null
+++ b/java/java-tests/testData/refactoring/wrapReturnValue/typeAnnotations/before/Test.java
@@ -0,0 +1,11 @@
+import java.lang.annotation.*;
+import java.util.*;
+
+@Target({ElementType.TYPE_USE})
+@interface TA { }
+
+class Test {
+ @TA List<@TA String> foo() {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics15HighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics15HighlightingTest.java
new file mode 100644
index 000000000000..36533d72893d
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics15HighlightingTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2014 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.codeInsight;
+
+import com.intellij.pom.java.LanguageLevel;
+
+public class ClsGenerics15HighlightingTest extends ClsGenericsHighlightingTest {
+
+ @Override
+ protected LanguageLevel getLanguageLevel() {
+ return LanguageLevel.JDK_1_5;
+ }
+
+ public void testIDEA97887() { doTest(); }
+ public void testIDEA118733() { doTest(); }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics18HighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics18HighlightingTest.java
new file mode 100644
index 000000000000..ae0ec20ab4d2
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenerics18HighlightingTest.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000-2014 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.codeInsight;
+
+import com.intellij.pom.java.LanguageLevel;
+
+public class ClsGenerics18HighlightingTest extends ClsGenericsHighlightingTest {
+ public void testIDEA121866() { doTest(); }
+
+ @Override
+ protected LanguageLevel getLanguageLevel() {
+ return LanguageLevel.JDK_1_8;
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenericsHighlightingTest.java
index 3cf2a8392089..839d933437fc 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/ClsGenericsHighlightingTest.java
@@ -14,10 +14,6 @@
* limitations under the License.
*/
-/*
- * User: anna
- * Date: 27-Jun-2007
- */
package com.intellij.codeInsight;
import com.intellij.openapi.application.ex.PathManagerEx;
@@ -31,6 +27,7 @@ import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestCase;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
@@ -38,7 +35,7 @@ import com.intellij.testFramework.fixtures.*;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
-public class ClsGenericsHighlightingTest extends UsefulTestCase {
+public abstract class ClsGenericsHighlightingTest extends UsefulTestCase {
private CodeInsightTestFixture myFixture;
private Module myModule;
@@ -54,11 +51,13 @@ public class ClsGenericsHighlightingTest extends UsefulTestCase {
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
myFixture.setTestDataPath(PathManagerEx.getTestDataPath() + "/codeInsight/clsHighlighting");
JavaModuleFixtureBuilder builder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
- builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
+ builder.setLanguageLevel(getLanguageLevel());
myFixture.setUp();
myModule = builder.getFixture().getModule();
}
+ protected abstract LanguageLevel getLanguageLevel();
+
@Override
protected void tearDown() throws Exception {
super.tearDown();
@@ -67,10 +66,7 @@ public class ClsGenericsHighlightingTest extends UsefulTestCase {
myModule = null;
}
- public void testIDEA97887() { doTest(); }
- public void testIDEA118733() { doTest(); }
-
- private void doTest() {
+ protected void doTest() {
String name = getTestName(false);
addLibrary(name + ".jar");
myFixture.configureByFile(name + ".java");
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy
index 4cad78b0c467..7de79b533944 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/HippieCompletionTest.groovy
@@ -189,7 +189,16 @@ class Xoo {
class Xoo {
}
'''
+ }
+ public void "test cpp indirection"() {
+ myFixture.configureByText "a.c", '''f<caret>
+foo->bar
+'''
+ complete()
+ myFixture.checkResult '''foo<caret>
+foo->bar
+'''
}
private void complete() {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
index 0b12b544bbfd..e626fd42b37f 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
@@ -1179,36 +1179,36 @@ class Foo {{
}
private doTestMulticaret(final String textBefore, final String toType, final String textAfter) {
- EditorTestUtil.enableMultipleCarets()
+ myFixture.configureByText "a.java", textBefore
+ type 'toStr'
+ assert lookup
+ type toType
+ myFixture.checkResult textAfter
+ }
+
+ private doTestBlockSelection(final String textBefore, final String toType, final String textAfter) {
+ EditorTestUtil.disableMultipleCarets()
try {
myFixture.configureByText "a.java", textBefore
+ edt {
+ def caret = myFixture.editor.offsetToLogicalPosition(myFixture.editor.caretModel.offset)
+ myFixture.editor.selectionModel.setBlockSelection(caret, new LogicalPosition(caret.line + 1, caret.column + 1))
+ }
type 'toStr'
assert lookup
type toType
myFixture.checkResult textAfter
+ def start = myFixture.editor.selectionModel.blockStart
+ def end = myFixture.editor.selectionModel.blockEnd
+ assert start.line == end.line - 1
+ assert start.column == end.column
+ assert end == myFixture.editor.caretModel.logicalPosition
}
finally {
- EditorTestUtil.disableMultipleCarets()
+ EditorTestUtil.enableMultipleCarets()
}
}
- private doTestBlockSelection(final String textBefore, final String toType, final String textAfter) {
- myFixture.configureByText "a.java", textBefore
- edt {
- def caret = myFixture.editor.offsetToLogicalPosition(myFixture.editor.caretModel.offset)
- myFixture.editor.selectionModel.setBlockSelection(caret, new LogicalPosition(caret.line + 1, caret.column + 1))
- }
- type 'toStr'
- assert lookup
- type toType
- myFixture.checkResult textAfter
- def start = myFixture.editor.selectionModel.blockStart
- def end = myFixture.editor.selectionModel.blockEnd
- assert start.line == end.line - 1
- assert start.column == end.column
- assert end == myFixture.editor.caretModel.logicalPosition
- }
-
public void "test two non-imported classes when space selects first autopopup item"() {
myFixture.addClass("package foo; public class Abcdefg {}")
myFixture.configureByText 'a.java', 'class Foo extends <caret>'
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
index 35b71f8cc33b..d30e3520f932 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/NormalCompletionTest.groovy
@@ -882,16 +882,6 @@ public class ListUtils {
doAntiTest()
}
- private void doMultiCaretTest() throws Exception {
- EditorTestUtil.enableMultipleCarets()
- try {
- doTest()
- }
- finally {
- EditorTestUtil.disableMultipleCarets()
- }
- }
-
private void doTest() throws Exception {
configure()
checkResult();
@@ -1366,68 +1356,44 @@ class XInternalError {}
}
public void "test block selection from bottom to top with single-item insertion"() {
- myFixture.configureByText "a.java", """
-class Foo {{
- ret<caret>;
- ret;
-}}"""
- edt {
- def caret = myFixture.editor.offsetToLogicalPosition(myFixture.editor.caretModel.offset)
- myFixture.editor.selectionModel.setBlockSelection(new LogicalPosition(caret.line + 1, caret.column), caret)
+ EditorTestUtil.disableMultipleCarets()
+ try {
+ myFixture.configureByText "a.java", """
+ class Foo {{
+ ret<caret>;
+ ret;
+ }}"""
+ edt {
+ def caret = myFixture.editor.offsetToLogicalPosition(myFixture.editor.caretModel.offset)
+ myFixture.editor.selectionModel.setBlockSelection(new LogicalPosition(caret.line + 1, caret.column), caret)
+ }
+ myFixture.completeBasic()
+ myFixture.checkResult '''
+ class Foo {{
+ return<caret>;
+ return;
+ }}'''
+ }
+ finally {
+ EditorTestUtil.enableMultipleCarets()
}
- myFixture.completeBasic()
- myFixture.checkResult '''
-class Foo {{
- return<caret>;
- return;
-}}'''
}
public void testMulticaretSingleItemInsertion() {
- doMultiCaretTest()
+ doTest()
}
public void testMulticaretMethodWithParen() {
- doMultiCaretTest()
- }
-
- public void testFinishWithEqualsWhenMultipleCaretsAreEnabled() {
- EditorTestUtil.enableMultipleCarets()
- try {
- configureByFile("SpacesAroundEq.java");
- type('=');
- checkResultByFile("SpacesAroundEq_after.java");
- }
- finally {
- EditorTestUtil.disableMultipleCarets()
- }
- }
-
- public void testPrimitiveSquareBracketWhenMultipleCaretsAreEnabled() {
- EditorTestUtil.enableMultipleCarets()
- try {
- configureByFile("PrimitiveSquareBracket.java");
- type('[');
- checkResultByFile("PrimitiveSquareBracket_after.java");
- }
- finally {
- EditorTestUtil.disableMultipleCarets()
- }
+ doTest()
}
public void testMulticaretTyping() {
- EditorTestUtil.enableMultipleCarets()
- try {
- configure()
- assert lookup
- type('p')
- assert lookup
- type('\n')
- checkResult()
- }
- finally {
- EditorTestUtil.disableMultipleCarets()
- }
+ configure()
+ assert lookup
+ type('p')
+ assert lookup
+ type('\n')
+ checkResult()
}
public void "test complete lowercase class name"() {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java
index 548f5df1500a..02773d45cd72 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType17CompletionTest.java
@@ -35,7 +35,7 @@ public class SmartType17CompletionTest extends LightFixtureCompletionTestCase {
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
- return JAVA_LATEST;
+ return JAVA_1_7;
}
public void testDiamondCollapsed() throws Exception {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java
index 72840250b795..a9811983947e 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java
@@ -73,6 +73,14 @@ public class SmartType18CompletionTest extends LightFixtureCompletionTestCase {
doTest();
}
+ public void testInLambdaPositionSingleParam() throws Exception {
+ doTest();
+ }
+
+ public void testInLambdaPositionNameSubstitution() throws Exception {
+ doTest();
+ }
+
public void testFilteredMethodReference() throws Exception {
doTest();
}
@@ -96,6 +104,11 @@ public class SmartType18CompletionTest extends LightFixtureCompletionTestCase {
}
}
+ public void testDiamondsInsideMethodCall() throws Exception {
+ configureByFile("/" + getTestName(false) + ".java");
+ checkResultByFile("/" + getTestName(false) + "-out.java");
+ }
+
private void doTest() {
configureByFile("/" + getTestName(false) + ".java");
assertNotNull(myItems);
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java
index ca4133b79172..eb73906a5f15 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Diamond8HighlightingTest.java
@@ -31,6 +31,10 @@ public class Diamond8HighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
+ public void testVarargs() throws Exception {
+ doTest();
+ }
+
private void doTest() throws Exception {
doTestNewInference(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
index 8af0821571d6..dbf3e3703992 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GraphInferenceHighlightingTest.java
@@ -168,6 +168,18 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
doTest();
}
+ public void testIncorporationWithEqualsBoundsSubstitution() throws Exception {
+ doTest();
+ }
+
+ public void testOuterCallConflictResolution() throws Exception {
+ doTest();
+ }
+
+ public void testVarargsOnNonPertinentPlace() throws Exception {
+ doTest();
+ }
+
private void doTest() throws Exception {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
index 0cb2f0ecc65c..5f4d01e4ab5e 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/MostSpecificResolutionTest.java
@@ -39,6 +39,30 @@ public class MostSpecificResolutionTest extends LightDaemonAnalyzerTestCase {
doTest();
}
+ public void testNestedLambdaSpecifics() throws Exception {
+ doTest();
+ }
+
+ public void testBothVarargs() throws Exception {
+ doTest();
+ }
+
+ public void testNestedVarargs() throws Exception {
+ doTest();
+ }
+
+ public void testMostSpecificForSameFunctionalTypes() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA121884() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA121999() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(true);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
index 826193c90f90..a3c2b12515eb 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
@@ -146,6 +146,14 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
+ public void testIDEA121315() throws Exception {
+ doTest();
+ }
+
+ public void testIDEA118965comment() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
index 83f0dfac5c1e..f18ae823c7ff 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewMethodRefHighlightingTest.java
@@ -181,6 +181,22 @@ public class NewMethodRefHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest();
}
+ public void testSuperClassPotentiallyApplicableMembers() throws Exception {
+ doTest();
+ }
+
+ public void testExactMethodReferencePertinentToApplicabilityCheck() throws Exception {
+ doTest();
+ }
+
+ public void testAmbiguityVarargs() throws Exception {
+ doTest();
+ }
+
+ public void testRawInnerClassQualifier() throws Exception {
+ doTest();
+ }
+
private void doTest() {
doTest(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToThrowsTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToThrowsTest.java
index f25775fb962b..5fa9b96f574d 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToThrowsTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/AddExceptionToThrowsTest.java
@@ -1,5 +1,8 @@
package com.intellij.codeInsight.daemon.quickFix;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.testFramework.IdeaTestUtil;
+
public class AddExceptionToThrowsTest extends LightQuickFixParameterizedTestCase {
public void test() throws Exception {
doAllTests();
@@ -9,4 +12,9 @@ public class AddExceptionToThrowsTest extends LightQuickFixParameterizedTestCase
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/addToThrows";
}
+
+ @Override
+ protected Sdk getProjectJDK() {
+ return IdeaTestUtil.getMockJdk18();
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy
index 662762ba2a69..ead75a2936e2 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/AddImportActionTest.groovy
@@ -133,8 +133,7 @@ import java.util.Collection;
@Target(ElementType.TYPE_USE) @interface TA { }
class Test {
- @TA
- Collection<caret> c;
+ @TA Collection<caret> c;
}
'''
}
@@ -157,8 +156,7 @@ import java.util.Collection;
@Target(ElementType.TYPE_USE) @interface TA { }
class Test {
- @TA
- Collection<caret> c;
+ @TA Collection<caret> c;
}
'''
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
index 939e7520ecf5..cef42e9ea06d 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -29,6 +29,7 @@ import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.impl.DocumentImpl
import com.intellij.openapi.util.Disposer
+import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
import com.intellij.psi.codeStyle.CommonCodeStyleSettings
@@ -74,15 +75,50 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
String group = "user";
final Template template = manager.createTemplate(templateName, group, templateText);
template.addVariable("ARG", "", "", false);
- final TemplateContextType contextType =
- ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.class);
+ TemplateContextType contextType = contextType(JavaCodeContextType.class);
((TemplateImpl)template).getTemplateContext().setEnabled(contextType, true);
addTemplate(template, testRootDisposable)
- final Editor editor = getEditor();
manager.startTemplate(editor, (char)'\t');
checkResultByText(expected);
}
+
+ public void testTemplateWithSegmentsAtTheSamePosition_1() {
+ doTestTemplateWithThreeVariables("", "", "", "class A { void test() { for(TestValue1TestValue2TestValue3) {} } }")
+ }
+
+ public void testTemplateWithSegmentsAtTheSamePosition_2() {
+ doTestTemplateWithThreeVariables("Def1", "Def2", "DefaultValue", "class A { void test() { for(Def1Def2DefaultValue) {} } }")
+ }
+
+ public void testTemplateWithSegmentsAtTheSamePosition_3() {
+ doTestTemplateWithThreeVariables("", "DefaultValue", "", "class A { void test() { for(TestValue1DefaultValueTestValue3) {} } }")
+ }
+
+ private void doTestTemplateWithThreeVariables(String firstDefaultValue, String secondDefaultValue, String thirdDefaultValue,
+ String expectedText) {
+ configureFromFileText("dummy.java", "class A { void test() { <caret> } }")
+
+ TemplateManager manager = TemplateManager.getInstance(getProject())
+ def templateName = "tst_template"
+ def templateGroup = "user"
+ final Template template = manager.createTemplate(templateName, templateGroup, 'for($TEST1$$TEST2$$TEST3$) {}')
+ template.addVariable("TEST1", "", StringUtil.wrapWithDoubleQuote(firstDefaultValue), true)
+ template.addVariable("TEST2", "", StringUtil.wrapWithDoubleQuote(secondDefaultValue), true)
+ template.addVariable("TEST3", "", StringUtil.wrapWithDoubleQuote(thirdDefaultValue), true)
+ ((TemplateImpl)template).templateContext.setEnabled(contextType(JavaCodeContextType.class), true)
+ addTemplate(template, testRootDisposable)
+
+ startTemplate(templateName, templateGroup)
+ if (firstDefaultValue.empty) myFixture.type("TestValue1")
+ myFixture.type("\t")
+ if (secondDefaultValue.empty) myFixture.type("TestValue2")
+ myFixture.type("\t")
+ if (thirdDefaultValue.empty) myFixture.type("TestValue3")
+ myFixture.type("\t")
+ assert state == null
+ checkResultByText(expectedText);
+ }
public void testTemplateWithArg1() throws IOException {
doTestTemplateWithArg("tst", 'wrap($ARG$)', "tst arg<caret>", "wrap(arg)");
@@ -245,6 +281,10 @@ class Foo {
TemplateManager.getInstance(getProject()).startTemplate(getEditor(), TemplateSettings.getInstance().getTemplate(name, group));
}
+ private static <T extends TemplateContextType> T contextType(Class<T> clazz) {
+ ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), clazz)
+ }
+
private void configure() {
myFixture.configureByFile(getTestName(false) + ".java");
}
@@ -397,7 +437,7 @@ class Foo {
assertTrue(isApplicable("class Foo { <caret>xxx void foo(String bar, xxx goo ) {} }", template));
assertTrue(isApplicable("class Foo { void foo(<caret>String[] bar) {} }", template));
assertTrue(isApplicable("class Foo { <caret>xxx String[] foo(String[] bar) {} }", template));
-
+
assertTrue(isApplicable("<caret>xxx package foo; class Foo {}", template));
}
@@ -448,7 +488,7 @@ class Foo {
new ListTemplatesHandler().invoke(project, editor, myFixture.file);
assert myFixture.lookupElementStrings.containsAll(['iter', 'itco', 'toar'])
-
+
myFixture.type('it')
assert myFixture.lookupElementStrings[0].startsWith('it')
assert LookupManager.getInstance(project).activeLookup.currentItem == myFixture.getLookupElements()[0]
@@ -549,8 +589,7 @@ class Foo {
public void testTemplateExpandingWithSelection() {
final TemplateManager manager = TemplateManager.getInstance(getProject());
final Template template = manager.createTemplate("tpl", "user", 'expanded');
- final JavaStringContextType contextType =
- ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaStringContextType.class);
+ final JavaStringContextType contextType = contextType(JavaStringContextType.class);
((TemplateImpl)template).getTemplateContext().setEnabled(contextType, true);
myFixture.configureByText("a.java", "class A { void f() { Stri<selection>ng s = \"tpl</selection><caret>\"; } }")
@@ -559,7 +598,7 @@ class Foo {
myFixture.type '\t'
myFixture.checkResult 'class A { void f() { Stri "; } }'
}
-
+
static void addTemplate(Template template, Disposable parentDisposable) {
def settings = TemplateSettings.getInstance()
settings.addTemplate(template);
@@ -589,7 +628,7 @@ class Foo {{
class Foo {{
java.util.List<String[]> list;
String[][] s = list.toArray(new String[list.size()][])<caret>
-}}'''
+}}'''
}
public void "test inner class name"() {
@@ -722,4 +761,32 @@ class Foo {
myFixture.checkResult('-foo-bar_goo- _foo_bar_goo_ c<caret>')
}
+ public void "test use single member static import first"() {
+ myFixture.addClass("""package foo;
+public class Bar {
+ public static void someMethod() {}
+ public static void someMethod(int a) {}
+}""")
+ myFixture.configureByText "a.java", """
+
+class Foo {
+ {
+ <caret>
+ }
+}
+"""
+ final TemplateManager manager = TemplateManager.getInstance(getProject());
+ final Template template = manager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)');
+ template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true);
+
+ manager.startTemplate(editor, template);
+ myFixture.checkResult """import static foo.Bar.someMethod;
+
+class Foo {
+ {
+ someMethod(<caret>)
+ }
+}
+"""
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java
index dbd4c1ddd20d..b7d4ef358823 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/CastPostfixTemplateTest.java
@@ -1,10 +1,22 @@
+/*
+ * Copyright 2000-2014 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.codeInsight.template.postfix.templates;
import org.jetbrains.annotations.NotNull;
-/**
- * @author ignatov
- */
public class CastPostfixTemplateTest extends PostfixTemplateTestCase {
@NotNull
@Override
@@ -12,4 +24,6 @@ public class CastPostfixTemplateTest extends PostfixTemplateTestCase {
public void testSingleExpression() { doTest(); } // jdk mock needed
public void testVoidExpression() { doTest(); }
+ public void testSingleArgument() { doTest(); }
+ public void testInsideString() { doTest(); }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
index e4cf4c7480a5..f636c11b37ab 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
@@ -79,6 +79,7 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testIDEA84489() throws Throwable { doTest(); }
public void testComparingToNotNullShouldNotAffectNullity() throws Throwable { doTest(); }
+ public void testComparingToNullableShouldNotAffectNullity() throws Throwable { doTest(); }
public void testStringTernaryAlwaysTrue() throws Throwable { doTest(); }
public void testStringConcatAlwaysNotNull() throws Throwable { doTest(); }
@@ -305,6 +306,11 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
public void testNotEqualsTypo() { doTest(); }
public void testAndEquals() { doTest(); }
+ public void testUnusedCallDoesNotMakeUnknown() { doTest(); }
+ public void testGettersAndPureNoFlushing() { doTest(); }
+
+ public void testSameComparisonTwice() { doTest(); }
+
public void testParametersAreNonnullByDefault() {
myFixture.addClass("package javax.annotation; public @interface ParametersAreNonnullByDefault {}");
myFixture.addClass("package javax.annotation; public @interface ParametersAreNullableByDefault {}");
diff --git a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
index bfd1de796f90..b0bc587fd406 100644
--- a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
+++ b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
@@ -600,4 +600,19 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
findModel.setInCommentsOnly(true);
FindManagerTestUtils.runFindForwardAndBackward(myFindManager, findModel, text, "java");
}
+
+ public void testPlusWholeWordsOnly() throws Exception {
+ createFile(myModule, "A.java", "3 + '+' + 2");
+
+ FindModel findModel = FindManagerTestUtils.configureFindModel("'+' +");
+ findModel.setMultipleFiles(true);
+
+ assertSize(1, findUsages(findModel));
+
+ findModel.setCaseSensitive(true);
+ assertSize(1, findUsages(findModel));
+
+ findModel.setWholeWordsOnly(true);
+ assertSize(1, findUsages(findModel));
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java
index ec5081ca1da6..c4cd499ccd96 100644
--- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterSpaceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -25,7 +25,7 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
*/
public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
- public void testSpacingBetweenTypeParameters() throws Exception {
+ public void testSpacingBetweenTypeParameters() {
// Implied by IDEADEV-3666
getSettings().SPACE_AFTER_COMMA = true;
@@ -33,6 +33,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"class Foo {\n" + " Map<String, String> map() {\n" + " }\n" + "}");
}
+ @SuppressWarnings("SpellCheckingInspection")
public void testDoNotPlaceStatementsOnOneLineIfFirstEndsWithSingleLineComment() {
getSettings().KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = true;
getSettings().KEEP_LINE_BREAKS = false;
@@ -195,7 +196,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"}");
}
- public void testSpaceWithArrayBrackets() throws Exception {
+ public void testSpaceWithArrayBrackets() {
// Inspired by IDEA-58510
getSettings().SPACE_WITHIN_BRACKETS = true;
doMethodTest(
@@ -207,11 +208,11 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"int[] i2 = new int[]{1}"
);
}
-
- public void testSpaceBeforeElse() throws Exception {
+
+ public void testSpaceBeforeElse() {
// Inspired by IDEA-58068
getSettings().ELSE_ON_NEW_LINE = false;
-
+
getSettings().SPACE_BEFORE_ELSE_KEYWORD = false;
doMethodTest(
"if (true) {\n" +
@@ -233,7 +234,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
- public void testSpaceBeforeWhile() throws Exception {
+ public void testSpaceBeforeWhile() {
// Inspired by IDEA-58068
getSettings().WHILE_ON_NEW_LINE = false;
@@ -254,8 +255,8 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
-
- public void testSpaceBeforeCatch() throws Exception {
+
+ public void testSpaceBeforeCatch() {
// Inspired by IDEA-58068
getSettings().CATCH_ON_NEW_LINE = false;
@@ -280,7 +281,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
- public void testSpaceBeforeFinally() throws Exception {
+ public void testSpaceBeforeFinally() {
// Inspired by IDEA-58068
getSettings().FINALLY_ON_NEW_LINE = false;
@@ -305,19 +306,19 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
- public void testEmptyIterationAtFor() throws Exception {
+ public void testEmptyIterationAtFor() {
// Inspired by IDEA-58293
getSettings().SPACE_AFTER_SEMICOLON = true;
getSettings().SPACE_WITHIN_FOR_PARENTHESES = false;
-
+
doMethodTest(
"for ( ; ; )",
"for (; ; )"
);
}
- public void testSpacesInDisjunctiveType() throws Exception {
+ public void testSpacesInDisjunctiveType() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().CATCH_ON_NEW_LINE = false;
@@ -330,7 +331,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"try { } catch (E1|E2 e) { }");
}
- public void testSpacesInsideLambda() throws Exception {
+ public void testSpacesInsideLambda() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().SPACE_AROUND_LAMBDA_ARROW = true;
@@ -342,7 +343,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"()->{}");
}
- public void testSpacesInsideMethodRef() throws Exception {
+ public void testSpacesInsideMethodRef() {
getSettings().SPACE_AROUND_METHOD_REF_DBL_COLON = true;
doMethodTest("Runnable r = this::foo",
@@ -353,7 +354,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"Runnable r = this::foo");
}
- public void testSpacesBeforeResourceList() throws Exception {
+ public void testSpacesBeforeResourceList() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
@@ -368,7 +369,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"try(AutoCloseable r = null){ }");
}
- public void testSpacesWithinResourceList() throws Exception {
+ public void testSpacesWithinResourceList() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().SPACE_WITHIN_TRY_PARENTHESES = false;
@@ -386,7 +387,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"try ( R r1 = null; R r2 = null; ) { }");
}
- public void testSpacesBetweenResources() throws Exception {
+ public void testSpacesBetweenResources() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().SPACE_BEFORE_SEMICOLON = false;
@@ -400,7 +401,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"try (R r1 = null ;R r2 = null ;) { }");
}
- public void testSpacesInResourceAssignment() throws Exception {
+ public void testSpacesInResourceAssignment() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
@@ -412,20 +413,20 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
"try (R r=null) { }");
}
- public void testBetweenMethodCallArguments() throws Exception {
+ public void testBetweenMethodCallArguments() {
// Inspired by IDEA-71823
getSettings().SPACE_AFTER_COMMA = false;
-
+
doMethodTest(
"foo(1, 2, 3);",
"foo(1,2,3);"
);
}
- public void testBeforeAnonymousClassConstructor() throws Exception {
+ public void testBeforeAnonymousClassConstructor() {
// Inspired by IDEA-72321.
getSettings().SPACE_BEFORE_METHOD_CALL_PARENTHESES = true;
-
+
doMethodTest(
"actions.add(new Action(this) {\n" +
" public void run() {\n" +
@@ -438,11 +439,11 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
- public void testBeforeAnnotationArrayInitializer() throws Exception {
+ public void testBeforeAnnotationArrayInitializer() {
// Inspired by IDEA-72317
getSettings().SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = false;
getSettings().SPACE_BEFORE_ANNOTATION_ARRAY_INITIALIZER_LBRACE = true;
-
+
doClassTest(
"@SuppressWarnings({\"HardCodedStringLiteral\"})\n" +
"void test() {\n" +
@@ -455,7 +456,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
- public void testBetweenParenthesesOfNoArgsMethod() throws Exception {
+ public void testBetweenParenthesesOfNoArgsMethod() {
// Inspired by IDEA-74751
getSettings().SPACE_WITHIN_METHOD_CALL_PARENTHESES = false;
getSettings().SPACE_WITHIN_EMPTY_METHOD_CALL_PARENTHESES = false;
@@ -484,7 +485,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
);
}
- public void testIncompleteCastExpression() throws Exception {
+ public void testIncompleteCastExpression() {
// Inspired by IDEA-75043.
String text = "void test(int i) {\n" +
" (() i)\n" +
@@ -492,7 +493,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
doClassTest(text, text);
}
- public void testSpacesWithinAngleBrackets() throws Exception {
+ public void testSpacesWithinAngleBrackets() {
getJavaSettings().SPACES_WITHIN_ANGLE_BRACKETS = true;
String beforeMethod = "static < T > void fromArray( T [ ] a , Collection< T > c) {\n}";
@@ -510,7 +511,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
doTextTest(beforeClass, "class A<U> {\n}");
}
- public void testSpaceAfterClosingAngleBracket_InTypeArgument() throws Exception {
+ public void testSpaceAfterClosingAngleBracket_InTypeArgument() {
String before = "Bar.<String, Integer> mess(null);";
getJavaSettings().SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT = false;
@@ -520,7 +521,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
doMethodTest(before, "Bar.<String, Integer> mess(null);");
}
- public void testSpaceBeforeOpeningAngleBracket_InTypeParameter() throws Exception {
+ public void testSpaceBeforeOpeningAngleBracket_InTypeParameter() {
String before = "class A<T> {\n}";
getJavaSettings().SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETER = false;
@@ -530,7 +531,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
doTextTest(before, "class A <T> {\n}");
}
- public void testSpaceAroundTypeBounds() throws Exception {
+ public void testSpaceAroundTypeBounds() {
String before = "public class Foo<T extends Bar & Abba, U> {\n}";
getJavaSettings().SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS = true;
@@ -539,4 +540,22 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
getJavaSettings().SPACE_AROUND_TYPE_BOUNDS_IN_TYPE_PARAMETERS = false;
doTextTest(before, "public class Foo<T extends Bar&Abba, U> {\n}");
}
+
+ public void testInnerTypeAnnotations() {
+ doTextTest(
+ "class C<@TA(1)T> {\n" +
+ " L<@TA(2)A> f = (@TA(3) A) new @TA(4) A() {\n" +
+ " void m(@TA(6) int @TA(7)[] p) {\n" +
+ " }\n" +
+ " };\n" +
+ "}",
+
+ "class C<@TA(1) T> {\n" +
+ " L<@TA(2) A> f = (@TA(3) A) new @TA(4) A() {\n" +
+ " void m(@TA(6) int @TA(7) [] p) {\n" +
+ " }\n" +
+ " };\n" +
+ "}"
+ );
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterWrapTest.java b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterWrapTest.java
index 5e545ecb8be6..4482dd7985ae 100644
--- a/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterWrapTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/formatter/java/JavaFormatterWrapTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,10 +15,14 @@
*/
package com.intellij.psi.formatter.java;
+import com.intellij.idea.Bombed;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
+import java.util.Calendar;
+
/**
* Is intended to hold specific java formatting tests for 'wrapping' settings.
*
@@ -26,8 +30,8 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
* @since Apr 29, 2010 4:06:15 PM
*/
public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
-
- public void testWrappingAnnotationArrayParameters() throws Exception {
+ @SuppressWarnings("SpellCheckingInspection")
+ public void testWrappingAnnotationArrayParameters() {
getSettings().getRootSettings().RIGHT_MARGIN = 80;
getSettings().ARRAY_INITIALIZER_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
doTextTest(
@@ -42,7 +46,7 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
"@AttributeOverride(name = \"systemExchangeRate\", column = @Column(name = \"system_exchange_rate\")) })\n" +
"class Foo {\n" +
"}",
-
+
"@AttributeOverrides({\n" +
" @AttributeOverride(name = \"id\", column = @Column(name = \"recovery_id\")),\n" +
" @AttributeOverride(name = \"transactionReference\", column = @Column(name = \"deal_reference\")),\n" +
@@ -58,7 +62,7 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
);
}
- public void testAnnotationParamValueExceedingRightMargin() throws Exception {
+ public void testAnnotationParamValueExceedingRightMargin() {
// Inspired by IDEA-18051
getSettings().getRootSettings().RIGHT_MARGIN = 80;
doTextTest(
@@ -83,7 +87,8 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
" }\n" +
"\n" +
"\n" +
- " @TheAnnotation(value = {TheEnum.FIRST, TheEnum.SECOND}, comment = \"some long comment that goes longer that right margin 012345678901234567890\")\n" +
+ " @TheAnnotation(value = {TheEnum.FIRST, TheEnum.SECOND}, comment =" +
+ " \"some long comment that goes longer that right margin 012345678901234567890\")\n" +
" public class Test {\n" +
"\n" +
" }\n" +
@@ -110,7 +115,8 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
" }\n" +
"\n" +
"\n" +
- " @TheAnnotation(value = {TheEnum.FIRST, TheEnum.SECOND}, comment = \"some long comment that goes longer that right margin 012345678901234567890\")\n" +
+ " @TheAnnotation(value = {TheEnum.FIRST, TheEnum.SECOND}, comment =" +
+ " \"some long comment that goes longer that right margin 012345678901234567890\")\n" +
" public class Test {\n" +
"\n" +
" }\n" +
@@ -118,6 +124,7 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
"}");
}
+ @SuppressWarnings("SpellCheckingInspection")
public void testEnumConstantsWrapping() {
// Inspired by IDEA-54667
getSettings().ENUM_CONSTANTS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
@@ -139,15 +146,15 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
);
}
- public void testMethodAnnotationFollowedBySingleLineComment() throws Exception {
+ public void testMethodAnnotationFollowedBySingleLineComment() {
// Inspired by IDEA-22808
getSettings().METHOD_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS;
String text =
- "@Test//mycomment\n" +
+ "@Test//my_comment\n" +
"public void foo() {\n" +
"}";
-
+
// Expecting the code to be left as-is
doClassTest(text, text);
}
@@ -163,7 +170,7 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
"}";
doTextTest(text, text);
}
-
+
public void testWrapLongLine() {
// Inspired by IDEA-55782
getSettings().getRootSettings().RIGHT_MARGIN = 50;
@@ -237,24 +244,24 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
"}"
);
}
-
- public void testWrapMethodAnnotationBeforeParams() throws Exception {
+
+ @Bombed(user = "Roman Shevchenko", year = 2014, month = Calendar.MARCH, day = 14)
+ public void testWrapMethodAnnotationBeforeParams() {
// Inspired by IDEA-59536
getSettings().getRootSettings().RIGHT_MARGIN = 90;
getSettings().METHOD_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
getSettings().METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
-
+
doClassTest(
"@SuppressWarnings({\"SomeInspectionIWantToIgnore\"}) public void doSomething(int x, int y) {}",
"@SuppressWarnings({\"SomeInspectionIWantToIgnore\"})\n" +
- "public void doSomething(int x, int y) {" +
- "\n}"
+ "public void doSomething(int x, int y) {\n}"
);
}
-
- public void testMultipleExpressionInSameLine() throws Exception {
+
+ public void testMultipleExpressionInSameLine() {
// Inspired by IDEA-64975.
-
+
getSettings().KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = true;
doMethodTest(
"int i = 1; int j = 2;",
@@ -268,10 +275,10 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
"int j = 2;"
);
}
-
- public void testIncompleteFieldAndAnnotationWrap() throws Exception {
+
+ public void testIncompleteFieldAndAnnotationWrap() {
// Inspired by IDEA-64725
-
+
getSettings().FIELD_ANNOTATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
doClassTest(
"@NotNull Comparable<String>",
@@ -279,7 +286,7 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
);
}
- public void testResourceListWrap() throws Exception {
+ public void testResourceListWrap() {
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
getSettings().getRootSettings().RIGHT_MARGIN = 40;
getSettings().RESOURCE_LIST_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
@@ -296,7 +303,8 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
") { }");
}
- public void testLineLongEnoughToExceedAfterFirstWrapping() throws Exception {
+ @SuppressWarnings("SpellCheckingInspection")
+ public void testLineLongEnoughToExceedAfterFirstWrapping() {
// Inspired by IDEA-103624
getSettings().WRAP_LONG_LINES = true;
getSettings().getRootSettings().RIGHT_MARGIN = 40;
@@ -316,7 +324,8 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
);
}
- public void testNoUnnecessaryWrappingIsPerformedForLongLine() throws Exception {
+ @SuppressWarnings("SpellCheckingInspection")
+ public void testNoUnnecessaryWrappingIsPerformedForLongLine() {
// Inspired by IDEA-103624
getSettings().WRAP_LONG_LINES = true;
getSettings().getRootSettings().RIGHT_MARGIN = 40;
@@ -332,13 +341,14 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
doMethodTest(text, text);
}
- public void testEnforceIndent_MethodCallParamWrap() throws Exception {
+ public void testEnforceIndentMethodCallParamWrap() {
getSettings().WRAP_LONG_LINES = true;
getSettings().getRootSettings().RIGHT_MARGIN = 140;
getSettings().PREFER_PARAMETERS_WRAP = true;
getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
- String before = "processingEnv.getMessenger().printMessage(Diagnostic.Kind.ERROR, String.format(\"Could not process annotations: %s%n%s\", e.toString(), writer.toString()));";
+ String before = "processingEnv.getMessenger().printMessage(Diagnostic.Kind.ERROR, " +
+ "String.format(\"Could not process annotations: %s%n%s\", e.toString(), writer.toString()));";
String afterFirstReformat = "processingEnv.getMessenger().printMessage(\n" +
" Diagnostic.Kind.ERROR, String.format(\n" +
@@ -362,17 +372,19 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
getSettings().CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true;
doMethodTest(before, after);
- before = "processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, call(\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"));\n";
- after = "processingEnv.getMessager().printMessage(\n" +
+ String literal = "\"" + StringUtil.repeatSymbol('A', 128) + "\"";
+ before = "processingEnv.getMessenger().printMessage(Diagnostic.Kind.ERROR, call(" + literal + "));\n";
+ after = "processingEnv.getMessenger().printMessage(\n" +
" Diagnostic.Kind.ERROR, call(\n" +
- " \"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\n" +
+ " " + literal + "\n" +
" )\n" +
");\n";
doMethodTest(before, after);
}
- public void testDoNotWrap_MethodsWithMethodCallAsParameters() throws Exception {
+ @SuppressWarnings("SpellCheckingInspection")
+ public void testDoNotWrapMethodsWithMethodCallAsParameters() {
getSettings().WRAP_LONG_LINES = true;
getSettings().getRootSettings().RIGHT_MARGIN = 140;
getSettings().PREFER_PARAMETERS_WRAP = true;
@@ -391,6 +403,33 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
doMethodTest(before, after);
}
+ public void testFieldAnnotationWithoutModifier() {
+ doClassTest("@NotNull String myFoo = null;", "@NotNull\nString myFoo = null;");
+ }
+ public void testTypeAnnotationsInModifierList() {
+ getSettings().getRootSettings().FORMATTER_TAGS_ENABLED = true;
+ String prefix =
+ "import java.lang.annotation.*;\n\n" +
+ "//@formatter:off\n" +
+ "@interface A { }\n" +
+ "@Target({ElementType.TYPE_USE}) @interface TA { int value() default 0; }\n" +
+ "//@formatter:on\n\n";
+
+ doTextTest(
+ prefix + "interface C {\n" +
+ " @TA(0)String m();\n" +
+ " @A @TA(1) @TA(2)String m();\n" +
+ " @A public @TA String m();\n" +
+ "}",
+
+ prefix + "interface C {\n" +
+ " @TA(0) String m();\n\n" +
+ " @A\n" +
+ " @TA(1) @TA(2) String m();\n\n" +
+ " @A\n" +
+ " public @TA String m();\n" +
+ "}");
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java
index 4c925fe931b2..df27bc351bb8 100644
--- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveClassTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -162,7 +162,7 @@ public class ResolveClassTest extends ResolveTestCase {
configureDependency();
PsiReference ref = configure();
PsiElement target = ((PsiJavaReference)ref).advancedResolve(true).getElement();
- assertTrue(target instanceof PsiClass);
+ assertTrue(String.valueOf(target), target instanceof PsiClass);
}
public void testTwoModules2() throws Exception {
@@ -203,7 +203,8 @@ public class ResolveClassTest extends ResolveTestCase {
PsiReference ref = configure();
long start = System.currentTimeMillis();
assertNull(ref.resolve());
- PlatformTestUtil.assertTiming("exponent?", 200, System.currentTimeMillis() - start);
+ long elapsed = System.currentTimeMillis() - start;
+ PlatformTestUtil.assertTiming("exponent?", 200, elapsed);
}
public void testStaticImportNetwork() throws Exception {
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java
index 8444c2b547c6..0423d0939242 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceParameterTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -13,15 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/*
- * Created by IntelliJ IDEA.
- * User: dsl
- * Date: 07.05.2002
- * Time: 13:59:01
- * To change template for new class use
- * Code Style | Class Templates options (Tools | IDE Options).
- */
package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
@@ -38,6 +29,7 @@ import com.intellij.refactoring.introduceParameter.IntroduceParameterProcessor;
import com.intellij.refactoring.introduceParameter.Util;
import com.intellij.refactoring.util.occurrences.ExpressionOccurrenceManager;
import com.intellij.testFramework.TestDataPath;
+import com.intellij.util.ObjectUtils;
import gnu.trove.TIntArrayList;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -45,6 +37,10 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
+/**
+ * @author dsl
+ * @since 07.05.2002
+ */
@TestDataPath("$CONTENT_ROOT/testData")
public class IntroduceParameterTest extends LightRefactoringTestCase {
@NotNull
@@ -53,247 +49,230 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
return JavaTestUtil.getJavaTestDataPath();
}
- private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal,
- final boolean generateDelegate) throws Exception {
- doTest(replaceFieldsWithGetters, removeUnusedParameters, searchForSuper, declareFinal, generateDelegate, null);
- }
-
- private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal, final boolean generateDelegate,
- String conflict) throws Exception {
- boolean enabled = true;
- try {
- configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
- enabled = myEditor.getSettings().isVariableInplaceRenameEnabled();
- myEditor.getSettings().setVariableInplaceRenameEnabled(false);
- perform(true, replaceFieldsWithGetters, "anObject", searchForSuper, declareFinal, removeUnusedParameters, generateDelegate);
- checkResultByFile("/refactoring/introduceParameter/after" + getTestName(false) + ".java");
- if (conflict != null) {
- fail("Conflict expected");
- }
- }
- catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
- if (conflict == null) {
- throw e;
- }
- assertEquals(conflict, e.getMessage());
- } finally {
- myEditor.getSettings().setVariableInplaceRenameEnabled(enabled);
- }
+ @Override
+ protected LanguageLevel getLanguageLevel() {
+ return LanguageLevel.JDK_1_7;
}
- public void testNoUsages() throws Exception {
+ public void testNoUsages() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testSimpleUsage() throws Exception {
+ public void testSimpleUsage() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testMethodWithoutParams() throws Exception {
+ public void testMethodWithoutParams() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testParameterSubstitution() throws Exception {
+ public void testParameterSubstitution() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testThisSubstitution() throws Exception {
+ public void testThisSubstitution() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testThisSubstitutionInQualifier() throws Exception {
- doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false, "field <b><code>Test.i</code></b> is not accessible from method <b><code>XTest.n()</code></b>. Value for introduced parameter in that method call will be incorrect.");
+ public void testThisSubstitutionInQualifier() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false,
+ "field <b><code>Test.i</code></b> is not accessible from method <b><code>XTest.n()</code></b>. " +
+ "Value for introduced parameter in that method call will be incorrect.");
}
- public void testFieldAccess() throws Exception {
+ public void testFieldAccess() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testMethodAccess() throws Exception {
+ public void testMethodAccess() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testStaticFieldAccess() throws Exception {
+ public void testStaticFieldAccess() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testFieldWithGetterReplacement() throws Exception {
+ public void testFieldWithGetterReplacement() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, false, false, false, false);
}
- public void testFieldWithInaccessibleGetterReplacement() throws Exception {
+ public void testFieldWithInaccessibleGetterReplacement() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testWeirdQualifier() throws Exception {
+ public void testWeirdQualifier() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testSuperInExpression() throws Exception {
- doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false, "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class");
+ public void testSuperInExpression() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false,
+ "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class");
}
- public void testNull() throws Exception {
+ public void testNull() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testWeirdQualifierAndParameter() throws Exception {
+ public void testWeirdQualifierAndParameter() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testImplicitSuperCall() throws Exception {
+ public void testImplicitSuperCall() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testImplicitDefaultConstructor() throws Exception {
+ public void testImplicitDefaultConstructor() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testLocalVarDeclaration() throws Exception {
+ public void testLocalVarDeclaration() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testInternalSideEffect() throws Exception {
+ public void testInternalSideEffect() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testQualifiedNew() throws Exception {
+ public void testQualifiedNew() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testAnonymousClass() throws Exception {
+ public void testAnonymousClass() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testSuperWithSideEffect() throws Exception {
- doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false, "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class");
+ public void testSuperWithSideEffect() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false,
+ "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class");
}
- public void testConflictingField() throws Exception {
+ public void testConflictingField() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, true, false, false);
}
- public void testParameterInFor() throws Exception {
+ public void testParameterInFor() {
configureByFile("/refactoring/introduceParameter/beforeParameterInFor.java");
performForLocal(true, true, true, false, false);
checkResultByFile("/refactoring/introduceParameter/afterParameterInFor.java");
}
- public void testParameterJavaDoc1() throws Exception {
+ public void testParameterJavaDoc1() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true, false);
}
- public void testParameterJavaDoc2() throws Exception {
+ public void testParameterJavaDoc2() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true, false);
}
- public void testParameterJavaDoc3() throws Exception {
+ public void testParameterJavaDoc3() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true, false);
}
- public void testParameterJavaDocBeforeVararg() throws Exception {
+ public void testParameterJavaDocBeforeVararg() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true, false);
}
- public void testIncompleteVararg() throws Exception {
- doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, true, false, true, false, "Incomplete call(method()): 2 parameters expected but only 0 found\n" +
- "Incomplete call(method()): expected to delete the 0 parameter but only 0 parameters found");
+ public void testIncompleteVararg() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, true, false, true, false,
+ "Incomplete call(method()): 2 parameters expected but only 0 found\n" +
+ "Incomplete call(method()): expected to delete the 0 parameter but only 0 parameters found");
}
- public void testIncorrectScope() throws Exception {
+ public void testIncorrectScope() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, true, true, false);
}
- public void testExpectedType() throws Exception {
+ public void testExpectedType() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true, false);
}
- public void testRemoveParameter() throws Exception {
+ public void testRemoveParameter() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false);
}
- public void testRemoveParameterAfterVariable() throws Exception {
+ public void testRemoveParameterAfterVariable() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false);
}
- public void testRemoveParameterInHierarchy() throws Exception {
+ public void testRemoveParameterInHierarchy() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false);
}
- public void testRemoveParameterWithJavadoc() throws Exception {
+ public void testRemoveParameterWithJavadoc() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false);
}
- public void testVarargs() throws Exception { // IDEADEV-16828
+ public void testVarargs() { // IDEADEV-16828
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testVarargs1() throws Exception { // IDEADEV-33555
+ public void testVarargs1() { // IDEADEV-33555
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false);
}
- public void testUseInInnerClass() throws Exception {
+ public void testUseInInnerClass() {
doTestThroughHandler();
}
- public void testLocalVarSelection() throws Exception {
+ public void testLocalVarSelection() {
doTestThroughHandler();
}
- public void testGenerateDelegate() throws Exception {
+ public void testGenerateDelegate() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, true);
}
- public void testGenerateDelegateRemoveParameter() throws Exception {
+ public void testGenerateDelegateRemoveParameter() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, true);
}
- public void testGenerateDelegateNoArgs() throws Exception {
+ public void testGenerateDelegateNoArgs() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, true);
}
- public void testEnums() throws Exception {
+ public void testEnums() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testMethodUsageInThisMethodInheritor() throws Exception {
+ public void testMethodUsageInThisMethodInheritor() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
}
- public void testGetterQualifier() throws Exception {
+ public void testGetterQualifier() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false);
}
- public void testArrayInitializer() throws Exception {
+ public void testArrayInitializer() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, true, false, false, false);
}
- public void testIncompleteEnumDefinition() throws Exception {
- doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false, "Incomplete call(Root()): 2 parameters expected but only 0 found\n" +
- "Incomplete call(Root()): expected to delete the 1 parameter but only 0 parameters found");
+ public void testIncompleteEnumDefinition() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false, false,
+ "Incomplete call(Root()): 2 parameters expected but only 0 found\n" +
+ "Incomplete call(Root()): expected to delete the 1 parameter but only 0 parameters found");
}
- public void testStaticFieldWithGetterReplacement() throws Exception {
+ public void testStaticFieldWithGetterReplacement() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testGenerateDelegateInSuperClass() throws Exception {
+ public void testGenerateDelegateInSuperClass() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, true, true, true);
}
- public void testGenerateDelegateInSuperInterface() throws Exception {
+ public void testGenerateDelegateInSuperInterface() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, true, true, true);
}
- public void testReplaceAllAndDeleteUnused() throws Exception {
+ public void testReplaceAllAndDeleteUnused() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testDiamond2Raw() throws Exception {
+ public void testDiamond2Raw() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testDiamondOccurrences() throws Exception {
+ public void testDiamondOccurrences() {
final LanguageLevel oldLevel = getLanguageLevel();
try {
setLanguageLevel(LanguageLevel.JDK_1_7);
@@ -304,39 +283,39 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
}
}
- public void testPreserveDiamondOccurrences() throws Exception {
+ public void testPreserveDiamondOccurrences() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testSubstituteTypeParams() throws Exception {
+ public void testSubstituteTypeParams() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testDelegateWithVarargs() throws Exception {
+ public void testDelegateWithVarargs() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, true);
}
- public void testSelfReference() throws Exception {
+ public void testSelfReference() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testSelfReferenceVarargs() throws Exception {
+ public void testSelfReferenceVarargs() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
-
- public void testSelfReferenceVarargs1() throws Exception {
+
+ public void testSelfReferenceVarargs1() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testSimplifiedResultedType() throws Exception {
+ public void testSimplifiedResultedType() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- public void testPackageReferenceShouldBeIgnored() throws Exception {
+ public void testPackageReferenceShouldBeIgnored() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, true, false, true, false);
}
- private void doTestThroughHandler() throws Exception {
+ private void doTestThroughHandler() {
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
boolean enabled = true;
try {
@@ -357,46 +336,87 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
}
}
- public void testEnclosingWithParamDeletion() throws Exception {
+ public void testEnclosingWithParamDeletion() {
configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
perform(true, 0, "anObject", false, true, true, false, 1);
checkResultByFile("/refactoring/introduceParameter/after" + getTestName(false) + ".java");
}
- private static boolean perform(boolean replaceAllOccurences,
+ public void testTypeAnnotation() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, false);
+ }
+
+ private void doTest(int replaceFieldsWithGetters,
+ boolean removeUnusedParameters,
+ boolean searchForSuper,
+ boolean declareFinal,
+ boolean generateDelegate) {
+ doTest(replaceFieldsWithGetters, removeUnusedParameters, searchForSuper, declareFinal, generateDelegate, null);
+ }
+
+ private void doTest(int replaceFieldsWithGetters,
+ boolean removeUnusedParameters,
+ boolean searchForSuper,
+ boolean declareFinal,
+ boolean generateDelegate,
+ String conflict) {
+ boolean enabled = true;
+ try {
+ configureByFile("/refactoring/introduceParameter/before" + getTestName(false) + ".java");
+ enabled = myEditor.getSettings().isVariableInplaceRenameEnabled();
+ myEditor.getSettings().setVariableInplaceRenameEnabled(false);
+ perform(true, replaceFieldsWithGetters, "anObject", searchForSuper, declareFinal, removeUnusedParameters, generateDelegate);
+ checkResultByFile("/refactoring/introduceParameter/after" + getTestName(false) + ".java");
+ if (conflict != null) {
+ fail("Conflict expected");
+ }
+ }
+ catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
+ if (conflict == null) {
+ throw e;
+ }
+ assertEquals(conflict, e.getMessage());
+ } finally {
+ myEditor.getSettings().setVariableInplaceRenameEnabled(enabled);
+ }
+ }
+
+ private static boolean perform(boolean replaceAllOccurrences,
int replaceFieldsWithGetters,
@NonNls String parameterName,
boolean searchForSuper,
boolean declareFinal,
- final boolean removeUnusedParameters,
- final boolean generateDelegate) {
- return perform(replaceAllOccurences, replaceFieldsWithGetters, parameterName, searchForSuper, declareFinal, removeUnusedParameters,
- generateDelegate, 0);
+ boolean removeUnusedParameters,
+ boolean generateDelegate) {
+ return perform(
+ replaceAllOccurrences, replaceFieldsWithGetters, parameterName, searchForSuper, declareFinal,
+ removeUnusedParameters, generateDelegate, 0
+ );
}
- private static boolean perform(boolean replaceAllOccurences,
+ private static boolean perform(boolean replaceAllOccurrences,
int replaceFieldsWithGetters,
@NonNls String parameterName,
boolean searchForSuper,
boolean declareFinal,
- final boolean removeUnusedParameters,
- final boolean generateDelegate,
+ boolean removeUnusedParameters,
+ boolean generateDelegate,
int enclosingLevel) {
final ElementToWorkOn[] elementToWorkOn = new ElementToWorkOn[1];
- ElementToWorkOn
- .processElementToWorkOn(myEditor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(), new ElementToWorkOn.ElementsProcessor<ElementToWorkOn>() {
- @Override
- public boolean accept(ElementToWorkOn el) {
- return true;
- }
-
- @Override
- public void pass(final ElementToWorkOn e) {
- if (e == null) return;
-
- elementToWorkOn[0] = e;
- }
- });
+ ElementToWorkOn.processElementToWorkOn(myEditor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(),
+ new ElementToWorkOn.ElementsProcessor<ElementToWorkOn>() {
+ @Override
+ public boolean accept(ElementToWorkOn el) {
+ return true;
+ }
+
+ @Override
+ public void pass(final ElementToWorkOn e) {
+ if (e != null) {
+ elementToWorkOn[0] = e;
+ }
+ }
+ });
final PsiExpression expr = elementToWorkOn[0].getExpression();
final PsiLocalVariable localVar = elementToWorkOn[0].getLocalVariable();
@@ -411,41 +431,46 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
final PsiMethod methodToSearchFor;
if (searchForSuper) {
- methodToSearchFor = method.findDeepestSuperMethod();
+ methodToSearchFor = method.findDeepestSuperMethods()[0];
}
else {
methodToSearchFor = method;
}
- PsiExpression[] occurences;
+ PsiExpression[] occurrences;
PsiExpression initializer;
if (expr == null) {
initializer = localVar.getInitializer();
- occurences = CodeInsightUtil.findReferenceExpressions(method, localVar);
+ assertNotNull(initializer);
+ occurrences = CodeInsightUtil.findReferenceExpressions(method, localVar);
}
else {
initializer = expr;
- occurences = new ExpressionOccurrenceManager(expr, method, null).findExpressionOccurrences();
+ occurrences = new ExpressionOccurrenceManager(expr, method, null).findExpressionOccurrences();
}
- TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, initializer, occurences) : new TIntArrayList();
+ TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, initializer, occurrences)
+ : new TIntArrayList();
new IntroduceParameterProcessor(
- getProject(), method, methodToSearchFor, initializer, expr, localVar, true, parameterName, replaceAllOccurences,
- replaceFieldsWithGetters,
- declareFinal, generateDelegate, null, parametersToRemove).run();
+ getProject(), method, methodToSearchFor, initializer, expr, localVar, true, parameterName, replaceAllOccurrences,
+ replaceFieldsWithGetters, declareFinal, generateDelegate, null, parametersToRemove
+ ).run();
myEditor.getSelectionModel().removeSelection();
return true;
}
- private static void performForLocal(boolean searchForSuper, boolean removeLocalVariable, boolean replaceAllOccurrences, boolean declareFinal,
+ private static void performForLocal(boolean searchForSuper,
+ boolean removeLocalVariable,
+ boolean replaceAllOccurrences,
+ boolean declareFinal,
final boolean removeUnusedParameters) {
final int offset = myEditor.getCaretModel().getOffset();
- final PsiElement element = myFile.findElementAt(offset).getParent();
+ final PsiElement element = ObjectUtils.assertNotNull(myFile.findElementAt(offset)).getParent();
assertTrue(element instanceof PsiLocalVariable);
PsiMethod method = Util.getContainingMethod(element);
final PsiMethod methodToSearchFor;
if (searchForSuper) {
- final PsiMethod deepestSuperMethod = method.findDeepestSuperMethod();
- methodToSearchFor = deepestSuperMethod != null ? deepestSuperMethod : method;
+ PsiMethod[] deepestSuperMethods = method.findDeepestSuperMethods();
+ methodToSearchFor = deepestSuperMethods.length > 0 ? deepestSuperMethods[0] : method;
}
else {
methodToSearchFor = method;
@@ -454,18 +479,14 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
assertNotNull(methodToSearchFor);
final PsiLocalVariable localVariable = (PsiLocalVariable)element;
final PsiExpression parameterInitializer = localVariable.getInitializer();
- TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, parameterInitializer, null) : new TIntArrayList();
+ assertNotNull(parameterInitializer);
+ TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, parameterInitializer, null)
+ : new TIntArrayList();
new IntroduceParameterProcessor(
- getProject(), method, methodToSearchFor,
- parameterInitializer, null, localVariable, removeLocalVariable,
- localVariable.getName(), replaceAllOccurrences,
- IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE,
- declareFinal, false, null, parametersToRemove).run();
- }
-
- @Override
- protected LanguageLevel getLanguageLevel() {
- return LanguageLevel.JDK_1_7;
+ getProject(), method, methodToSearchFor, parameterInitializer, null, localVariable, removeLocalVariable,
+ localVariable.getName(), replaceAllOccurrences, IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE,
+ declareFinal, false, null, parametersToRemove
+ ).run();
}
}
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/RenameMembersInplaceTest.java b/java/java-tests/testSrc/com/intellij/refactoring/RenameMembersInplaceTest.java
index f77166535cef..d15dc3c2969c 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/RenameMembersInplaceTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/RenameMembersInplaceTest.java
@@ -18,11 +18,15 @@ package com.intellij.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.psi.PsiElement;
+import com.intellij.refactoring.rename.JavaNameSuggestionProvider;
import com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler;
import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
import org.jetbrains.annotations.NotNull;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
/**
* User: anna
* Date: 12/4/11
@@ -76,6 +80,20 @@ public class RenameMembersInplaceTest extends LightCodeInsightTestCase {
doTestInplaceRename("bar");
}
+ public void testNameSuggestion() throws Exception {
+ configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+
+ final PsiElement element = TargetElementUtilBase.findTargetElement(myEditor, TargetElementUtilBase.getInstance().getAllAccepted());
+ assertNotNull(element);
+
+ final Set<String> result = new LinkedHashSet<String>();
+ new JavaNameSuggestionProvider().getSuggestedNames(element, getFile(), result);
+
+ CodeInsightTestUtil.doInlineRename(new MemberInplaceRenameHandler(), result.iterator().next(), getEditor(), element);
+
+ checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
+ }
+
public void testConflictingMethodName() throws Exception {
try {
doTestInplaceRename("bar");
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/WrapReturnValueTest.java b/java/java-tests/testSrc/com/intellij/refactoring/WrapReturnValueTest.java
index 1b0d7f1072fd..01c5907754f1 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/WrapReturnValueTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/WrapReturnValueTest.java
@@ -13,11 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/*
- * User: anna
- * Date: 20-Aug-2008
- */
package com.intellij.refactoring;
import com.intellij.openapi.vfs.VirtualFile;
@@ -30,7 +25,10 @@ import com.intellij.JavaTestUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-public class WrapReturnValueTest extends MultiFileTestCase{
+/**
+ * @author anna
+ */
+public class WrapReturnValueTest extends MultiFileTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
@@ -42,39 +40,43 @@ public class WrapReturnValueTest extends MultiFileTestCase{
return "/refactoring/wrapReturnValue/";
}
- private void doTest(final boolean existing) throws Exception {
+ public void testSimple() { doTest(false); }
+ public void testGenerics() { doTest(false); }
+ public void testInconsistentWrapper() { doTest(true, "Existing class does not have getter for selected field"); }
+ public void testWrapper() { doTest(true); }
+ public void testStrip() { doTest(true); }
+ public void testNoConstructor() { doTest(true, "Existing class does not have appropriate constructor"); }
+ public void testInnerClass() { doTest(false, null, true); }
+ public void testHierarchy() { doTest(false, null, true); }
+ public void testAnonymous() { doTest(true, null, false); }
+ public void testWrongFieldAssignment() { doTest(true, "Existing class does not have appropriate constructor", false); }
+ public void testWrongFieldType() { doTest(true, "Existing class does not have appropriate constructor", false); }
+ public void testStaticMethodInnerClass() { doTest(false, null, true); }
+ public void testRawReturnType() { doTest(true, "Existing class does not have appropriate constructor"); }
+ public void testReturnInsideLambda() { doTest(false, null, true); }
+ public void testTypeAnnotations() { doTest(false); }
+
+ private void doTest(final boolean existing) {
doTest(existing, null);
}
- private void doTest(final boolean existing, @NonNls String exceptionMessage) throws Exception {
+ private void doTest(final boolean existing, @NonNls String exceptionMessage) {
doTest(existing, exceptionMessage, false);
}
- private void doTest(final boolean existing, String exceptionMessage, final boolean createInnerClass) throws Exception {
+ private void doTest(final boolean existing, String exceptionMessage, final boolean createInnerClass) {
try {
doTest(new PerformAction() {
@Override
- public void performAction(final VirtualFile rootDir, final VirtualFile rootAfter) throws Exception {
+ public void performAction(final VirtualFile rootDir, final VirtualFile rootAfter) {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(getProject()));
-
assertNotNull("Class Test not found", aClass);
-
- final PsiMethod method = aClass.findMethodsByName("foo", false)[0];
-
-
-
- @NonNls final String wrapperClassName = "Wrapper";
-
- final PsiClass wrapperClass = myJavaFacade.findClass(wrapperClassName, GlobalSearchScope.projectScope(getProject()));
-
+ PsiMethod method = aClass.findMethodsByName("foo", false)[0];
+ String wrapperClassName = "Wrapper";
+ PsiClass wrapperClass = myJavaFacade.findClass(wrapperClassName, GlobalSearchScope.projectScope(getProject()));
assertTrue(!existing || wrapperClass != null);
- final PsiField delegateField = existing ? wrapperClass.findFieldByName("myField", false) : null;
- WrapReturnValueProcessor processor = new WrapReturnValueProcessor(wrapperClassName, "",
- null, method, existing, createInnerClass,
- delegateField);
- processor.run();
- /*LocalFileSystem.getInstance().refresh(false);
- FileDocumentManager.getInstance().saveAllDocuments();*/
+ PsiField delegateField = existing ? wrapperClass.findFieldByName("myField", false) : null;
+ new WrapReturnValueProcessor(wrapperClassName, "", null, method, existing, createInnerClass, delegateField).run();
}
});
}
@@ -89,61 +91,4 @@ public class WrapReturnValueTest extends MultiFileTestCase{
fail("Conflict was not found");
}
}
-
- public void testSimple() throws Exception {
- doTest(false);
- }
-
- public void testGenerics() throws Exception {
- doTest(false);
- }
-
- public void testInconsistentWrapper() throws Exception {
- doTest(true, "Existing class does not have getter for selected field");
- }
-
- public void testWrapper() throws Exception {
- doTest(true);
- }
-
- public void testStrip() throws Exception {
- doTest(true);
- }
-
- public void testNoConstructor() throws Exception {
- doTest(true, "Existing class does not have appropriate constructor");
- }
-
- public void testInnerClass() throws Exception {
- doTest(false, null, true);
- }
-
- public void testHierarchy() throws Exception {
- doTest(false, null, true);
- }
-
- public void testAnonymous() throws Exception {
- doTest(true, null, false);
- }
-
- public void testWrongFieldAssignment() throws Exception {
- doTest(true, "Existing class does not have appropriate constructor", false);
- }
-
- public void testWrongFieldType() throws Exception {
- doTest(true, "Existing class does not have appropriate constructor", false);
- }
-
- public void testStaticMethodInnerClass() throws Exception {
- doTest(false, null, true);
- }
-
- public void testRawReturnType() throws Exception {
- doTest(true, "Existing class does not have appropriate constructor");
- }
-
- public void testReturnInsideLambda() throws Exception {
- doTest(false, null, true);
- }
-
} \ No newline at end of file