Snapshot 117b3dbedca758fa08dd37d4a36cf4a2320fae03 from idea/136.1685 of git://git.jetbrains.org/idea/community.git

117b3db: IDEA-123994 Java 8 compact profiles support
fbeda14: WEB-11238 Live Console: avoid overlapping for the error and link to the file
555bcd7: WEB-11485 Debug Console missing horizontal scrollbar WEB-11238 Live Console: avoid overlapping for the error and link to the file (issue still actual in case of softwrap)
96b3c3d: move LineSeparatorPainter up
3171d15: create from sources: setup default (web) module if nothing special is detected (IDEA-91446, ZD-27093)
cb43848: testdata fixed
8cd1ee6: remove assignment: fix for assignment nested in expression, not statement (IDEA-123903)
14718472: testdata for IDEA-79251
953109a: fix file name casing
36db24a: fix not-disposed errors on quit
610d8f1: cleanup
f774ed3: dfa: reuse free eq class indices
81ae814: IDEA-123959 cannot create a new file
8718f8b: replace DfaMemoryStateImpl.areEquivalent with a more efficient version requiring less eq class traversals (IDEA-123826)
0b26e18: EA-55830 - PIEAE: PsiUtilCore.ensureValid
e512a2f: EA-55951 - CCE: StreamApiMigrationInspection$ReplaceWithForeachCallFix.applyFix
e7b3efb: EA-55962 - CCE: DefUseInspection$RemoveInitializerFix.sideEffectAwareRemove
0de9b5a: Start plugins wizard #15
b62e353: Start plugins wizard #14
1d23857: Start plugins wizard #13
199e9d8: generate visibility setting for create from usage, generate getter/setter/constructor (IDEA-120662, IDEA-64613, IDEA-122025)
a850470: testng/junit: do not start pattern evaluation if one element is selected
9fda587: extract variable: ensure replace all occurrences survive parenthesis around value (IDEA-122041)
51f15b7: ignore methods return Void (IDEA-124010)
d8a1d98: [vcs] IDEA-67409 Support Home/End keys in the Log.
c854a5c: Revert "[vcs] IDEA-67409 Support Home/End keys in the Log."
19714f2: closure recursion test
f13e5bf: IDEA-123484 abstract modifier for trait methods, some code duplicates removed
bc38735: IDEA-123484 trait fields and properties
d110706: cleanup
91085d8: IDEA-123484 anonymous from traits are not allowed
c958da2: IDEA-123484 highlighting for extends list of traits, inc/dec on trait field
c73b8b2: IDEA-123484 modifier inferring for trait members
3859660: IDEA-123484 initial. lexer, parser and psi for traits
1000337: extra code
7b25e0e: some overrides
15f3266: console leak fixed
d385ea2: EA-31437,IDEA-121511 - assert: DocumentFoldingInfo.writeExternal
8f8d834: sometimes distraction free mode stays forever
439f50d: Test fixed (rt.jar on Apple JRE, again)
4306f24: [vcs] IDEA-67409 Support Home/End keys in the Log.
475c2be: fix a copy paste misprint
7e742e3: [git] IDEA-98189 Retry up to 3 times if authentication failed
ac764f5: [git] better error text
7536b91: [git] remove an unused test class
ecc84d5: [git] Use GitImpl for all remote commands
85cad87: [git] IDEA-98189 Forget incorrect password
ccc5043: [git] refactor authenticator
fffcd49: Add "try" live postfix template
5686958: Start plugins wizard #12
8bad783: jb v8 debug protocol: function scopes
77256b2: check extra assumptions
ceb0932: typed field instead of Object, cleanup
74bfdbf: simplify, introduce runWriteCommandAction(ThrowableComputable)
75a0914: more readable temp file names: unitTest_defaultCharset_9 instead of unitTest234234234234234unitTest_213424
33980d3: re-detect file type on contents change
32f7b42: Cleanup (typos)
11fbadc: Cleanup (outdated comment; pointless assertion)
6495cfe: IDEA-123354 (content-based .jar check replaced with file type-based)
b8493b6: method refs/lambdas: apply ground types for completion
62db5ce: EA-55747 - AIOOBE: ControlFlowUtil.getUsedVariables
6e61173: cancel inspections progress if view was closed
3bedbab: EA-55910 - CCE: JavaDocInfoGenerator.generateValue
af91351: try to pass self name as default value during create parameter from usage (IDEA-123780)
89dc56b: test fix
81230c2: Make per language stack trace for InitialInfoBuilder (formatter) errors to separate reports in EA [CR-IC-5164]
29f708c: EnterInStringLiteralHandler should use language-specific option for operation sign (fixes IDEA-114783), [CR-IC-5159]
e2e37ae: External system: source package prefix support added
685f753: External system: source package prefix support added
998ca88: disable test in headless environment, as it fails there
b90a38f: EA-31437,IDEA-121511 - assert: DocumentFoldingInfo.writeExternal
6f86e2d: continue WEB-11784 slow nodejs debug: initial done properties loading
12d83e6: continue WEB-11784 slow nodejs debug: done frames loading
a9dd7ee: allow TTL customization
28edb41: fix quickfix on last Assert usage and static import
2330050: trigram builder builds trigrams over "identifiers"
4622ff0: IDEA-122202 Mercurial: on new repository creating by EnableVCS action it is impossible to work with it until project reopening
ab56115: inline local: do not try to delete declaration if this only; do not pretend to delete this when no reference selected
d4c2db8: new inference: eliminate wildcards elimination
eef0d12: new inference: eliminate wildcards at top level as they can't appear in type elements
0f8aed0: new inference: eliminate wildcards elimination
317d279: new inference: no need to eliminate wildcards as they are not used anyway
82fd80e: new inference: perform reduction and incorporation in one step
db79a6f: disabled incompatible plugins NodeJS (136.1205), Php (134.1456), JSTestDriver (136.1141)
ab4aada: [git] Simplify packed-refs line parsing a bit.
bf5c358: [git] Refactor GitRepositoryReader
06a2de7: [vcs] generify a method
42e3586: test dependency added
7c56b9f: interruptibility
8af01dc: removed dependency on lang-api
1e2959c: implement LocalQuickFix interface in addition to IntentionAction
f74d26f: AppCode: even more consistent Xcode keymap
e98fd4d: continue WEB-11784 slow nodejs debug: continue frames loading
b48e3e0: AppCode: more consistent Xcode keymap + keymap test
105221d: Keymap: 'IntelliJ IDEA Classic' schemes on mac are shown as 'IntelliJ IDEA Classic (Windows)' and 'IntelliJ IDEA Classic (OS X)'
b6d8e90: Platform: per-IDE keymap tests
97228b6: Keymap: Console.SplitLine uses shortcut of generic SplitLine
47438f5: WEB-11877 Emmet transforms escaped $ to 0 (zero)
7d8ab23: IDEA-123331 IOOBException   if cancel "paths affected in revision:..." process fixed
86357a2: remote-servers-agent-rt moved to platform
01c7467: include remote-servers modules to platform and include remote-servers-git to git plugin for small IDEs (IDEA-123977)
ec2a990: do not delete output files corresponding to non-existing sources, if these outputs are already associated with existing sources from other modules that have been already compiled: part 2: correctly clean the mapping when removing outputs corresponding to changed sources
5609d39: new jb-v8-debugger support: fix bootstrap
116a0fc: Test fix (rt.jar path on Apple JRE)
fb0efdd: EA-55889 - NPE: NavBarRootPaneExtension$.updateUI
fee6711: avoid too many "invalid jar"
3b24c80: performance: DCL
bdce1ee: get rid of pointless autoboxing
3ec7789: NotNull
d29890e: NPE
a077d24: tests
3e36dd7: IDEA-121445
150e69e: cleanup
f0b0f50: Merge remote-tracking branch 'origin/master'
f6c9348: IDEA-123912 Expression Evaluation does not have a default key binding
71800cf: IDEA-123691 Minor project wizard edits: Java (SE) category
59e7e94: Keymaps: * 'reset' action for each binding (IDEA-90069) * restoring selection on keymap filtering in UI
b05305e: Keymaps: * correctly handle bound action overriding in both parent and child keymaps * show bound actions in the UI when no parent action present
d21d35d: cloud detection in 'import project': don't access VFS if it isn't necessary
9d3b463: join declaration and assignment (IDEA-92226; IDEA-123689)
b708f20: remove unused assignment: do not move the transformed statement up as it could change the semantic and is not evident (IDEA-123841)
36771d7: eclipse: restore root path from .classpath or do not create module at all (IDEA-123946)
df1105f: do not write new setting to profile if it has not changed from the default value
71376ca: if there are any changed files after no-op UnindexedFilesUpdater, index them in the same dumb mode
8352036: Storyboard format
db886f9: EA-54870 (read lock)
3afd5e77: proper reading of compressed data
55a791b: use custom InputsIndexExternalizer during snapshot indexing
fee336b: ability to supply custom input index + TrigramIndex custom input index implementation
8887a5a: ability to use supplied bytearray
fcb939f: introduced / used ThreadLocalCachedByteArray
c02d91b: continue getFrame — continue WEB-11784 slow nodejs debug
8195023: switch selector error message (IDEA-123937)
964735c: compilation fix
44e9fff: compose scopes intersection when filter by file type is on (IDEA-119595)
36073fa: unwrap anonymous: replace return statements (IDEA-119558)
7a90a13: unwrap anonymous: do not remove declaration - try to replace initialization only (IDEA-47218)
f20f1bb: redundant cast: nested casts with outer primitive (IDEA-119857)
f3bc48e: no need in URLs? during description composition (IDEA-119992)
e5a6475: allow to inline this only variable (IDEA-120041)
c6828ca: parameter hides member: accept setters returning this (IDEA-120214)
f4a2254: Try to download JIRA issue in separate request, if query looks like ID.
fddf4bd: IDEA-123851 Link in Event Log seems to be not working correctly
64fdf83: Redmine REST API has no NATIVE_SEARCH support
22801d8: if there are any changed files after UnindexedFilesUpdater, index them in the same dumb mode
30f0b46: Don't repeat exception message twice
c32ada6: Cleanup (formatting; immutability)
12e7a78: IDEA-123825 - Git Clouds detect Git remotes - OpenShift and generic
f02a2d7: action registered in plugin.xml should always override update()
19140e2: Correctly extract project name from Redmine task
130eeba: IDEA-110736 Java autoformatter adds brackets when it shoulnd't, reverted fix for IDEA-87969
e8b5589: Merge branch 'svn_18_3'
f4f3750: Mark getter for cached projects as @Transient to prevent serialization
2878862: EA-55850 (diagnostic)
dc525c4: svn: Disabled "Save credentials" checkbox when requesting ssh credentials for command line (as ssh credentials caching is not supported by svn)
ee24417: svn: Make ssh credentials be saved in memory by default for command line (like for other repository protocols and SVNKit)
099d86d: IDEA-123784 Do not treat "svn cat" output as binary for Unix - as currently separate error and output streams are not supported
880d0ef: Fix infinite loop in MavenProjectsTree.findRootProject when there is more than one level of aggregate POMs
0918676: External System: fix classpath for remote communication
c8c92e9: IDEA-123691 Minor project wizard edits: more reliable sorting
886ea2c: Alex's fix about getting the physical path of a Gradle sub-project from a GradleBuild moved from Android plugin to Gradle plugin, see Change-Id: I2617fc929d18f23447d658ed2f4ae084b64847af and  Ifa59c4810615fa27f5f8d5753bc89ea85374ff39
38abbe6: IDEA-118529 Mercurial (hg4idea) slow with IJ 13: workaround for processing hg ignored files
5b9b1f1: IDEA-82961 Mute breakpoints turns off when when start a new debug session - xdebugger fix
4005a3f: restore cashed argument types, not for overload resolution
e0b83e7: new inference: remember mentioned constraints in set optimization
173e0be: new inference: optimization
3ffd666: IDEA-123886 (postpone .jar file type check until root creation)
9b747fd: Cleanup (JAR FS test moved to the flock)
76d2ce1: IDEA-123803 Popup goes behind its parent dialog for multyline editor
077fcc3: Platform: duplication spotted
9210149: WEB-11278 Bad performance expanding emmet
cc4033e: Platform: do not prevent project files from being written (IDEA-123489, IDEA-123899)
c8d9978: test finder: accept test classes from source roots
005dd85: Merge remote-tracking branch 'origin/master'
774099a: PyCharm 3.4 EAP logos.
555eac5: fix description file name
594451e: Package prefix support for external build systems
4cc78e5: IDEA-123477 Newly created Live Surround Template shows null in UI
155c419: IDEA-123344 Settings->File And Code Templates: group "Java EE" -> "Other"?
b5df84e: IDEA-123850 incorrect "Condition is always false" warning in GemRequirementsChangeWatcher.updateAndAttach()
c6c205d: refactor move inner for aspectJ
1977e48: escalate visibility for moved class (IDEA-119683)
288b080: test finder: accept potential tests as junit4 doesn't contain features of test until it contains test methods (IDEA-120123)
545753a: Cleanup (dependencies)
3194d62: IDEA-123674 (new "Usage of obsolete date-time api" inspection)
0e7c113: IDEA-123364 (Mismatched update of collections inspection no longer works)
4935bbc: do not delete output files corresponding to non-existing sources, if these outputs are already associated with existing sources from other modules that have been already compiled (example: moving some class to a dependent module with the same output root)
45cb352: IDEA-123773 The "Show Whitespaces" broken
0f869eb: schedule index rebuild after assertion
5c53c0d: better fix for IDEA-101698 & IDEA-123573
4c92967: Merge remote-tracking branch 'origin/master'
d9fe702: push down: interface constants in class should appear with public-static-final (IDEA-123758)
eb9a0ab: IDEA-123838 Iteration over 'keySet()' may be replaced with 'entrySet()' iteration quick fix produces wrong code
01b6c67: continue: speed up scope variables loading
62b2aa6: vfs: .jar validity check without opening ZipFile
99e72e6: IDEA-97465 Can't edit variable values in debugger with double click (F2 is required) - get back double click on empty space
b19d559: IDEA-82961 Mute breakpoints turns off when when start a new debug session - better option name
42ede18: do not save new defaults
bfac5ce: EA-55604 - assert: CopyFilesOrDirectoriesHandler.doCloneFile
e672f58: WEB-11278 Bad performance expanding emmet
8d09421: Make CustomTemplateCallback immutable
99b97a5: Enable emmet completion in autopopup only
b2bfd33: Merge remote-tracking branch 'origin/master'
0d66941: IDEA-123839: abstract&default combination
75f267c: testdata for IDEA-123848
5e4751f: testdata for IDEA-123869
675cd38: too aggressive: show popup when shift is pressed only
36466df: redundant type args: check also method reference qualifiers
d84cfe4: method refs: do not loose information about type arguments given by ReferenceType in receiver
a3348c5: lambda-> method ref: do not insert type args to reference type if they were inferred for lambda expression
08f5dad: show default tool name if XML contains empty group name
9e36eb1: catch CancellationException
86e8dd8: IDEA-123691 Minor project wizard edits: moving settings to the first page
c67ada4d: Merge remote-tracking branch 'origin/master'
9ce01ad: Merge remote-tracking branch 'origin/master'
aab16ff: IDEA-123867 Alignment between editor main are and gutter is lost while scrolling
8273986: IDEA-122292 Plugins list: checkbox missing padding/not usable
18f831a: Update Gitlab repository to use new API with server-side pagination
5d09a00: unused code cleanup
ef53a1f: IDEA-111803 Breakpoint indicator on the right gutter - better fix
442ad37: minor cleanup
003db18: IDEA-123866 Map Help button of the Server Certificates page
49eaa91: [git] migrate GitRepositoryReaderTest to use JUnit Parametrized
90365a7: [git] more test data for GitRepositoryReaderTest
13eb661: [git] GitRepositoryReaderTest rewrite
d89e625: [git] remove some weird test case
b228286: Storyboard format
9cebef6: Request handlers in ResponseUtil don't throw JsonSyntaxException
86a4529: IDEA-123468 Correctly interpret id and iid as task's ID and task's number in Gitlab issues
d2769ac: Refactor local task's project name and number to stored fields instead of computable properties, so they can be persisted in settings.
42c1335: correct font sizing when copying as HTML
471e1f9: IDEA-123820 Typeless Groovy catch parameter is Exception
91d363f: get rid of unnecessary invokeLater, check whether the module is disposed
0d2d5d3: less duplicated code
6b7e24c: IDEA-82961 Mute breakpoints turns off when when start a new debug session
8b124a1: use snapshot mapping for IdIndex / TrigramIndex for storing keys, right now switched on by the flag
f8863d6: gradle: avoid distributions downloading in tests
3201ec7: init: speed up scope variables loading WEB-11784 slow nodejs debug
88b4b72: IDEA-111803 Breakpoint indicator on the right gutter
a11b289: Merge remote-tracking branch 'origin/master'
09215e7: another attempt to reimplement IDEA-53663
397567d: tuple and map types improved. Used VolatileNotNullLazyValue instead of AtomicNotNullLazyValue to avoid deadlock Got rid of GrTupleTypeWithLazyValue. All the functionality is moved to GrTupleType
458ffce: known recursion manager prototype
c8e27bf: ability to store PHM<Key,Integer> in more compact format
542bb74: run pushers in background
ea048db: move more logic from CacheUpdateSession to CacheUpdateRunner
17ae7cb: renamed
18bec53: User/password dialog
7e74562: Merge remote-tracking branch 'origin/master'
ee8955d: rerun failed tests: include all parameterized if one have failed (IDEA-121214)
e1aa830: Platform: not-null SimpleProgramParameters.getEnv
025232d: IDEA-123818 Inspection "JUnit TestCase with non-trivial constructors" should not report error when used in a Parameterized test
925a186: copyright: allow to skip files with existing copyrights (IDEA-121912)
02724fc: try to start javafx without main (IDEA-101939)
b824958: infer nullity: preview with ability to exclude some usages(IDEA-123110), remember "annotate local" checkbox
0b4a7df: setup javadoc url for javafx for java 7 as it was distributed without sources (IDEA-123290)
c5de91a: tests: common TeamCity detector
f6154f9: Cleanup (test)
d35ae28: IDEA-122914 (unclosed ZipFile: JarFile usages)
c6175fb: Storyboard format
7a23ecf: IDEA-123825 - Git Clouds: detect Git remotes
5c22e17: IDEA-91835 Debugger: Support caret at the 'View Text' control
d51ce75: IDEA-51509 (IG: "String concatenation in i18n context" could suggest annotation quick fix for more variables)
6ff0475: IDEA-55853 Value displayed by custom type renderer is not copied to clipboard
a7f8535: CheckingHandlerUtil.disableWhenDumb
617d0e0: GitChangeProviderTest: rethrow init exception
aa81e27: GitChangeProviderTest, GitHistoryUtilsTest: prevent project leaks when failing
c0e93d8: more cleanup in fixture-based test tearDown (e.g. local history)
6435abb: GitBranchWorkerTest: recover from setUp exceptions and prevent project leaks
8615c5f: ssl backend: sing outgoing traffic
c807e88: IDEA-123691 Minor project wizard edits: project type list refactored
a0e0851: IDEA-123803 Popup goes behind its parent dialog for multiline editor
7732839: IDEA-122856 Hard to catch layout delimiter in portrait mode
6f6e2c0: IDEA-123647 Mercurial merge fail
6f7f761: IDEA-123338
52951cf: allow to replace strings with non-final static 'constants' (IDEA-119480)
69f8d95: plugin updater: prefer plugins from hosts (IDEA-123350); ensure download progress is cancelable
f2711a0: svn: Removed attempt to get "svn info" for HEAD revision in case of no local "svn info" found
c4c0770: debugging OfflineModeTest
0d61815: versions for file type detectors + usage of them for file type index
312acda: Reimplement emmet completion with new CustomLiveTemplate api
c96efa1: Disable autopopup in Xhtml
3e2b169: remove null icons
54afffa: platform: missed BindException bug info updated
83c4db5: platform: screen insets bug info updated
e781fb9: use default tool name instead of blank
2579106: cleanup
84eb84b: remove null icon
9f55d61: fix Tab behaviour when there's selection (fixing test data)
546701d: Use SyncDateFormat in TaskUtil to make date parsing thread safe
2309f91: fix distraction-free extra size not being updated
1d0e6e8: get rid of intermediate markup representation (IDEA-67767)
19a7bdf: get rid of intermediate markup representation (IDEA-67767)
7aabb42: CR-IC-5125 (cleanup)
f1907dd: IDEA-123710 Execute "lock" and "unlock" commands under terminal (if configured) as they require authentication
44dbc43: remove EditorChooseLookupItemAlways action
efacd01: IDEA-123615 (Proxy settings are not exported)
3682593: Disable Basic Authentication in JIRA connector once JSESSIONID cookie was received to maintain session
33da443: Add some missing @Nullable/@NotNull annotation and JavaDoc in tasks API classes and concrete repositories
0c7f52f: Add @Nullable/@NotNull annotations to JIRA API classes
1b9067e: Add test of deadlock detection to CertificateTest
c1b86a9: IDEA-123467 Add option in CertificateManager to accept all certificates automatically (not showing dialog)
75bf2d6d: Delayed requests to servers from Open Task popup using Alarm and FutureTask
527f08f9: fix Tab behaviour when there's selection (fixing test data)
76d86a5: initial WEB-4369 Support 'Jump to source' in JavaScript debuggers for object properties
4fa68a6: invokeOnEdt — always check passed condition
ec8500e: empty tool name protection
3fe9754: notnull
e6896ab: cleanup
699e022: make usable in upsource
944bdb4: cleanup
004ae7b: IDEA-90254 Feature suggestion: add names and groups to breakpoints - speed search
a9c5e47: IDEA-90254 Feature suggestion: add names and groups to breakpoints
be04021: Platform: meta-backspace remapped to Delete in Mac OS X 10.5+ keymap (IDEA-102003)
b3c2e61: fix Tab behaviour when there's selection
390d102: IDEA-122405 Indent selection is disabled in IDEA 13.1
4961cdc: Fix tips.
b9117c1: Fix editor leak in tests.
0a57685: Dispose correctly console view.
82b66b9: Print disposable stack trace in case of unreleased editors.
43c2a5f: Merge remote-tracking branch 'origin/master'
4efdfe2: Fixed path mappings for remote interpreters (PY-12550).
f59ef7c: fix compilation for uncommitted code
af109cb: Fix NPE on vagrant based interpreter creation (PY-12625).
cae4610: extracted content hashing code into util class
6fb1478: introduced hasSnapshotMapping
ce5cda1: extracted InputIndexDataExternalizer
4566871: do not switch scopes when focus is not requested/assume it is autoscroll from source (IDEA-123380)
bdfa121: IDEA-123403 TestNG integration ignoring test classes without default constructor when using testng.@Guice
79a999d: don't use AtomicReferenceFieldUpdater — field name could be changed, use our util class
025e804: PasswordSafe: implement memory / master password timeouts
3a1128a: so long, and thanks for all the fish
8d7f369: Merge remote-tracking branch 'origin/master'
5329af0: remove links to old artwork
70a621d: Merge branch 'patch-1' of https://github.com/mounte/intellij-community into mounte-patch-1
fbb72f1: Merge remote-tracking branch 'origin/master'
c871aed: IDEA-122856 Hard to catch layout delimiter in portrait mode
d511bdc: debug VisitingTest
8278ee9: use trove maps/sets to save some memory
c928235: register JList as generified compared to java 1.6
d4adc24: compilation fix
e8d0e26: generate test templates: include static imports on Assert-s to provide simple completion, optimize imports on the fly would remove them though
666addd: invert boolean: ensure to invert default boolean initializer (IDEA-123510)
5a0fe43: check access class for super expressions referenced to interfaces
ef82d76: java 8: anonymous class fields could be available later in next lambdas (IDEA-123731); narrow down scope of chained calls to the containing statement
d9cd272: IDEA-100036
07600e5: testdata for IDEA-123731
6d7cfc9: java 8: anonymous class fields could be available later in next lambdas (IDEA-123731)
258af30: testng/junit: <no module> choice when all in project selected (IDEA-88524)
6ab05a2: chooser to redebug failed tests (IDEA-100278)
fcc536f: Merge remote-tracking branch 'origin/master'
53a8f26: fixed project creation with detected sdk
11e10c9: RUBY-15187 File -> New command is disabled when editing a file
70107c7: console LineSeparatorPainter — remove from editor markup model, but not from document
2814b3d: IDEA-123543 Navigate to the Grails plugin page!
41e2698: patch local history tests; remove sync indexing
0b22926: WEB-11810 Node.js debugging doesn't work
eb2735c: Merge remote-tracking branch 'origin/master'
070603e: ability to find a component by its id
8da69d7: fixed PY-12544 Access to a protected member: false negative for import statements
dc15d42: RUBY-15202: some parsing tests do want to lowercase first letter
9a3d73e: Merge remote-tracking branch 'origin/master'
4220a13: Remote interpreters dialog redesign (PY-12462).
c613ae1: Minor optimization +review CR-IC-5136
89639df: no exceptions in log
1e6e14d: make tests platform-independent (IDEA-67767)
926d1e5: Code formatting
8e895ee: IDEA-48247 Maven: resources builder: support outputDirectory parameters of maven-resources-plugin; updated for review comments
d535632: New icons
5baf0cd: fixed PY-12500 Instance attribute defined outside init: generate python 3 super call without arguments for python 3 interpreters
10e91a9: Merge remote-tracking branch 'origin/master'
4f52352: fixed PY-12449 Create Virtualenv: do not run skeleton generator when selecting not added base python interpreter
cb14faf: make FontMapper compile and work with JRE 1.6 (IDEA-67767)
4ba6c03: sync nashorn debugger support ValueType
33f6d78: testdata for IDEA-64103
e860377: testdata for IDEA-123366
cdf4412: provide project for TestStatusListener
67da469: jump to source: ability to jump to native V8 script (actual only for V8 debugger protocol)
e1ca784: specify Locale.ENGLISH (it's a locale insensitive string)
2796b2e: Gradle: code clean-up
71f3f29: Gradle: code clean-up
67bc41e: new iteration model based on ChooseByNameItemProvider
7ddbfd5: dfa: don't suggest to replace reference qualifiers with null
73850cb: IDEA-123163 Use new single file content root in "open single file in temp project"
c208dce: IDEA-27445 Breakpoint groups - added support for default group
e56d173: cleanup
c86fff8: better detection of binary files
7035c3a: ignore io exceptions on file type detect
065f021: CR-IC-4781 Formatter diagnostics improvement: check cases when PSI tree/model doesn't match the document
61bef59: WEB-11268 Live Templates in auto-completion interfere with Emmet/Zen expand
b3a4361: util: universal .jar URLs splitter
2aeb018: IDEA-48247 Maven: resources builder: support outputDirectory parameters of maven-resources-plugin
6e4249e: diamonds: wrong constructor selected (IDEA-123518)
7e0d323: fixed PY-12637 PEP 8 naming inspection: scandinavian letters
6ca24c1: fix local history tests: don't do initial vfs refresh in unit test mode (as it was previously)
8dbc39fc: Merge remote-tracking branch 'origin/master'
09ddfbd: IDEA-123641 Breakpoints groups: for the java/javascriptExceptions nodes the MoveToGroup action is enabled but doesn't move AnyException subnodes
0e8173a: Merge remote-tracking branch 'origin/master'
4ed1669: C++: hangup at compiler launch is fixed (rollback Dmitry.Semeniouta changes) +review CR-OC-1448
5bc3f1d: EA-55239, EA-55618 - IllegalArgumentException
195ca9b: TestFramework: cleanup, copyrights, use org.junit.Assert
c19f73d: convert to light test
68576b4: Merge remote-tracking branch 'origin/master'
53d6460: cleanup imports
24e8549: cleanup imports
0bc5d9d: IDEA-119544 Terminal title font doesn't revert to usual size after presentation mode
7d28015: cleanup imports
9ec0421: attempt to fix WEB-11784 huge array cause 100 cpu debug
bb65da0: cleanup — nullability
9c5cd3f: Cleanup (docs)
4b3cbd3: templates to create new test classes (IDEA-107251)
bb0af0a: dependencies: do not highlight return type params - already shown (IDEA-123577)
a0dd4c5: use snappy in java implementation
9e4e295: Merge branch 'svn_18_3'
9fb6bdb: svn: terminal: Do not destroy process in terminal mode if some data is available in error stream - as subsequent interactive prompts could occur
144216c: Merge remote-tracking branch 'origin/master'
45cb54c: PY-12565 Django: default template names for generic class-based views are not resolved
93f8191: IDEA-123511 (DynamicRegexReplaceableByCompiledPattern should ignore String.split in some cases)
f589bf2: C++: hangup at compiler launch is fixed +review CR-OC
6b882a3: Merge remote-tracking branch 'origin/master'
479984f: literal expression won't be created from string with line break
58e7a1e: NPE: usage in foreign language (IDEA-123604)
6fd18d1: unused parameter: do not highlight if method is used locally by method reference (IDEA-123265)
e14e21a: ensure that tree is not flattened when action to switch is disabled (IDEA-123549)
2fa8491: IDEA-112552 "Replace with lambda" should use expression lambda when possible
b26f696: improve distraction-free UE: fix blinking & enlarge breakpoint area
16dca7c: IDEA-123641 Breakpoints groups: for the java/javascriptExceptions nodes the MoveToGroup action is enabled but doesn't move AnyException subnodes
6f41e9e: Compilation fix
26aaa68: Cleanup (formatting)
6509542: IDEA-101642 Floating windows disappear/change positions on dual monitor
a0b16a0: IDEA-123466 Sheet dialogs doesn't transfer focus back then closed
e46486e: Merge remote-tracking branch 'origin/master'
7b697a5: compilation fix
cf0ab3d: IDEA-67767 Copy syntax-coloured code block to clipboard as rtf
f80bf32: functional expressions: include in find results when implementing classes/implementing methods options are on
ab86d61: functional expressions: implementations view
39f354b: functional expressions: ensure that method to search is functional (not default or static)
c8bbd66: anonym -> lambda, method ref: do not suggest replacement when default method is called out of functional interface context
e9996cf: enter distraction-free mode in presentation mode
0a7b14c: refresh editors on successful registry changes
30fe8ea: fixes for distraction-free & presentation mode: file-editors only & etc.
812e2bd: clear() method should update 'myContentSize' only once
a562a5e: IDEA-123337 fast constructor references for map literals
e217b44: IDEA-123337 getReference should work fast
21c1cbf: IDEA-123337 lazy type inference for map literals
6e96d42: fix on demand import
14f4d6b: UnindexedFilesUpdater -> DumbModeTask; faster refresh handling
7a17712: index only valid files
5b12890: disable closure folding on Java 8 as confusing
5e0ad33: IDEA-12514 Can't generate EOF input in Console panel - ^D doesn't work - default shortcut
282ba94: svn: terminal: Do not guess process output type by line content for windows (as implementation already provide separate streams for output and errors)
85d01c0: IDEA-12514 Can't generate EOF input in Console panel - ^D doesn't work
b200296: Merge remote-tracking branch 'origin/master'
56b33a8: Add missing feature declaration in YouTrack repository
1c0f050: Merge remote-tracking branch 'origin/master'
70a1264: IDEA-12514 Can't generate EOF input in Console panel - ^D doesn't work
2814589: IDEA-44718 Maven: provide possibility to navigate from profile node in MavenProjects tree to the corresponding profile
357fcee: Short method documentation
9b9cf22: Merge remote-tracking branch 'origin/master'
74b0d4b: do not run skeleton generation twice while creating virtual env
d5c9775: for now test failure is expected
af075b6: Fix maven test
97584df: fixed PY-12452 Replace browse button for interpreter selector with details icon in project creation dialog
c6a98b1: fix presentation
1132fd5: Merge remote-tracking branch 'origin/master'
be050f6: compilation fix
61243fb: IDEA-123619 Simplify adding stepping filters
aad1a93: make the dialog non-modal to compare traces
8bb23c3: IDEA-123444 Item “more…” on Search Everywhere does not work
732de39: Real font families by generic names (cherry picked from commit 286ecf7)
c09045e: console insert user text test
172a01d: functional expressions & @FunctionalInterface based conflicts for pull up/push down refactorings
e55748f: functional expressions: pull up conflicts
05fb5ed: functional expressions: push down conflicts
d8ed05d: functional expressions: allow to delete/change signature of default methods of functional interfaces
c213495: functional expressions: reject to inline to anonymous if corresponding functional expressions exist
149197d: IDEA-123519 improvement
1337076: use thread local cached value for AppenderStream
cbc6d61: removing all temp enumerator / persistence map files created during tests run
9ad5194: avoid multiple notificationgroup registration
e91d207: IDEA-44718 Maven: provide possibility to navigate from profile node in MavenProjects tree to the corresponding profile
92cdb96: IDEA-123519 Sheet dialog: default button and focused buttons are incorrectly set
87d9dc6: SearchEverywhere shows Searching... if the popup is empty
b40f6a5: external system: testFramework test dependency added
fc7d372c: remove wrong @TestDataFile (CR-IC-5117#c24906)
04acba8: cleanup
6d24b11: Merge remote-tracking branch 'origin/master'
bf1b30b: fixed PY-12628 Ugly interpretator configuration
edff3da: DomFileFattern
6cf89cca: fix testdata
99e8efe: don't optimize imports and rearrange on commit in dumb mode
034c76d: DumbService: don't prepocess progress fraction, it only hurts in DumbModeTask's
fe49955: kill old DirectoryIndex
810d328b: format, @TestDataFile
d7f1281: reorder table items & fix renderers
0773a6f: functional expressions: include in class hierarchy
feb2a09: disable convert interface to class for @FunctionalInterface-s
3692adc: @FunctionalInterface -> CommonClassNames
417e7a2: warn when converting from interface to class in presence of functional expressions
a7875b5: functional expressions: show in method hierarchy
da399c3: functional expressions: show them in hierarchy view (IDEA-95127)
2a89426: safe delete: warn about functional expressions
cd3eac2: IDEA-118774 Warning about lack of subclasses when using lambdas
c064f3c: better place for license info
89a7ea9: update artworks
8de7f77: Cleanup (formatting)
fed172f: Fix icon of 'Browse styles' toolwindow
29250fe: Add options to disable/enable using maven-surefire-plugin configuration when execute JUnit Run Configuration.
128f2c1: Merge remote-tracking branch 'origin/master'
9bf99a9: fixed PY-12448 Create Virtualenv: NASE at com.jetbrains.python.sdk.CreateVirtualEnvDialog$4.actionPerformed
51ce094: Merge remote-tracking branch 'origin/master'
19d410e: fixed PY-12477 Project Interpreter is not set when attaching created project to currently opened one
c908880: Merge remote-tracking branch 'origin/master'
9553c3f: IDEA-123467 Add two checks to prevent deadlocking with MediaTracker threads
68de0c5: IDEA-123467 Add key 'ide.certificate.manager' in registry to disable CertificateManager usage
8f03500: Add internal action to simulate deadlock caused by CertificateManager
43f09a2: compilation fix
89d58d467: do not treat anonymous classes as functional
6397808: Merge remote-tracking branch 'origin/master'
90f3c6f: laziness & compilation fix
0ee17fd: fixed PY-12477 Project Interpreter is not set when attaching created project to currently opened one
693c5f3: bring back changed files sync reindexing (local history tests are failing)
7f99a09: correct relative point for window
2f3d180: IDEA-123355 Postfix template expansions .null/.notnull after 'else' fail to provide a valid Java output
ec1d492: search for functional interface implementations by lambdas and method references: change signature/find usages; to be continued (IDEA-104286; IDEA-90824)
737a7d5: IDEA-123529 No Retina Icon for Changed File
cfb44bf: update icons
d386f9e: IDEA-123116 method processed from static imports has special priority
1e550ab: cleanup
eedead7: IDEA-123337 Lazy tuple types
3ad4478: some @notnulls
5ad0c0f: cleanup
5e7f2b7: Groovy: optimize declaration processing
98a6a14: Groovy: cleanup non-code members processing
02a2aa2: remove redundant field myName. Name property is already declared in the superClass
75fba02: notnull/nullable for NonCodeMembersContributor
5b9cf2b: get rid of myTypedContext field in MethodResolverProcessor and corresponding code, some code cleanup
fbb5045: SimpleModificationTracker added to util
73f8ed4: IDEA-122995 "Grab dependencies" intention should work on any red class reference
d2abb03: NPE
f167774: Favorites: DnD fixes
30e96ba: some still make use of the horizontal scrollbar from time to time
3b3db9c: Dart — scope object could be primitive (for example, Integer)
ace1780: Favorites: alphabetical sorting for favorite lists
16ad824: Platform: taking OS X scrollbar click behavior into account (IDEA-56288)
318b7b7: default value for Karma splitter
edb1f6b: suppress postfix templates [r=ignatov]
3d258b9: IDEA-123268 (Wrong "magic number" triggering)
f299a3b: Android-Gradle: use external project notifications for project sync messages
8e3a6d1: Fix several typos in JavaDoc
feb9b63: IDEA-71597
3b86f6c: cleanup
de04dfe: NPE
34e550f: notnull
12c80e7: seems html attributes spec is too aggressive, let's use alpha as attribute start
f2c19c1: move JavaScriptDebugAware to community (required for kotlin&nashorn)
7c0dece: fix NPE
141fa22: ^174 "from my point of view it would be better to make inner MyFullValueEvaluator class static and change constructor signature to accept Value instead of int actualLength."
7371df1: IDEA-123160 Find Usages doing nothing in 13.1
88f8d64: cleanup
b67d8ba: External project notification: code cleanup + added message counter methods
47c0c85: external system: add check for disposed application before  document save handling
276af49: show execution point for VM script file and http files
77c13bc: cleanup — notnull
1850bd7: distraction free mode improvement: don't blink during editor switching
cfe2889: IDEA-123160 Find Usages doing nothing in 13.1: do not throw exception in production.
7f2cc84: IDEA-123160 Find Usages doing nothing in 13.1: do not throw exception in production.
573c488: Change time measurements in logging to display time of request to single server
e650594: AppCode: initial Reveal integration (incorrectly committed code removed)
d2e05d8: AppCode: initial Reveal integration +review CR-OC
b3df989: Platform: NSWorkspace class to work with cocoa
e0dfdb9: IDEA-123508 DevKit: improve extension point quickdoc
4f72805: before reporting "already disposed", check if it's a canceled background process that could be gracefully finished by PCE
85740b0: remove CacheUpdater in v.15
6514533: better logging for detecting sporadic indexing updates
ee4d472: display "Indexing..." while indexing
67ac560: avoid dumb mode on small vfs changes
1fdef60: don't do optimized groovyc classloading on java 5 where util.jar can't be loaded
d2bfdb3: removed GrReferenceExpressionImpl println
ed1187a: FileManager.forceReload, move and simplify
edd39ff: ReferencesSearch should default to allScope
a10e679: IDEA-123273 (correct handling of UNC roots in FileUtil and file pointer manager)
af1a5eb: Cleanup (formatting; dead code)
e561d7e: Merge remote-tracking branch 'origin/master'
192a47c: JediTerm updated to version 2.0.
d3a2e4b: Merge remote-tracking branch 'origin/master'
5a3cd13: Templates obtained recursively
93c9741: track the reason of index updates
bcb2530: introducing ThreadLocalCachedValue
b8e2be3: Experimental utility method about system keyboard layout
7181aba: Merge remote-tracking branch 'origin/master'
a85f897: Removing custom impl. of TargetElementUtilBase to fix tests
a40b71a: fix offset contains condition
05ab3eb: report in more cases
f38f05c: expand negative names list
fcd5061: name suggestions for static non-final fields should escape _ (IDEA-123441)
8021c7c: allow final fields serialization (e.g. used by HighlightSeverity)
46f47a9: same custom file types as we have in community
5e5838a: made html lexer more closely follow html attribute syntax spec
b2459ce: IDEA-123017 Mac sheet-dialogs do not correctly handle line breaks
f187f25: IDEA-103016 Tooltip/label for Toggle Fullscreen Button in Main Toolbar is inverted compared to 'real' status
d2ee60b: Storyboard format
d8a6130: IDEA-123409 Sheet dialogs: Order of buttons and their sizes are incorrect
6e4e343: Merge remote-tracking branch 'origin/master'
f32b903: sync field filter with xmlb.BeanBinding: skip transient and @Transient fields
c3a806c: EA-55600
49e4236: EA-55548 - IOOBE: SegmentArray.offsetOutOfRange
a89888e: Sizes and layout of buttons for IDEA-123409
6c78461: Revised Color & Font import API
86a9401: allow to run parameterized tests from plugin
dd53240: EA-55041 - IAE: TypeConversionUtil.isAssignable
9de341b: EA-54930 - IOE: PsiJavaParserFacadeImpl.createExpressionFromText
83a1f2a: EA-55521 - IAE: TypeConversionUtil.getSuperClassSubstitutor
c97a567: fixed PY-12478 Test Runner detector gets info about installed package from wrong project interpreter for multi-project
5a3a16e: move script-debugger-* to community — fix build scripts, add modules to community project
b5a437a: move script-debugger-* to community
5e120d3: WEB-2100 Node.js debug: value is truncated, but IDE does not suggest to see full value WEB-11392 Node.js debugging: Copy Value doesn't copy the entire string
a87079b: fix compilation
bc234fe: WEB-6069 CoffeeScript Debugger doesn't show value of the variables
842010b: fix NPE
8b94534: cleanup, ExecutionStackImpl must not hold topFrame — check actual on get
5045ed4: WEB-11133 JS Debugger: Variables view is not properly updated after setting value
4b47fd6: WEB-11133 JS Debugger: Variables view is not properly updated after setting value
5b27729: cleanup — must be named as VmBase
d2a450f:  continue: local variables defined in the console should be available for resolve/completion/variables view
4df77a8: getCacheState -> getCacheStamp
aafa722: cleanup — remove getGlobalEvaluateContext
4e48d7e: getCacheState -> getCacheStamp
c9fe4c9: init: local variables defined in the console should be available for resolve/completion/variables view
e020ca2: release object after global variables calculation
4e0bc81: release object after global variables calculation
e33c085: honor context.watchableAsEvaluationExpression
60308ca: WEB-11399 Live Console: variables defined in the console are not autocompleted (global context)
2f11f9a: WEB-11399 Live Console: variables defined in the console are not autocompleted (global context)
50d6e15: StandaloneWipTab - add logging
5496bef: library scope is not watchableAsEvaluationExpression
0576bc5: variables sorting — prefixed '_' must last, fixed case sensitive natural compare cleanup
193062e: move createAndAddScopeList to ScopeVariablesGroup
e65a4fa: WEB-7303 — node-webkit debug works
c231831: continue WEB-7303: reduce dependency on ExtBackedChromeConnection, move navigated() up
3e26b8d: continue WEB-7303: reduce dependency on ExtBackedChromeConnection, move navigated() up
d16a88f: move generic ProcessBackedVmConnection impl to shared module
4e72d77: move generic connection impl to shared module
66051bb: move generic connection impl to shared module
60dbe50: move generic connection impl to shared module
f377dbd: extract SuspendContextImpl
542fce0: ChromeExecutionStack is generic impl
86b7cf8: ChromeExecutionStack is generic impl
08f232e: ChromeExecutionStack is generic impl
ab343e3: cleanup
d449db6: cleanup
98d2108: CR-IC-4719 revert "pass value to renderValue"
2e69bf5: cleanup
1c56ee5: cleanup dependencies
656f137: remove dependency on liveedit-protocol
e39d6cb: notnull
d5597c8: remove dependency on JavaScriptDebugger
bff031a: move VM_SCHEME to backend sdk to reduce dependencies
19e548e: init nashorn conditional breakpoints
dae303e: EvaluateContextBase
194fc38: remove dependency on JavaScriptDebugger
116514e: move Value to values package
8354821: move Value to values package
b085e92: nashorn indexed array support
d6a80f5: nashorn indexed array support
790b885: cleanup
53840c1: v8: don't return empty string as class name
b694bf7: get rid of ObjectPropertyData
2258111: get rid of ObjectPropertyData
502f01d: NashornArray presentation
d047f87: NashornArray presentation
4cfa1f7: cleanup
4a96f13: move isTruncated/getActualLength/reloadHeavyValue to StringValue
79862ca: move isTruncated/getActualLength/reloadHeavyValue to StringValue
7a54bda: add ObjectValue.hasProperties to simplify renderers
67f3450: add ObjectValue.hasProperties to simplify renderers
325d219: jdi Array presentation like current java impl
55bf487: jdi Array presentation like current java impl
f668bcd: initial implementation of JdoObject/JdiArray
fdc3ccc: cleanup
8e1b754: get rid of asObject
158024c: get rid of asObject
435ae25: remove getRefId() from API
d1a7ef0: NotNull
c0265e1: ClassObjectReference
6f7bdf2: rename "asFunction" to "resolve"
694d96f: rename to DebuggerView
9dd0456: rename "asFunction" to "resolve"
2dd20b5: nashorn variables view: Current "official" approach doesn't work in our case — it is better for us to not use DebuggerSupport, we should operate with ScriptObject directly. So, we have implemented our own nashorn debugger support (thanks to documented and public Nashorn API).
546cb8b: nashorn variables view: Current "official" approach doesn't work in our case — it is better for us to not use DebuggerSupport, we should operate with ScriptObject directly. So, we have implemented our own nashorn debugger support (thanks to documented and public Nashorn API).
35c5720: ValueLoader -> ValueManager It is not loader, it is just manager/factory.
ddb3a80: ValueLoader -> ValueManager It is not loader, it is just manager/factory.
eda0a66: relax getProperties — Variable is enough, we must not require ObjectProperty
594db26: relax getProperties — Variable is enough, we must not require ObjectProperty
43b45c0: refine ValueLoader concept
49799df: ObjectPropertyBase — getters/setters must be FunctionValue, move generic impl from V8
46c265a: rename scope.className to scope.description — actually, it is description
a0f1f9c: rename scope.className to scope.description — actually, it is description
db91942: add note about NashornScope impl
60eb22e: rename DeclarativeScopeBase to DeclarativeScope
6c56fcd: rename DeclarativeScopeBase to DeclarativeScope
8ae8053: rename StackFrameImpl to CallFrameView
aad574d: move loadScopeVariables down nashorn variables view initially works
5624e4d: nashorn: continue variables presentation simplify V8Scope
c1a42c7: don't auto expand Scope.Type.WITH
15a426d: BaseVariableContext -> VariableContextBase
d4e978c: implement SimpleDebugProcessEx
702ee28: continue decouple xdebugger ex ui — XStackFrame impl
902bda6: continue decouple xdebugger ex ui — XStackFrame impl
8c202a8: continue decouple xdebugger ex ui — XValue/XStackFrame impl
87e701e: continue decouple xdebugger ex ui — XValue impl
2df6840: continue decouple xdebugger ex ui — XValue impl
e4dab99: continue decouple xdebugger ex ui — XValue impl
8f64d34: continue decouple xdebugger ex ui
270adbb: simplify – suspend context has reference to vm
1b22196: move ContextDependentAsyncResultConsumer to decoupled module
0011573: decouple ContextDependentAsyncResultConsumer
053808e: simplification — get rid of v8 DebugSession add debugger-ui module
2916e19: simplification — get rid of v8 DebugSession add debugger-ui module
58b9bf9: nashorn: continue variables presentation
ad81d5c: nullability
5ae3a76: nashorn: initial getReceiverVariable impl
101c153: introduce isMemberVisible/normalizeMemberName to avoid dependency on V8DebugProcess
f521266: continue nashorn: variables view
63f68f2: nullability
5951a1c: don't depend on javascript
b186cac: nashorn: x variables view
4668592: nashorn: frames view — correct presentation of stack frame (function name is not yet displayed)
ebda663: fix compilation
f403d8c: WEB-9926 remove 0xhh postfix
4c981bb: WEB-9926 add additional scopes
fe52fa4: show "native" description for node objects
d323ba1: WEB-9926 don't auto expand library scope, we must use case-sensitive natural compare — constants must be first
b925454: WEB-9926 library scope
5a13a6c: CR-IC-4324 revert to NotNull, move new contract to PathUtil
ed408cf: get rid of ScriptInfo
2692f06: move js debugger platform up
86d2886: move js debugger platform up
b4c85ed: move js debugger platform up
0a0bc7f: disabling breakpoint group worked only after the second click
2cea25a: WEB-11695 Insert handler doesn't work for function with multiple definition
8e02a81: Merge branch 'svn_18_3'
00b440a: Merge remote-tracking branch 'origin/master'
129e760: Narrowing the top shadow, shadows are lighter for IDEA-122991
18a6681: Better workaround for PY-12317
37c7f51: Expression simplification
10e7111: IDEA-123402 Sheet dialogs are too transparent, making it hard to read the content
5ad2cb5: Merge remote-tracking branch 'origin/master'
699c241: IDEA-123115 Infer Nullity mark Local History
7a9f96d: shared icon introduced (IDEA-120989)
0afb681: IDEA-123230 html code visible in updated plugin disabled warning
0ce4ecd: svn: Implemented one common process handler for svn commands (both for terminal and regular mode)
8909f2e: DevKit: Extension.getExtensionPoint use domDeclaration provided by Extender directly
36c2d1b: IDEA-116029 in-place introduce variable name suggestions popup disappears before I can select anything (disabling property key to check for regressions)
084e9d4: svn: terminal: Implemented running svn commands using "cmd /c" and redirecting output to separate file for Windows (so we do not need separately process terminal escape sequences in process output)
15150f5: Platform: globally use customized 'Delete' shortcuts (IDEA-102003) + more places use standard shortcuts
90d6d50: Nix NPE while settings save.
50ae319: Platform: globally use customized 'Delete' shortcuts (IDEA-102003) + added 'delete' and 'backspace' mappings to the 'classic OS X' keymap
95314e2: Gradle: Tooling API integration tests fix - set minimal daemonMaxIdleTime
117155e: Gradle: Tooling API integration tests fix - set minimal daemonMaxIdleTime
75febf1: fix NPE on set breakpoint in Dart SDK file
9861ddc: DevKit: add Extensions#getEpPrefix
90fa8cb: move spellchecker to java-impl so it won't depend on any plugins enabled (IDEA-123346)
7ffb54d: view implementations: show self first (IDEA-123377)
79f6257: testng: allow all in project configuration for group, suite, pattern (IDEA-123385)
9f2d913: Platform: globally use customized 'Delete' shortcuts (IDEA-102003) + typo fixed
d82d9b1: Add internal option to run processes with PTY.
430c02d: better name and problem descriptor
1637a3f: Cleanup (javadoc)
192b16f: Cleanup (test stability)
d70e1ac: Cleanup (pointless exceptions)
bd5f93c: Cleanup (formatting)
cd55e1a: Refactored RunnerWinProcess - delegating method calls to original process extracted to separate class
d15303a: Merge remote-tracking branch 'origin/master'
e3c36ee: fix asm bug (IDEA-123343)
a7d2e86: Merge remote-tracking branch 'origin/master'
05d9c33: IDEA-69131 (Cannot import inner class from annotation on outer class.)
4186051: presentation mode fixes: IDEA-123043, IDEA-122892
dd71309: svn: terminal: Terminal support for Windows extracted to separate classes
2b2ba01: svn: Refactored CommandExecutor - extracted utility methods to work with temp files
70887d1: use psi-based DomAnchor by default
788fe65: IDEA-122391 Apply correct arguments escaping for pty4j (depending on current OS)
fcd726c: improve distraction free mode for detached editors
0c34825: IDEA-122391 Trim xml data before parsing - as unnecessary whitespaces (i.e. line breaks at the beginning) break parsing logic
f0b6421: change prompt style for ipython to plain green text PY-9171 (cherry picked from commit e6f4916)
934f8f6: override exit handling for IPython TerminalInteractiveShell (PY-5172) (cherry picked from commit 05c1755)
d0ac46e: Merge remote-tracking branch 'origin/master'
7bb8868: smart completion of method references (IDEA-123293; IDEA-123291)
c33aa26: inside_expression already exclude literals
12ad891: fix generated api
df9e6aa: safe delete should not start callback when "safe" checkbox is not on
1daf8f5: ambiguity (IDEA-123352)
9b1c967: simplify because myAlignmentStrategy != null
7257ecb: don't hold all strings from all plugin.xmls forever
680938d: JavaAutoPopupTest.testRestartWithVisibleLookup: don't blink
9524396: EA-54618 - assert: ComponentManagerImpl.getComponent
09389bb: Platform: tests added for virtual stace handling in DeleteToLineStart/End actions
101dc41: Merge remote-tracking branch 'origin/master'
6fb0d03: Merge remote-tracking branch 'origin/master'
12b5eed: IDEA-122701 IDEA doesn't start on Mac under one of the user accounts after patch update
3706485: AIOOBE (^Vassily)
1feee4a: support multiple carets in EditorDeleteToLineStart/End actions
30356e7: Platform: globally use customized 'Delete' shortcuts (IDEA-102003), Xcode keymap uses 'native' delete action shortcuts
a587c8b: show source text as value name, part of "WEB-6069 CoffeeScript Debugger doesn't show value of the variables"
617cbb9: cleanup
24fe15e: remove obsolete class
3d6913c: fix NPE
b6c6b95: IDEA-99329 Buggy UI when manually adding framework support for a module
f2f8756: IDEA-27445 Breakpoint groups - prototype
4e53b58: fixed PY-7535 Specify return type: intention is not available at the end of the function name
2d6eafa: Merge remote-tracking branch 'origin/master'
417935b: TODOs added
3953531: Workaround for PY-12317
6fd05ee: NPE fixed
1a5f9d2: Merge branch 'master' of git.labs.intellij.net:idea/community
2406ded: Notify GIT repository listeners After info update - rollback static for listener notification (according to review CR-IC-5069)
d200119: by default it's not stripped
3a0093d: fix AIOOBE in dfa contract processing
8c01fc0: initial folding should be build under a read action
f6262c4: DumbService.queueTask(DumbModeTask)
2841329: avoid unnecessary status bar repaint
23bae53: IDEA-123356 Settings->"Postfix Completion" enhancements
b0667e0: IDEA-123360 Sheet dialogs should have minimum size
9857064: IDEA-123383 Please rewrite ActionsTreeTest so it doesn't count on platform actions being incorrect
21dedab: remove new editor mode (revert d42ee690)
d9969be: made public
2831129: notnull
4e0ca1c: cleanup
e25a73e: isNative2AsciiForPropertiesFiles
f7a20ff: CIDR: Xcode keymap utilizes Delete to Line start action
9e297df: Use Tahoma in HTMLEditorKit on Windows
07257e9: Platform: Delete to Line Start action (IDEA-102469)
d1c4c28: Editor Actions: CutLineHandler extracted
0112f24: IDEA-123145 New project wizard is broken
582d67c: Open     action on welcome screen
5f35c4f: Start plugins wizard #11
0eedbf0: Start plugins wizard #10
9a38c20: Start plugins wizard #9
ba25977: Start plugins wizard #8 (fix broken compilation)
aeca763: Start plugins wizard #7
f7e746c: Start plugins wizard #6
d8166a2: Start plugins wizard #5
e086a39: Start plugins wizard #4
909a15a: Start plugins wizard #3
cbaf7f5: Start plugins wizard #2
5d38a35: Start plugins wizard #1
edf024c: ensure assert inserted in correct place (IDEA-123296)
02fc8fe: method refs refactoring
565b28a: check for assignment to final field inside lambda (IDEA-123308)
4bbe424: IDEA-102508 error status of run configuration is not updated after fix Get rid of extra repaints
fd0f629: better fix for IDEA-120011 quick documentation looses styling
b45b456: IDEA-113615 (Magic Number inspection does not treat ByteArrayInputStream initial size as initial capacity parameter)
675c6ed: introducing / using ReflectionUtil.getGrandCallerClass()
358f633: play sound utility methods
03073c1: Merge remote-tracking branch 'origin/master'
3455dde: PY-7000 Django: not able to Find Usages for template reference variable passed to template from view PY-12427 URL names reference does not work TODO: Add tests!
dac515e: Mac keymap: restore old shortcut for rerun tests (cherry picked from commit 5bedbd8)
83a48c1: External project notification: clear notification messages in EDT
58b41b5: Merge branch 'master' of git.labs.intellij.net:idea/community
30f94c0: Notify GIT repository listeners After info update - remove unnecessary static's
1e9430a: Notify GIT repository listeners After info update
b0fa971: EA-54357 - assert: ComponentManagerImpl.getComponent
3ff58dc: svn: Refactored SvnDiffProvider - log errors while resolving current revision for file as info (not as debug)
014d4c8: mark new files as dirty in jar FS: otherwise even if new version of jar is refreshed in Local FS jar content from persistent FS won't be refreshed
934f438: ui-designer-core moved to platform to allow third-party plugins to use it
6467286: Move JSPTreePatcher to XmlTemplateTreePatcher (WI-22026, WEB-5058) [CR-IC-4933]
1a7aff6: svn: Do not resolve repository url (with "svn info" command) only for local "svn info" commands
cefdce8: catch NFE added to HgBaseLogParser
52aa623: IDEA-122078 Consider excluded output roots on output cleaning
f3eda43: fixed PY-12506 Updating skeletons is run twice
b487137: IDEA-122394 Use ModalityState.any() to prompt user if executing svn commands in terminal mode (as currently these prompts are in the thread that reads output and not in the one that started progress)
33790eb: svn: Make Command.myRepositoryUrl volatile - as it is accessed from several threads when in terminal mode
adfe9ba: Fixed bug where Gradle settings were not updated on each project sync.
4d2b747: 'setMaskProvider' method restored and moved to API (used in 'presentation assistant' plugin)
fd92682: [log] Cosmetics changes in VcsLogJoiner.
a75b365: optimization
844099f: External project notification: add support for use of "Messages" tool window
bec7a5d: External project notification: add support for use of "Messages" tool window
56484f1: code cleanup
9cfa601: allow unchecked generics in comparing unrelated return types (IDEA-123316)
2c85ce7: explicit 1.6 language level/compilation target
cbe0d6d: create method from method reference (IDEA-112556)
702932a: make change color scheme actions dumb aware
bb62d58: patch from Zalim Bashorov https://github.com/JetBrains/intellij-community/pull/162
905227b: breakpoint was not selected when opened from event popup
c25dd563: fixed PY-12526 Replace with str format method call: unnecessary u prefix for python 3
a7d8bb3: bind smart element to proper root in template languages: keep API intact, use utility method
2c66b01: fixed PY-12541 do not add ruby interpreter as possible base for virtualenv
f350935: bind smart element to proper root in template languages #WEB-11589 fixed
8ac22e1: Mac keymap: bind rerun tests on valid shortcut
e75d93b: notnull, cleanup
c6a7962: cleanup
fb7d39f: moved to project-model
ad25db4: notnull
82930ae: diagnostics
95398bd: cleanup
a36a361: cleanup
e45865e: IDEA-113198
7ce2aaa: cleanup
2cc9842: method references: highlight separately non-instantiated classes, not resolved methods (IDEA-123279)
6b4ad69: IDEA-123286 diff: fix off-by-one in the current document too
5ff0518: Update module_redeclarator.py
d281c91: remove border
f18463d: set proper fg and remove border
ffe1edd: quick doc and tips are broken under darcula
70d6d69: IDEA-71048 (test fixed one more time)
d783d86: IDEA-122670 Hg log: request only necessary log information
7333a78: explicit 1.6 language level
50bd74d: fixed PY-12545 Override method: generated incorrect super call for local classes
5898229: Emmet: reformat surrounded block
fe7b903: testdata fixed
29265b3: Merge remote-tracking branch 'origin/master'
de14860: Merge remote-tracking branch 'origin/master'
7164eb8: IDEA-71048 (test fixed once again)
c46012d: fixed PY-12546 Completion: except keyword should not be available in try block after else or finally
2be1cd2: IDEA-71048 (test fixed once again)
9195d8e: stop replacement chain calls to sequences when root type changes during call chain; this-chain is not supported though
73f87cd: junit 3: workaround not to filter out "warning" suites when test was not correctly created (IDEA-123209)
06d6ad7: static in interfaces before 1.8 (IDEA-123252)
5f1e0e0: don't use @Override on implemented methods in util-rt
6ca82ee: revert util module language level changes
f49bcf6: fixed PY-12551 Project Interpreters: deadlock after removing detected interpreter in the list
fd29e82: Merge branch 'master' of https://github.com/ShlXue/intellij-community
077af48: allow to use system-independent delimiter in plugin.path property (comma)
46dc44c: breakpoints must not be rendered in diff editor
6a90941: explain invokeLater (IDEA-123118)
20d3149: asm 5 jarjar fixed
6d85a6c: [git] Fix GitConfigTest: correctly split by lines
c30f704: [git] Fix GitLogParserTest: better paths comparison, don't use fake root
55f84ff: [git] Fix GitHistoryUtilsTest: better file path comparison
a513885: consider static and non-static methods when language level is 8.0 or higher
2f2db4c: warn in more cases and conserve comments
d3eebf3: IDEA-123142 Cannot specify default (no) package in Command Line App project template.
472f313: inline velocity
300e871: conditional velocity
e70a2f8: SimpleTemplatesTest
d72b199: IDEA-123236 Can't click through
e23d6a9: Cleanup in TaskManager * Make getIssues with old signature not abstract and throwing exception * Add a few missing annotations on public methods and remove some redundant in TaskManagerImpl * Add  javadoc for getIssues() * Switch parameters in getIssues to get rid of overloading on int/long types
c0ea251: fixed PY-8151 Don't highlight deprecation on symbols imported as fallbacks after ImportError
7dfcf72: IDEA-123103 Structure view empty when editing some XML files
b8c784f: ensure non-locked state to drop caches on stub-ast mismatch recovery (IDEA-123118)
5bc8717: EA-55507 - IOE: PsiJavaParserFacadeImpl.createStatementFromText
d335758: new inference: substitute resolved vars which e.g. did not participate in initial session (IDEA-123248)
5518b93: method reference constraints (IDEA-123223)
925b71c: IDEA-107653 No Drag&Drop from "Expression Evaluation" window to watches tool window
b400f0d: IDEA-88850 Inconsistent checkbox capitalization in breakpoints dialog - also sort buttons by group priority
3526fe0: Platform: new scrollbars are supported on JBTabbedPane + inspection to always use JBTabbedPanes
97d9377: java: .class parameter name calculation fixed
219c078: Cleanup (formatting)
cce59a2: Cleanup (test)
a18ec28: IDEA-98393 Bring focus into Inspect window after it is opened (so it can be browsed right away)
d640d90: ability to disable debugger value lookup
6e7f8ff: util.jar should be compiled with 1.5 target level since it's used in groovyc
fbda954: O(1) SortedList.isEmpty
18b1ccd: use stubs when resolving in dumb mode
90163c5: fix database tests build?
8fba729: fix PsiPackageImpl.getCachedClassesByName race condition in dumb mode
b69532b: unnecessary dependency removed
ca07624: Test .jar generation fixed
e28d3f5: method reference: use site substitutor if nothing else was inferred
990094f: new inference: collect nested calls from lambda return statements (JDK-8038747)
34f4baa: toString
20690a0: toString
50ddb05: EA-55461
c5e0960: EP for upsource
00efb07: removing unused parameter and field
a8cfc8b: DomUtil.checkHasXml: use hasXml() instead of getXmlElement()
001e5de: IDEA-122931, EA-52281 (better handling for corrupted .jar files)
edcd1ec: WEB-11133 JS Debugger: Variables view is not properly updated after setting value
1294056: [log] Don't destroy data, when request invalid.
db2ce67: minor refactoring to avoid NPEs
67054be: typo
aca6b01: [log] Don't make defensive copying here: there is no need in it.
3a1335b: [git] cleanup
8f487f2: [git] convert some tests to java
ffa433b: [log] GitLogProviderTest
ed8883a: [log] remove dependency
f9e8fa1: [log] remove temp method VcsRef#getCommitIndex
329848d: [log] Remove duplicating implementation
7a39b2b: [log] Extend VcsShortCommitDetailsImpl from TimedVcsCommitImpl
3fa88a4: [git] read current user on GitVcs activate
7d2f32c: [log] IDEA-117553 optimize git log initialization & refresh
096155f: [log] refactor & some API changes
570394b: Test .jar generation fixed
34c093d: Test .jar generation fixed
50e411e: IDEA-123141 Refactor / Rename erroneously wraps xml element content in CDATA when it already exists, and corrupts text content if two occurrences
8c63822: Merge remote-tracking branch 'origin/master'
76e04ec: PY-12579 "url" function is not processed correctly when imported as alias
6fa4820: Xcode keymap tweaks +review CR-OC-1412
03c4328: Merge remote-tracking branch 'origin/master'
9668628: Fog patch 4 (cherry picked from commit 48d6308)
add006d: Fog patch 3 (cherry picked from commit 3487b86)
6ff2d05: IDEA-122950 Breakpoints aren't set, unless debugger already active
f423ee7: Fog patch 2 (cherry picked from commit 1ed4a92)
4508615: sort postfix templates
f34ae98: IDEA-123179 Task context grows to humongous size
dd5dab3: Fog patch
2e5ae76: fix for polyadic expressions and make quickfix conserve comments
d07565c: do not add an 'abstract' modifier to 'static' methods
ea80c04: also warn when method from superclass is overloaded
e132e12: diff: do not break layout if we don't know revision number
1150c6d: Added extension point for import buttons in Colors & Fonts preferences UI
79d1984: correcttions after review: using as unique IDs instances of Object instead of Key, which is stored in a never cleared static Map
3c47368: Easter fog: works if today is 1 Apr (or there is -Deggs=true) You can switch it off by -Dnoeggs=true Note: Fog won;t start if there are less than 4 CPU or if there are less than 32Mb of free memory
e4d6a57: Clone dialog repository url label changed according  to selected vcs name.
880b479: Huge performance hit when adding new property at the end of the large .properties file (IDEA-101698)
fb63924: Platform: javadoc for ContentRoot-related classes updated to reflect new file-roots functionality
857d86d: slightly better performance
7f3f40c: cleanup
d42ee69: new editor mode
6c497a6: Merge remote-tracking branch 'origin/master'
e0d3b91: Use UnsupportedOperationException instead of AssertionError in deprecated abstract method. Fix delegation to overloaded #getIssues without progress indicator support
33ded49: advance bomb
c6c28d7: IDEA-120802 Optimize imports preparation freezes UI & throws Exception & crashes with OOM when called on a large project [CR-IC-4766]
67ac3e2: Platform: OS X scrollbars disabled on OS X < 10.8 (IDEA-123156)
33e8c78: EA-55259
11bc248: EA-55456
1f9ab71: Emmet: more diagnostic info
af4bbc3: Fix IDEA-123157 Unnecessary scrolling in Editor Color Dialog (typo fix in line 226) +review
188e321: diff: do not show 'contents identical' if we can't calculate diff
5c926ef: Override getRepository in tasks for Redmine and Gitlab
f2224a2: disable animations
68ed40e: don't place notification under toolbar
aaea529: + shadowSize
950b36e: cleanup
9688913: + titleForeground
eace490: Merge remote-tracking branch 'origin/master'
12f32a4: bigger icons for notifications
42412c5: Add annotations to the builtin known Nullable/NotNull annotations (IDEA-123102)
8bdf39f: only highlight identifier instead of entire expression
01b0876: only highlight identifier instead of entire expression
cf7a32d: give similar inspections similar descriptions
4342d32: fix grammar
9768008: should warn on prepared statement
25c0576: [log] fix cursor shape
7dc9975: Merge remote-tracking branch 'origin/master'
39ec503: testdata for IDEA-120498
b22a73b: Merge remote-tracking branch 'origin/master'
2b867ce: PY-12344 Views in i18n_patterns are not resolved
0cfb14e: hide fix with possible dialogs in batch mode
7751598: testng exception is expected but never thrown: use common util to collect thrown exceptions
cceb035: IDEA-120769 Expected exception never thrown in test method body: process subclasses
123ba34: create enum constant: support constant creation when static import is used, process varargs method candidates as vararg/basic separately (IDEA-121287)
1cf32d2: EA-55404 - assert: PsiPackageBase.getChildren
3707c56: sort output
6b91f55: IDEA-122414 Boolean expression simplification changes behavior of the code
e24e934: remove the test committed by mistake
6d2412b: dfa: a variable can't be null after dereference (IDEA-122215)
87a2944: IDEA-122624 @Contract fails on vararg methods
6199ff6: IDEA-123113 Tool window: stripe button text differs from View|Tool Windows
f89a793: IDEA-122974 expected type suggester should ignore 'null' types
fddab7b: IDEA-123034 Unused assignment inspection - Remove quick fix
94a0eb4: update bytecode viewer to asm5
2e7694a: IDEA-123084 Modules with errors are not marked in project tree.
406c45f: some TemplateContext improvements after review
0763359: Xcode keymap parent changed from "Mac OS X" to "Mac OS X 10.5+"
da2b5b0: ClasspathCache correctly handles getResource("/") requests (more strict check)
0c76f8a: refresh hg repository root after rebasing and update appropriate repository information
47ab9b5: DSM project disposed checks
a8bfd9c: added notnulls
779508e: do not stop in case of exceptions in position managers impls
599cd0b: CR-IC-5030 (test added)
1dd12cd: EA-55398 produce code from template without error checking
9ef3453: ui: avoid exceptions caused by writing VM options to protected file (reverted)
50b9228: Cleanup (arrangement)
6f25948: fixes after review
6afba27: IDEA-122950 Breakpoints aren't set, unless debugger already active
8998f5e: http://crucible.labs.intellij.net/cru/CR-IC-4539#c24372
a13593d4: use WeakHashMap (Upsource#105)
552fc59: Cleanup (test migrated to JUnit 4)
6d94d67: ClasspathCache correctly handles getResource("/") requests
ba71998: Different alpha for Darcula and Aqua
6a59fbc:  continue: local variables defined in the console should be available for resolve/completion/variables view
247e21d: vfs: ignore invalid .jar roots (tests fixed)
9a5d20a: Cleanup (unneeded write action)
1e8614b: IDEA-120785 Multiline select issue
b990d94: Merge remote-tracking branch 'origin/master'
69df14c: VirtualDirectory allow assess to Apple JDK Classes dir
9496da1: only variables are expected while processing code blocks
ed8bb6a: honor ClassHint while processing declarations
5aa70ff: IDEA-122707 prevent recursion while inferring @BaseScript. We can do this because there is no annotation classes can be declared inside script class
2f6448f: check elements in all languages for hover #WEB-10538 fixed
4e2177c: cleanup
f2bcf5d: avoid recursive invocation of caret merging procedure
69e31da: vfs: ignore invalid .jar roots
3b9b0f7: IDEA-91160 Database console: AE at TextEditorHighlightingPassRegistrarImpl.instantiatePasses() on using same data source in different projects
84451e6: IDEA-121400
b55c837: new inference: processing of compound bounds
e55a20c: raw substitutor when erasure happened during inference
87ef3f9: improve debugging experience
97ce34b: ui: avoid exceptions caused by writing VM options to protected file
71f46d6: Cleanup (inspections)
0b70f88: IDEA-122677 (do not show "fatal error" dialog if the app is already loaded)
53d5579: platform: catch/log all project initialization errors
dfa3ef1: Cleanup (arrangement; formatting)
6163ece: fix missing mnemonic
3e6a790: RootIndex is always initialized
3c96063: rehighlight editors on dumb mode start/finish
d7081c9b: reuse MockDumbService in tests
fefc5a3: debugging blinking GroovyCompilerTest
6b036aa: IDEA-122891 Presentation mode: TW layout on exit is recalculated based on fullscreen sizes
207e963: VirtualDirectory checks access only for the new files as before
5c11491: added extra logging
07df0a4: IDEA-120011 quick documentation looses styling
64f0a14: Improvement for IDEA-122851. Only one button case.
7839bb6: VirtualDirectory.checkAccess does not break VirtualFilePointer + checks access on developer machines as well
15400e5: Platform: JBCardLayout keeps focused component when after swipe finishes
bfd1504: Platform: ability to set add-remove-edit panel borders
6e59f59: Platform: update action toolbar on showing to avoid situation, when it's not displayed until IDE gets focued
b362435: Platform: swipe animation in wizards
6c2afa2: IDEA-123011 Rebase strategy fixed in case updating without local commits
de5c580: [git] fix reference to executable
4989f68: [git] temporary disable several tests
22479d4: [git] Fix retrial if index.lock error happens.
05a5137: [git] Fix GitCrlfProblemsDetectorTest: less mocky
cda0a73: [git] fix GitBranchWorkerTest: less groovy
1ed8a0d: [git] GitSingleRepoTest for tests that operate with 1 and only 1 repo
6f1906b: [git] fix change provider tests: operate on io.Files for setup + more
9e5fa74: [git] cleanup
3ff96d2: [git] various tests fixes
4167521: [git] simplify tests dir structure
a9b1b89: [git] remove some obsolete tests
80a0e5d: [git] convert & fix GitChangeProviderTests
ed4c062: remove unused
e4f8f1d: [vcs tests] move some static utility methods to VcsTestUtil
daad6f0: [vcs tests] remove code duplication: move some methods to VcsTestUtil
0dcb5c5: [git] Fixing GitRebaserReorderCommitsTest
378af2a: [git] remove some obsolete test
c7e1efe: [git] rename test to what it actually tests
103d25b: [git] convert & fix GitMergeTest
4734402: [git] remove some obsolete tests
da6d90c: [git tests] fix some strange Groovy error
65fca10: Fix GitScenarios: suppress non-zero exit code exception
e6dc680: [git] more GitHistoryUtilsTest fixes
d95eb30: [git & hg tests] support failing in case of non zero exit code
7d8915c: [git] Convert & fix GitHistoryUtils test
581848a: [git] Fix GitLogParserTest
f42eb11: [git] remove some unused test utils
3abe205: [git] Fix GitConfigTest: convert from testng, cleanup
79c581f: [git] Remove some obsolete not very good test
e5884b6: [git] convert GitLightTests to be GitPlatformTest
91139fb: [git] Extract GitPlatformTest from GithubTest to reuse in some git tests
98c795b: [git] rename the basic old deprecated test class to free the name
a859eec: IDEA-122924: FileProcessingCompilerAdapterTask ignores value of ValidityState
5b820a0: Better sizing and layout for buttons (IDEA-122991)
22b227a: IDEA-122918 MarkupModel.removeAllHighlighters() does not invalidate
817272b: getMaxId() method
71b615d: do not search for executable during class loading
0fc8215: javadoc
04dde29: cleanup
ef0ff58: isWriteActionInProgress() method added
7fe17ae: Merge remote-tracking branch 'origin/master'
39a92b9: Merge remote-tracking branch 'origin/master'
b5eee92: Aqua: Navigation popup has wrong visual text alignment (text is too close to bottom border line)
520a6fe: compareTo uses non-final vars: check methods from Comparable interfaces only
c90293c: IDEA-123005 deadlock in awt thread
e0a6809: remove duplication
9f03f56: fix test
066e3c0: #IDEA-122793 fixed
f591119: Parent shadow for IDEA-122991
dab310f: Font size, translucency value for IDEA-122991
2436c9c: unused import
e4530f1: Rename CertificatesManager to CertificateManager (not plural) to be consistent with related classes and components
2f634cf: IDEA-102693 Can't update maven repository (see comments in http://youtrack.jetbrains.com/issue/IDEA-122485)
fb27b19: EA-55354 - IOOBE: MarkupModelImpl.addLineHighlighter
573eb8b: Cleanup in CertificateInfoPanel
979822c: IDEA-119804 second click on item in watches panel should toggle edit mode - avoid NPE
0ded360: jps-plugin-system extracted to separate jar in standalone jps
d06b4bf: fixed handling AbstractMethodError by exception reporter, avoided self-contradictory messages, removed unused 'essential plugins' list (IDEA-122870)
9d97c23: IDEA-119804 second click on item in watches panel should toggle edit mode
b662a95: StartupWizard2: icons
1881195: svn: Refactored SvnAuthenticationProvider - removed unused code
9465f77: IDEA-121752 Get cached authentication data through special SVNKit authentication provider and not directly from runtime storage (to utilize logic for creating appropriate storage key)
675031e: IDEA-96467 Block selection is not respected by Toggle Case action
b6d7e79: StartupWizard2: initial
fb58763: Merge remote-tracking branch 'origin/master'
5ab2bd8: PY-12497 .NET stubs are generated incorrectly when name is imported instead of module
5a8919a: Merge remote-tracking branch 'origin/master'
c3176f8: fix colors on LAF change on Mac [the real one]
d845005: junit: disable manual modification of parameterized test names (IDEA-122937)
73b01ed: icons (IDEA-119742)
c7eb840: new inference: use available in stack methods, do not cache if this info was used (IDEA-122406)
a4f36f2: anonym to lambda: rename conflicting locals (IDEA-120221)
72203e2: default methods: check for super class is now needed (IDEA-122720)
8e237e0: fixed PY-12476 Django: Nose Test Runner: not able to run django tests with django 1.6: AttributeError: 'NoOptions' object has no attribute 'with_fixture_bundling'
2dd7e92: disposeResult default impl
6a349f3: Merge remote-tracking branch 'origin/master'
94f4e2b: Merge remote-tracking branch 'origin/master'
b0bc3ff: IDEA-122883 reverted fix. Status not updated
e7fb793: DomImplUtil.isNameSuitable: remove obsolete assertion
a926b06: [log] Use IntList for big int arrays.
324407c: [log] Add IntList.
d95b41e: [log] Use BitSetFlags in PermanentGraphBuilder.
a4fedd2: [log] Add BitSetFlags.
868acd6: [log] Move PermanentGraph and relative files to log.facade.graph.permanent package.
c521d8a: [log] Fix 0 size for IntToIntMaps.
e9140b4: [log] Move IntToIntMap and relative files to log.facade.utils package.
102ab03: [log] Move PrintParameters.
45c3ad8: [log] Move Flags.
7ec491d: [log] Move GraphAction & ActionRequest classes to vcs-log-api.
fdb72b6: [log] Move GraphCommitCell.
ec760a6: [log] Move ColorGenerator.
848619b: [log] Delete old GraphFacade.
a51b125: [log] Add ListIntToIntMap and use it instead TreeIntToIntMap.
8b23ea0: [log] Extract UpdatableIntToIntMap interface.
e65f6b0: IDEA-122883 Log should refreshes immediately after pull
c6739a6: IDEA-122949 ChangeListTodosPanel should update GUI on EDT
db75a82: on install/uninstall do fireUISettingChange + update toolbars
188bd20: +revalidate()
b120397: reset inactive image on UI settings change
6b9964a: update Tab fg on UI settings change
b9015d2: IDEA-78486 Column selection lost
39db3bd: Stop ignoring the exceptions.
b927ac9: We still need to set a focused button, but now we can use requestFocusInWindow to prevent focus stealing. Jdk6 does not return focus to the modal blocker properly, so we use the requestFocus conditionally.
f966367: IDEA-122499 Groovy static imports prefix with get unnecessarily
2454a0a: improve static import processing
a35bcae: IDEA-121539 New Mac Messages: Yes/No messages have buttons in wrong order
4886836: Wrong assertion isAncestor returns true even if it is the same window
c3e242f: IDEA-118590 Rule matcher for arrangement of Java code does not use the most specific rule
190c324: IDEA-122851 Mac Messages on Java 6: sometimes message doesn't get focus
a16a1dc: remove duplicate updateUI & drop restart dialog
03efdc5: fix colors on LAF change on Mac
5cb034b: make editor less sensitive to accidental drags when adding/removing carets using mouse
3f39f7d: IDEA-121787 Multiple Carets: surround with character (', ", etc) works incorrectly
c74c2cb: Merge branch 'master' of git.labs.intellij.net:idea/community
7375536: CR-IU-595 - introduce createTemporaryConnection - fix
00d1685: NPE
fdd0cb1: IDEA-122928 Duplicate symbols in SearchEverywhere
71a9f36: Initial value of "do not ask" option has not been honored
812ce07: better test deps
17919cb: search symbols under read action
8de434f: cleanup
f3a4990: IDEA-122662 Breakpoints dialog: on new breakpoint adding it should get focus
1eddec2: JPS extension loading: skip duplicated urls
6e35800: Merge remote-tracking branch 'origin/master'
cac585c: fixed PY-12510 NPE in Idea 13 Python Plugin New Module SDK dialog prevents all python use
a48429d: (IDEA-122795)  problem with merge during update project fixed
dcc87d6: comment added
f3cc4e1: EP for upsource added
e0e1939: IDEA-122465 Spring: Alt-F1/SpringBeans... navigation doesn't work properly in mixed contexts StubAnchor equals() missing
eb997fb: multi-caret typing fixes for Java files
8b26747: fix overriding final method: com.intellij.execution.process.ConsoleHistoryModel com.intellij.execution.console.ConsoleExecuteAction$ConsoleExecuteActionHandler#getConsoleHistoryModel() (in SBT:1.5.1)
6b2fb64: IDEA-122729 Rename refactoring fails on method with spaces (Groovy)
824b8b0: WEB-11399 Live Console: variables defined in the console are not autocompleted (global context)
163f0ea: new master password dialog icon
1b22104: use RegExpFileType in find dialog directly (IDEA-122775)
1d65d9e: update: ignore errors on automatic updates (IDEA-122848)
7df6897: testng: allow in ui "all in project" for group, pattern, suite configurations (IDEA-122835)
0beea24: NPE during completion for lambda params
6065112: IDEA-122796 Call to 'printStackTrace()' should warn about overridden calls as well
2868293: IDEA-122281 Do not explicitly specify "--force-interactive" for svn commands under terminal (they will be interactive by default if under terminal)
9449019: IDEA-102508 error status of run configuration is not updated after fix
0b83ac9: IDEA-122839 wrong ToolWindow title
933956c: custom annotation checkers should be applied to alias annotations
925a430: Merge branch 'master' of git.labs.intellij.net:idea/community
5305823: PY-12521 Wrong skeletons generated for static methods in CLR/IronPython
61fdaaa: Merge branch 'svn_18_3'
ea818c8: PY-12332 "Generate stubs for binary module" in IronPython with non-Camelcase names not available or presented (Env test added)
0db5440: Better approach for IDEA-122869 Change signature: unreadable message
86e7362: IDEA-122863 Settings / TODO: the user-defined color is shown incorrectly after making changes
f072cf4: don't assume that *.txt is mapped to Plain Text (IDEA-122775)
915a3d6: do not show Local History group in console editors
6b9fcd0: IDEA-122865 Settings / Editor / Color and Fonts: disable ability to edit color for inherited attributes
904069b: IDEA-122852 Mac Messages: underscore (broken mnemonic) on some buttons
44818b4: IDEA-122866 'Terminate the process after disconnect' checkbox is switch off by default
d134cea: IDEA-122869 Change signature: unreadable message
d9a27f7: Typo
ffe5268: IDEA-113949 Read output of svn commands with "--xml" option using UTF-8 encoding
80126cb: IDEA-104933 IDEA-113949 Use temporary file to specify message for svn commit operation
b197f05: "Line/block comment at first column" options to be taken from language-specific settings [CR-IC-4952]
6495aaa: Better "do not ask" checkbox re-layout.
c47c4f5: comment about special negative timestamps and long value for milliseconds
02a51bf: svn: Refactored CommandExecutor - methods extracted
7a4cf37: EA-55230 github: do not use deprecated method
a761ae4: svn: Make CmdVersionClient utilize CommandExecutor (not to duplicate common logic)
d19b9b4: svn: Make SvnVcs.isVcsBackgroundOperationsAllowed be always true if command line is configured
5705d76: IDEA-122529 Wrong event log icon
4b4d831: fix regressions for copy/paste behaviour in column selection mode
a02159e: IDEA-122861 IDE fails to open HTML files on a system with Turkish locale
b1e0f63: do not do resolve in dumb mode!!!
40b2cd3: IDEA-122164 Possibility to change default prompt style in LanguageConsoleImpl
9f58257: new inference: String::length should be exact (IDEA-122191)
5605b2e: field can be local: quick fix to register stop-annotations is added (IDEA-122836)
7e1ce96: Focus was broken for F12 on Windows.
a1456bf: warn about active method breakpoints on debug session start
319a7b0: Bug fix: IDEA does not recognize managed dependencies usage in current pom.xml
c6e39c5: IDEA-122757 IOE at com.intellij.openapi.util.io.FileUtilRt.doCreateTempFile
e0ff391: IDEA-122637 CCE at com.intellij.debugger.ui.XBreakpointGroupingByClassRule.getGroup
4c49d4f: reverted fix for IDEA-122637
1896ad2: IDEA-121916 Allow to select several words with multiple carets with mouse
446b34c: Eliminating ugly black window with jdk7 and jdk8.
b814912: Improove code readability. +review CR-IC-4863
29f8c8b: IDEA-112576 ("if statement replaceable with switch" quickfix is not equivalent for string targets)
390da27: Bug fix: replace addListener() with removeListener() inside ToolWindowManagerImpl.removeToolWindowManagerListener() +review CR-IC
cd14dd0: IDEA-122838 Add UI click counters to the Editor context menu
bc37a63: IDEA-122607 "SVN Repositories" tab don't closing
104f227: gFileChooserDescriptor renamed to getFileChooserDescriptor
76c3d23: lazy DirectoryInfo order entries calculation
d822760: no expensive groovy runnable icon calculation in dumb mode
b7b7efe: IDEA-122152 Retain 'the oldest' caret in editor on Esc press
e949ad5: remove finishExecution form platform
2c67c88: IDEA-122837 Add UI click counters to toolwindow buttons
2402106: IDEA-122833 SearchEverywhere: renderer is broken in Jr. IDEs
530e825: base script checker
4e1ade3: IDEA-122707 @BaseScript initial support
bdd42a7: resolve annotations inside injected fragments
894430b: optimize method call checks for Groovy Injector using Injection cache
fcd90cf: Injection cache extracted from Concatenation injector for using in Groovy injector as well
3538327: DelimitedListProcessorTest: move to corresponding module
e1d9fc35: dom-*: add missing license headers
47a0146: update netty — https://github.com/netty/netty/issues/2331
7e47fb6: wip bootstrap — support packaged app remove NodeJSRunner — platform impl is enough remove MochaDebugProgramRunner, NodeunitDebugRunner, NodeJSDebugRunner — DebuggableProgramRunner is enough
879f4bf: Content and source roots can now be files
7bed5dd: Disable SNI in IDEA to avoid "javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name"
df25676: DomUtil.hasXml: use DomElement.exists() to avoid costly getXmlElement() fixes + tests CR-IC-4788
68ba599: IDEA-121510 JSP: reindex: INRE through JspSpiUtil.isIncludedOrIncludesSomething(): check for JSP includes should be invoked from pass itself, because it involves some index processing.
bc95c5f: checkForSettingsDamage(): throw after tearDown()
3eb6d33: Merge remote-tracking branch 'origin/master'
7a2f35c: Merge remote-tracking branch 'origin/master'
7b940e1: rollback
4a4c6e3: Merge remote-tracking branch 'origin/master'
5697391: PY-12332 "Generate stubs for binary module" in IronPython with non-Camelcase names not available or presented (TODO: Add env tests)
f8b3fa2: testdata fixed
fb09780: IDEA-122661 "Method overloads method of superclass" inspection missing default methods in Java 8 interfaces
8632fe1: testng: forbid to run abstract tests not annotated with @Test (IDEA-122724)
654463b: use obsolete TW title property as Stripe button text
9c56b62: EA-55173 (diagnostic)
3d7bf9f: layout (IDEA-122614)
40424a1: wildcard substitution partly reverted (IDEA-122700)
b500c13: effectively final: check usages inside inner classes/lambdas (IDEA-122686)
aa6dbcd: collapse statement lambda to expression lambda: enable for value compatible lambdas (IDEA-122785)
b19b34a: shorten qNames on adding explicit type arguments (IDEA-122667)
43b8f9c: stream migration: collapse identity matching (IDEA-122706)
c82446f: java: .class stub builder API cleaned from explicit ASM dependency
32cf812: Merge remote-tracking branch 'origin/master'
e714041: Further reduce size of responses by excluding almost all unused fields
f39ed60: java: .class stub builder migrated to ASM 5
614e90e: Some cleanup in Trello: add annotations, use messages from bundle, and methods from ResponseUtil
e1e3863: Exclude comment actions from query to reduce size of responses in Trello
0240a3e: IDEA-122630 AE at com.intellij.ui.BalloonImpl.a
4288833: asm 5 sources renamed
10124af: IDEA-122637 CCE at com.intellij.debugger.ui.XBreakpointGroupingByClassRule.getGroup
68cae1a: testdata fixed
a008d21: asm 5 checks
895860c: library declaration for community
d7f97b4: Sheets are added to the ide modality.
ab2c16b: IDEA-122725
d1e89d1: cleanup
e831bea: move method
cf71866: moved method
039062c: diagnostics
be8accb: EA-55101 - NPE: NegationBroadScopeFix.getText
00cf2c9: Focuses, draggability on mac + jdk6. The messages are enabled with jdk8 and jdk6
2bb7917: Merge remote-tracking branch 'origin/master'
adbb58f: update asm to 5.0.1
7ee47b9: Better usability for focus tracer
8162e5a: EA-54991 - ISE: CaretModelImpl.getCurrentCaret
9885d31: test for breakpoint condition and log expression conversion
61094f0: Merge remote-tracking branch 'origin/master'
3c94abe: Properties API further extraction
45d0dcf: Merge remote-tracking branch 'origin/master'
5bd2213: inference: ensure nested methods lift their bounds (IDEA-122681)
86cf8fe: same behaviour for extract variable/constant/field (IDEA-122756)
124200e: IDEA-122710 JavaFX sources should be added when SDK is created
eb470ce: IDEA-120443 Groovy: Idea can't compile valid code in implicitly typed statically compiled extension module
938485b: always queue index update in dump mode when idea.schedule.cache.update.in.dumb.mode property is set
87da48c: IDEA-122655 Breakpoints dialog: new java line breakpoint adding is available
c98662e: following CR-IC-4653
c0180cf: following CR-IC-4773
f8fc600: Platform: OS X scrollbars (taking system preference into account IDEA-122633 - obsolete registry key removed)
c68fd07: use name sequence to determine file types
ae53d99: introduce VirtualFile.getNameSequence() to avoid too many String instantiations
297a0b4: do not update contentless indices upon content change + removed unused requestReindexExcluded method
cd869fb: Platform: OS X scrollbars (taking system preference into account IDEA-122633)
d051e6b: VirtualFilePointer correctly handles moves and copies under existing pointer + roots event are now sent on such changes
4d5269f: try coverage with asm 5.0.1
c15f69b: java name suggestions should work for java
ce4031e: avoid opening nonclosed cached file bit map
22168b8: following CR-IC-4636
74576a1: IDEA-114685 Color editor should open with a single click on the color square
b38c029: avoid race for reassigning fields
427a0cb: Remove unused ProjectFileExclusionManager / ProjectFileExclusionManagerImpl
7177fd5: IDEA-120730 Editor drops the existing selection when hitting Alt while selecting
09bb6a3: IDEA-104560 Duplicating the first line with line-wrapping enabled does not work well
82b2857: Merge remote-tracking branch 'origin/master'
3da109d: Save documents in EDT in console.
84a28b9: Fix NPE (WI-22515).
79e4e8a: cleanup
9d75bb0: nodewebkit RC — macro aware
8d297a6: AppCode: fixed some shortcuts in the Xcode keymap OC-7210 +review CR-OC @Anton.Makeev
3787230: AppCode: Xcode keymap rearranged to show Xcode shortcuts first OC-4212 +review CR-OC @Anton.Makeev
8da3dfb: Copy IntelliLang-python resources.
5e8f847: Add IntelliLang to classpath.
0178a9f: Add IntelliLang-python to community plugin build.
7a756f6: better caret row color for darcula
7279e47: change prompt to 'In[...]' for ipython (PY-9171)  and fix problem in indentation (cherry picked from commit ff89fbe)
60c3bff: [log] IDEA-122300 Show full path in structure filter tooltip
7e4740e: [log] structure filter: increase the amount of max possible folders
224e701: [log] Don't duplicate text in tooltip
9c66c02: [log] IDEA-115897 Call applyFilters() on onFieldCleared().
ab8a24a: [log] IDEA-121948 Possibly fix "row doesn't exist" exception
eebccf1: [log] spelling
fdf2f79: [log] IDEA-122558 reset filters before applying new ones
ca66a26: rerun action for GroovyShell & GroovyConsole
892246e: Fix build for community.
d0940bd: Fix build.
54276f2: Merge remote-tracking branch 'origin/master'
621bf17: Handle navigation actions before Terminal.
67f215f: Don't override toolwindow switch shortcuts in Terminal (IDEA-122273).
3c26ebe: Improvement in Search Everywhere field: vertical alignment for text and icons.
98139f6: Usability issue: ColorPicker with Retina
e55e917: Fixed remote external tool launch (IDEA-122288).
34ca931: NotNull annotations
08351c7: IDEA-122285 (Native method naming convention)
d066c46: Merge remote-tracking branch 'origin/master'
e2ba921: Rerun console should save documents as it is done by Run console action.
3f51a8a: IDEA-122344 (incorrect handling of paths around PATH_MAX limit on Windows)
6257b00: Merge remote-tracking branch 'origin/master'
60acb4b: IDEA-122616
0a516f5: refresh html5 schema #IDEA-122531 fixed
85aa2ff: common program parameters: preselect current directory
42cbbb1: IDEA-122653 Bad code green: missing extends list
1efd934: don't compile project before starting groovy console
782dc47: hg log: first block of commits loaded without changes
8ab972c: log problem for empty commit message fixed
e04d876: improve master password UE: initial setup fixed
a6ec39f: option to ignore 'native' methods (IDEA-122285)
ca10464: EA-54946 (IOE: PsiJavaParserFacadeImpl.createExpressionFromText)
5ab135a: make public field final
2d149f4: IDEA-68621 (CVS: with 'don't Remove' option selected in Confirmation/WhenFilesAreDeleted settings file cannot be removed from vcs at all)
fd187e3: IDEA-105413 Configure Axis when proxy is used. Refactor usages of awkward Mantis SOAP API in helper methods
5215938: improve master password UE
38ebd87: Merge remote-tracking branch 'origin/master'
1581f3f: Reassign alt+click to multiple carets in PyCharm.
2f2c698: IDEA-122208 Previous errors are sometimes stuck in errors view
d487813: Local History: do not iterate newly created directories, unless they are under a project's context (IDEA-122495)
089b5de: IDEA-122507 Groovy: CompileStatic class should be red on private access
a32f67d: cleanup GrUnresolvedAccessInspection
d441984: libnotify version fixed to avoid API incompatibility
2ad59ed: delete/safe delete: restore delete (IDEA-122639)
9845ef2: new inference: capture nested call case fixed (~Collections)
ccd70ec: Platform: OS X scrollbars (NPE due to concurrent issue in background createEditors)
6fd1324: UnscrambleDialogTest: RunContentDescriptor are not automatically disposed in tests, dispose manually
6452f5f: Merge remote-tracking branch 'origin/master'
f1b3b1c: expandable item has extra space under Retina (Oracle JDK)
7fd26d1: CR-IC-4877 (cleanup)
da5b8f3: Slim injection directly in the tree
a87792f: CR-IC-4915 (cleanup)
e8fa6ae: IDEA-122626 Github: try to reuse existing access token
99c0991: cleanup
2668819: cleanup
0aabc49: removed obsolete run configuration template from default project settings
f1c1d23: verbose assertion
6a86074: TemplateState: yet another debug info
e30e9a7: WEB-11445 AngularJS filters break Emmet
79aa741: IDEA-122476: Pack JPS distribution into one zip file
509a630: cleanup
99870ef: optimisation: overload to reduce varargs array allocation
52fba19: optimisation: do not allocate list unnecessarily
df3c020: cleanup
5004732: optimisation: concurrent sets
0d27873: optimisation: no expensive Class.getmodifiers() and checkAccess() calls
913d755: avoid unnecessary SecurityException
d687355: IDEA-72979 DOM: make DelimitedListConverter work nicely with TagValues
ae33002: update navbar on frame selection
062c0f1: EA-55032: there is no reason to request UI update if update queue has been already disposed
ea9d3c6: extract BasicGutterContentProvider — we need gutter content provider in any case to provide pretty UI (in/out markers)
ba95020: Balloons: fix for inverted "contains" condition (causes NPE and wrong behavior)
c351f3b: Add toString method in diagnostic purposes
c33e62c: TemplateState: yet another debug info
f8551ee: IDEA-122565 (CVS: files shown not under version control in 13.1)
545e353: fix property value
a4747a9: nodejs 136.1205 published
37cf7a5: Empty descriptor PSI anchor fixed
e6c34e4: logging
8f9d0ab: Platform: OS X scrollbars (do not directly cast view's parents to scrollbar)
944dfe2: Platform: OS X scrollbars (leak in AWT listener fixed + only keep scrollbar visible while mouse is moving over the scrollpane)
4a1dd3b: RUBY-15071: restoring an old logic which fights with extra new-lines
6bc99a3: IDEA-122548 Exception while inlining method
4686315: A class may not at the same time be a subtype of two interface types which are different parameterizations of the same generic interface(IDEA-122475); revert workarounds for javac 6 bug
f6c426c: IDEA-122561 Some code is not shielded by "ide.mac.message.dialogs.as.sheets" key
9812ab2: EA-54956 (ignore corrupted annotations)
1f43d17: Merge remote-tracking branch 'origin/master'
f6a41ef: IDEA-105413 Update Mantis integration tests
58a7e99: PY-10377 (allow non-journaled local FS to be watched)
0b836c0: Merge remote-tracking branch 'origin/master'
079a063: fix icons preview
75afd8d: findIcon without caching
73a0dad: don't hold console on a hard reference until the project is closed
04175e9: restore text search in directories outside project (IDEA-122322)
e8932d6: IDEA-122578 Support content roots under ignored directories
2a938a0: Painting on retina
1def1d0: Restore import pydev_log
01c054d: IDEA-105413 Update pagination in Mantis
730951b: IDEA-105413 Remove filter from serialized form of Mantis project in settings
a6e8deb: IDEA-121156 Editor Caret Odd Behavior For Blank Lines
0c9b479: Merge remote-tracking branch 'origin/master'
dfd3a17: Don't try to stop threads as it has little sense in general and causes exception in Python 3.4 (PY-12317).
5461aa2: IDEA-122519 No enclosing instance of type XXX in scope
b711782: IDEA-122464 Unused declaration ignores annotation patterns
4c4fff5: EA-55045 - ISE: MethodParameterInfoHandler.updateMethodPresentation
a6218a4: process declarations for cls file should provide classes, otherwise cls classes in default packages have no chance to be found from inside cls (IDEA-122486)
e350d3b: IDEA-105413 Remove awkward public static mutable project and filter from connector
76f7706: [log] move "Select..." up in multi-user filter to match multi-branch one
3a6a0bd: [log] IDEA-122429 Remember current value in branch/user filter popup
1b32efc: IDEA-122192 highlight usages should have highest priority
884db72: IDEA-122492 identifier highlighting conflicts with current line
0ab930d: Merge remote-tracking branch 'origin/master'
922b4f4: fix clear button position
75ef000: handle brilliant obsolete and deprecated marks
e66d2cb: Painting optimisation
5a4b51e: more logging for mysticism
b390943: place the netty-ID workaround code so that it is executed before any netty-dependent code in platform runs
b26a980: EA-55106 - IAE: LeafPsiElement.replace
bf098f6: IDEA-121693 Postfix completion for System.out.println() IDEA-122459 Postfix completion: template for String.format
595fa4e: be prepared to plugin bytecode issues when loading extensions (IDEA-122436)
5447b3e: leave at least one CPU core free during indexing: it improves IDE responsiveness noticeably
aaa659e: IDEA-85572 only splitter fixed (form deleted)
b9975e2: EA-52995 - assert: RefreshQueueImpl.execute
3ec59b5: IDEA-122536 Debug: App Freezes on launch after update to 13.1
ffcb263: don't trust lookup.isCompletion()
baea900: EA-52995 - assert: RefreshQueueImpl.execute
103c590: EA-54103 - SOE: don't check need of instance methods if we don't need to process methods at all
23596b9: Groovy Shell & Console actions: ask for target module before compilation
b9bbd55: IDEA-122505 Incorrect cursor position in "Expression Evaluation" window
798ac7f: WEB-11240 Live Console: implement multiple line input
409dd73: IDEA-122179 13.1 make/compile is much slower than 13.0 IDEA-122367 Build(make) is extremely slow
6ad2bf1: xdebugger java breakpoints: obtain project directly instead of fetching it via DataContext
003bfed: testdata for IDEA-122509
d8747df: stream: do not suggest collect when filter depends on collection (IDEA-122410)
b929552: IDEA-122392 intention: "Create Local Var from instanceof Usage" does not format generated code
c9e83b2: ui: popup-based expansion hints
be4ba0a: CommonProgramParametersPanel — use native mac chooser working directory ensure that we set system dependent text
a49b7c3: IDEA-122498 Code completion with @DataProvider does not work anymore
e6547e3: poly conditional expression type = target type (IDEA-122401)
77f6284: IDEA-105413 Update Mantis repository to emulate "All Projects" pseudo project on client side if it's not available on server
9440209: Extract RemoteFetchTask and ComboBoxUpdater in TaskUiUtil class. Also added SimpleComboBoxRenderer class as common kind of renderer in repository editors
01fc6fe: Merge remote-tracking branch 'origin/master'
eb9c90f: PY-12426 Create inspection that reports django language level specific issues (quckfix added)
1d6aa84: Merge branch 'svn_18_3'
9ededd4: update media values
687bd20: #WEB-6710 fixed
aca42b2: provide content types from IANA registered list
e609a41: reuse RFC2616 headers from html in REST client (IANA headers list misses some headers)
c14437d: dropped RangeHighlighter from BreakpointWithHighlighter
e38e4d6: cleanup
d46ce2f: ignore missing XInclude in tests [me & nik]
a0adee8: svn: Refactored SvnCommittedChangesProvider - determine repository root url using "svn info" command (instead of explicitly using SVNRepository from SVNKit)
64294ef: ui: about dialog converted to popup
0e79a85: ui: allow borderless popups
10f61bc: Cleanup (dead code, typos)
4da3a18: Cleanup (avoid pointless "cannot restart" exception from the IDE being debugged)
12757b7: jdk 1.6 painting
ee49376: IDEA-122467 Exception in creating syntax highlighter shouldn't prevent opening a file
dbd2050: remove dead CacheUtil code
17c3959: svn: Refactored SvnCommittedChangesProvider.getCommittedChangesImpl - use SVNRevision.HEAD as default "before revision" instead of explicitly calculating latest revision number available
28abbac: Gradle: cdata escape of null string
06fe402: [log] Fix smart refresh, in one commit case.
0ace194: Merge remote-tracking branch 'origin/master'
4d042e5: Windows/Linux fullscreen: more useful layout for clock and "Toggle Full Screen" button.
7e41480: IDEA-122425 "java.awt.AWTError: no screen devices" when trying to run Upsource with JDK 1.8
7c1d2e4: IDEA-122192 highlight usages should have highest priority
8852b34: fixed starting build scripts from IDEA
42975ca: IDEA-108515: Update Resources on frame deactivation should not perform compilation
f27eb57: Platform: OS X scrollbars (registry key for disable)
3de588b: make inspection warn on anonymous classes
e92a1a9: IDEA-84172 (Intention "Inner class is serializable while its outer class is not" doesn't warn on anonymous inner classes)
71ebc41: Bug fix: Don't pass unresolved properties to command line
6334dee: svn: Refactored SvnCommittedChangesProvider.getCommittedChangesImpl - use common client factory model (instead of direct SVNLogClient usage)
56e63f3: IDEA-122377 (do not show plugin error dialog in tests)
a70bef6: PY-12374 (JRE-w/o-JDK detection in startup script)
c63e915: Current branch preselected in Push Dialog
4c8ab4f: IDEA-122310 Hg: "push as new remote branch" should not require selected  "Branch" checkbox
ffa983e: IDEA-122358 Push should use 'default' path by default
75ce562: remove hgroup from html5 tags
86f09b2: svn: Refactored SvnCommittedChangesProvider.getCommittedChangesImpl - removed "filterUrls" parameter (usage of empty string array provides the same results)
8d0a079: unused symbol: should not apply to the public constructors of Externalizable classes (IDEA-120639 )
4671189: IDEA-122138 formatting for Spock by default
00827c2: fixed loading JPS extensions in minor IDEs
f6975dd: IDEA-109467 Too big tooltip for Close Icon (Debug Window)
55dc7eb: #WEB-8630 fixed
4cd7b8a: IDEA-122398 all wraps inside plain GString injections should be NONE
cc7c165: fixed loading JPS extensions from plugins inside IDE process; JPS modules extracted to separate jar to get rid of idea.jar in classpath of external build process
7355e5c: Platform: OS X scrollbars (leaking AWT listener temporarily removed)
3751fb2: IDEA-25231 Resource Editor: Remember Group node foldings + arrows in properties structure
3c5ab6b: EA-53645 - assert: ComponentManagerImpl.getComponent
300f96e: EA-54605 - CCE: GradleConfigurationsNonCodeMembersContributor.processConfigurationAddition
0119122: Platform: OS X scrollbars (do not paint unnecessary scrollbar's background in the console)
fb0df17: Platform: OS X scrollbars (mouse hovering threshold + animating track appearance)
a42ebc1: Platform: OS X scrollbars (do not hide scrollbar while mouse is moving around)
17f72c9: Platform: OS X scrollbars (components hierarchy changed IDEA-122255 + handling components addition/removal after scrollpane creation)
d452ad6: IDEA-122388 Replace with 'Integer.valueOf()' call raises Exception
a97bc5c: IDEA-121180 Exception: Introduce parameter from final local var in anonymous class
6af1d4e: field can be local: group by top level blocks (IDEA-121490)
f2c905d: fix extra border
b5ed665: IDEA-122331 Cannot set breakpoints on multiple selections - corrected isEnabled
1db99bf: IDEA-122331 Cannot set breakpoints on multiple selections
08366a8: registry property to disable injections highlighting WEB-1475 and WEB-11251 partially fixed
26cf621: Icons from option panel, cosmetic changes, magic numbers eliminated.
39dea62: reverted fix for IDEA-121089 Rearrange watches in Debug toolwindow with drag-and-drop (it disables DnD from editor)
266a15d: svn: changes cache: Optimized incoming changes collecting using "svn status -u" command (available when Registry key "svn.use.incoming.optimization" is set)
4ba2acc: github: implement new Task API
5cc1d7e: vcs: changes cache: Optimized files revisions collecting - do not get revision for same file several times (duplicate files are removed from revisions collecting)
eb66628: WEB-7303 — node-webkit debug works
38168d7: testdata after JDK-8034223
90698ca: IDEA-122014 Extract method duplicates analysis fails in case of inner classes
ed13961: IDEA-122347 No quick fix to add explicit type arguments
8abeb2b: Merge remote-tracking branch 'origin/master'
162d49b: exception on exit
4006d8a: CR-IU-652 related to IDEA-114022 false positive inspection error "Cannot resolve query parameter '2'"
5cdd5da: IDEA-122382 Exception in Gradle: update failed for AnAction with ID=CreateRunConfiguration: com/intellij/execution/junit/PatternConfigurationProducer
106529a: IDEA-94140 Run Configurations: first configurations of every type is shown below Defaults on creation
bc39cfc: Use clientIncludes/clientExcludes to filter foo-client.jar content.
9c76da9: Remove unused field webArtifactName
aab8fbd: Rename MavenArtifactResourceConfiguration to MavenWebArtifactConfiguration
a1bf8d4: Minor optimization
2f5eee0: Add expected file name in assertion message
0b6f6ef: IDEA-122192 highlight usages should have highest priority
c26198d: Reusing offscreen image to increase performance.
4d20694: IDEA-99194 Groovy: valueOf of Groovy enum should be available in Java code
7476283e: IDEA-121089 Rearrange watches in Debug toolwindow with drag-and-drop
96c6021: introduced INDEX_DATA_OUTDATED saved indexing state that is set on index invalidation upon events. It allows us to clean index data properly upon file deletion and also avoid index clearing for changed files upon shutdown (IDEA-118211)
390cc17: follow up for IDEA-122272
5339701: IDEA-122050 Groovy. Good code red. @Typechecked.
47ce0aa: Merge remote-tracking branch 'origin/master'
150b3c1: use small font for editor when tabs font is small
3a32c96: Try to receive current user information instead of issues from Redmine  to test connection
9aafaf3: Add several utility methods in ResponseUtil and TaskUtil
074efa8: Check that username is not empty in RedmineRepository#isConfigured
f7b41fe: IDEA-119917 IntelliJ Platform Windows Launcher (pin to windows task bar)
3e87317: [log] fix graph tests when called from idea ultimate
badd156: + notificationType2messageType
58a9de5: Tooltip is bigger than need in case of lack of space. UIUtil: CSS update (it works but has some mistakes)
0de1ef9: ability to customize "Options" text
8242749: IDEA-119475 Can't remove file reverence
4e20c7f: IDEA-121779 set correct context when creating extracted method body. If there is no correct context set original used classes are over covered by the classes imported by default. So the extracted class gets broken.
e8b960c: IDEA-122105: manually set use scope for ReferenceSearch because the default search scope is restricted to project. So libraries are not included. It leads to empty results if the highlighted file is a library source file
f17ed0c: Groovy reassigned checker: simplified caching
75dea1d: IDEA-122125 "Close Active Task" fail on commit
7983e89: compilation
453c95b: IDEA-116904 Gradle: Expand ide junit execution/report facilities to tests run via gradle
b9d8057: sm.runner: StatisticsPanel row selection fix
3b538ef: made filters table cells editable
fcc820f: revert change of http handlers
040e1d7: Merge remote-tracking branch 'origin/master'
ec5b1cd: initial WEB-7303 Add support for debugging with node-webkit
74b15db: fix nullability
8b1944e: extract checkPath
e1d36c7: log most frequent unknown extensions only if indices were used (IDEA-121444)
b901aff: alt insert in editor tip: replace may with can
b7b8338: reverted
15d941c: cleanup
39eb03d: Merge remote-tracking branch 'origin/master'
22d2a16: copyright: provide write action progress (IDEA-122290)
b16c8c7: Updated python plugin versions.
db9dd4a: Updated python plugin versions.
2aec833: Merge remote-tracking branch 'origin/master'
c3874db: IDEA-122091 Scratch editor > Save as: provide default directory
df55839: FinderRecursivePanel: when creating child from updateSelectedPath(), do not fire updatePanel(), also block updatePanel() when in update mode
ad32b3b: Merge remote-tracking branch 'origin/master'
18f73e8: project leak via settingsListener
e7e0833: log most frequent unknown extensions after full-text search (IDEA-121444)
c4b2d85: make favorites dumb aware
de6385b: query dumb-awareness from delegate
2368a48: dumb aware
a37bf73: dumb aware buttons
62e38db: mention Contract(pure=true) in description
7976cb0: FinderRecursivePanel#updateSelectedPath: focus last list's selected item
1f9f67b: Merge remote-tracking branch 'origin/master'
62ee825: JPS: return modules and libraries from dependencies in proper order (IDEA-122154)
c799d76: Merge branch 'master' of git.labs.intellij.net:idea/community
76bf0e3: Merge branch 'master' of git.labs.intellij.net:idea/community
c321d51: memory leak in tests
81235aa: CR-IU-595 - introduce createTemporaryConnection
0d792f7: IDEA-122235 Detect groovy scripts from the hashbang line
b066fcd: Merge remote-tracking branch 'origin/master'
8da91c3: missed optimize imports quick fix (IDEA-122234)
c80dd70: return Advanced configuration tab for java
72389dc: IDEA-120348 Add checkbox in editor, that allows to download cards, not assigned to current user, because it turned out to be confusing
9499ff4: EA-54906 - IAE: ElementManipulators.getManipulator
161297a: IDEA-119863 Extract variable moves variable above label
407a496: IDEA-120595 Fix version number in bundle's message
8e9c741: IDEA-120595 Correctly check STATUS_UPDATING feature of repository in "Open Task" and "Close Task" dialogs
05308c7: [log] Preselect the first commit on log initialization
4701c07: [log] invokeAndWait instead of invokeLater
a5af202: [git] fix typo in comment
1ed8560: [git log] IDEA-121969 don't request changes on start & refresh
afdb8dd: [log] IDEA-121969 Don't load Changes on start and refresh
5f1d22f: [log] cleanup
8ab7cfd: [log] Simplify code & comments: no need to consider recent commit count
768265d: EA-54739 - assert: QuickEditHandler.<init>
859689e: IDEA-122283 Notification.expire() doesn't work if Event Log toolwindow hasn't been activated yet
86166fa: coverage: build trove4j to be compatible with 1.5
6f29a21: Merge remote-tracking branch 'origin/master'
1fe0dd9: EA-54916 exception in PhpStorm commandLineTool plugin
aa6d3f6: Merge remote-tracking branch 'origin/master'
c341934: better getPriority description
99fed4d: IDEA-119475 Can't remove file reverence
5924163: optimisation: lock-free sets
cce3665: cleanup
80cbf54: notnull
959161e: test fixed
3a250971: notnull
1f0dcc2: feature usage for postfix completion
5aa3ffb: changing mouse shortcut for QuickEvaluateExpression on Linux to avoid conflict with add/remove caret shortcut
e0bb6bd: IDEA-121963 AIOOBE at com.intellij.refactoring.introduceVariable.IntroduceVariableBase.collectExpressions
0bbad3a: IDEA-54392 (show annotations in type migration dialog)
34d89f6: Cleanup (pointless code; formatting)
2e878bc: IDEA-114022 false positive inspection error "Cannot resolve query parameter '2'"
1df86cf: IDEA-120430 (Format string %c with integer argument should not be shown as error)
fde4e85: add javadoc url dumb aware
56458c2: make copy button dumb aware
f536137: IDEA-120563
9e5d095: postfix templates rebranding
d502927: postfix: gray example text (^zolotov)
fb4cb3f: Platform: OS X scrollbars (table cell animator fixed)
f9a8d50: IDEA-121067, EA-48867 Uncertain editor bug
10659ce: fixed firing rootsChange event on changes in libraries and SDK (IDEA-121272)
ab5d415: Merge remote-tracking branch 'origin/master'
b5be271: add global message to push dialog
29b0996: cleanup
1dbf9f3: cleanup
60f6491: prepare to fix WEB-7303 — reduce dependency on ExtBackedChromeConnection, add node-webkit icons
2ecb8b1: init WEB-7303 WebStorm: Add support for debugging with node-webkit.
0d8b9ae: deprecate unused method
54439ef: EA-53722
a8aebce: Merge remote-tracking branch 'origin/master'
1c63f99: tune mac scrollbars color under darcula
2025e78: [git] log suppressed output by separate logger
f3e571b: [git] suppress stdout by default
5b25e65: [git] cleanup
adccc14: [git] reuse parent logger
f7f812c: [git] cleanup
5eec291: diff: enable/disable 'merge parameters' text field depending on 'Merge tool enabled' checkbox
365c3b8: IDEA-99129 diff: remember 'external merge tool' settings
ada3f58: fix compilation
af02623: fix compilation
422f7ad: forbid multi selection for unwrap (IDEA-120869)
3117a5a: delete from project view: show same safe delete dialog (IDEA-120945)
366670a: junit: exclude resources from test run (IDEA-121076)
4e081bc: prefer tests over main on test methods (DEA-121541)
8b37b2b: overload resolution: compare SAMs erasures
c464f19: IDEA-122129 agentmain method is highlighted as unused
3704bfc: IDEA-121234 IDEA can not update method return type
30c779b: schedule cache update in dump mode on by default
c7648e1: CR-IC-4717 name refactoring
9c7e7ed: Merge remote-tracking branch 'origin/master'
3457c99: CR-IC-4717 review result fixing
035d3eb: vcs: changes cache: Refactored ChangesCacheFile.RefreshIncomingChangesOperation - methods extracted
0de2170: Platform: OS X scrollbars (do not hide scrollbar while grabbed by mouse)
8eabdc7: IDEA-122142 on new Tag creating dialog focus moved to tag name field
1f16202: Platform: OS X scrollbars (unnecessary resets of scrollbars in editor)
cb0037f: Platform: OS X scrollbars (incorrectly calculated indents fixed)
ff2ecb3: IDEA-122188 IDEA 13.1 deadlock when loading project
b7b410b: Add org.jetbrains.plugins.vagrant plugin
3e7913c: more tips and tricks
d06c01c: Platform: OS X scrollbars
d910f8b: vcs: changes cache: Optimized incoming changes processing - call FilePath.isUnder() only if we definitely need to (corresponding change indicates either parent was replaced or file was moved/renamed)
d00772e: tune commit dialog to show global messages
105781f: git edit global message
76d0e4f: vcs global message initial
e0dd82f: split buildHtml method
5a4b91e: vcs: changes cache: Optimized incoming changes processing - use cached value of index file length (instead of always calling native method RandomAccessFile.length())
224598d: postfix completion tip
f944608: catch any error from EP impl
1fa1472: add custom line split action for python console (PY-12224)
73346a2: Group by Directory dumb aware
bfec045: expand all can be dumb aware
18d2a02: make browser panel action dumb aware
0ce3ced: make cvs tool window dumb aware (to e.g. browse CVS repository while in dumb mode)
db0aa77: EA-54889 (NPE: CvsAnnotationProvider.annotateBinary)
2b1f5c1: make CVS actions dumb aware
e8e8818: IDEA-122132 Maven: filtering of deployment descriptors support filteringDeploymentDescriptors option
d8051db: EA-54696 - assert: FileManagerImpl.findFile
232212c: Return NONE connection type for null.
da6d210: Gradle: rely on external Scala resolver extension declaration
773042b: save/restore psi elements
5c0ec9d: java implementation for psi externalizer
bcd6ce9: Lang EP for psi <--> String conversions
86914b1: IDEA-117507 (lazy progress manager initialization)
7326052: obsolete highlighting
0517608: Typo
b2f04a3: EA-54467 - assert: GroovyAccessibilityInspection$.fun
68a2121: scratch: introduce max visible size and better language filtration
be322d6: IDEA-97026 Debugger: 'Help' button in 'Customize data views' dialog should exist
b0a3d30: creating django project from python plugin
2a9abea: Temporarily disabled "only VCS changed text" checkbox due to [IDEA-122040]
0fb6648: [IDEA-116058] reformat code over selected text forces optimizes imports option. Temporarily disabled "only VCS changed text" checkbox for directory formatting.
56270c5: save/restore run configurations
450be84: IDEA-118548 Applied "locale settings for Mac" fix to CmdVersionClient
965b384: EnforcedPlainTextFileTypeManager: Use FileContentUtilCore.reparseFiles() instead of makeRootsChange, [CR-CR-IC-4656] comment
5ae8b51: Groovy: use method can be used with a list of classes
328daa4: fix HtmlCompletionTest.testXhtmlCompletionInHtml
fd55393: Groovy: closure signature infrastructure. Closure signature implementations for PsiMethod and GrClosableBlock without state. Some utility signature implementations
c2c368d: IDEA-121042 Disable certain types of documentation dialogs
7e48866: EA-54551 - IAE: ResolveUtil.treeWalkUp
a5cc688: fix unboxing detection for equality operations and more than 2 operands
fa8030d: EA-54780 (AIOOBE: ExpectedTypeUtils$ExpectedTypeVisitor.visitPolyadicExpression)
1bc249d: EA-52755 (assert: ProblemDescriptorBase.<init>)
97bd1ac: Tips update: IntelliLang
7adc32a: don't create UI in headless environment
f4cd155: renderer is already receiving proper bounding rectangle (see JavaDoc) #WEB-11280 fixed
bb3283e: Add meta shift B alias for Go to type declaration action in MacOS keymap
5e27502: fix missing CSS in plugin-specific tips
f38c1c0: Merge remote-tracking branch 'origin/master'
219506d: new inference: ignore return dependencies of a variable when proper bound is present (IDEA-119535)
766bdc0: new inference: method reference constraint for the case of return type depends on type params (IDEA-122100)
51194e4: Fix emmet surround action. Replace unmodifiable set with modifiable one
15eb603: Merge remote-tracking branch 'origin/master'
170cf57: Merge branch 'master' of git.labs.intellij.net:idea/community
222b27b: IDEA-121738 Shift-click in gutter doesn't create 'no suspend' breakpoint anymore (after review)
f37e655: fixed NPE when toggling a breakpoint on a line with comment
4482c9d: CR-IU-624 - make JavaDebugServerModeHandler the abstract class
0ab82a3: trunk is IntelliJ Idea 14.0
118d0ef: Merge remote-tracking branch 'origin/master'
ad8a60e: [log] invoke handleAnswer (which manipulates with UI) in EDT
4b93624: Support properties loaded via properties-maven-plugin
1cfcd2d: Fix editing of a remote python sdk.
4032773: style: introduce tip variable
fa3b014: CR-IU-637 remove fileType parameter
09a7e02: FinderRecursivePanel: always re-create child element as existing instance might refer to previously selected value of parent
b8c5d87: introduce registry property: ide.scratch.enabled and small cleanup
ee1aa0b: adjust popup size
cfe4903: IDEA-122032 log problem with missed appropriate branch head file
7092b7e: EA-54824 - NPE: ModifiableModelCommitter.createDFSTBuilder
9cf91c4: Merge branch 'python-fixes'
835183a: CR-IC-4719 revert "pass value to renderValue"
9307222: fixed PY-9367 Instance attribute defined outside init: missing underscore in inspection name
1d66053: style
822c165: [git] IDEA-119453 IDEA-120142 Keep git error output
7b4e53e: IDEA-121431 New Mac Messages sometimes appear in the upper left corner of the desktop for a split second
fc93d6e: fixed option name for PY-9222 False positive on 1-tuple in Remove Redundant Parentheses inspection
5ff6abd: fixed PY-9222 False positive on 1-tuple in Remove Redundant Parentheses inspection
fe96d85: exception handling
1671619: initialize compiler options before any further customizations to adapt to lazy initialization of some components inside javac (IDEA-120255)
b4b3825: fixed PY-9073 Wrong inspection of redundant parenthesis
a4359f0: fixed tuple in return statement option in redundant parentheses inspection
28e65cb: wizard popup positioning fix fox mac (^medvedev)
932fdf2: Don't show modules from python-skeletons in Go To Class / Symbol
068794c: added PY-8367 Quickfix for removing unused parameter or variable
96b2f7d: Merge remote-tracking branch 'origin/master'
524034d: [git log] IDEA-122148 Hide action from non-git projects
8532356: new inference: resolve bounds which are not mentioned by additional constraints before starting algorithm
d03d73e: testdata for IDEA-122074, IDEA-122084
8f39cbc: new inference: reject expression constraint which leads to false inside bound set
a062d00: quick fix for EA-54736 - assert: MethodCandidateInfo.getPertinentApplicabilityLevel
78aca2e: default update Project strategy should be merge strategy
8484f43: IDEA-122034 status command error temporary fixed
9043ec6: [log] Fix getGraphChange() in GraphAnswer.
94ba424: Merge remote-tracking branch 'origin/master'
18e5363: DomUtil.hasXml: use DomElement.exists() to avoid costly getXmlElement()
51adc66: Merge branch 'python-fixes'
2683078: scratchpad: replace dialog with popup
d276f0d: Cleanup
40c0a1b: wizard popup positioning fix (^kb)
67046c7: Don't include paths libraries in Python run configurations for PyCharm
fb23b2b: EA-54574 - CCE: GroovyAnnotationAttributeInfoHandler.updateUI
cf85fdc: get rid of DefaultGroovyMethods
93f4eef: EA-54612 - IAE: GroovyLanguageInjectionSupport.getTopLevelInjectionTarget
3f3ba45: some NotNulls
aa406ec: Merge branch 'svn_18_3'
ad01bdc: Merge remote-tracking branch 'origin/master'
ee8efc6: IDEA-121826 Link to IDE in 'License Upgrade Needed' popup doesn't work
745ec14: [log] ignore empty lines in branch/user popups
44ec341: [log] IDEA-122051 Better fix case when no current user is defined
6f11629: github: remove deprecated string constant
14f5ea1: Next/Prev buttons stats
565c12d: Merge remote-tracking branch 'origin/master'
dbf6107: Create and use checkedPlugins.txt
daa6cbc: platform: update check postponed till the application is loaded
2fa0feb: EA-53425 (do not suggest casting to null type)
2805c47: IDEA-103174 (type annotations in change signature)
3ba792a: Cleanup (dead code; pointless exceptions; constants; formatting)
5dda968: show tips on startup statistics
92c73eb: ide settings statistics
82b3c91: [log] IDEA-117920 Remember 'show long edges' setting between refreshes & restarts
0a6d94b: Missed try/catch for MacMessagesException
e88877b: EA-54776 - NPE: PsiSubstitutorImpl.toString
a4d1145: IDEA-122052 Groovy: blinking red highlighting Any code inside annotations is never compile-static. So don't waste time for inferring. More over it can lead to incorrect result of isCompileStatic() if the inference is started inside @TypeChecked(...) annotation.
6909687: fixed vertical scrolling speed in debugger variables view
77ef485: IDEA-118202  Unable to create default run configuration from Welcome / Configure +review
fac019e: Merge branch 'python-fixes'
5e9c513: libs for project templates
4aedbcc: Merge remote-tracking branch 'origin/master'
8caa48a: do not create run configuration for the LightVirtualFiles
61f6205: Show skeletons as "Binary Skeletons" and "Extended Defitions" inside Python SDK in project tree (PY-12407)
9d6906a: CR-IU-617 IDEA-122113
6f7a42f: cleanup
f4985e3: IDEA-121896 Delete key doesn't delete CRLF while using multiple carets
2577f91: IDEA-120593 Do not suggest to create 'Static Web' module in IntelliJ IDEA Community Edition if there are no specific project templates like 'Dart'.
1a86a27: IDEA-121301 Setting a breakpoint after navigation to a folded method (after review)
dfe4e01: undo should restore primary caret properly (IDEA-80056)
e32ac9d: [log] IDEA-122051 Fix case when no current user is defined
660cb5c: IDEA-121301 Setting a breakpoint after navigation to a folded method (added glyph click support)
6fe62ef: fixed test runner for non-python modules
97f5f6c: fixed test runner detection
f3f559c: CR-IU-586 IDEA-121892 Hibernate console: after Tab in code completion list truncated query is executed
a440a00: Merge remote-tracking branch 'origin/master'
259a9c1: fixed tests
86eda08: [log] IDEA-117753 trim spaces in log filters
8583eb9: [git] IDEA-122086 update repository info after cherry-pick
60adb2f: fixed test data
200205e: Merge remote-tracking branch 'origin/master'
71cbc6e: added update property signature quick fix to the Property definitions inspection
bb02dfc: Extracted getPythonSdk(AbstractTreeNode)
ac95684: IDEA-122068 Unknown plugin error
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
016663e: added Change base class quick fix to the Old-style class contains new-style class features inspection
ce5b97b: fix UI artifacts after exiting from Presentation Mode
6937b4d: StatusBar doesn't change when perform Prefs -> Appearance -> Custom fonts
0e9cbc8: added convert to new-style class quick fix to the Old-style class contains new-style class features inspection
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)
8945192: added Remove decorator quick fix to the Problematic nesting of decorators inspection
dd6b3a2: added Remove call quick fix to the Trying to call a non-callable object inspection
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
042305c: EA-48005 Make default value for committed revision in PortableStatus be SVNRevision.UNDEFINED instead of null
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
71e5440: Don't show python-skeletons in Python SDK libraries inside project tree structure
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
0ffb666: svn: terminal: Make commands that do not require repository access do no execute in terminal mode even if terminal mode is configured (to optimize performance)
fc62f95: Simplify Gitlab connector by using ComboBoxUpdater. Also ComboBoxUpdater selects first item of the list, if no one is provided.
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
eb624ba: Merge branch 'new-redmine-repo'
12f879f: svn: terminal: Run commands in terminal mode (if configured) only for ssh repositories
4e7d70f: Add several changes in "Tasks and Contexts" subsystem API to avoid previous problems with issues missing in "Open Task" dialog (e.g. see IDEA-110012).
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)
262b949: Add tooltip about NTLM authentication to login field
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
1441da4: Fixed a warning, run maven build in maven 3.2.1
7461b16: Add tests for Redmine and filtering by assignee in its requests
56b1f50: Configure proper preemptive basic authentication in http client
5c6037b: Refactor Redmine editor to contain combo box with available projects. Extract common kinds of backgroundable tasks to RemoteFetchTask class
efc4ae6: Update date parsing to accept spaces before timezone
b75dafd: First version of updated Redmine repository
7b94fd3: Fix typo and remove unused redundant hashCode() implementation from Gitlab connector
2897d8e: Move Gson related utitly methods to 'impl.gson' package
47dfe5b: Move httpclient helper classes to 'impl' package
b151d5d: Update old repository to use new getIssues() format

Change-Id: I6689a2b039c939829abf0656740d02d779f14795
diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
index 5a2fa70..b8a27b7 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java
@@ -23,8 +23,6 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ex.ProjectManagerEx;
-import com.intellij.openapi.roots.impl.DirectoryIndex;
-import com.intellij.openapi.roots.impl.DirectoryIndexImpl;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 
@@ -81,9 +79,6 @@
       logMessage(0, "Loading project...");
       myProject = ProjectManagerEx.getInstanceEx().loadProject(myProjectPath);
 
-      DirectoryIndexImpl dirIndex = (DirectoryIndexImpl)DirectoryIndex.getInstance(myProject);
-      dirIndex.initialize();
-
       logMessageLn(0, " done");
 
       GenerateAntBuildAction.generateSingleFileBuild(myProject,
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java
index a901381..f4c372a 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileContextImpl.java
@@ -26,6 +26,7 @@
 import com.intellij.compiler.CompilerWorkspaceConfiguration;
 import com.intellij.compiler.make.DependencyCache;
 import com.intellij.compiler.progress.CompilerTask;
+import com.intellij.execution.impl.ExecutionManagerImpl;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.compiler.*;
 import com.intellij.openapi.compiler.Compiler;
@@ -99,7 +100,13 @@
     myIsAnnotationProcessorsEnabled = CompilerConfiguration.getInstance(project).isAnnotationProcessorsEnabled();
 
     if (compilerSession != null) {
-      compilerSession.setContentIdKey(compileScope.getUserData(CompilerManager.CONTENT_ID_KEY));
+      final Object sessionId = ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.get(compileScope);
+      if (sessionId != null) {
+        // in case compilation is started as a part of some execution session, 
+        // all compilation tasks should have the same sessionId in order for successive task not to clean messages 
+        // from previous compilation tasks run within this execution session
+        compilerSession.setSessionId(sessionId);
+      }
     }
     recalculateOutputDirs();
     final CompilerWorkspaceConfiguration workspaceConfig = CompilerWorkspaceConfiguration.getInstance(myProject);
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
index 015da86..342ff2e 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.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.
@@ -207,7 +207,7 @@
       compileScope = projectScope;
     }
     else {
-      CompileScope scopeWithArtifacts = ArtifactCompileScope.createScopeWithArtifacts(projectScope, ArtifactUtil.getArtifactWithOutputPaths(myProject), false);
+      CompileScope scopeWithArtifacts = ArtifactCompileScope.createScopeWithArtifacts(projectScope, ArtifactUtil.getArtifactWithOutputPaths(myProject));
       compileScope = addAdditionalRoots(scopeWithArtifacts, ALL_EXCEPT_SOURCE_PROCESSING);
     }
     doRebuild(callback, null, true, compileScope);
@@ -280,7 +280,9 @@
           }
           finally {
             result.set(COMPILE_SERVER_BUILD_STATUS.get(compileContext));
-            CompilerCacheManager.getInstance(myProject).flushCaches();
+            if (!myProject.isDisposed()) {
+              CompilerCacheManager.getInstance(myProject).flushCaches();
+            }
           }
         }
       };
@@ -488,7 +490,11 @@
     final Collection<String> paths = CompileScopeUtil.fetchFiles(compileContext);
     List<TargetTypeBuildScope> scopes = new ArrayList<TargetTypeBuildScope>();
     final boolean forceBuild = !compileContext.isMake();
-    if (!compileContext.isRebuild() && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {
+    List<TargetTypeBuildScope> explicitScopes = CompileScopeUtil.getBaseScopeForExternalBuild(scope);
+    if (explicitScopes != null) {
+      scopes.addAll(explicitScopes);
+    }
+    else if (!compileContext.isRebuild() && !CompileScopeUtil.allProjectModulesAffected(compileContext)) {
       CompileScopeUtil.addScopesForModules(Arrays.asList(scope.getAffectedModules()), scopes, forceBuild);
     }
     else {
@@ -1210,7 +1216,7 @@
 
   private void clearAffectedOutputPathsIfPossible(final CompileContextEx context) {
     final List<File> scopeOutputs = new ReadAction<List<File>>() {
-      protected void run(final Result<List<File>> result) {
+      protected void run(@NotNull final Result<List<File>> result) {
         final MultiMap<File, Module> outputToModulesMap = new MultiMap<File, Module>();
         for (Module module : ModuleManager.getInstance(myProject).getModules()) {
           final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module);
@@ -1894,40 +1900,33 @@
       final Set<String> pathsToRemove = new HashSet<String>(cache.getUrls());
 
       final Map<GeneratingCompiler.GenerationItem, String> itemToOutputPathMap = new HashMap<GeneratingCompiler.GenerationItem, String>();
-      final IOException[] ex = {null};
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
+      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
+        @Override
+        public Void compute() throws IOException {
           for (final GeneratingCompiler.GenerationItem item : allItems) {
+
             final Module itemModule = item.getModule();
             final String outputDirPath = CompilerPaths.getGenerationOutputPath(compiler, itemModule, item.isTestSource());
             final String outputPath = outputDirPath + "/" + item.getPath();
             itemToOutputPathMap.put(item, outputPath);
+            final ValidityState savedState = cache.getState(outputPath);
 
-            try {
-              final ValidityState savedState = cache.getState(outputPath);
-
-              if (forceGenerate || savedState == null || !savedState.equalsTo(item.getValidityState())) {
-                final String outputPathUrl = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, outputPath);
-                if (context.getCompileScope().belongs(outputPathUrl)) {
-                  toGenerate.add(item);
-                }
-                else {
-                  pathsToRemove.remove(outputPath);
-                }
+            if (forceGenerate || savedState == null || !savedState.equalsTo(item.getValidityState())) {
+              final String outputPathUrl = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, outputPath);
+              if (context.getCompileScope().belongs(outputPathUrl)) {
+                toGenerate.add(item);
               }
               else {
                 pathsToRemove.remove(outputPath);
               }
             }
-            catch (IOException e) {
-              ex[0] = e;
+            else {
+              pathsToRemove.remove(outputPath);
             }
           }
+          return null;
         }
       });
-      if (ex[0] != null) {
-        throw ex[0];
-      }                   
 
       if (onlyCheckStatus) {
         if (toGenerate.isEmpty() && pathsToRemove.isEmpty()) {
@@ -2508,7 +2507,7 @@
         final Boolean refreshSuccess =
           new WriteAction<Boolean>() {
             @Override
-            protected void run(Result<Boolean> result) throws Throwable {
+            protected void run(@NotNull Result<Boolean> result) throws Throwable {
               LocalFileSystem.getInstance().refreshIoFiles(nonExistingOutputPaths);
               Boolean res = Boolean.TRUE;
               for (File file : nonExistingOutputPaths) {
@@ -2734,26 +2733,19 @@
       list.add(new Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>(cache, item));
     }
 
-    public void doUpdate() throws IOException{
-      final IOException[] ex = {null};
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          try {
-            for (Map.Entry<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>> entry : myData.entrySet()) {
-              for (Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem> pair : entry.getValue()) {
-                final FileProcessingCompiler.ProcessingItem item = pair.getSecond();
-                pair.getFirst().update(entry.getKey(), item.getValidityState());
-              }
+    public void doUpdate() throws IOException {
+      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
+        @Override
+        public Void compute() throws IOException {
+          for (Map.Entry<VirtualFile, List<Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem>>> entry : myData.entrySet()) {
+            for (Pair<FileProcessingCompilerStateCache, FileProcessingCompiler.ProcessingItem> pair : entry.getValue()) {
+              final FileProcessingCompiler.ProcessingItem item = pair.getSecond();
+              pair.getFirst().update(entry.getKey(), item.getValidityState());
             }
           }
-          catch (IOException e) {
-            ex[0] = e;
-          }
+          return null;
         }
       });
-      if (ex[0] != null) {
-        throw ex[0];
-      }
     }
   }
 
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileScopeUtil.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileScopeUtil.java
index 1f5269e..3942f2d 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileScopeUtil.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileScopeUtil.java
@@ -17,7 +17,9 @@
 
 import com.intellij.openapi.compiler.CompileScope;
 import com.intellij.openapi.module.Module;
+import com.intellij.openapi.util.Key;
 import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;
 import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
 
@@ -27,6 +29,12 @@
  * @author nik
  */
 public class CompileScopeUtil {
+  private static final Key<List<TargetTypeBuildScope>> BASE_SCOPE_FOR_EXTERNAL_BUILD = Key.create("SCOPE_FOR_EXTERNAL_BUILD");
+
+  public static void setBaseScopeForExternalBuild(@NotNull CompileScope scope, @NotNull List<TargetTypeBuildScope> scopes) {
+    scope.putUserData(BASE_SCOPE_FOR_EXTERNAL_BUILD, scopes);
+  }
+
   public static void addScopesForModules(Collection<Module> modules, List<TargetTypeBuildScope> scopes, boolean forceBuild) {
     if (!modules.isEmpty()) {
       for (JavaModuleBuildTargetType type : JavaModuleBuildTargetType.ALL_TYPES) {
@@ -39,6 +47,10 @@
     }
   }
 
+  public static List<TargetTypeBuildScope> getBaseScopeForExternalBuild(@NotNull CompileScope scope) {
+    return scope.getUserData(BASE_SCOPE_FOR_EXTERNAL_BUILD);
+  }
+
   public static List<TargetTypeBuildScope> mergeScopes(List<TargetTypeBuildScope> scopes1, List<TargetTypeBuildScope> scopes2) {
     if (scopes2.isEmpty()) return scopes1;
     if (scopes1.isEmpty()) return scopes2;
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java b/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java
index 8ed8e88..8848a40 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/FileProcessingCompilerAdapterTask.java
@@ -21,7 +21,6 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.vfs.LocalFileSystem;
@@ -77,7 +76,7 @@
               if (isMake && cache.getTimestamp(url) == file.getTimeStamp()) {
                 final ValidityState state = cache.getExtState(url);
                 final ValidityState itemState = item.getValidityState();
-                if (Comparing.equal(state, itemState)) {
+                if (state != null ? state.equalsTo(itemState) : itemState == null) {
                   continue;
                 }
               }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
index 3ee643e..c82e7bd 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java
@@ -405,11 +405,10 @@
     final int projectId = getProjectId(project);
     if (!successfullyCompiled.isEmpty()) {
       final LocalFileSystem lfs = LocalFileSystem.getInstance();
-      final IOException[] exceptions = {null};
       // need read action here to ensure that no modifications were made to VFS while updating file attributes
-      ApplicationManager.getApplication().runReadAction(new Runnable() {
-        public void run() {
-          try {
+      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
+        @Override
+        public Void compute() throws IOException {
             final Map<VirtualFile, SourceFileInfo> compiledSources = new HashMap<VirtualFile, SourceFileInfo>();
             final Set<VirtualFile> forceRecompile = new HashSet<VirtualFile>();
 
@@ -477,15 +476,9 @@
                 addSourceForRecompilation(projectId, file, info);
               }
             }
-          }
-          catch (IOException e) {
-            exceptions[0] = e;
-          }
+          return null;
         }
       });
-      if (exceptions[0] != null) {
-        throw exceptions[0];
-      }
     }
     
     if (filesToRecompile.length > 0) {
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.java
index c29b5c5..19e2a0b 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/api/CompilerAPICompiler.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.
@@ -30,7 +30,7 @@
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
-import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -101,27 +101,20 @@
 
   @NotNull
   public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
-    final IOException[] ex = {null};
-    @NonNls final List<String> commandLine = ApplicationManager.getApplication().runReadAction(new Computable<List<String>>() {
-      public List<String> compute() {
-        try {
+    @NonNls final List<String> commandLine =
+      ApplicationManager.getApplication().runReadAction(new ThrowableComputable<List<String>, IOException>() {
+        @Override
+        public List<String> compute() throws IOException {
           List<String> commandLine = new ArrayList<String>();
           final List<String> additionalOptions =
-            JavacCompiler.addAdditionalSettings(commandLine, CompilerAPIConfiguration.getOptions(myProject, CompilerAPIConfiguration.class), false, JavaSdkVersion.JDK_1_6, chunk, compileContext.isAnnotationProcessorsEnabled());
+            JavacCompiler.addAdditionalSettings(commandLine, CompilerAPIConfiguration .getOptions(myProject, CompilerAPIConfiguration.class), false,
+                                                 JavaSdkVersion.JDK_1_6, chunk, compileContext.isAnnotationProcessorsEnabled());
 
-          JavacCompiler.addCommandLineOptions(chunk, commandLine, outputDir, chunk.getJdk(), false,false, null, false, false, false);
+          JavacCompiler.addCommandLineOptions(chunk, commandLine, outputDir, chunk.getJdk(), false, false, null, false, false, false);
           commandLine.addAll(additionalOptions);
           return commandLine;
         }
-        catch (IOException e) {
-          ex[0] = e;
-        }
-        return null;
-      }
-    });
-    if (ex[0] != null) {
-      throw ex[0];
-    }
+      });
     return new MyProcess(commandLine, chunk, outputDir, compileContext);
   }
 
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java
index 615315d..d9a7c30 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompiler.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.
@@ -31,6 +31,7 @@
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -130,20 +131,13 @@
     throws IOException {
 
     final ArrayList<String> commandLine = new ArrayList<String>();
-    final IOException[] ex = {null};
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        try {
-          createStartupCommand(chunk, commandLine, outputPath, true);
-        }
-        catch (IOException e) {
-          ex[0] = e;
-        }
+    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
+      @Override
+      public Void compute() throws IOException {
+        createStartupCommand(chunk, commandLine, outputPath, true);
+        return null;
       }
     });
-    if (ex[0] != null) {
-      throw ex[0];
-    }
     return ArrayUtil.toStringArray(commandLine);
   }
 
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.java
index 77aa2a1..ed6c03a 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseEmbeddedCompiler.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.
@@ -28,6 +28,7 @@
 import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -104,21 +105,15 @@
   @NotNull
   public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
     @NonNls final ArrayList<String> commandLine = new ArrayList<String>();
-    final IOException[] ex = {null};
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        try {
-          final EclipseCompilerOptions options = EclipseCompilerConfiguration.getOptions(myProject, EclipseEmbeddedCompilerConfiguration.class);
-          myEclipseExternalCompiler.addCommandLineOptions(commandLine, chunk, outputDir, options, false, false);
-        }
-        catch (IOException e) {
-          ex[0] = e;
-        }
+    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
+      @Override
+      public Void compute() throws IOException {
+        final EclipseCompilerOptions options =
+          EclipseCompilerConfiguration.getOptions(myProject, EclipseEmbeddedCompilerConfiguration.class);
+        myEclipseExternalCompiler.addCommandLineOptions(commandLine, chunk, outputDir, options, false, false);
+        return null;
       }
     });
-    if (ex[0] != null) {
-      throw ex[0];
-    }
 
     return new Process() {
       public OutputStream getOutputStream() {
@@ -140,7 +135,7 @@
         try {
           commandLine.remove("-verbose");
           String[] finalCmds = ArrayUtil.toStringArray(commandLine);
-          myEclipseCompilerDriver.parseCommandLineAndCompile(finalCmds,compileContext);
+          myEclipseCompilerDriver.parseCommandLineAndCompile(finalCmds, compileContext);
           myExitCode = 0;
           return myExitCode;
         }
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java
index fb4eed3..fb0246f 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/jikes/JikesCompiler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -33,6 +33,7 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -140,20 +141,13 @@
     throws IOException {
 
     final ArrayList<String> commandLine = new ArrayList<String>();
-    final IOException[] ex = {null};
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        try {
-          _createStartupCommand(chunk, commandLine, outputPath);
-        }
-        catch (IOException e) {
-          ex[0] = e;
-        }
+    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, IOException>() {
+      @Override
+      public Void compute() throws IOException {
+        _createStartupCommand(chunk, commandLine, outputPath);
+        return null;
       }
     });
-    if (ex[0] != null) {
-      throw ex[0];
-    }
     return ArrayUtil.toStringArray(commandLine);
   }
 
diff --git a/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java b/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java
index bf2a58e..51cb953 100644
--- a/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java
+++ b/java/compiler/impl/src/com/intellij/compiler/make/CacheUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -27,6 +27,7 @@
 import com.intellij.openapi.compiler.ex.CompileContextEx;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.util.ArrayUtil;
@@ -134,7 +135,7 @@
     final Set<VirtualFile> compiledWithErrors, 
     final @Nullable Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> filter)
     throws CacheCorruptedException, ExitException {
-    
+
     if (!CompilerConfiguration.MAKE_ENABLED) {
       return Collections.emptyList();
     }
@@ -143,51 +144,44 @@
     final DependencyCache dependencyCache = context.getDependencyCache();
 
     final Pair<int[], Set<VirtualFile>> deps = dependencyCache.findDependentClasses(context, context.getProject(), compiledWithErrors);
-    final Pair<int[], Set<VirtualFile>> filteredDeps = filter != null? filter.fun(deps) : deps;
+    final Pair<int[], Set<VirtualFile>> filteredDeps = filter != null ? filter.fun(deps) : deps;
 
     final Set<VirtualFile> dependentFiles = new HashSet<VirtualFile>();
-    final CacheCorruptedException[] _ex = {null};
-    ApplicationManager.getApplication().runReadAction(new Runnable() {
-      public void run() {
-        try {
-          CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(context.getProject());
-          SourceFileFinder sourceFileFinder = new SourceFileFinder(context.getProject(), context);
-          final Cache cache = dependencyCache.getCache();
-          for (final int infoQName : filteredDeps.getFirst()) {
-            final String qualifiedName = dependencyCache.resolve(infoQName);
-            final String sourceFileName = cache.getSourceFileName(infoQName);
-            final VirtualFile file = sourceFileFinder.findSourceFile(qualifiedName, sourceFileName, true);
-            if (file != null) {
-              dependentFiles.add(file);
-              if (ApplicationManager.getApplication().isUnitTestMode()) {
-                LOG.assertTrue(file.isValid());
-                CompilerManagerImpl.addRecompiledPath(file.getPath());
-              }
-            }
-            else {
-              LOG.info("No source file for " + dependencyCache.resolve(infoQName) + " found; source file name=" + sourceFileName);
+    ApplicationManager.getApplication().runReadAction(new ThrowableComputable<Void, CacheCorruptedException>() {
+      @Override
+      public Void compute() throws CacheCorruptedException {
+        CompilerConfiguration compilerConfiguration = CompilerConfiguration.getInstance(context.getProject());
+        SourceFileFinder sourceFileFinder = new SourceFileFinder(context.getProject(), context);
+        final Cache cache = dependencyCache.getCache();
+        for (final int infoQName : filteredDeps.getFirst()) {
+          final String qualifiedName = dependencyCache.resolve(infoQName);
+          final String sourceFileName = cache.getSourceFileName(infoQName);
+          final VirtualFile file = sourceFileFinder.findSourceFile(qualifiedName, sourceFileName, true);
+          if (file != null) {
+            dependentFiles.add(file);
+            if (ApplicationManager.getApplication().isUnitTestMode()) {
+              LOG.assertTrue(file.isValid());
+              CompilerManagerImpl.addRecompiledPath(file.getPath());
             }
           }
-          for (final VirtualFile file : filteredDeps.getSecond()) {
-            if (!compilerConfiguration.isExcludedFromCompilation(file)) {
-              dependentFiles.add(file);
-              if (ApplicationManager.getApplication().isUnitTestMode()) {
-                LOG.assertTrue(file.isValid());
-                CompilerManagerImpl.addRecompiledPath(file.getPath());
-              }
+          else {
+            LOG.info("No source file for " + dependencyCache.resolve(infoQName) + " found; source file name=" + sourceFileName);
+          }
+        }
+        for (final VirtualFile file : filteredDeps.getSecond()) {
+          if (!compilerConfiguration.isExcludedFromCompilation(file)) {
+            dependentFiles.add(file);
+            if (ApplicationManager.getApplication().isUnitTestMode()) {
+              LOG.assertTrue(file.isValid());
+              CompilerManagerImpl.addRecompiledPath(file.getPath());
             }
           }
         }
-        catch (CacheCorruptedException e) {
-          _ex[0] = e;
-        }
+        return null;
       }
     });
-    if (_ex[0] != null) {
-      throw _ex[0];
-    }
     context.getProgressIndicator().setText(
-      dependentFiles.size() > 0? CompilerBundle.message("progress.found.dependent.files", dependentFiles.size()) : ""
+      dependentFiles.size() > 0 ? CompilerBundle.message("progress.found.dependent.files", dependentFiles.size()) : ""
     );
 
     return dependentFiles;
diff --git a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
index d37e7c2..c4497e0 100644
--- a/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
+++ b/java/compiler/impl/src/com/intellij/compiler/progress/CompilerTask.java
@@ -71,10 +71,14 @@
 
 public class CompilerTask extends Task.Backgroundable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.progress.CompilerProgressIndicator");
-  private static final Key<Key<?>> CONTENT_ID_KEY = Key.create("CONTENT_ID");
+  private static final Key<Object> CONTENT_ID_KEY = Key.create("CONTENT_ID");
+  private static final Key<Object> SESSION_ID_KEY = Key.create("SESSION_ID");
   private static final String APP_ICON_ID = "compiler";
-  private Key<Key<?>> myContentIdKey = CONTENT_ID_KEY;
-  private final Key<Key<?>> myContentId = Key.create("compile_content");
+  @NotNull
+  private final Object myContentId = new IDObject("content_id");
+  
+  @NotNull
+  private Object mySessionId = myContentId; // by default sessionID should be unique, just as content ID
   private NewErrorTreeViewPanel myErrorTreeView;
   private final Object myMessageViewLock = new Object();
   private final String myContentName;
@@ -107,8 +111,13 @@
     myCompilationStartedAutomatically = compilationStartedAutomatically;
   }
 
-  public void setContentIdKey(Key<Key<?>> contentIdKey) {
-    myContentIdKey = contentIdKey != null? contentIdKey : CONTENT_ID_KEY;
+  @NotNull
+  public Object getSessionId() {
+    return mySessionId;
+  }
+
+  public void setSessionId(@NotNull Object sessionId) {
+    mySessionId = sessionId;
   }
 
   public String getProcessId() {
@@ -189,7 +198,9 @@
 
     ApplicationManager.getApplication().invokeLater(new Runnable() {
       public void run() {
-        if (myProject.isDisposed()) return;
+        if (myProject.isDisposed()) {
+          return;
+        }
         synchronized (myMessageViewLock) {
           // clear messages from the previous compilation
           if (myErrorTreeView == null) {
@@ -410,7 +421,8 @@
     
     final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
     final Content content = ContentFactory.SERVICE.getInstance().createContent(component, myContentName, true);
-    content.putUserData(myContentIdKey, myContentId);
+    CONTENT_ID_KEY.set(content, myContentId);
+    SESSION_ID_KEY.set(content, mySessionId);
     messageView.getContentManager().addContent(content);
     myCloseListener.setContent(content, messageView.getContentManager());
     removeAllContents(myProject, content);
@@ -423,7 +435,7 @@
         final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
         Content[] contents = messageView.getContentManager().getContents();
         for (Content content : contents) {
-          if (content.getUserData(myContentIdKey) != null) {
+          if (CONTENT_ID_KEY.get(content) == myContentId) {
             messageView.getContentManager().setSelectedContent(content);
             return;
           }
@@ -442,7 +454,7 @@
       if (content == notRemove) {
         continue;
       }
-      if (content.getUserData(myContentIdKey) != null) { // the content was added by me
+      if (CONTENT_ID_KEY.get(content) == myContentId  || SESSION_ID_KEY.get(content) != mySessionId) { // the content was added by previous compilation
         messageView.getContentManager().removeContent(content, true);
       }
     }
@@ -617,5 +629,17 @@
       }
     }
   }
+
+  public static final class IDObject {
+    private final String myDisplayName;
+  
+    public IDObject(@NotNull String displayName) {
+      myDisplayName = displayName;
+    }
+  
+    public String toString() {
+      return myDisplayName;
+    }
+  }
 }
                                       
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index 506580c..50227a7 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -72,6 +72,7 @@
 import com.intellij.openapi.wm.IdeFrame;
 import com.intellij.util.Alarm;
 import com.intellij.util.Function;
+import com.intellij.util.PathUtil;
 import com.intellij.util.SmartList;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.concurrency.SequentialTaskExecutor;
@@ -935,6 +936,7 @@
     cmdLine.addParameter(launcherClass.getName());
 
     final List<String> cp = ClasspathBootstrap.getBuildProcessApplicationClasspath(true);
+    cp.add(getJpsPluginSystemClassesPath());
     cp.addAll(myClasspathManager.getBuildProcessPluginsClasspath(project));
     if (isProfilingMode) {
       cp.add(new File(workDirectory, "yjp-controller-api-redist.jar").getPath());
@@ -960,6 +962,17 @@
     };
   }
 
+  private static String getJpsPluginSystemClassesPath() {
+    File classesRoot = new File(PathUtil.getJarPathForClass(BuildManager.class));
+    if (classesRoot.isDirectory()) {
+      //running from sources: load classes from .../out/production/jps-plugin-system
+      return new File(classesRoot.getParentFile(), "jps-plugin-system").getAbsolutePath();
+    }
+    else {
+      return new File(classesRoot.getParentFile(), "rt/jps-plugin-system.jar").getAbsolutePath();
+    }
+  }
+
   public File getBuildSystemDirectory() {
     return new File(mySystemDirectory, SYSTEM_ROOT);
   }
@@ -1253,7 +1266,7 @@
     @Override
     public String getValue() {
       if (myPath.length == 1) {
-        final String name = FileNameCache.getVFileName(myPath[0]);
+        final String name = FileNameCache.getVFileName(myPath[0]).toString();
         // handle case of windows drive letter
         return name.length() == 2 && name.endsWith(":")? name + "/" : name;
       }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java
index abf0484..5280384 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java
@@ -17,7 +17,6 @@
 
 import com.intellij.compiler.impl.ModuleCompileScope;
 import com.intellij.openapi.compiler.CompileScope;
-import com.intellij.openapi.compiler.CompilerManager;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.project.Project;
@@ -44,8 +43,7 @@
   private static final Key<Boolean> FORCE_ARTIFACT_BUILD = Key.create("force_artifact_build");
   private static final Key<Artifact[]> ARTIFACTS_KEY = Key.create("artifacts");
   private static final Key<Set<Artifact>> CACHED_ARTIFACTS_KEY = Key.create("cached_artifacts");
-  private static final Key<Key<?>> ARTIFACTS_CONTENT_ID_KEY = Key.create("build_artifacts_task");
-
+  
   private ArtifactCompileScope() {
   }
 
@@ -62,23 +60,16 @@
   public static CompileScope createArtifactsScope(@NotNull Project project,
                                                   @NotNull Collection<Artifact> artifacts,
                                                   final boolean forceArtifactBuild) {
-    return createScopeWithArtifacts(createScopeForModulesInArtifacts(project, artifacts), artifacts, true, forceArtifactBuild);
+    return createScopeWithArtifacts(createScopeForModulesInArtifacts(project, artifacts), artifacts, forceArtifactBuild);
   }
 
   public static CompileScope createScopeWithArtifacts(final CompileScope baseScope,
-                                                      @NotNull Collection<Artifact> artifacts,
-                                                      boolean useCustomContentId) {
-    return createScopeWithArtifacts(baseScope, artifacts, useCustomContentId, false);
+                                                      @NotNull Collection<Artifact> artifacts) {
+    return createScopeWithArtifacts(baseScope, artifacts, false);
   }
 
-  public static CompileScope createScopeWithArtifacts(final CompileScope baseScope,
-                                                      @NotNull Collection<Artifact> artifacts,
-                                                      boolean useCustomContentId,
-                                                      final boolean forceArtifactBuild) {
+  public static CompileScope createScopeWithArtifacts(final CompileScope baseScope, @NotNull Collection<Artifact> artifacts, final boolean forceArtifactBuild) {
     baseScope.putUserData(ARTIFACTS_KEY, artifacts.toArray(new Artifact[artifacts.size()]));
-    if (useCustomContentId) {
-      baseScope.putUserData(CompilerManager.CONTENT_ID_KEY, ARTIFACTS_CONTENT_ID_KEY);
-    }
     if (forceArtifactBuild) {
       baseScope.putUserData(FORCE_ARTIFACT_BUILD, Boolean.TRUE);
     }
diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java b/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
index e0342eb..a9ea9c3 100644
--- a/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
+++ b/java/compiler/impl/src/com/intellij/packaging/impl/run/BuildArtifactsBeforeRunTaskProvider.java
@@ -20,6 +20,7 @@
 import com.intellij.execution.RunManagerEx;
 import com.intellij.execution.configurations.RunConfiguration;
 import com.intellij.execution.impl.ConfigurationSettingsEditorWrapper;
+import com.intellij.execution.impl.ExecutionManagerImpl;
 import com.intellij.execution.runners.ExecutionEnvironment;
 import com.intellij.icons.AllIcons;
 import com.intellij.ide.DataManager;
@@ -164,7 +165,7 @@
 
   public boolean executeTask(DataContext context,
                              RunConfiguration configuration,
-                             ExecutionEnvironment env,
+                             final ExecutionEnvironment env,
                              final BuildArtifactsBeforeRunTask task) {
     final Ref<Boolean> result = Ref.create(false);
     final Semaphore finished = new Semaphore();
@@ -195,7 +196,9 @@
       public void run() {
         final CompilerManager manager = CompilerManager.getInstance(myProject);
         finished.down();
-        manager.make(ArtifactCompileScope.createArtifactsScope(myProject, artifacts), compilerFilter, callback);
+        final CompileScope scope = ArtifactCompileScope.createArtifactsScope(myProject, artifacts);
+        ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.set(scope, ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.get(env));
+        manager.make(scope, compilerFilter, callback);
       }
     }, ModalityState.NON_MODAL);
 
diff --git a/java/compiler/instrumentation-util/instrumentation-util.iml b/java/compiler/instrumentation-util/instrumentation-util.iml
index 60d62d3..370070e 100644
--- a/java/compiler/instrumentation-util/instrumentation-util.iml
+++ b/java/compiler/instrumentation-util/instrumentation-util.iml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module relativePaths="true" type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="true">
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
index 03d9be2..f9d8bce 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerManager.java
@@ -34,6 +34,7 @@
  * and invoke various types of compilations (make, compile, rebuild)
  */
 public abstract class CompilerManager {
+  @Deprecated
   public static final Key<Key> CONTENT_ID_KEY = Key.create("COMPILATION_CONTENT_ID_CUSTOM_KEY");
   public static final NotificationGroup NOTIFICATION_GROUP = NotificationGroup.logOnlyGroup("Compiler");
 
diff --git a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java
index f02820f..15c1933 100644
--- a/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.java
+++ b/java/compiler/openapi/src/com/intellij/openapi/compiler/CompilerPaths.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.
@@ -16,17 +16,16 @@
 package com.intellij.openapi.compiler;
 
 import com.intellij.compiler.CompilerConfiguration;
-import com.intellij.ide.highlighter.ProjectFileType;
 import com.intellij.openapi.application.Application;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectUtilCore;
 import com.intellij.openapi.roots.CompilerModuleExtension;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
@@ -38,7 +37,6 @@
 import java.io.File;
 import java.util.Arrays;
 import java.util.Comparator;
-import java.util.Locale;
 
 /**
  * A set of utility methods for working with paths
@@ -47,16 +45,13 @@
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.compiler.CompilerPaths");
   private static volatile String ourSystemPath;
   private static final Comparator<String> URLS_COMPARATOR = new Comparator<String>() {
+    @Override
     public int compare(String o1, String o2) {
       return o1.compareTo(o2);
     }
   };
-  private static final String DEFAULT_GENERATED_DIR_NAME = "generated";
-
   /**
    * Returns a directory
-   * @param project
-   * @param compiler
    * @return a directory where compiler may generate files. All generated files are not deleted when the application exits
    */
   public static File getGeneratedDataDirectory(Project project, Compiler compiler) {
@@ -65,7 +60,6 @@
   }
 
   /**
-   * @param project
    * @return a root directory where generated files for various compilers are stored
    */
   public static File getGeneratedDataDirectory(Project project) {
@@ -74,7 +68,6 @@
   }
 
   /**
-   * @param project
    * @return a root directory where compiler caches for the given project are stored
    */
   public static File getCacheStoreDirectory(final Project project) {
@@ -92,7 +85,6 @@
   }
 
   /**
-   * @param project
    * @return a directory under IDEA "system" directory where all files related to compiler subsystem are stored (such as compiler caches or generated files)
    */
   public static File getCompilerSystemDirectory(Project project) {
@@ -104,36 +96,7 @@
   }
 
   public static String getCompilerSystemDirectoryName(Project project) {
-    return getPresentableName(project) + "." + project.getLocationHash();
-  }
-
-  @Nullable
-  private static String getPresentableName(final Project project) {
-    if (project.isDefault()) {
-      return project.getName();
-    }
-
-    String location = project.getPresentableUrl();
-    if (location == null) {
-      return null;
-    }
-
-    String projectName = FileUtil.toSystemIndependentName(location);
-    if (projectName.endsWith("/")) {
-      projectName = projectName.substring(0, projectName.length() - 1);
-    }
-
-    final int lastSlash = projectName.lastIndexOf('/');
-    if (lastSlash >= 0 && lastSlash + 1 < projectName.length()) {
-      projectName = projectName.substring(lastSlash + 1);
-    }
-
-    if (StringUtil.endsWithIgnoreCase(projectName, ProjectFileType.DOT_DEFAULT_EXTENSION)) {
-      projectName = projectName.substring(0, projectName.length() - ProjectFileType.DOT_DEFAULT_EXTENSION.length());
-    }
-    
-    projectName = projectName.toLowerCase(Locale.US).replace(':', '_'); // replace ':' from windows drive names
-    return projectName;
+    return ProjectUtilCore.getPresentableName(project) + "." + project.getLocationHash();
   }
 
   public static File getCompilerSystemDirectory() {
@@ -143,7 +106,6 @@
   }
 
   /**
-   * @param module
    * @param forTestClasses true if directory for test sources, false - for sources.
    * @return a directory to which the sources (or test sources depending on the second partameter) should be compiled.
    * Null is returned if output directory is not specified or is not valid
@@ -190,6 +152,7 @@
       }
       else {
         outPathUrl = application.runReadAction(new Computable<String>() {
+          @Override
           public String compute() {
             final String url = extension.getCompilerOutputUrlForTests();
             return url != null ? url : extension.getCompilerOutputUrl();
@@ -203,6 +166,7 @@
       }
       else {
         outPathUrl = application.runReadAction(new Computable<String>() {
+          @Override
           public String compute() {
             return extension.getCompilerOutputUrl();
           }
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/AddSteppingFilterAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/AddSteppingFilterAction.java
new file mode 100644
index 0000000..269a8b6
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/AddSteppingFilterAction.java
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+/*
+ * @author egor
+ */
+package com.intellij.debugger.actions;
+
+import com.intellij.debugger.engine.DebugProcessImpl;
+import com.intellij.debugger.engine.evaluation.EvaluateException;
+import com.intellij.debugger.engine.events.DebuggerCommandImpl;
+import com.intellij.debugger.impl.DebuggerContextImpl;
+import com.intellij.debugger.jdi.StackFrameProxyImpl;
+import com.intellij.debugger.settings.DebuggerSettings;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.ui.classFilter.ClassFilter;
+import com.sun.jdi.Location;
+import com.sun.jdi.ReferenceType;
+
+import java.util.Arrays;
+
+public class AddSteppingFilterAction extends DebuggerAction {
+  public void actionPerformed(final AnActionEvent e) {
+    final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
+    DebugProcessImpl process = debuggerContext.getDebugProcess();
+    if (process == null) {
+      return;
+    }
+    process.getManagerThread().schedule(new DebuggerCommandImpl() {
+      protected void action() throws Exception {
+        final String name = getClassName(debuggerContext.getFrameProxy());
+        if (name == null) {
+          return;
+        }
+
+        final Project project = e.getData(CommonDataKeys.PROJECT);
+        ApplicationManager.getApplication().invokeLater(new Runnable() {
+          @Override
+          public void run() {
+            String filter = Messages.showInputDialog(project, "", "Add Stepping Filter", null, name, null);
+            if (filter != null) {
+              ClassFilter[] filters = DebuggerSettings.getInstance().getSteppingFilters();
+              ClassFilter[] newFilters = Arrays.copyOf(filters, filters.length + 1);
+              newFilters[newFilters.length - 1] = new ClassFilter(filter);
+              DebuggerSettings.getInstance().setSteppingFilters(newFilters);
+            }
+          }
+        });
+      }
+    });
+  }
+
+  public void update(AnActionEvent e) {
+    e.getPresentation().setEnabled(true);
+  }
+
+  private static String getClassName(StackFrameProxyImpl stackFrameProxy) {
+    if (stackFrameProxy != null) {
+      try {
+        Location location = stackFrameProxy.location();
+        if (location != null) {
+          ReferenceType type = location.declaringType();
+          if (type != null) {
+            return type.name();
+          }
+        }
+      }
+      catch (EvaluateException ignore) {
+      }
+    }
+    return null;
+  }
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/BaseValueAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/BaseValueAction.java
index 6c86ac3..08cefad 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/BaseValueAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/BaseValueAction.java
@@ -27,11 +27,11 @@
 import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
 import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
+import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
 import com.intellij.debugger.ui.tree.ValueDescriptor;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.actionSystem.Presentation;
 import com.intellij.openapi.progress.util.ProgressWindowWithNotification;
 import com.intellij.openapi.project.Project;
@@ -45,12 +45,21 @@
 
   public void actionPerformed(AnActionEvent e) {
     final DataContext actionContext = e.getDataContext();
+    final Project project = CommonDataKeys.PROJECT.getData(actionContext);
     final DebuggerTreeNodeImpl node = getSelectedNode(actionContext);
+    final String text = getValueText(node);
+    if (text != null) {
+      DebuggerInvocationUtil.swingInvokeLater(project, new Runnable() {
+        public void run() {
+          processText(project, DebuggerUtilsEx.prepareValueText(text, project), node, null);
+        }
+      });
+      return;
+    }
     final Value value = getValue(node);
     if (value == null) {
       return;
     }
-    final Project project = CommonDataKeys.PROJECT.getData(actionContext);
     final DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
     if(debuggerManager == null) {
       return;
@@ -101,6 +110,18 @@
   }
 
   @Nullable
+  private static String getValueText(final DebuggerTreeNodeImpl node) {
+    if (node == null) {
+      return null;
+    }
+    NodeDescriptorImpl descriptor = node.getDescriptor();
+    if (descriptor instanceof ValueDescriptorImpl) {
+      return ((ValueDescriptorImpl)descriptor).getValueText();
+    }
+    return null;
+  }
+
+  @Nullable
   private static Value getValue(final DebuggerTreeNodeImpl node) {
     if (node == null) {
       return null;
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java
index c08bfd5..61bfd73 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/CustomizeContextViewAction.java
@@ -72,7 +72,7 @@
 
       @Override
       public String getHelpTopic() {
-        return null;
+        return "reference.debug.customize.data.view";
       }
 
       @Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerAction.java
index 86ddfaa..d221619 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/DebuggerAction.java
@@ -123,14 +123,14 @@
         return true;
       }
     };
-    listener.installOn(tree);
+    //listener.installOn(tree);
 
     final AnAction action = ActionManager.getInstance().getAction(actionName);
     action.registerCustomShortcutSet(CommonShortcuts.getEditSource(), tree);
 
     return new Disposable() {
       public void dispose() {
-        listener.uninstall(tree);
+        //listener.uninstall(tree);
         action.unregisterCustomShortcutSet(tree);
       }
     };
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JumpToObjectAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/JumpToObjectAction.java
index 498ee6d..1737956 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/JumpToObjectAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/JumpToObjectAction.java
@@ -110,7 +110,7 @@
               SourcePosition position = debugProcess.getPositionManager().getSourcePosition(location);
               // adjust position for non-anonymous classes
               if (clsType.name().indexOf('$') < 0) {
-                final PsiClass classAt = position != null? JVMNameUtil.getClassAt(position) : null;
+                final PsiClass classAt = JVMNameUtil.getClassAt(position);
                 if (classAt != null) {
                   final SourcePosition classPosition = SourcePosition.createFromElement(classAt);
                   if (classPosition != null) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/RunToCursorActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/RunToCursorActionHandler.java
index 4da56c6..6bef7bc 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/RunToCursorActionHandler.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/RunToCursorActionHandler.java
@@ -27,12 +27,8 @@
 import com.intellij.debugger.impl.DebuggerSession;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiFile;
 import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
@@ -49,23 +45,19 @@
     myIgnoreBreakpoints = ignoreBreakpoints;
   }
 
+  @Override
   public boolean isEnabled(final @NotNull Project project, final AnActionEvent event) {
-
     Editor editor = event.getData(CommonDataKeys.EDITOR);
-
     if (editor == null) {
       return false;
     }
 
     PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
-    FileTypeManager fileTypeManager = FileTypeManager.getInstance();
     if (file == null) {
       return false;
     }
 
-    final VirtualFile virtualFile = file.getVirtualFile();
-    FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
-    if (DebuggerUtils.supportsJVMDebugging(fileType) || DebuggerUtils.supportsJVMDebugging(file)) {
+    if (DebuggerUtils.isDebugActionAware(file)) {
       DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(project).getContext().getDebuggerSession();
       return debuggerSession != null && debuggerSession.isPaused();
     }
@@ -74,6 +66,7 @@
   }
 
 
+  @Override
   public void perform(@NotNull final Project project, final AnActionEvent event) {
     Editor editor = event.getData(CommonDataKeys.EDITOR);
     if (editor == null) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ToggleBreakpointEnabledAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/ToggleBreakpointEnabledAction.java
index 693b7f4..a57211b 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/ToggleBreakpointEnabledAction.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/ToggleBreakpointEnabledAction.java
@@ -25,10 +25,7 @@
 import com.intellij.openapi.actionSystem.Presentation;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.fileEditor.FileEditorManager;
-import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiDocumentManager;
 import com.intellij.psi.PsiFile;
 import org.jetbrains.annotations.Nullable;
@@ -74,10 +71,7 @@
       return;
     }
 
-    FileTypeManager fileTypeManager = FileTypeManager.getInstance();
-    final VirtualFile virtualFile = file.getVirtualFile();
-    FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
-    if (DebuggerUtils.supportsJVMDebugging(fileType) || DebuggerUtils.supportsJVMDebugging(file)) {
+    if (DebuggerUtils.isBreakpointAware(file)) {
       Breakpoint breakpoint = findBreakpoint(project);
       if (breakpoint == null) {
         presentation.setEnabled(false);
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
index 250186e..c890d14 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/CompoundPositionManager.java
@@ -21,6 +21,7 @@
 import com.intellij.debugger.engine.evaluation.EvaluationContext;
 import com.intellij.debugger.jdi.StackFrameProxyImpl;
 import com.intellij.debugger.requests.ClassPrepareRequestor;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.util.ThreeState;
 import com.intellij.xdebugger.frame.XStackFrame;
 import com.sun.jdi.Location;
@@ -34,6 +35,8 @@
 import java.util.List;
 
 public class CompoundPositionManager extends PositionManagerEx {
+  private static final Logger LOG = Logger.getInstance(CompoundPositionManager.class);
+
   private final ArrayList<PositionManager> myPositionManagers = new ArrayList<PositionManager>();
 
   @SuppressWarnings("UnusedDeclaration")
@@ -57,44 +60,56 @@
       }
       catch (NoDataException ignored) {
       }
+      catch (Exception e) {
+        LOG.error(e);
+      }
     }
     return null;
   }
 
   @Override
   @NotNull
-  public List<ReferenceType> getAllClasses(SourcePosition classPosition) {
+  public List<ReferenceType> getAllClasses(@NotNull SourcePosition classPosition) {
     for (PositionManager positionManager : myPositionManagers) {
       try {
         return positionManager.getAllClasses(classPosition);
       }
       catch (NoDataException ignored) {
       }
+      catch (Exception e) {
+        LOG.error(e);
+      }
     }
     return Collections.emptyList();
   }
 
   @Override
   @NotNull
-  public List<Location> locationsOfLine(ReferenceType type, SourcePosition position) {
+  public List<Location> locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) {
     for (PositionManager positionManager : myPositionManagers) {
       try {
         return positionManager.locationsOfLine(type, position);
       }
       catch (NoDataException ignored) {
       }
+      catch (Exception e) {
+        LOG.error(e);
+      }
     }
     return Collections.emptyList();
   }
 
   @Override
-  public ClassPrepareRequest createPrepareRequest(ClassPrepareRequestor requestor, SourcePosition position) {
+  public ClassPrepareRequest createPrepareRequest(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) {
     for (PositionManager positionManager : myPositionManagers) {
       try {
         return positionManager.createPrepareRequest(requestor, position);
       }
       catch (NoDataException ignored) {
       }
+      catch (Exception e) {
+        LOG.error(e);
+      }
     }
 
     return null;
@@ -105,9 +120,14 @@
   public XStackFrame createStackFrame(@NotNull StackFrameProxyImpl frame, @NotNull DebugProcessImpl debugProcess, @NotNull Location location) {
     for (PositionManager positionManager : myPositionManagers) {
       if (positionManager instanceof PositionManagerEx) {
-        XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(frame, debugProcess, location);
-        if (xStackFrame != null) {
-          return xStackFrame;
+        try {
+          XStackFrame xStackFrame = ((PositionManagerEx)positionManager).createStackFrame(frame, debugProcess, location);
+          if (xStackFrame != null) {
+            return xStackFrame;
+          }
+        }
+        catch (Throwable e) {
+          LOG.error(e);
         }
       }
     }
@@ -121,9 +141,14 @@
                                       @NotNull String expression) {
     for (PositionManager positionManager : myPositionManagers) {
       if (positionManager instanceof PositionManagerEx) {
-        ThreeState result = ((PositionManagerEx)positionManager).evaluateCondition(context, frame, location, expression);
-        if (result != ThreeState.UNSURE) {
-          return result;
+        try {
+          ThreeState result = ((PositionManagerEx)positionManager).evaluateCondition(context, frame, location, expression);
+          if (result != ThreeState.UNSURE) {
+            return result;
+          }
+        }
+        catch (Throwable e) {
+          LOG.error(e);
         }
       }
     }
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java
index c54ab3b..5d29954 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java
@@ -317,7 +317,6 @@
       threadDeathRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
       threadDeathRequest.enable();
 
-      DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager().setInitialBreakpointsState();
       myDebugProcessDispatcher.getMulticaster().processAttached(this);
 
       final String addressDisplayName = DebuggerBundle.getAddressDisplayName(getConnection());
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java
index 2570d9a..39451f7 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java
@@ -771,7 +771,9 @@
           myDebugProcessDispatcher.getMulticaster().processDetached(this, closedByUser);
         }
         finally {
-          setBreakpointsMuted(false);
+          if (DebuggerSettings.getInstance().UNMUTE_ON_STOP) {
+            setBreakpointsMuted(false);
+          }
           if (vm != null) {
             try {
               vm.dispose(); // to be on the safe side ensure that VM mirror, if present, is disposed and invalidated
@@ -1774,6 +1776,8 @@
       }
     });
 
+    // reload to make sure that source positions are initialized
+    DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().reloadBreakpoints();
 
     getManagerThread().schedule(new DebuggerCommandImpl() {
       @Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java b/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java
index e1a28f7..13e8f15 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JVMNameUtil.java
@@ -259,9 +259,6 @@
 
   @Nullable
   public static JVMName getContextClassJVMQualifiedName(@Nullable SourcePosition pos) {
-    if (pos == null) {
-      return null;
-    }
     final PsiClass psiClass = getClassAt(pos);
     if (psiClass == null) {
       return null;
@@ -319,13 +316,16 @@
   }
 
   @Nullable
-  public static PsiClass getClassAt(SourcePosition position) {
+  public static PsiClass getClassAt(@Nullable SourcePosition position) {
+    if (position == null) {
+      return null;
+    }
     final PsiElement element = position.getElementAt();
     return (element != null) ? PsiTreeUtil.getParentOfType(element, PsiClass.class, false) : null;
   }
 
   @Nullable
-  public static String getSourcePositionClassDisplayName(DebugProcessImpl debugProcess, SourcePosition position) {
+  public static String getSourcePositionClassDisplayName(DebugProcessImpl debugProcess, @Nullable SourcePosition position) {
     if (position == null) {
       return null;
     }
@@ -391,7 +391,7 @@
   }
 
   @Nullable
-  public static String getSourcePositionPackageDisplayName(DebugProcessImpl debugProcess, SourcePosition position) {
+  public static String getSourcePositionPackageDisplayName(DebugProcessImpl debugProcess, @Nullable SourcePosition position) {
     if (position == null) {
       return null;
     }
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
index b3e371d..0e37ff3 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/PositionManagerImpl.java
@@ -59,7 +59,7 @@
   }
 
   @NotNull
-  public List<Location> locationsOfLine(ReferenceType type, SourcePosition position) throws NoDataException {
+  public List<Location> locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) throws NoDataException {
     try {
       final int line = position.getLine() + 1;
       return type.locationsOfLine(DebugProcess.JAVA_STRATUM, null, line);
@@ -69,7 +69,7 @@
     return Collections.emptyList();
   }
 
-  public ClassPrepareRequest createPrepareRequest(final ClassPrepareRequestor requestor, final SourcePosition position) throws NoDataException {
+  public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) throws NoDataException {
     final Ref<String> waitPrepareFor = new Ref<String>(null);
     final Ref<ClassPrepareRequestor> waitRequestor = new Ref<ClassPrepareRequestor>(null);
     ApplicationManager.getApplication().runReadAction(new Runnable() {
@@ -197,7 +197,7 @@
   }
 
   @NotNull
-  public List<ReferenceType> getAllClasses(final SourcePosition position) throws NoDataException {
+  public List<ReferenceType> getAllClasses(@NotNull final SourcePosition position) throws NoDataException {
     final Ref<String> baseClassNameRef = new Ref<String>(null);
     final Ref<PsiClass> classAtPositionRef = new Ref<PsiClass>(null);
     final Ref<Boolean> isLocalOrAnonymous = new Ref<Boolean>(Boolean.FALSE);
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java
index c35c971..d20bad7 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java
@@ -398,7 +398,11 @@
         Project project = myDebugProcess.getProject();
         final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
         for (final Breakpoint breakpoint : breakpointManager.getBreakpoints()) {
-          breakpoint.createRequest(myDebugProcess);
+          try {
+            breakpoint.createRequest(myDebugProcess);
+          } catch (Exception e) {
+            LOG.error(e);
+          }
         }
 
         //AccessToken token = ReadAction.start();
diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
index f68436f..1419a28 100644
--- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
+++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsEx.java
@@ -36,9 +36,12 @@
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.ui.classFilter.ClassFilter;
 import com.intellij.util.SmartList;
 import com.sun.jdi.*;
@@ -604,5 +607,14 @@
     }
   }
 
+  public static String prepareValueText(String text, Project project) {
+    text = StringUtil.unquoteString(text);
+    text = StringUtil.unescapeStringCharacters(text);
+    int tabSize = CodeStyleSettingsManager.getSettings(project).getTabSize(StdFileTypes.JAVA);
+    if (tabSize < 0) {
+      tabSize = 0;
+    }
+    return text.replace("\t", StringUtil.repeat(" ", tabSize));
+  }
 
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
index ed9994c..ea54ac2 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
@@ -98,7 +98,7 @@
 
   public JComponent createComponent() {
     if (myProject == null) {
-      myProject = JavaDebuggerSupport.getCurrentProject();
+      myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
     }
     final JPanel panel = new JPanel(new GridBagLayout());
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java
index 4d188d8..db01e13 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerDataViewsConfigurable.java
@@ -83,7 +83,7 @@
 
   public JComponent createComponent() {
     if (myProject == null) {
-      myProject = JavaDebuggerSupport.getCurrentProject();
+      myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
     }
     final JPanel panel = new JPanel(new GridBagLayout());
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
index 8a1762d..294d9de 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSettings.java
@@ -69,7 +69,7 @@
   public volatile boolean WATCH_RETURN_VALUES = false;
   public volatile boolean AUTO_VARIABLES_MODE = false;
   public volatile boolean SHOW_LIBRARY_STACKFRAMES = true;
-
+  public volatile boolean UNMUTE_ON_STOP = false;
 
   private ClassFilter[] mySteppingFilters = ClassFilter.EMPTY_ARRAY;
 
@@ -83,7 +83,7 @@
     return rv;
   }
 
-  void setSteppingFilters(ClassFilter[] steppingFilters) {
+  public void setSteppingFilters(ClassFilter[] steppingFilters) {
     mySteppingFilters = steppingFilters != null ? steppingFilters : ClassFilter.EMPTY_ARRAY;
   }
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java
index d85e636..75d9a81 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/DebuggerSteppingConfigurable.java
@@ -94,7 +94,7 @@
 
   public JComponent createComponent() {
     final JPanel panel = new JPanel(new GridBagLayout());
-    myProject = JavaDebuggerSupport.getCurrentProject();
+    myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
     myCbSkipSyntheticMethods = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.synthetic.methods"));
     myCbSkipConstructors = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.constructors"));
     myCbSkipClassLoaders = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.skip.classloaders"));
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
index 0ffc89c..45cfa2e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
@@ -323,6 +323,7 @@
     }
     settings.add(new WatchLastMethodReturnValueAction());
     settings.add(new AutoVarsSwitchAction());
+    settings.add(new UnmuteOnStopAction());
     settings.addSeparator();
     addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
 
@@ -379,6 +380,12 @@
     for (DebuggerTreeNodeImpl watch : watches) {
       watchTree.addWatch((WatchItemDescriptor)watch.getDescriptor());
     }
+
+    DebugProcessImpl process = getDebugProcess();
+    DebugProcessImpl reuseProcess = reuseSession.getDebugProcess();
+    if (process != null && reuseProcess != null) {
+      process.setBreakpointsMuted(reuseProcess.areBreakpointsMuted());
+    }
   }
 
   public String getSessionName() {
@@ -591,4 +598,23 @@
     }
   }
 
+  private class UnmuteOnStopAction extends ToggleAction {
+    private volatile boolean myUnmuteOnStop;
+
+    private UnmuteOnStopAction() {
+      super(DebuggerBundle.message("action.unmute.on.stop.text"), DebuggerBundle.message("action.unmute.on.stop.text"), null);
+      myUnmuteOnStop = DebuggerSettings.getInstance().UNMUTE_ON_STOP;
+    }
+
+    @Override
+    public boolean isSelected(AnActionEvent e) {
+      return myUnmuteOnStop;
+    }
+
+    @Override
+    public void setSelected(AnActionEvent e, boolean state) {
+      myUnmuteOnStop = state;
+      DebuggerSettings.getInstance().UNMUTE_ON_STOP = state;
+    }
+  }
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/EvaluationDialog.java b/java/debugger/impl/src/com/intellij/debugger/ui/EvaluationDialog.java
index 7deaf44..6359af3 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/EvaluationDialog.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/EvaluationDialog.java
@@ -26,6 +26,7 @@
 import com.intellij.debugger.impl.DebuggerContextListener;
 import com.intellij.debugger.impl.DebuggerSession;
 import com.intellij.debugger.impl.PositionUtil;
+import com.intellij.debugger.ui.impl.ValueNodeDnD;
 import com.intellij.debugger.ui.impl.WatchDebuggerTree;
 import com.intellij.debugger.ui.impl.WatchPanel;
 import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
@@ -176,6 +177,7 @@
       });
       setUpdateEnabled(true);
       getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.results"));
+      new ValueNodeDnD(myTree, project);
     }
 
     protected ActionPopupMenu createPopupMenu() {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
index 52bcf8a..e17b8af 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
@@ -17,6 +17,7 @@
 
 import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.DebuggerInvocationUtil;
+import com.intellij.debugger.SourcePosition;
 import com.intellij.debugger.actions.DebuggerActions;
 import com.intellij.debugger.engine.DebugProcessImpl;
 import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
@@ -59,7 +60,9 @@
 import com.intellij.util.Alarm;
 import com.sun.jdi.ObjectCollectedException;
 import com.sun.jdi.VMDisconnectedException;
+import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import javax.swing.border.EmptyBorder;
@@ -76,7 +79,7 @@
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 
-public class FramesPanel extends UpdatableDebuggerView {
+public class FramesPanel extends UpdatableDebuggerView implements DataProvider {
   private static final Icon FILTER_STACK_FRAMES_ICON = AllIcons.Debugger.Class_filter;
 
   private final JComboBox myThreadsCombo;
@@ -147,6 +150,21 @@
     return myStateManager;
   }
 
+  @Nullable
+  @Override
+  public Object getData(@NonNls String dataId) {
+    if (CommonDataKeys.PSI_FILE.is(dataId)) {
+      DebuggerContextImpl context = myStateManager.getContext();
+      if (context != null) {
+        SourcePosition position = context.getSourcePosition();
+        if (position != null) {
+          return position.getFile();
+        }
+      }
+    }
+    return null;
+  }
+
   private class FramesListener implements ListSelectionListener {
     boolean myIsEnabled = true;
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
index 3b300fc..27b922c 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
@@ -22,7 +22,6 @@
 import com.intellij.debugger.ui.breakpoints.Breakpoint;
 import com.intellij.ide.DataManager;
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.editor.Document;
@@ -209,17 +208,6 @@
     //private final List<MyBreakpointManagerListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
 
     @Override
-    public AnAction[] getAddBreakpointActions(@NotNull Project project) {
-      //List<AnAction> result = new ArrayList<AnAction>();
-      //BreakpointFactory[] breakpointFactories = BreakpointFactory.getBreakpointFactories();
-      //for (BreakpointFactory breakpointFactory : breakpointFactories) {
-      //  result.add(new AddJavaBreakpointAction(breakpointFactory));
-      //}
-      //return result.toArray(new AnAction[result.size()]);
-      return AnAction.EMPTY_ARRAY;
-    }
-
-    @Override
     public void createBreakpointsGroupingRules(Collection<XBreakpointGroupingRule> rules) {
       //rules.add(new XBreakpointGroupingByCategoryRule());
       rules.add(new XBreakpointGroupingByPackageRule());
@@ -356,7 +344,7 @@
     }
   }
 
-  public static Project getCurrentProject() {
+  public static Project getContextProjectForEditorFieldsInDebuggerConfigurables() {
     //todo[nik] improve
     Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
     if (project != null) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/PositionHighlighter.java b/java/debugger/impl/src/com/intellij/debugger/ui/PositionHighlighter.java
index dd0b0de..b6de255 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/PositionHighlighter.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/PositionHighlighter.java
@@ -240,8 +240,8 @@
         if (breakpoint instanceof BreakpointWithHighlighter) {
           if (((BreakpointWithHighlighter)breakpoint).isVisible() && breakpoint.isValid()) {
             breakpoint.reload();
-            final SourcePosition sourcePosition = ((BreakpointWithHighlighter)breakpoint).getSourcePosition();
-            if (sourcePosition == null || sourcePosition.getLine() != lineIndex) {
+            int bptLine = ((BreakpointWithHighlighter)breakpoint).getLineIndex();
+            if (bptLine < 0 || bptLine != lineIndex) {
               eventsOutOfLine.add(eventDescriptor);
             }
           }
@@ -423,7 +423,7 @@
       DefaultActionGroup group = new DefaultActionGroup();
       for (Pair<Breakpoint, Event> eventDescriptor : myEventsOutOfLine) {
         Breakpoint breakpoint = eventDescriptor.getFirst();
-        AnAction viewBreakpointsAction = new ViewBreakpointsAction(breakpoint.getDisplayName(), breakpoint);
+        AnAction viewBreakpointsAction = new ViewBreakpointsAction(breakpoint.getDisplayName(), breakpoint.getXBreakpoint());
         group.add(viewBreakpointsAction);
       }
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
index cebaf68..f3bbf9e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
@@ -15,7 +15,7 @@
  */
 package com.intellij.debugger.ui;
 
-import com.intellij.debugger.DebuggerManagerEx;
+import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.ui.breakpoints.Breakpoint;
 import com.intellij.debugger.ui.breakpoints.BreakpointManager;
 import com.intellij.icons.AllIcons;
@@ -30,7 +30,7 @@
 
 class XBreakpointGroupingByClassRule<B> extends XBreakpointGroupingRule<B, XBreakpointClassGroup> {
   XBreakpointGroupingByClassRule() {
-    super("XBreakpointGroupingByClassRule", "Group by Class");
+    super("XBreakpointGroupingByClassRule", DebuggerBundle.message("rule.name.group.by.class"));
   }
 
   @Override
@@ -46,8 +46,7 @@
   @Override
   public XBreakpointClassGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointClassGroup> groups) {
     if (b instanceof XBreakpoint) {
-      BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(JavaDebuggerSupport.getCurrentProject()).getBreakpointManager();
-      Breakpoint javaBreakpoint = breakpointManager.findBreakpoint((XBreakpoint)b);
+      Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint((XBreakpoint)b);
       if (javaBreakpoint == null) {
         return null;
       }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java
index 98ef5a3..7644b87 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java
@@ -15,7 +15,7 @@
  */
 package com.intellij.debugger.ui;
 
-import com.intellij.debugger.DebuggerManagerEx;
+import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.ui.breakpoints.Breakpoint;
 import com.intellij.debugger.ui.breakpoints.BreakpointManager;
 import com.intellij.icons.AllIcons;
@@ -32,7 +32,7 @@
 public class XBreakpointGroupingByPackageRule<B> extends XBreakpointGroupingRule<B, XBreakpointPackageGroup> {
 
   protected XBreakpointGroupingByPackageRule() {
-    super("XBreakpointGroupingByPackageRule", "Group by package");
+    super("XBreakpointGroupingByPackageRule", DebuggerBundle.message("rule.name.group.by.package"));
   }
 
   @Override
@@ -44,8 +44,7 @@
   public XBreakpointPackageGroup getGroup(@NotNull B breakpoint, @NotNull Collection<XBreakpointPackageGroup> groups) {
     String packageName = null;
     if (breakpoint instanceof XBreakpoint) {
-      BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(JavaDebuggerSupport.getCurrentProject()).getBreakpointManager();
-      Breakpoint javaBreakpoint = breakpointManager.findBreakpoint((XBreakpoint)breakpoint);
+      Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint((XBreakpoint)breakpoint);
       if (javaBreakpoint != null) {
         packageName = javaBreakpoint.getPackageName();
       }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java
index 8787290..ebbef2c 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/AnyExceptionBreakpoint.java
@@ -31,11 +31,12 @@
 import com.sun.jdi.ReferenceType;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.java.debugger.breakpoints.properties.JavaExceptionBreakpointProperties;
 
 public class AnyExceptionBreakpoint extends ExceptionBreakpoint {
   public static final @NonNls Key<AnyExceptionBreakpoint> ANY_EXCEPTION_BREAKPOINT = BreakpointCategory.lookup("breakpoint_any");
 
-  protected AnyExceptionBreakpoint(Project project, XBreakpoint xBreakpoint) {
+  protected AnyExceptionBreakpoint(Project project, XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint) {
     super(project, null, null, xBreakpoint);
     //setEnabled(false);
   }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
index e013d7c..0aeb93e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/Breakpoint.java
@@ -62,25 +62,13 @@
   final XBreakpoint<P> myXBreakpoint;
   protected final Project myProject;
 
-  //private boolean ENABLED = true;
-  //private boolean LOG_ENABLED = false;
-  //private boolean LOG_EXPRESSION_ENABLED = false;
-  //private boolean REMOVE_AFTER_HIT = false;
-  //private TextWithImports  myLogMessage; // an expression to be evaluated and printed
   @NonNls private static final String LOG_MESSAGE_OPTION_NAME = "LOG_MESSAGE";
   public static final Breakpoint[] EMPTY_ARRAY = new Breakpoint[0];
   protected boolean myCachedVerifiedState = false;
-  //private TextWithImportsImpl myLogMessage;
 
   protected Breakpoint(@NotNull Project project, XBreakpoint<P> xBreakpoint) {
-    //super(project);
     myProject = project;
     myXBreakpoint = xBreakpoint;
-    //myLogMessage = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
-    //noinspection AbstractMethodCallInConstructor
-    //final BreakpointDefaults defaults = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager().getBreakpointDefaults(getCategory());
-    //SUSPEND_POLICY = defaults.getSuspendPolicy();
-    //CONDITION_ENABLED = defaults.isConditionEnabled();
   }
 
   public Project getProject() {
@@ -91,6 +79,11 @@
     return myXBreakpoint.getProperties();
   }
 
+  public XBreakpoint<P> getXBreakpoint() {
+    return myXBreakpoint;
+  }
+
+  @Nullable
   public abstract PsiClass getPsiClass();
   /**
    * Request for creating all needed JPDA requests in the specified VM
@@ -176,7 +169,7 @@
     }
   }
 
-  protected void createOrWaitPrepare(final DebugProcessImpl debugProcess, final SourcePosition classPosition) {
+  protected void createOrWaitPrepare(final DebugProcessImpl debugProcess, @NotNull final SourcePosition classPosition) {
     debugProcess.getRequestsManager().callbackOnPrepareClasses(this, classPosition);
 
     for (ReferenceType refType : debugProcess.getPositionManager().getAllClasses(classPosition)) {
@@ -464,16 +457,7 @@
     }
   }
 
-  //@Override
-  //public void writeExternal(Element parentNode) throws WriteExternalException {
-    //super.writeExternal(parentNode);
-    //JDOMExternalizerUtil.writeField(parentNode, LOG_MESSAGE_OPTION_NAME, getLogMessage().toExternalForm());
-  //}
-
-  //public void setLogMessage(TextWithImports logMessage) {
-  //  myLogMessage = logMessage;
-  //}
-
+  @Nullable
   public abstract PsiElement getEvaluationElement();
 
   protected TextWithImports getLogMessage() {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
index ac27788..9164041 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -22,7 +22,7 @@
 
 import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.DebuggerInvocationUtil;
-import com.intellij.debugger.SourcePosition;
+import com.intellij.debugger.DebuggerManagerEx;
 import com.intellij.debugger.engine.BreakpointStepMethodFilter;
 import com.intellij.debugger.engine.DebugProcessImpl;
 import com.intellij.debugger.engine.requests.RequestManagerImpl;
@@ -41,7 +41,10 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.startup.StartupManager;
 import com.intellij.openapi.ui.MessageType;
-import com.intellij.openapi.util.*;
+import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.InvalidDataException;
+import com.intellij.openapi.util.Key;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
 import com.intellij.psi.PsiField;
@@ -52,6 +55,7 @@
 import com.intellij.xdebugger.breakpoints.*;
 import com.intellij.xdebugger.impl.DebuggerSupport;
 import com.intellij.xdebugger.impl.XDebugSessionImpl;
+import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
 import com.intellij.xdebugger.impl.breakpoints.XBreakpointManagerImpl;
 import com.intellij.xdebugger.impl.breakpoints.XDependentBreakpointManager;
 import com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl;
@@ -59,7 +63,6 @@
 import com.sun.jdi.ThreadReference;
 import com.sun.jdi.request.*;
 import gnu.trove.THashMap;
-import gnu.trove.TIntHashSet;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -84,45 +87,11 @@
   private final Map<XBreakpoint, Breakpoint> myBreakpoints = new HashMap<XBreakpoint, Breakpoint>(); // breakpoints storage, access should be synchronized
   @Nullable private List<Breakpoint> myBreakpointsListForIteration = null; // another list for breakpoints iteration, unsynchronized access ok
   private final Map<String, String> myUIProperties = new LinkedHashMap<String, String>();
-  //private final Map<Key<? extends Breakpoint>, BreakpointDefaults> myBreakpointDefaults = new LinkedHashMap<Key<? extends Breakpoint>, BreakpointDefaults>();
 
   private final EventDispatcher<BreakpointManagerListener> myDispatcher = EventDispatcher.create(BreakpointManagerListener.class);
 
   private final StartupManager myStartupManager;
 
-  private void update(@NotNull List<BreakpointWithHighlighter> breakpoints) {
-    final TIntHashSet intHash = new TIntHashSet();
-    for (BreakpointWithHighlighter breakpoint : breakpoints) {
-      SourcePosition sourcePosition = breakpoint.getSourcePosition();
-      breakpoint.reload();
-
-      if (breakpoint.isValid()) {
-        if (sourcePosition == null || breakpoint.getSourcePosition().getLine() != sourcePosition.getLine()) {
-          fireBreakpointChanged(breakpoint);
-        }
-
-        if (intHash.contains(breakpoint.getLineIndex())) {
-          remove(breakpoint);
-        }
-        else {
-          intHash.add(breakpoint.getLineIndex());
-        }
-      }
-      else {
-        remove(breakpoint);
-      }
-    }
-  }
-
-  private void remove(final BreakpointWithHighlighter breakpoint) {
-    DebuggerInvocationUtil.invokeLater(myProject, new Runnable() {
-      @Override
-      public void run() {
-        removeBreakpoint(breakpoint);
-      }
-    });
-  }
-
   public BreakpointManager(@NotNull Project project, @NotNull StartupManager startupManager, @NotNull DebuggerManagerImpl debuggerManager) {
     myProject = project;
     myStartupManager = startupManager;
@@ -131,6 +100,11 @@
 
       @Override
       public void changeEvent(@NotNull DebuggerContextImpl newContext, int event) {
+        if (event == DebuggerSession.EVENT_ATTACHED) {
+          for (XBreakpoint breakpoint : getXBreakpointManager().getAllBreakpoints()) {
+            if (checkAndNotifyPossiblySlowBreakpoint(breakpoint)) break;
+          }
+        }
         if (newContext.getDebuggerSession() != myPreviousSession || event == DebuggerSession.EVENT_DETACHED) {
           updateBreakpointsUI();
           myPreviousSession = newContext.getDebuggerSession();
@@ -139,6 +113,15 @@
     });
   }
 
+  private boolean checkAndNotifyPossiblySlowBreakpoint(XBreakpoint breakpoint) {
+    if (breakpoint.isEnabled() &&
+        (breakpoint.getType() instanceof JavaMethodBreakpointType || breakpoint.getType() instanceof JavaWildcardMethodBreakpointType)) {
+      XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING).notify(myProject);
+      return true;
+    }
+    return false;
+  }
+
   public void init() {
     XBreakpointManager manager = XDebuggerManager.getInstance(myProject).getBreakpointManager();
     manager.addBreakpointListener(new XBreakpointListener() {
@@ -188,15 +171,6 @@
     });
   }
 
-  //@NotNull
-  //public BreakpointDefaults getBreakpointDefaults(Key<? extends Breakpoint> category) {
-  //  BreakpointDefaults defaults = myBreakpointDefaults.get(category);
-  //  if (defaults == null) {
-  //    defaults = new BreakpointDefaults();
-  //  }
-  //  return defaults;
-  //}
-
   public void setBreakpointDefaults(Key<? extends Breakpoint> category, BreakpointDefaults defaults) {
     Class typeCls = null;
     if (LineBreakpoint.CATEGORY.toString().equals(category.toString())) {
@@ -215,10 +189,8 @@
       XBreakpointType<XBreakpoint<?>, ?> type = XDebuggerUtil.getInstance().findBreakpointType(typeCls);
       ((XBreakpointManagerImpl)getXBreakpointManager()).getBreakpointDefaults(type).setSuspendPolicy(Breakpoint.transformSuspendPolicy(defaults.getSuspendPolicy()));
     }
-    //myBreakpointDefaults.put(category, defaults);
   }
 
-
   @Nullable
   public RunToCursorBreakpoint addRunToCursorBreakpoint(Document document, int lineIndex, final boolean ignoreBreakpoints) {
     return RunToCursorBreakpoint.create(myProject, document, lineIndex, ignoreBreakpoints);
@@ -245,16 +217,6 @@
     return breakpoint;
   }
 
-  //@Nullable
-  //public FieldBreakpoint addFieldBreakpoint(Field field, ObjectReference object) {
-  //  ApplicationManager.getApplication().assertIsDispatchThread();
-  //  final FieldBreakpoint fieldBreakpoint = FieldBreakpoint.create(myProject, field, object, null);
-  //  if (fieldBreakpoint != null) {
-  //    addBreakpoint(fieldBreakpoint);
-  //  }
-  //  return fieldBreakpoint;
-  //}
-
   @Nullable
   public FieldBreakpoint addFieldBreakpoint(@NotNull Document document, int offset) {
     PsiField field = FieldBreakpoint.findField(myProject, document, offset);
@@ -311,8 +273,6 @@
       return null;
     }
 
-    XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING).notify(myProject);
-
     addBreakpoint(breakpoint);
     return breakpoint;
   }
@@ -330,50 +290,6 @@
     });
   }
 
-  @Nullable
-  public WildcardMethodBreakpoint addMethodBreakpoint(String classPattern, String methodName) {
-    ApplicationManager.getApplication().assertIsDispatchThread();
-    WildcardMethodBreakpoint breakpoint = WildcardMethodBreakpoint.create(myProject, classPattern, methodName, null);
-    if (breakpoint == null) {
-      return null;
-    }
-    addBreakpoint(breakpoint);
-    return breakpoint;
-  }
-
-  /**
-   * @return null if not found or a breakpoint object
-   */
-  @NotNull
-  public List<BreakpointWithHighlighter> findBreakpoints(final Document document, final int offset) {
-    LinkedList<BreakpointWithHighlighter> result = new LinkedList<BreakpointWithHighlighter>();
-    ApplicationManager.getApplication().assertIsDispatchThread();
-    for (final Breakpoint breakpoint : getBreakpoints()) {
-      if (breakpoint instanceof BreakpointWithHighlighter && ((BreakpointWithHighlighter)breakpoint).isAt(document, offset)) {
-        result.add((BreakpointWithHighlighter)breakpoint);
-      }
-    }
-
-    return result;
-  }
-
-  @NotNull
-  public List<BreakpointWithHighlighter> findBreakpoints(@NotNull Document document, @NotNull TextRange textRange) {
-    ApplicationManager.getApplication().assertIsDispatchThread();
-    List<BreakpointWithHighlighter> result = new ArrayList<BreakpointWithHighlighter>();
-    int startLine = document.getLineNumber(textRange.getStartOffset());
-    int endLine = document.getLineNumber(textRange.getEndOffset())+1;
-    TextRange lineRange = new TextRange(startLine, endLine);
-    for (final Breakpoint breakpoint : getBreakpoints()) {
-      if (breakpoint instanceof BreakpointWithHighlighter &&
-          lineRange.contains(((BreakpointWithHighlighter)breakpoint).getLineIndex())) {
-        result.add((BreakpointWithHighlighter)breakpoint);
-      }
-    }
-
-    return result;
-  }
-
   /**
    * @param category breakpoint category, null if the category does not matter
    */
@@ -390,16 +306,20 @@
     return null;
   }
 
-  public Breakpoint findBreakpoint(XBreakpoint xBreakpoint) {
-    return myBreakpoints.get(xBreakpoint);
+  @Nullable
+  public static Breakpoint findBreakpoint(@NotNull XBreakpoint xBreakpoint) {
+    Project project = ((XBreakpointBase)xBreakpoint).getProject();
+    BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
+    return breakpointManager.myBreakpoints.get(xBreakpoint);
   }
 
-  private List<Element> myOriginalBreakpointsNodes = new ArrayList<Element>();
+  private HashMap<String, Element> myOriginalBreakpointsNodes = new HashMap<String, Element>();
 
   public void readExternal(@NotNull final Element parentNode) {
+    myOriginalBreakpointsNodes.clear();
     // save old breakpoints
     for (Element element : parentNode.getChildren()) {
-      myOriginalBreakpointsNodes.add(element.clone());
+      myOriginalBreakpointsNodes.put(element.getName(), element.clone());
     }
     if (myProject.isOpen()) {
       doRead(parentNode);
@@ -586,15 +506,13 @@
   }
 
   //used in Fabrique
-  public synchronized void addBreakpoint(Breakpoint breakpoint) {
+  public synchronized void addBreakpoint(@NotNull Breakpoint breakpoint) {
     myBreakpoints.put(breakpoint.myXBreakpoint, breakpoint);
     myBreakpointsListForIteration = null;
     breakpoint.updateUI();
     RequestManagerImpl.createRequests(breakpoint);
     myDispatcher.getMulticaster().breakpointsChanged();
-    if (breakpoint instanceof MethodBreakpoint || breakpoint instanceof WildcardMethodBreakpoint) {
-      XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Method breakpoints may dramatically slow down debugging", MessageType.WARNING).notify(myProject);
-    }
+    checkAndNotifyPossiblySlowBreakpoint(breakpoint.myXBreakpoint);
   }
 
   private synchronized void onBreakpointAdded(XBreakpoint xBreakpoint) {
@@ -634,123 +552,14 @@
 
   public void writeExternal(@NotNull final Element parentNode) {
     // restore old breakpoints
-    for (Element group : myOriginalBreakpointsNodes) {
+    for (Element group : myOriginalBreakpointsNodes.values()) {
       if (group.getAttribute(CONVERTED_PARAM) == null) {
         group.setAttribute(CONVERTED_PARAM, "true");
       }
       group.detach();
     }
 
-    parentNode.addContent(myOriginalBreakpointsNodes);
-    //ApplicationManager.getApplication().runReadAction(new Runnable() {
-    //  @Override
-    //  public void run() {
-    //    removeInvalidBreakpoints();
-    //    final Map<Key<? extends Breakpoint>, Element> categoryToElementMap = new THashMap<Key<? extends Breakpoint>, Element>();
-    //    for (Key<? extends Breakpoint> category : myBreakpointDefaults.keySet()) {
-    //      final Element group = getCategoryGroupElement(categoryToElementMap, category, parentNode);
-    //      final BreakpointDefaults defaults = getBreakpointDefaults(category);
-    //      group.setAttribute(DEFAULT_SUSPEND_POLICY_ATTRIBUTE_NAME, String.valueOf(defaults.getSuspendPolicy()));
-    //      group.setAttribute(DEFAULT_CONDITION_STATE_ATTRIBUTE_NAME, String.valueOf(defaults.isConditionEnabled()));
-    //    }
-    //    // don't store invisible breakpoints
-    //    for (Breakpoint breakpoint : getBreakpoints()) {
-    //      if (breakpoint.isValid() &&
-    //          (!(breakpoint instanceof BreakpointWithHighlighter) || ((BreakpointWithHighlighter)breakpoint).isVisible())) {
-    //        writeBreakpoint(getCategoryGroupElement(categoryToElementMap, breakpoint.getCategory(), parentNode), breakpoint);
-    //      }
-    //    }
-    //    final AnyExceptionBreakpoint anyExceptionBreakpoint = getAnyExceptionBreakpoint();
-    //    final Element group = getCategoryGroupElement(categoryToElementMap, anyExceptionBreakpoint.getCategory(), parentNode);
-    //    writeBreakpoint(group, anyExceptionBreakpoint);
-    //
-    //    final Element rules = new Element(RULES_GROUP_NAME);
-    //    parentNode.addContent(rules);
-    //    //for (EnableBreakpointRule myBreakpointRule : myBreakpointRules) {
-    //    //  writeRule(myBreakpointRule, rules);
-    //    //}
-    //  }
-    //});
-    //
-    //final Element uiProperties = new Element("ui_properties");
-    //parentNode.addContent(uiProperties);
-    //for (final String name : myUIProperties.keySet()) {
-    //  Element property = new Element("property");
-    //  uiProperties.addContent(property);
-    //  property.setAttribute("name", name);
-    //  property.setAttribute("value", myUIProperties.get(name));
-    //}
-  }
-
-  //@SuppressWarnings({"HardCodedStringLiteral"})
-  //private static void writeRule(@NotNull final EnableBreakpointRule enableBreakpointRule, @NotNull Element element) {
-  //  Element rule = new Element("rule");
-  //  if (enableBreakpointRule.isLeaveEnabled()) {
-  //    rule.setAttribute("leaveEnabled", Boolean.toString(true));
-  //  }
-  //  element.addContent(rule);
-  //  writeRuleBreakpoint(rule, MASTER_BREAKPOINT_TAGNAME, enableBreakpointRule.getMasterBreakpoint());
-  //  writeRuleBreakpoint(rule, SLAVE_BREAKPOINT_TAGNAME, enableBreakpointRule.getSlaveBreakpoint());
-  //}
-
-  //@SuppressWarnings({"HardCodedStringLiteral"}) private static void writeRuleBreakpoint(@NotNull final Element element, final String tagName, @NotNull final Breakpoint breakpoint) {
-  //  Element master = new Element(tagName);
-  //  element.addContent(master);
-  //  master.setAttribute("name", breakpoint.getDisplayName());
-  //}
-
-  //@SuppressWarnings({"HardCodedStringLiteral"})
-  //private static void writeBreakpoint(@NotNull final Element group, @NotNull final Breakpoint breakpoint) {
-  //  Element breakpointNode = new Element("breakpoint");
-  //  group.addContent(breakpointNode);
-  //  try {
-  //    breakpoint.writeExternal(breakpointNode);
-  //  }
-  //  catch (WriteExternalException e) {
-  //    LOG.error(e);
-  //  }
-  //}
-
-  private static <T extends Breakpoint> Element getCategoryGroupElement(@NotNull final Map<Key<? extends Breakpoint>, Element> categoryToElementMap, @NotNull final Key<T> category, @NotNull final Element parentNode) {
-    Element group = categoryToElementMap.get(category);
-    if (group == null) {
-      group = new Element(category.toString());
-      categoryToElementMap.put(category, group);
-      parentNode.addContent(group);
-    }
-    return group;
-  }
-
-  private void removeInvalidBreakpoints() {
-    ArrayList<Breakpoint> toDelete = new ArrayList<Breakpoint>();
-
-    for (Breakpoint breakpoint : getBreakpoints()) {
-      if (!breakpoint.isValid()) {
-        toDelete.add(breakpoint);
-      }
-    }
-
-    for (final Breakpoint aToDelete : toDelete) {
-      removeBreakpoint(aToDelete);
-    }
-  }
-
-  /**
-   * @return breakpoints of one of the category:
-   *         LINE_BREAKPOINTS, EXCEPTION_BREAKPOINTS, FIELD_BREAKPOINTS, METHOD_BREAKPOINTS
-   */
-  public <T extends Breakpoint> Breakpoint[] getBreakpoints(@NotNull final Key<T> category) {
-    ApplicationManager.getApplication().assertIsDispatchThread();
-    removeInvalidBreakpoints();
-
-    final ArrayList<Breakpoint> breakpoints = new ArrayList<Breakpoint>();
-    for (Breakpoint breakpoint : getBreakpoints()) {
-      if (category.equals(breakpoint.getCategory())) {
-        breakpoints.add(breakpoint);
-      }
-    }
-
-    return breakpoints.toArray(new Breakpoint[breakpoints.size()]);
+    parentNode.addContent(myOriginalBreakpointsNodes.values());
   }
 
   @NotNull
@@ -953,43 +762,8 @@
   public void setBreakpointEnabled(@NotNull final Breakpoint breakpoint, final boolean enabled) {
     if (breakpoint.isEnabled() != enabled) {
       breakpoint.setEnabled(enabled);
-      //fireBreakpointChanged(breakpoint);
-      //breakpoint.updateUI();
     }
   }
-  
-  public void addBreakpointRule(@NotNull EnableBreakpointRule rule) {
-    //rule.init();
-    //myBreakpointRules.add(rule);
-  }
-  
-  public boolean removeBreakpointRule(@NotNull EnableBreakpointRule rule) {
-    //final boolean removed = myBreakpointRules.remove(rule);
-    //if (removed) {
-    //  rule.dispose();
-    //}
-    //return removed;
-    return false;
-  }
-  
-  public boolean removeBreakpointRule(@NotNull Breakpoint slaveBreakpoint) {
-    //for (final EnableBreakpointRule rule : myBreakpointRules) {
-    //  if (slaveBreakpoint.equals(rule.getSlaveBreakpoint())) {
-    //    removeBreakpointRule(rule);
-    //    return true;
-    //  }
-    //}
-    return false;
-  }
-
-  //private void updateBreakpointRules(@NotNull Breakpoint removedBreakpoint) {
-  //  for (Iterator<EnableBreakpointRule> it = myBreakpointRules.iterator(); it.hasNext();) {
-  //    final EnableBreakpointRule rule = it.next();
-  //    if (removedBreakpoint.equals(rule.getMasterBreakpoint()) || removedBreakpoint.equals(rule.getSlaveBreakpoint())) {
-  //      it.remove();
-  //    }
-  //  }
-  //}
 
   // copied from XDebugSessionImpl processDependencies
   public void processBreakpointHit(@NotNull final Breakpoint breakpoint) {
@@ -1019,38 +793,12 @@
     }
   }
 
-  public void setInitialBreakpointsState() {
-    //myAllowMulticasting = false;
-    //for (final EnableBreakpointRule myBreakpointRule : myBreakpointRules) {
-    //  myBreakpointRule.init();
-    //}
-    //myAllowMulticasting = true;
-    //if (!myBreakpointRules.isEmpty()) {
-    //  IJSwingUtilities.invoke(new Runnable() {
-    //    @Override
-    //    public void run() {
-    //      myDispatcher.getMulticaster().breakpointsChanged();
-    //    }
-    //  });
-    //}
-  }
-  
   @Nullable
   public Breakpoint findMasterBreakpoint(@NotNull Breakpoint dependentBreakpoint) {
     XDependentBreakpointManager dependentBreakpointManager = ((XBreakpointManagerImpl)getXBreakpointManager()).getDependentBreakpointManager();
     return myBreakpoints.get(dependentBreakpointManager.getMasterBreakpoint(dependentBreakpoint.myXBreakpoint));
   }
 
-  @Nullable
-  public EnableBreakpointRule findBreakpointRule(@NotNull Breakpoint dependentBreakpoint) {
-    //for (final EnableBreakpointRule rule : myBreakpointRules) {
-    //  if (dependentBreakpoint.equals(rule.getSlaveBreakpoint())) {
-    //    return rule;
-    //  }
-    //}
-    return null;
-  }
-
   public String getProperty(String name) {
     return myUIProperties.get(name);
   }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form
deleted file mode 100644
index c546244..0000000
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form
+++ /dev/null
@@ -1,442 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.debugger.ui.breakpoints.BreakpointPropertiesPanel">
-  <grid id="6570" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-    <margin top="0" left="0" bottom="0" right="0"/>
-    <constraints>
-      <xy x="23" y="37" width="751" height="404"/>
-    </constraints>
-    <properties/>
-    <border type="none"/>
-    <children>
-      <grid id="7978d" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
-        </constraints>
-        <properties/>
-        <border type="none"/>
-        <children>
-          <xy id="f3049" binding="myConditionComboPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
-            <margin top="0" left="0" bottom="0" right="0"/>
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties/>
-            <border type="none"/>
-            <children/>
-          </xy>
-          <component id="ecb15" class="javax.swing.JCheckBox" binding="myConditionCheckbox">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text value="&amp;Condition"/>
-            </properties>
-          </component>
-        </children>
-      </grid>
-      <grid id="763d0" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="true"/>
-        </constraints>
-        <properties/>
-        <clientProperties>
-          <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
-        </clientProperties>
-        <border type="none">
-          <font/>
-        </border>
-        <children>
-          <component id="f6192" class="javax.swing.JRadioButton" binding="myRbSuspendThread">
-            <constraints>
-              <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.thread"/>
-            </properties>
-          </component>
-          <component id="106f5" class="javax.swing.JRadioButton" binding="myRbSuspendAll">
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.all"/>
-            </properties>
-          </component>
-          <hspacer id="46ea8">
-            <constraints>
-              <grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-          </hspacer>
-          <component id="be00d" class="javax.swing.JButton" binding="myMakeDefaultButton">
-            <constraints>
-              <grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.suspend.default"/>
-            </properties>
-          </component>
-          <component id="f0c10" class="javax.swing.JCheckBox" binding="myCbSuspend">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <text value="&amp;Suspend"/>
-            </properties>
-          </component>
-        </children>
-      </grid>
-      <grid id="5aab2" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-        </constraints>
-        <properties/>
-        <border type="none"/>
-        <children>
-          <grid id="da86f" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-            <margin top="0" left="0" bottom="0" right="0"/>
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
-                <preferred-size width="245" height="251"/>
-              </grid>
-            </constraints>
-            <properties/>
-            <border type="none"/>
-            <children>
-              <grid id="1d1c" binding="myActionsPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                <margin top="0" left="0" bottom="0" right="5"/>
-                <constraints>
-                  <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-                <clientProperties>
-                  <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
-                </clientProperties>
-                <border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.actions"/>
-                <children>
-                  <component id="185b0" class="javax.swing.JCheckBox" binding="myLogMessageCheckBox">
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.log.message"/>
-                    </properties>
-                  </component>
-                  <grid id="42168" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                    <margin top="0" left="0" bottom="0" right="0"/>
-                    <constraints>
-                      <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties/>
-                    <border type="none"/>
-                    <children>
-                      <grid id="4a38" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                        <margin top="0" left="0" bottom="0" right="0"/>
-                        <constraints>
-                          <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties/>
-                        <border type="none"/>
-                        <children>
-                          <hspacer id="9c54c">
-                            <constraints>
-                              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
-                                <preferred-size width="15" height="-1"/>
-                              </grid>
-                            </constraints>
-                          </hspacer>
-                          <grid id="80950" binding="myLogExpressionComboPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                            <margin top="0" left="0" bottom="0" right="0"/>
-                            <constraints>
-                              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
-                            </constraints>
-                            <properties/>
-                            <border type="none"/>
-                            <children/>
-                          </grid>
-                        </children>
-                      </grid>
-                      <component id="7b0ce" class="javax.swing.JCheckBox" binding="myLogExpressionCheckBox">
-                        <constraints>
-                          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties>
-                          <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.log.expression"/>
-                        </properties>
-                      </component>
-                    </children>
-                  </grid>
-                  <component id="50916" class="javax.swing.JCheckBox" binding="myTemporaryCheckBox" default-binding="true">
-                    <constraints>
-                      <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <text value="&amp;Remove once hit"/>
-                    </properties>
-                  </component>
-                </children>
-              </grid>
-              <xy id="862d9" binding="mySpecialBoxPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
-                <margin top="0" left="0" bottom="0" right="0"/>
-                <constraints>
-                  <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties>
-                  <visible value="true"/>
-                </properties>
-                <border type="none"/>
-                <children/>
-              </xy>
-              <grid id="d7b0a" binding="myDependsOnPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                <margin top="0" left="0" bottom="0" right="0"/>
-                <constraints>
-                  <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-                <clientProperties>
-                  <BorderFactoryClass class="java.lang.String" value=""/>
-                </clientProperties>
-                <border type="empty"/>
-                <children>
-                  <grid id="4241e" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                    <margin top="0" left="0" bottom="0" right="5"/>
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties/>
-                    <border type="none"/>
-                    <children>
-                      <grid id="9b21c" binding="myDependentBreakpointComboPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                        <margin top="0" left="15" bottom="0" right="0"/>
-                        <constraints>
-                          <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties/>
-                        <border type="none"/>
-                        <children/>
-                      </grid>
-                      <component id="7f1f0" class="javax.swing.JLabel" binding="myEnableOrDisableLabel">
-                        <constraints>
-                          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties>
-                          <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.dependency.type.lable"/>
-                        </properties>
-                      </component>
-                      <component id="e3baf" class="javax.swing.JRadioButton" binding="myDisableAgainRadio" default-binding="true">
-                        <constraints>
-                          <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties>
-                          <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.disable.again"/>
-                        </properties>
-                      </component>
-                      <component id="10e41" class="javax.swing.JRadioButton" binding="myLeaveEnabledRadioButton" default-binding="true">
-                        <constraints>
-                          <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties>
-                          <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.depends.leave.enabled"/>
-                        </properties>
-                      </component>
-                      <component id="f3672" class="com.intellij.ui.components.JBLabel">
-                        <constraints>
-                          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties>
-                          <text resource-bundle="messages/XDebuggerBundle" key="xbreakpoint.master.breakpoint.description"/>
-                        </properties>
-                      </component>
-                    </children>
-                  </grid>
-                </children>
-              </grid>
-            </children>
-          </grid>
-          <grid id="d03f5" binding="myConditionsPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
-            <margin top="2" left="2" bottom="5" right="5"/>
-            <constraints>
-              <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties/>
-            <clientProperties>
-              <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
-            </clientProperties>
-            <border type="etched" title-resource-bundle="messages/DebuggerBundle" title-key="label.breakpoint.properties.panel.group.conditions"/>
-            <children>
-              <grid id="b404a" binding="myInstanceFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
-                <margin top="0" left="0" bottom="0" right="0"/>
-                <constraints>
-                  <grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-                <border type="none"/>
-                <children>
-                  <component id="20b41" class="javax.swing.JCheckBox" binding="myInstanceFiltersCheckBox">
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <margin top="2" left="2" bottom="0" right="2"/>
-                      <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.instance.filters"/>
-                    </properties>
-                  </component>
-                  <grid id="d9be2" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                    <margin top="0" left="0" bottom="0" right="0"/>
-                    <constraints>
-                      <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties/>
-                    <border type="none"/>
-                    <children>
-                      <hspacer id="e6448">
-                        <constraints>
-                          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
-                            <preferred-size width="15" height="-1"/>
-                          </grid>
-                        </constraints>
-                      </hspacer>
-                      <xy id="1114b" binding="myInstanceFiltersFieldPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
-                        <margin top="0" left="0" bottom="0" right="0"/>
-                        <constraints>
-                          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties/>
-                        <border type="none"/>
-                        <children/>
-                      </xy>
-                    </children>
-                  </grid>
-                </children>
-              </grid>
-              <grid id="f07fc" binding="myClassFiltersPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
-                <margin top="0" left="0" bottom="0" right="0"/>
-                <constraints>
-                  <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-                <border type="none"/>
-                <children>
-                  <component id="40e6b" class="javax.swing.JCheckBox" binding="myClassFiltersCheckBox">
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <margin top="2" left="2" bottom="0" right="2"/>
-                      <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.class.filters"/>
-                    </properties>
-                  </component>
-                  <grid id="fbeb4" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                    <margin top="0" left="0" bottom="0" right="0"/>
-                    <constraints>
-                      <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties/>
-                    <border type="none"/>
-                    <children>
-                      <xy id="72d13" binding="myClassFiltersFieldPanel" layout-manager="XYLayout" hgap="-1" vgap="-1">
-                        <margin top="0" left="0" bottom="0" right="0"/>
-                        <constraints>
-                          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                        </constraints>
-                        <properties/>
-                        <border type="none"/>
-                        <children/>
-                      </xy>
-                      <hspacer id="1d45">
-                        <constraints>
-                          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
-                            <preferred-size width="15" height="-1"/>
-                          </grid>
-                        </constraints>
-                      </hspacer>
-                    </children>
-                  </grid>
-                </children>
-              </grid>
-              <grid id="21edd" binding="myPassCountPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
-                <margin top="0" left="0" bottom="0" right="0"/>
-                <constraints>
-                  <grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
-                </constraints>
-                <properties/>
-                <border type="none"/>
-                <children>
-                  <component id="11e5a" class="javax.swing.JCheckBox" binding="myPassCountCheckbox">
-                    <constraints>
-                      <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties>
-                      <margin top="2" left="2" bottom="0" right="2"/>
-                      <text resource-bundle="messages/DebuggerBundle" key="breakpoint.properties.panel.option.pass.count"/>
-                    </properties>
-                  </component>
-                  <grid id="e8cc5" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-                    <margin top="0" left="0" bottom="0" right="0"/>
-                    <constraints>
-                      <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-                    </constraints>
-                    <properties/>
-                    <border type="none"/>
-                    <children>
-                      <component id="64df8" class="javax.swing.JTextField" binding="myPassCountField">
-                        <constraints>
-                          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
-                            <preferred-size width="15" height="-1"/>
-                          </grid>
-                        </constraints>
-                        <properties>
-                          <enabled value="true"/>
-                          <horizontalAlignment value="10"/>
-                        </properties>
-                      </component>
-                      <hspacer id="9be08">
-                        <constraints>
-                          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false">
-                            <preferred-size width="15" height="-1"/>
-                          </grid>
-                        </constraints>
-                      </hspacer>
-                    </children>
-                  </grid>
-                </children>
-              </grid>
-              <vspacer id="905e2">
-                <constraints>
-                  <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
-                </constraints>
-              </vspacer>
-            </children>
-          </grid>
-        </children>
-      </grid>
-      <grid id="22269" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
-        <margin top="0" left="0" bottom="0" right="0"/>
-        <constraints>
-          <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
-        </constraints>
-        <properties/>
-        <border type="none"/>
-        <children>
-          <component id="247a5" class="javax.swing.JCheckBox" binding="myEnabledCheckbox">
-            <constraints>
-              <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
-            </constraints>
-            <properties>
-              <font size="11" style="1"/>
-              <text value="Enabled"/>
-            </properties>
-          </component>
-        </children>
-      </grid>
-    </children>
-  </grid>
-  <buttonGroups>
-    <group name="buttonGroup1">
-      <member id="e3baf"/>
-      <member id="10e41"/>
-    </group>
-  </buttonGroups>
-</form>
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
deleted file mode 100644
index afeeb13..0000000
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
+++ /dev/null
@@ -1,897 +0,0 @@
-/*
- * 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 BreakpointPropertiesPanel
- * @author Jeka
- */
-package com.intellij.debugger.ui.breakpoints;
-
-import com.intellij.debugger.DebuggerManagerEx;
-import com.intellij.debugger.InstanceFilter;
-import com.intellij.debugger.engine.evaluation.CodeFragmentKind;
-import com.intellij.debugger.engine.evaluation.DefaultCodeFragmentFactory;
-import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
-import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.debugger.ui.CompletionEditor;
-import com.intellij.debugger.ui.DebuggerExpressionComboBox;
-import com.intellij.debugger.ui.DebuggerStatementEditor;
-import com.intellij.debugger.ui.JavaDebuggerSupport;
-import com.intellij.ide.util.ClassFilter;
-import com.intellij.openapi.editor.event.DocumentEvent;
-import com.intellij.openapi.editor.event.DocumentListener;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.FixedSizeButton;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.wm.IdeFocusManager;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.ui.FieldPanel;
-import com.intellij.ui.MultiLineTooltipUI;
-import com.intellij.ui.popup.util.DetailView;
-import com.intellij.util.IJSwingUtilities;
-import com.intellij.xdebugger.impl.DebuggerSupport;
-import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointChooser;
-import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointItem;
-import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointNoneItem;
-import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
-import org.jetbrains.annotations.Nullable;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/*
- * Not used any more, since move to xBreakpoints
- */
-public abstract class BreakpointPropertiesPanel {
-
-  private BreakpointChooser myMasterBreakpointChooser;
-
-  public void setDetailView(DetailView detailView) {
-    myMasterBreakpointChooser.setDetailView(detailView);
-  }
-
-  protected final Project myProject;
-  private final Key<? extends Breakpoint> myBreakpointCategory;
-  private boolean myCompact;
-  private JPanel myPanel;
-  private final DebuggerExpressionComboBox myConditionCombo;
-  private final DebuggerExpressionComboBox myLogExpressionCombo;
-  private JTextField myPassCountField;
-  private final FieldPanel myInstanceFiltersField;
-
-  private final FieldPanel myClassFiltersField;
-  private com.intellij.ui.classFilter.ClassFilter[] myClassFilters;
-  private com.intellij.ui.classFilter.ClassFilter[] myClassExclusionFilters;
-  private InstanceFilter[] myInstanceFilters;
-
-  private JCheckBox myLogExpressionCheckBox;
-  private JCheckBox myLogMessageCheckBox;
-  protected JCheckBox myPassCountCheckbox;
-  private JCheckBox myInstanceFiltersCheckBox;
-  private JCheckBox myClassFiltersCheckBox;
-
-  private JPanel myInstanceFiltersFieldPanel;
-  private JPanel myClassFiltersFieldPanel;
-  private JPanel myConditionComboPanel;
-  private JPanel myLogExpressionComboPanel;
-  private JPanel myDependentBreakpointComboPanel;
-  private JPanel mySpecialBoxPanel;
-  private PsiClass myBreakpointPsiClass;
-
-  private JRadioButton myRbSuspendThread;
-  private JRadioButton myRbSuspendAll;
-  private JCheckBox myCbSuspend;
-  private JButton myMakeDefaultButton;
-
-  private JRadioButton myDisableAgainRadio;
-  private JRadioButton myLeaveEnabledRadioButton;
-
-  private JLabel myEnableOrDisableLabel;
-  private JPanel myDependsOnPanel;
-  private JPanel myInstanceFiltersPanel;
-  private JPanel myClassFiltersPanel;
-  private JPanel myPassCountPanel;
-  private JPanel myConditionsPanel;
-  private JPanel myActionsPanel;
-  private JCheckBox myConditionCheckbox;
-  private JCheckBox myTemporaryCheckBox;
-  private JCheckBox myEnabledCheckbox;
-
-  ButtonGroup mySuspendPolicyGroup;
-  public static final String CONTROL_LOG_MESSAGE = "logMessage";
-  private final FixedSizeButton myConditionMagnifierButton;
-  private boolean myMoreOptionsVisible = true;
-  private Breakpoint myBreakpoint;
-
-  public boolean isMoreOptionsVisible() {
-    return myMoreOptionsVisible;
-  }
-
-  public interface Delegate {
-
-    void showActionsPanel();
-  }
-  private Delegate myDelegate;
-
-  public JComponent getControl(String control) {
-    if(CONTROL_LOG_MESSAGE.equals(control)) {
-      return myLogExpressionCombo;
-    }
-    return null;
-  }
-
-  public void dispose() {
-    if (myConditionCombo != null) {
-      myConditionCombo.dispose();
-    }
-    if (myLogExpressionCombo != null) {
-      myLogExpressionCombo.dispose();
-    }
-  }
-
-  public void setActionsPanelVisible(boolean b) {
-    myActionsPanel.setVisible(b);
-  }
-
-  public void setMoreOptionsVisible(boolean b) {
-    myMoreOptionsVisible = b;
-    myDependsOnPanel.setVisible(b);
-    myConditionsPanel.setVisible(b);
-    if (b) {
-      myActionsPanel.setVisible(true);
-    }
-    if (!b) {
-      myPanel.setPreferredSize(new Dimension(500, -1));
-    }
-  }
-
-  public void setDelegate(Delegate delegate) {
-    myDelegate = delegate;
-  }
-
-  private class MyTextField extends JTextField {
-    public MyTextField() {
-    }
-
-    @Override
-    public String getToolTipText(MouseEvent event) {
-      reloadClassFilters();
-      updateClassFilterEditor(false);
-      reloadInstanceFilters();
-      updateInstanceFilterEditor(false);
-      String toolTipText = super.getToolTipText(event);
-      return getToolTipText().length() == 0 ? null : toolTipText;
-    }
-
-    @Override
-    public JToolTip createToolTip() {
-      JToolTip toolTip = new JToolTip(){{
-        setUI(new MultiLineTooltipUI());
-      }};
-      toolTip.setComponent(this);
-      return toolTip;
-    }
-  }
-
-  private static void insert(JPanel panel, JComponent component) {
-    panel.setLayout(new BorderLayout());
-    panel.add(component, BorderLayout.CENTER);
-  }
-
-  public BreakpointPropertiesPanel(final Project project, final Key<? extends Breakpoint> breakpointCategory, boolean compact) {
-    myProject = project;
-    myBreakpointCategory = breakpointCategory;
-    myCompact = compact;
-
-    mySuspendPolicyGroup = new ButtonGroup();
-    mySuspendPolicyGroup.add(myRbSuspendAll);
-    mySuspendPolicyGroup.add(myRbSuspendThread);
-
-    updateSuspendPolicyRbFont();
-    final ItemListener suspendPolicyChangeListener = new ItemListener() {
-      @Override
-      public void itemStateChanged(final ItemEvent e) {
-        //final BreakpointDefaults defaults = getBreakpointManager(myProject).getBreakpointDefaults(breakpointCategory);
-        //myMakeDefaultButton.setEnabled(!defaults.getSuspendPolicy().equals(getSelectedSuspendPolicy()) || defaults.isConditionEnabled() != myConditionCheckbox.isSelected());
-      }
-    };
-
-    myCbSuspend.addActionListener(new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent event) {
-        final boolean enabled = myCbSuspend.isSelected();
-        myRbSuspendAll.setEnabled(enabled);
-        myRbSuspendThread.setEnabled(enabled);
-      }
-    });
-
-
-    myRbSuspendAll.addItemListener(suspendPolicyChangeListener);
-    myRbSuspendThread.addItemListener(suspendPolicyChangeListener);
-    myConditionCheckbox.addItemListener(suspendPolicyChangeListener);
-
-    myMakeDefaultButton.addActionListener(new ActionListener() {
-      @Override
-      public void actionPerformed(final ActionEvent e) {
-        final BreakpointManager breakpointManager = getBreakpointManager(myProject);
-        final String suspendPolicy = getSelectedSuspendPolicy();
-        breakpointManager.setBreakpointDefaults(breakpointCategory, new BreakpointDefaults(suspendPolicy, myConditionCheckbox.isSelected()));
-        updateSuspendPolicyRbFont();
-        if (DebuggerSettings.SUSPEND_THREAD.equals(suspendPolicy)) {
-          myRbSuspendThread.requestFocus();
-        }
-        else {
-          myRbSuspendAll.requestFocus();
-        }
-        myMakeDefaultButton.setEnabled(false);
-      }
-    });
-
-    myConditionCombo = new DebuggerExpressionComboBox(project, "LineBreakpoint condition");
-    myConditionCombo.addDocumentListener(new DocumentListener() {
-      @Override
-      public void beforeDocumentChange(DocumentEvent event) {
-        myConditionCheckbox.setSelected(true);
-      }
-
-      @Override
-      public void documentChanged(DocumentEvent event) {
-
-      }
-    });
-
-    myConditionCombo.getEditorComponent().addMouseListener(new MouseAdapter() {
-      @Override
-      public void mouseClicked(MouseEvent event) {
-        myConditionCombo.setEnabled(true);
-        myConditionCheckbox.setSelected(true);
-      }
-    });
-
-    if (myCompact) {
-      myPanel.addFocusListener(new FocusAdapter() {
-        @Override
-        public void focusGained(FocusEvent event) {
-          DebuggerExpressionComboBox focus;
-          if (myLogExpressionCheckBox.isSelected()) {
-            focus = myLogExpressionCombo;
-          } else {
-            focus = myConditionCombo;
-          }
-          IdeFocusManager.findInstance().requestFocus(focus, true);
-        }
-      });
-    }
-
-    myLogExpressionCombo = new DebuggerExpressionComboBox(project, "LineBreakpoint logMessage");
-
-    myInstanceFiltersField = new FieldPanel(new MyTextField(), "", null,
-     new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent e) {
-        reloadInstanceFilters();
-        EditInstanceFiltersDialog _dialog = new EditInstanceFiltersDialog(myProject);
-        _dialog.setFilters(myInstanceFilters);
-        _dialog.show();
-        if(_dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
-          myInstanceFilters = _dialog.getFilters();
-          updateInstanceFilterEditor(true);
-        }
-      }
-    },
-     null
-    );
-
-    myClassFiltersField = new FieldPanel(new MyTextField(), "", null,
-     new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent e) {
-        reloadClassFilters();
-
-        ClassFilter classFilter = createClassConditionFilter();
-
-        EditClassFiltersDialog _dialog = new EditClassFiltersDialog(myProject, classFilter);
-        _dialog.setFilters(myClassFilters, myClassExclusionFilters);
-        _dialog.show();
-        if (_dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
-          myClassFilters = _dialog.getFilters();
-          myClassExclusionFilters = _dialog.getExclusionFilters();
-          updateClassFilterEditor(true);
-        }
-      }
-    },
-     null
-    );
-    ToolTipManager.sharedInstance().registerComponent(myClassFiltersField.getTextField());
-    ToolTipManager.sharedInstance().registerComponent(myInstanceFiltersField.getTextField());
-
-    JComponent specialBox = createSpecialBox();
-    if(specialBox != null) {
-      insert(mySpecialBoxPanel, specialBox);
-    } 
-    else {
-      mySpecialBoxPanel.setVisible(false);
-    }
-
-    final JPanel conditionPanel = new JPanel(new BorderLayout());
-    conditionPanel.add(myConditionCombo, BorderLayout.CENTER);
-    myConditionMagnifierButton = new FixedSizeButton(myConditionCombo);
-    conditionPanel.add(myConditionMagnifierButton, BorderLayout.EAST);
-    myConditionMagnifierButton.setFocusable(false);
-    myConditionMagnifierButton.addActionListener(new MagnifierButtonAction(project, myConditionCombo, "Condition"));
-
-    insert(myConditionComboPanel, conditionPanel);
-    insert(myLogExpressionComboPanel, myLogExpressionCombo);
-
-    insert(myInstanceFiltersFieldPanel, myInstanceFiltersField);
-    insert(myClassFiltersFieldPanel, myClassFiltersField);
-
-    DebuggerUIUtil.enableEditorOnCheck(myLogExpressionCheckBox, myLogExpressionCombo);
-    ActionListener updateListener = new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent e) {
-        updateCheckboxes();
-      }
-    };
-
-    myPassCountCheckbox.addActionListener(new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent event) {
-        if (myPassCountCheckbox.isSelected()) {
-          myConditionCheckbox.setSelected(false);
-        }
-        updateCheckboxes();
-      }
-    });
-    myInstanceFiltersCheckBox.addActionListener(updateListener);
-    myClassFiltersCheckBox.addActionListener(updateListener);
-    myConditionCheckbox.addActionListener(new ActionListener() {
-      @Override
-      public void actionPerformed(ActionEvent event) {
-        if (myConditionCheckbox.isSelected()) {
-          myPassCountCheckbox.setSelected(false);
-        }
-        updateCheckboxes();
-      }
-    });
-    DebuggerUIUtil.focusEditorOnCheck(myPassCountCheckbox, myPassCountField);
-    DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, myLogExpressionCombo);
-    DebuggerUIUtil.focusEditorOnCheck(myInstanceFiltersCheckBox, myInstanceFiltersField.getTextField());
-    DebuggerUIUtil.focusEditorOnCheck(myClassFiltersCheckBox, myClassFiltersField.getTextField());
-    DebuggerUIUtil.focusEditorOnCheck(myConditionCheckbox, myConditionCombo);
-
-    IJSwingUtilities.adjustComponentsOnMac(myCbSuspend);
-    IJSwingUtilities.adjustComponentsOnMac(myLogExpressionCheckBox);
-    IJSwingUtilities.adjustComponentsOnMac(myLogMessageCheckBox);
-    IJSwingUtilities.adjustComponentsOnMac(myTemporaryCheckBox);
-    IJSwingUtilities.adjustComponentsOnMac(myEnabledCheckbox);
-  }
-
-  private List<BreakpointItem> getBreakpointItemsExceptMy() {
-    List<BreakpointItem> items = new ArrayList<BreakpointItem>();
-    final DebuggerSupport support = DebuggerSupport.getDebuggerSupport(JavaDebuggerSupport.class);
-    support.getBreakpointPanelProvider().provideBreakpointItems(myProject, items);
-    for (BreakpointItem item : items) {
-      if (item.getBreakpoint() == myBreakpoint) {
-        items.remove(item);
-        break;
-      }
-    }
-    items.add(new BreakpointNoneItem());
-    return items;
-  }
-
-  private void saveMasterBreakpoint() {
-    Breakpoint masterBreakpoint = (Breakpoint)myMasterBreakpointChooser.getSelectedBreakpoint();
-    if (masterBreakpoint == null) {
-      getBreakpointManager(myProject).removeBreakpointRule(myBreakpoint);
-    }
-    else {
-      EnableBreakpointRule rule = findMasterBreakpointRule();
-      boolean selected = myLeaveEnabledRadioButton.isSelected();
-      if (rule != null) {
-        if (rule.getMasterBreakpoint() != masterBreakpoint || rule.isLeaveEnabled() != selected) {
-          getBreakpointManager(myProject).removeBreakpointRule(rule);
-        }
-        else {
-          return;
-        }
-      }
-      getBreakpointManager(myProject).addBreakpointRule(new EnableBreakpointRule(getBreakpointManager(myProject), masterBreakpoint, myBreakpoint, selected));
-    }
-  }
-
-  private String getSelectedSuspendPolicy() {
-    if (myRbSuspendThread.isSelected()) {
-      return DebuggerSettings.SUSPEND_THREAD;
-    }
-    return DebuggerSettings.SUSPEND_ALL;
-  }
-
-  private void updateSuspendPolicyRbFont() {
-    //final String defPolicy = getBreakpointManager(myProject).getBreakpointDefaults(myBreakpointCategory).getSuspendPolicy();
-    
-    final Font font = myRbSuspendAll.getFont().deriveFont(Font.PLAIN);
-    final Font boldFont = font.deriveFont(Font.BOLD);
-    
-    //myRbSuspendAll.setFont(DebuggerSettings.SUSPEND_ALL.equals(defPolicy)? boldFont : font);
-    //myRbSuspendThread.setFont(DebuggerSettings.SUSPEND_THREAD.equals(defPolicy)? boldFont : font);
-  }
-
-  protected ClassFilter createClassConditionFilter() {
-    ClassFilter classFilter;
-    if(myBreakpointPsiClass != null) {
-      classFilter = new ClassFilter() {
-        @Override
-        public boolean isAccepted(PsiClass aClass) {
-          return myBreakpointPsiClass == aClass || aClass.isInheritor(myBreakpointPsiClass, true);
-        }
-      };
-    }
-    else {
-      classFilter = null;
-    }
-    return classFilter;
-  }
-
-  protected JComponent createSpecialBox() {
-    return null;
-  }
-
-  /**
-   * Init UI components with the values from Breakpoint
-   */
-  public void initFrom(Breakpoint breakpoint, boolean moreOptionsVisible1) {
-    //myBreakpoint = breakpoint;
-    //boolean moreOptionsVisible = moreOptionsVisible1;
-    //boolean actionsPanelVisible = moreOptionsVisible1;
-    //
-    //initMasterBreakpointPanel();
-    //
-    //if (breakpoint.getCountFilter() > 0) {
-    //  myPassCountField.setText(Integer.toString(breakpoint.getCountFilter()));
-    //  moreOptionsVisible = true;
-    //}
-    //else {
-    //  myPassCountField.setText("");
-    //}
-    //
-    //PsiElement context = breakpoint.getEvaluationElement();
-    //myPassCountCheckbox.setSelected(breakpoint.isCountFilterEnabled());
-    //
-    //myConditionCheckbox.setSelected(breakpoint.isConditionEnabled());
-    //
-    //myConditionCombo.setEnabled(breakpoint.isConditionEnabled());
-    //
-    //myConditionCombo.setContext(context);
-    //myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : emptyText());
-    //
-    //myCbSuspend.setSelected(breakpoint.isSuspend());
-    //myRbSuspendThread.setEnabled(myCbSuspend.isSelected());
-    //myRbSuspendAll.setEnabled(myCbSuspend.isSelected());
-    //
-    //if(!breakpoint.isSuspend()) {
-    //  actionsPanelVisible = true;
-    //}
-    //if(DebuggerSettings.SUSPEND_THREAD.equals(breakpoint.getSuspendPolicy())){
-    //  myRbSuspendThread.setSelected(true);
-    //}
-    //else {
-    //  myRbSuspendAll.setSelected(true);
-    //}
-    //
-    //myCbSuspend.addActionListener(new ActionListener() {
-    //  @Override
-    //  public void actionPerformed(ActionEvent event) {
-    //    if (!myActionsPanel.isVisible()) {
-    //      if (!myCbSuspend.isSelected()) {
-    //        if (myDelegate != null) {
-    //          myDelegate.showActionsPanel();
-    //        }
-    //      }
-    //    }
-    //    myRbSuspendThread.setEnabled(myCbSuspend.isSelected());
-    //    myRbSuspendAll.setEnabled(myCbSuspend.isSelected());
-    //  }
-    //});
-    //myLogMessageCheckBox.setSelected(breakpoint.isLogEnabled());
-    //myTemporaryCheckBox.setSelected(breakpoint.isRemoveAfterHit());
-    //myEnabledCheckbox.setSelected(breakpoint.isEnabled());
-    //myEnabledCheckbox.setText(breakpoint.getShortName() + " enabled");
-    //
-    //DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().addBreakpointManagerListener(new BreakpointManagerListener() {
-    //  @Override
-    //  public void breakpointsChanged() {
-    //    myEnabledCheckbox.setSelected(myBreakpoint.isEnabled());
-    //  }
-    //});
-    //
-    //myEnabledCheckbox.addActionListener(new ActionListener() {
-    //  @Override
-    //  public void actionPerformed(ActionEvent event) {
-    //    if (myBreakpoint.isEnabled() != myEnabledCheckbox.isSelected()) {
-    //      myBreakpoint.setEnabled(myEnabledCheckbox.isSelected());
-    //      getBreakpointManager(myProject).fireBreakpointChanged(myBreakpoint);
-    //      myBreakpoint.updateUI();
-    //    }
-    //  }
-    //});
-    //myTemporaryCheckBox.setVisible(breakpoint instanceof LineBreakpoint);
-    //myLogExpressionCheckBox.setSelected(breakpoint.isLogExpressionEnabled());
-    //if (breakpoint.isLogEnabled() ||
-    //    breakpoint.isLogExpressionEnabled() || (breakpoint instanceof LineBreakpoint && breakpoint.isRemoveAfterHit())) {
-    //  actionsPanelVisible = true;
-    //}
-    //
-    //myLogExpressionCombo.setContext(context);
-    //
-    //if (breakpoint.getLogMessage() != null) {
-    //  myLogExpressionCombo.setText(breakpoint.getLogMessage());
-    //}
-    //else {
-    //  myLogExpressionCombo.setText(emptyText());
-    //}
-    //
-    //myLogExpressionCombo.setEnabled(breakpoint.isLogExpressionEnabled());
-    //if (breakpoint.isLogExpressionEnabled()) {
-    //  actionsPanelVisible = true;
-    //}
-    //
-    //myInstanceFiltersCheckBox.setSelected(breakpoint.isInstanceFiltersEnabled());
-    //myInstanceFiltersField.setEnabled(breakpoint.isInstanceFiltersEnabled());
-    //myInstanceFiltersField.getTextField().setEditable(breakpoint.isInstanceFiltersEnabled());
-    //myInstanceFilters = breakpoint.getInstanceFilters();
-    //updateInstanceFilterEditor(true);
-    //if (breakpoint.isInstanceFiltersEnabled()) {
-    //  moreOptionsVisible = true;
-    //}
-    //
-    //myClassFiltersCheckBox.setSelected(breakpoint.isClassFiltersEnabled());
-    //myClassFiltersField.setEnabled(breakpoint.isClassFiltersEnabled());
-    //myClassFiltersField.getTextField().setEditable(breakpoint.isClassFiltersEnabled());
-    //myClassFilters = breakpoint.getClassFilters();
-    //myClassExclusionFilters = breakpoint.getClassExclusionFilters();
-    //updateClassFilterEditor(true);
-    //if (breakpoint.isClassFiltersEnabled()) {
-    //  moreOptionsVisible = true;
-    //}
-    //
-    //myBreakpointPsiClass = breakpoint.getPsiClass();
-    //
-    //updateCheckboxes();
-    //
-    //setActionsPanelVisible(actionsPanelVisible && !moreOptionsVisible1);
-    //setMoreOptionsVisible(moreOptionsVisible);
-  }
-
-  private void initMasterBreakpointPanel() {
-    final EnableBreakpointRule rule = findMasterBreakpointRule();
-
-    final Breakpoint baseBreakpoint = rule != null ? rule.getMasterBreakpoint() : null;
-    updateMasterBreakpointPanel(rule);
-
-
-    myMasterBreakpointChooser = new BreakpointChooser(myProject, new BreakpointChooser.Delegate() {
-      @Override
-      public void breakpointChosen(Project project, BreakpointItem item) {
-        final boolean enabled = item != null && item.getBreakpoint() != null;
-        myLeaveEnabledRadioButton.setEnabled(enabled);
-        myDisableAgainRadio.setEnabled(enabled);
-        myEnableOrDisableLabel.setEnabled(enabled);
-
-        if (item != null) {
-
-          saveMasterBreakpoint();
-        }
-
-        updateMasterBreakpointPanel(findMasterBreakpointRule());
-
-      }
-    }, baseBreakpoint, getBreakpointItemsExceptMy());
-
-    insert(myDependentBreakpointComboPanel, myMasterBreakpointChooser.getComponent());
-
-  }
-
-  private @Nullable EnableBreakpointRule findMasterBreakpointRule() {
-    return myBreakpoint != null? getBreakpointManager(myProject).findBreakpointRule(myBreakpoint) : null;
-  }
-
-  private void updateMasterBreakpointPanel(@Nullable EnableBreakpointRule rule) {
-    final boolean leaveEnabled = rule != null && rule.isLeaveEnabled();
-    if (leaveEnabled) {
-      myLeaveEnabledRadioButton.setSelected(true);
-    }
-    else {
-      myDisableAgainRadio.setSelected(true);
-    }
-  }
-
-  private static TextWithImportsImpl emptyText() {
-    return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
-  }
-
-  /**
-   * Save values in the UI components to the breakpoint object
-   */
-  public void saveTo(Breakpoint breakpoint) {
-
-    //saveMasterBreakpoint();
-    //try {
-    //  String text = myPassCountField.getText().trim();
-    //  breakpoint.setCountFilter(!text.isEmpty() ? Integer.parseInt(text) : 0);
-    //  if (breakpoint.getCountFilter() < 0) {
-    //    breakpoint.setCountFilter(0);
-    //  }
-    //}
-    //catch (Exception ignored) {
-    //}
-    //
-    //breakpoint.setCountFilterEnabled(breakpoint.getCountFilter() > 0 && myPassCountCheckbox.isSelected());
-    //breakpoint.setCondition(myConditionCombo.getText().getText());
-    ////breakpoint.setConditionEnabled(myConditionCheckbox.isSelected());
-    //breakpoint.setLogMessage(myLogExpressionCombo.getText());
-    //breakpoint.setLogExpressionEnabled(!breakpoint.getLogMessage().isEmpty() && myLogExpressionCheckBox.isSelected());
-    //breakpoint.setLogEnabled(myLogMessageCheckBox.isSelected());
-    //breakpoint.setEnabled(myEnabledCheckbox.isSelected());
-    //breakpoint.setRemoveAfterHit(myTemporaryCheckBox.isSelected());
-    ////breakpoint.setSuspend(myCbSuspend.isSelected());
-    //breakpoint.setSuspendPolicy(getSelectedSuspendPolicy());
-    //reloadInstanceFilters();
-    //reloadClassFilters();
-    //updateInstanceFilterEditor(true);
-    //updateClassFilterEditor(true);
-    //
-    //breakpoint.setInstanceFiltersEnabled(myInstanceFiltersField.getText().length() > 0 && myInstanceFiltersCheckBox.isSelected());
-    //breakpoint.setClassFiltersEnabled(myClassFiltersField.getText().length() > 0 && myClassFiltersCheckBox.isSelected());
-    //breakpoint.setClassFilters(myClassFilters);
-    //breakpoint.setClassExclusionFilters(myClassExclusionFilters);
-    //breakpoint.setInstanceFilters(myInstanceFilters);
-    //
-    //myConditionCombo.addRecent(myConditionCombo.getText());
-    //myLogExpressionCombo.addRecent(myLogExpressionCombo.getText());
-    //breakpoint.updateUI();
-  }
-
-  private static String concatWithEx(List<String> s, String concator, int N, String NthConcator) {
-    String result = "";
-    int i = 1;
-    for (Iterator iterator = s.iterator(); iterator.hasNext(); i++) {
-      String str = (String) iterator.next();
-      result += str;
-      if(iterator.hasNext()){
-        if(i % N == 0){
-          result += NthConcator;
-        }
-        else {
-          result += concator;
-        }
-      }
-    }
-    return result;
-  }
-
-  private void updateInstanceFilterEditor(boolean updateText) {
-    List<String> filters = new ArrayList<String>();
-    for (InstanceFilter instanceFilter : myInstanceFilters) {
-      if (instanceFilter.isEnabled()) {
-        filters.add(Long.toString(instanceFilter.getId()));
-      }
-    }
-    if (updateText) {
-      myInstanceFiltersField.setText(StringUtil.join(filters, " "));
-    }
-
-    String tipText = concatWithEx(filters, " ", (int)Math.sqrt(myInstanceFilters.length) + 1, "\n");
-    myInstanceFiltersField.getTextField().setToolTipText(tipText);
-  }
-
-  private void reloadInstanceFilters() {
-    String filtersText = myInstanceFiltersField.getText();
-
-    ArrayList<InstanceFilter> idxs = new ArrayList<InstanceFilter>();
-    int startNumber = -1;
-    for(int i = 0; i <= filtersText.length(); i++) {
-      if(i < filtersText.length() && Character.isDigit(filtersText.charAt(i))) {
-        if(startNumber == -1) {
-          startNumber = i;
-        }
-      }
-      else {
-        if(startNumber >=0) {
-          idxs.add(InstanceFilter.create(filtersText.substring(startNumber, i)));
-          startNumber = -1;
-        }
-      }
-    }
-    for (InstanceFilter instanceFilter : myInstanceFilters) {
-      if (!instanceFilter.isEnabled()) {
-        idxs.add(instanceFilter);
-      }
-    }
-    myInstanceFilters = idxs.toArray(new InstanceFilter[idxs.size()]);
-  }
-
-  private void updateClassFilterEditor(boolean updateText) {
-    List<String> filters = new ArrayList<String>();
-    for (com.intellij.ui.classFilter.ClassFilter classFilter : myClassFilters) {
-      if (classFilter.isEnabled()) {
-        filters.add(classFilter.getPattern());
-      }
-    }
-    List<String> excludeFilters = new ArrayList<String>();
-    for (com.intellij.ui.classFilter.ClassFilter classFilter : myClassExclusionFilters) {
-      if (classFilter.isEnabled()) {
-        excludeFilters.add("-" + classFilter.getPattern());
-      }
-    }
-    if (updateText) {
-      String editorText = StringUtil.join(filters, " ");
-      if(!filters.isEmpty()) {
-        editorText += " ";
-      }
-      editorText += StringUtil.join(excludeFilters, " ");
-      myClassFiltersField.setText(editorText);
-    }
-
-    int width = (int)Math.sqrt(myClassExclusionFilters.length + myClassFilters.length) + 1;
-    String tipText = concatWithEx(filters, " ", width, "\n");
-    if(!filters.isEmpty()) {
-      tipText += "\n";
-    }
-    tipText += concatWithEx(excludeFilters, " ", width, "\n");
-    myClassFiltersField.getTextField().setToolTipText(tipText);
-  }
-
-  private void reloadClassFilters() {
-    String filtersText = myClassFiltersField.getText();
-
-    ArrayList<com.intellij.ui.classFilter.ClassFilter> classFilters     = new ArrayList<com.intellij.ui.classFilter.ClassFilter>();
-    ArrayList<com.intellij.ui.classFilter.ClassFilter> exclusionFilters = new ArrayList<com.intellij.ui.classFilter.ClassFilter>();
-    int startFilter = -1;
-    for(int i = 0; i <= filtersText.length(); i++) {
-      if(i < filtersText.length() && !Character.isWhitespace(filtersText.charAt(i))){
-        if(startFilter == -1) {
-          startFilter = i;
-        }
-      }
-      else {
-        if(startFilter >=0) {
-          if(filtersText.charAt(startFilter) == '-') {
-            exclusionFilters.add(new com.intellij.ui.classFilter.ClassFilter(filtersText.substring(startFilter + 1, i)));
-          }
-          else {
-            classFilters.add(new com.intellij.ui.classFilter.ClassFilter(filtersText.substring(startFilter, i)));
-          }
-          startFilter = -1;
-        }
-      }
-    }
-    for (com.intellij.ui.classFilter.ClassFilter classFilter : myClassFilters) {
-      if (!classFilter.isEnabled()) {
-        classFilters.add(classFilter);
-      }
-    }
-    for (com.intellij.ui.classFilter.ClassFilter classFilter : myClassExclusionFilters) {
-      if (!classFilter.isEnabled()) {
-        exclusionFilters.add(classFilter);
-      }
-    }
-    myClassFilters          = classFilters    .toArray(new com.intellij.ui.classFilter.ClassFilter[classFilters    .size()]);
-    myClassExclusionFilters = exclusionFilters.toArray(new com.intellij.ui.classFilter.ClassFilter[exclusionFilters.size()]);
-  }
-
-  public void setEnabled(boolean enabled) {
-    myPanel.setEnabled(enabled);
-    Component[] components = myPanel.getComponents();
-    for (Component component : components) {
-      component.setEnabled(enabled);
-    }
-  }
-
-  protected void updateCheckboxes() {
-    boolean passCountApplicable = true;
-    if (myInstanceFiltersCheckBox.isSelected() || myClassFiltersCheckBox.isSelected()) {
-      passCountApplicable = false;
-    }
-    myPassCountCheckbox.setEnabled(passCountApplicable);
-
-    final boolean passCountSelected = myPassCountCheckbox.isSelected();
-    myInstanceFiltersCheckBox.setEnabled(!passCountSelected);
-    myClassFiltersCheckBox.setEnabled(!passCountSelected);
-
-    myPassCountField.setEditable(myPassCountCheckbox.isSelected());
-    myPassCountField.setEnabled (myPassCountCheckbox.isSelected());
-
-    myConditionCombo.setEnabled(myConditionCheckbox.isSelected());
-    myConditionMagnifierButton.setEnabled(myConditionCheckbox.isSelected());
-
-    myInstanceFiltersField.setEnabled(myInstanceFiltersCheckBox.isSelected());
-    myInstanceFiltersField.getTextField().setEditable(myInstanceFiltersCheckBox.isSelected());
-
-    myClassFiltersField.setEnabled(myClassFiltersCheckBox.isSelected());
-    myClassFiltersField.getTextField().setEditable(myClassFiltersCheckBox.isSelected());
-  }
-
-  public JPanel getPanel() {
-    return myPanel;
-  }
-
-  private static BreakpointManager getBreakpointManager(Project project) {
-    return DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
-  }
-
-  private static class MagnifierButtonAction implements ActionListener {
-    private final Project myProject;
-    private final CompletionEditor myTargetEditor;
-    private final String myDialogTitle;
-    private DebuggerStatementEditor myEditor;
-
-    private MagnifierButtonAction(final Project project, final CompletionEditor targetEditor, final String dialogTitle) {
-      myProject = project;
-      myTargetEditor = targetEditor;
-      myDialogTitle = dialogTitle;
-    }
-
-    @Override
-    public void actionPerformed(final ActionEvent e) {
-      new DialogWrapper(myTargetEditor, true){
-        @Override
-        public void show() {
-          setTitle(myDialogTitle);
-          setModal(true);
-          init();
-          super.show();
-        }
-
-        @Override
-        public JComponent getPreferredFocusedComponent() {
-          return myEditor;
-        }
-
-        @Override
-        @Nullable
-        protected JComponent createCenterPanel() {
-          final JPanel panel = new JPanel(new BorderLayout());
-          myEditor = new DebuggerStatementEditor(myProject, myTargetEditor.getContext(), myTargetEditor.getRecentsId(), DefaultCodeFragmentFactory.getInstance());
-          myEditor.setPreferredSize(new Dimension(400, 150));
-          myEditor.setText(myTargetEditor.getText());
-          panel.add(myEditor, BorderLayout.CENTER);
-          return panel;
-        }
-
-        @Override
-        protected void dispose() {
-          super.dispose();
-          myEditor.dispose();
-        }
-
-        @Override
-        protected void doOKAction() {
-          myTargetEditor.setText(myEditor.getText());
-          super.doOKAction();
-        }
-      }.show();
-    }
-  }
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
index 63ec571..29443c0 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
@@ -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.
@@ -26,14 +26,8 @@
 import com.intellij.debugger.impl.DebuggerContextImpl;
 import com.intellij.debugger.settings.DebuggerSettings;
 import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.colors.EditorColorsScheme;
-import com.intellij.openapi.editor.ex.MarkupModelEx;
-import com.intellij.openapi.editor.impl.DocumentMarkupModel;
-import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
-import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Computable;
@@ -52,7 +46,6 @@
 import com.intellij.xdebugger.breakpoints.XBreakpoint;
 import com.intellij.xdebugger.breakpoints.XBreakpointManager;
 import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
-import com.intellij.xdebugger.ui.DebuggerColors;
 import com.intellij.xml.util.XmlStringUtil;
 import com.sun.jdi.ReferenceType;
 import org.jdom.Element;
@@ -68,8 +61,7 @@
  * Time: 3:22:55 PM
  */
 public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperties> extends Breakpoint<P> {
-  @Nullable
-  private RangeHighlighter myHighlighter;
+  private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.breakpoints.BreakpointWithHighlighter");
 
   @Nullable
   private SourcePosition mySourcePosition;
@@ -127,10 +119,6 @@
   @Nullable
   public BreakpointWithHighlighter init() {
     if (!isValid()) {
-      final RangeHighlighter highlighter = myHighlighter;
-      if (highlighter != null) {
-        highlighter.dispose();
-      }
       return null;
     }
 
@@ -190,23 +178,6 @@
     reload();
   }
 
-  public BreakpointWithHighlighter(@NotNull final Project project, @NotNull final RangeHighlighter highlighter, XBreakpoint breakpoint) {
-    super(project, breakpoint);
-    myHighlighter = highlighter;
-    setEditorFilter(highlighter);
-    reload();
-  }
-
-  protected void setEditorFilter(RangeHighlighter highlighter) {
-    highlighter.setEditorFilter(MarkupEditorFilterFactory.createIsNotDiffFilter());
-  }
-
-  @Nullable
-  public RangeHighlighter getHighlighter() {
-    ApplicationManager.getApplication().assertReadAccessAllowed();
-    return myHighlighter;
-  }
-
   @Override
   public boolean isValid() {
     return isPositionValid(myXBreakpoint.getSourcePosition());
@@ -221,6 +192,7 @@
     }).booleanValue();
   }
 
+  @Nullable
   public SourcePosition getSourcePosition() {
     return mySourcePosition;
   }
@@ -309,7 +281,10 @@
     ApplicationManager.getApplication().assertReadAccessAllowed();
     XSourcePosition position = myXBreakpoint.getSourcePosition();
     if (position != null) {
-      return PsiManager.getInstance(myProject).findFile(position.getFile());
+      VirtualFile file = position.getFile();
+      if (file.isValid()) {
+        return PsiManager.getInstance(myProject).findFile(file);
+      }
     }
     return null;
   }
@@ -329,7 +304,13 @@
       return;
     }
 
-    createOrWaitPrepare(debugProcess, getSourcePosition());
+    SourcePosition position = getSourcePosition();
+    if (position != null) {
+      createOrWaitPrepare(debugProcess, position);
+    }
+    else {
+      LOG.error("Unable to create request for breakpoint with null position: " + getDisplayName() + " at " + myXBreakpoint.getSourcePosition());
+    }
     updateUI();
   }
 
@@ -397,44 +378,9 @@
         final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(myProject).getBreakpointManager();
         breakpointManager.updateBreakpointPresentation((XLineBreakpoint)myXBreakpoint, getIcon(), null);
       }
-      //RangeHighlighter highlighter = myHighlighter;
-      //if (highlighter != null && highlighter.isValid() && isValid()) {
-      //  AppUIUtil.invokeLaterIfProjectAlive(myProject, new Runnable() {
-      //    @Override
-      //    public void run() {
-      //      if (isValid()) {
-      //        setupGutterRenderer(myHighlighter);
-      //      }
-      //    }
-      //  });
-      //}
-      //else {
-      //  DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().removeBreakpoint(this);
-      //}
     }
   }
 
-  /**
-   * called by BreakpointManager when destroying the breakpoint
-   */
-  @Override
-  public void delete() {
-    if (isVisible()) {
-      final RangeHighlighter highlighter = getHighlighter();
-      if (highlighter != null) {
-        DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
-          @Override
-          public void run() {
-            highlighter.dispose();
-            //we should delete it here, so gutter will not fire events to deleted breakpoint
-            BreakpointWithHighlighter.super.delete();
-          }
-        });
-      }
-    }
-
-  }
-
   public boolean isAt(@NotNull Document document, int offset) {
     final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
     int line = document.getLineNumber(offset);
@@ -451,7 +397,7 @@
     return getPsiClassAt(sourcePosition);
   }
 
-  protected static PsiClass getPsiClassAt(final SourcePosition sourcePosition) {
+  protected static PsiClass getPsiClassAt(@Nullable final SourcePosition sourcePosition) {
     return ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
       @Nullable
       @Override
@@ -461,67 +407,9 @@
     });
   }
 
-  //private void setupGutterRenderer(@NotNull RangeHighlighter highlighter) {
-  //  highlighter.setGutterIconRenderer(new MyGutterIconRenderer(getIcon(), getDescription()));
-  //}
-
   @Override
   public abstract Key<? extends BreakpointWithHighlighter> getCategory();
 
-  public boolean canMoveTo(@Nullable final SourcePosition position) {
-    if (position == null || !position.getFile().isValid()) {
-      return false;
-    }
-    final PsiFile psiFile = position.getFile();
-    final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
-    if (document == null) {
-      return false;
-    }
-    final int spOffset = position.getOffset();
-    if (spOffset < 0) {
-      return false;
-    }
-    final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager();
-    return breakpointManager.findBreakpoint(document, spOffset, getCategory()) == null;
-  }
-
-  public boolean moveTo(@NotNull SourcePosition position) {
-    if (!canMoveTo(position)) {
-      return false;
-    }
-    final PsiFile psiFile = position.getFile();
-    final PsiFile oldFile = getSourcePosition().getFile();
-    final Document document = PsiDocumentManager.getInstance(getProject()).getDocument(psiFile);
-    final Document oldDocument = PsiDocumentManager.getInstance(getProject()).getDocument(oldFile);
-    if (document == null || oldDocument == null) {
-      return false;
-    }
-    final RangeHighlighter newHighlighter = createHighlighter(myProject, document, position.getLine());
-    if (newHighlighter == null) {
-      return false;
-    }
-    final RangeHighlighter oldHighlighter = myHighlighter;
-    myHighlighter = newHighlighter;
-
-    reload();
-
-    if (!isValid()) {
-      myHighlighter.dispose();
-      myHighlighter = oldHighlighter;
-      reload();
-      return false;
-    }
-
-    if (oldHighlighter != null) {
-      oldHighlighter.dispose();
-    }
-
-    DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager().fireBreakpointChanged(this);
-    updateUI();
-
-    return true;
-  }
-
   public boolean isVisible() {
     return myVisible;
   }
@@ -532,40 +420,21 @@
 
   @Nullable
   public Document getDocument() {
-    final RangeHighlighter highlighter = getHighlighter();
-    if (highlighter != null) {
-      return highlighter.getDocument();
-    }
-    final SourcePosition position = getSourcePosition();
-    if (position != null) {
-      final PsiFile file = position.getFile();
+    final PsiFile file = getPsiFile();
+    if (file != null) {
       return PsiDocumentManager.getInstance(getProject()).getDocument(file);
     }
     return null;
   }
 
   public int getLineIndex() {
-    final SourcePosition sourcePosition = getSourcePosition();
+    XSourcePosition sourcePosition = myXBreakpoint.getSourcePosition();
     return sourcePosition != null ? sourcePosition.getLine() : -1;
   }
 
-  @Nullable
-  protected static RangeHighlighter createHighlighter(@NotNull Project project, @NotNull Document document, int lineIndex) {
-    if (lineIndex < 0 || lineIndex >= document.getLineCount()) {
-      return null;
-    }
-
-    EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
-    TextAttributes attributes = scheme.getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES);
-
-    RangeHighlighter highlighter = ((MarkupModelEx)DocumentMarkupModel.forDocument(document, project, true))
-      .addPersistentLineHighlighter(lineIndex, DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER, attributes);
-    if (highlighter == null || !highlighter.isValid()) {
-      return null;
-    }
-    highlighter.putUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY, Boolean.TRUE);
-    highlighter.setErrorStripeTooltip(DebuggerBundle.message("breakpoint.tooltip.text", lineIndex + 1));
-    return highlighter;
+  protected String getFileName() {
+    XSourcePosition sourcePosition = myXBreakpoint.getSourcePosition();
+    return sourcePosition != null ? sourcePosition.getFile().getName() : "";
   }
 
   @Override
@@ -585,147 +454,5 @@
     if (packageName != null) {
       myPackageName = packageName;
     }
-
-    //VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url);
-    //if (vFile == null) {
-    //  throw new InvalidDataException(DebuggerBundle.message("error.breakpoint.file.not.found", url));
-    //}
-    //final Document doc = FileDocumentManager.getInstance().getDocument(vFile);
-    //if (doc == null) {
-    //  throw new InvalidDataException(DebuggerBundle.message("error.cannot.load.breakpoint.file", url));
-    //}
-    //
-    //// line number
-    //final int line;
-    //try {
-    //  //noinspection HardCodedStringLiteral
-    //  line = Integer.parseInt(breakpointNode.getAttributeValue("line"));
-    //}
-    //catch (Exception e) {
-    //  throw new InvalidDataException("Line number is invalid for breakpoint");
-    //}
-    //if (line < 0) {
-    //  throw new InvalidDataException("Line number is invalid for breakpoint");
-    //}
-    //
-    //RangeHighlighter highlighter = createHighlighter(myProject, doc, line);
-    //
-    //if (highlighter == null) {
-    //  throw new InvalidDataException("");
-    //}
-    //
-    //myHighlighter = highlighter;
-    //reload();
   }
-  //
-  //@Override
-  //@SuppressWarnings({"HardCodedStringLiteral"})
-  //public void writeExternal(@NotNull Element parentNode) throws WriteExternalException {
-  //  super.writeExternal(parentNode);
-  //  PsiFile psiFile = getSourcePosition().getFile();
-  //  final VirtualFile virtualFile = psiFile.getVirtualFile();
-  //  final String url = virtualFile != null ? virtualFile.getUrl() : "";
-  //  parentNode.setAttribute("url", url);
-  //  parentNode.setAttribute("line", Integer.toString(getSourcePosition().getLine()));
-  //  if (myClassName != null) {
-  //    parentNode.setAttribute("class", myClassName);
-  //  }
-  //  if (myPackageName != null) {
-  //    parentNode.setAttribute("package", myPackageName);
-  //  }
-  //}
-
-  //private class MyGutterIconRenderer extends GutterIconRenderer {
-  //  private final Icon myIcon;
-  //  private final String myDescription;
-  //
-  //  public MyGutterIconRenderer(@NotNull Icon icon, @NotNull String description) {
-  //    myIcon = icon;
-  //    myDescription = description;
-  //  }
-  //
-  //  @Override
-  //  @NotNull
-  //  public Icon getIcon() {
-  //    return myIcon;
-  //  }
-  //
-  //  @Override
-  //  public String getTooltipText() {
-  //    return myDescription;
-  //  }
-  //
-  //  @Override
-  //  public Alignment getAlignment() {
-  //    return Alignment.RIGHT;
-  //  }
-  //
-  //  @Override
-  //  public AnAction getClickAction() {
-  //    return new AnAction() {
-  //      @Override
-  //      public void actionPerformed(AnActionEvent e) {
-  //        DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager().removeBreakpoint(BreakpointWithHighlighter.this);
-  //      }
-  //    };
-  //  }
-  //
-  //  @Override
-  //  public AnAction getMiddleButtonClickAction() {
-  //    return new AnAction() {
-  //      @Override
-  //      public void actionPerformed(AnActionEvent e) {
-  //        setEnabled(!isEnabled());
-  //        DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager().fireBreakpointChanged(BreakpointWithHighlighter.this);
-  //        updateUI();
-  //      }
-  //    };
-  //  }
-  //
-  //  @Override
-  //  public ActionGroup getPopupMenuActions() {
-  //    return null;
-  //  }
-  //
-  //  @Nullable
-  //  @Override
-  //  public AnAction getRightButtonClickAction() {
-  //    return new EditBreakpointAction.ContextAction(this, BreakpointWithHighlighter.this, DebuggerSupport.getDebuggerSupport(JavaDebuggerSupport.class));
-  //  }
-  //
-  //  @Override
-  //  public GutterDraggableObject getDraggableObject() {
-  //    return new GutterDraggableObject() {
-  //      @Override
-  //      public boolean copy(int line, @NotNull VirtualFile file) {
-  //        final PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(file);
-  //        return psiFile != null && moveTo(SourcePosition.createFromLine(psiFile, line));
-  //      }
-  //
-  //      @Override
-  //      public Cursor getCursor(int line) {
-  //        final SourcePosition newPosition = SourcePosition.createFromLine(getSourcePosition().getFile(), line);
-  //        return canMoveTo(newPosition) ? DragSource.DefaultMoveDrop : DragSource.DefaultMoveNoDrop;
-  //      }
-  //    };
-  //  }
-  //
-  //  @Override
-  //  public boolean equals(@NotNull Object obj) {
-  //    return obj instanceof MyGutterIconRenderer &&
-  //           Comparing.equal(getTooltipText(), ((MyGutterIconRenderer)obj).getTooltipText()) &&
-  //           Comparing.equal(getIcon(), ((MyGutterIconRenderer)obj).getIcon());
-  //  }
-  //
-  //  @Override
-  //  public int hashCode() {
-  //    return getIcon().hashCode();
-  //  }
-  //
-  //  @Override
-  //  public String toString() {
-  //    return "LB " + getDisplayName();
-  //  }
-  //}
-
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/EnableBreakpointRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/EnableBreakpointRule.java
deleted file mode 100644
index bcda420..0000000
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/EnableBreakpointRule.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.debugger.ui.breakpoints;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Eugene Zhuravlev
- *         Date: May 10, 2005
- */
-public class EnableBreakpointRule {
-  private final BreakpointManager myManager;
-  private final boolean myLeaveEnabled;
-  private final Breakpoint myMasterBreakpoint;
-  private final Breakpoint mySlaveBreakpoint;
-
-  public EnableBreakpointRule(@NotNull BreakpointManager manager, @NotNull Breakpoint masterBreakpoint, @NotNull Breakpoint slaveBreakpoint) {
-    this(manager,masterBreakpoint, slaveBreakpoint, false);
-  }
-
-  public EnableBreakpointRule(@NotNull BreakpointManager manager, @NotNull Breakpoint masterBreakpoint, @NotNull Breakpoint slaveBreakpoint, boolean leaveEnabled) {
-    myMasterBreakpoint = masterBreakpoint;
-    mySlaveBreakpoint = slaveBreakpoint;
-    myManager = manager;
-    myLeaveEnabled = leaveEnabled;
-  }
-
-  public Breakpoint getMasterBreakpoint() {
-    return myMasterBreakpoint;
-  }
-
-  public Breakpoint getSlaveBreakpoint() {
-    return mySlaveBreakpoint;
-  }
-
-  public boolean isLeaveEnabled() {
-    return myLeaveEnabled;
-  }
-
-  public void init() {
-    myManager.setBreakpointEnabled(getSlaveBreakpoint(), false);
-  }
-
-  public void dispose() {
-    myManager.setBreakpointEnabled(getSlaveBreakpoint(), true);
-  }
-
-  public void processBreakpointHit(Breakpoint breakpointHit) {
-    if (getMasterBreakpoint().equals(breakpointHit)) {
-      myManager.setBreakpointEnabled(getSlaveBreakpoint(), true);
-    }
-    else if (getSlaveBreakpoint().equals(breakpointHit)){
-      if (!myLeaveEnabled) {
-        myManager.setBreakpointEnabled(getSlaveBreakpoint(), false);
-      }
-    }
-  }
-
-}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java
index 8a0b515..4316da6 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/ExceptionBreakpoint.java
@@ -23,12 +23,8 @@
 import com.intellij.debugger.DebuggerBundle;
 import com.intellij.debugger.DebuggerManagerEx;
 import com.intellij.debugger.SourcePosition;
-import com.intellij.debugger.engine.DebugProcess;
-import com.intellij.debugger.engine.DebugProcessImpl;
-import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
-import com.intellij.debugger.engine.SuspendContextImpl;
+import com.intellij.debugger.engine.*;
 import com.intellij.debugger.engine.evaluation.EvaluateException;
-import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.icons.AllIcons;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
@@ -61,7 +57,7 @@
   protected final static String READ_NO_CLASS_NAME = DebuggerBundle.message("error.absent.exception.breakpoint.class.name");
   public static final @NonNls Key<ExceptionBreakpoint> CATEGORY = BreakpointCategory.lookup("exception_breakpoints");
 
-  public ExceptionBreakpoint(Project project, XBreakpoint xBreakpoint) {
+  public ExceptionBreakpoint(Project project, XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint) {
     super(project, xBreakpoint);
   }
 
@@ -69,7 +65,7 @@
     return CATEGORY;
   }
 
-  protected ExceptionBreakpoint(Project project, String qualifiedName, String packageName, XBreakpoint xBreakpoint) {
+  protected ExceptionBreakpoint(Project project, String qualifiedName, String packageName, XBreakpoint<JavaExceptionBreakpointProperties> xBreakpoint) {
     super(project, xBreakpoint);
     setQualifiedName(qualifiedName);
     if (packageName == null) {
@@ -80,7 +76,7 @@
     }
   }
 
-  private String calcPackageName(String qualifiedName) {
+  private static String calcPackageName(String qualifiedName) {
     if (qualifiedName == null) {
       return null;
     }
@@ -99,7 +95,7 @@
   public PsiClass getPsiClass() {
     return PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Computable<PsiClass>() {
       public PsiClass compute() {
-        return getQualifiedName() != null ? DebuggerUtilsEx.findClass(getQualifiedName(), myProject, GlobalSearchScope.allScope(myProject)) : null;
+        return getQualifiedName() != null ? DebuggerUtils.findClass(getQualifiedName(), myProject, GlobalSearchScope.allScope(myProject)) : null;
       }
     });
   }
@@ -127,7 +123,7 @@
 
     SourcePosition classPosition = PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Computable<SourcePosition>() {
       public SourcePosition compute() {
-        PsiClass psiClass = DebuggerUtilsEx.findClass(getQualifiedName(), myProject, debugProcess.getSearchScope());
+        PsiClass psiClass = DebuggerUtils.findClass(getQualifiedName(), myProject, debugProcess.getSearchScope());
 
         return psiClass != null ? SourcePosition.createFromElement(psiClass) : null;
       }
@@ -176,12 +172,12 @@
         exceptionName = exceptionEvent.exception().type().name();
         threadName = exceptionEvent.thread().name();
       }
-      catch (Exception e) {
+      catch (Exception ignore) {
       }
     }
     final Location location = event.location();
     final String locationQName = location.declaringType().name() + "." + location.method().name();
-    String locationFileName = "";
+    String locationFileName;
     try {
       locationFileName = location.sourceName();
     }
@@ -240,11 +236,11 @@
 
     try {
       getProperties().NOTIFY_CAUGHT = Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "NOTIFY_CAUGHT"));
-    } catch (Exception e) {
+    } catch (Exception ignore) {
     }
     try {
       getProperties().NOTIFY_UNCAUGHT = Boolean.valueOf(JDOMExternalizerUtil.readField(parentNode, "NOTIFY_UNCAUGHT"));
-    } catch (Exception e) {
+    } catch (Exception ignore) {
     }
 
     //noinspection HardCodedStringLiteral
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java
index aa3a295..707b185 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/FieldBreakpoint.java
@@ -148,11 +148,11 @@
     }
   }
 
-  @Override
-  public boolean moveTo(@NotNull SourcePosition position) {
-    final PsiField field = PositionUtil.getPsiElementAt(getProject(), PsiField.class, position);
-    return field != null && super.moveTo(SourcePosition.createFromElement(field));
-  }
+  //@Override
+  //public boolean moveTo(@NotNull SourcePosition position) {
+  //  final PsiField field = PositionUtil.getPsiElementAt(getProject(), PsiField.class, position);
+  //  return field != null && super.moveTo(SourcePosition.createFromElement(field));
+  //}
 
   @Override
   protected ObjectReference getThisObject(SuspendContextImpl context, LocatableEvent event) throws EvaluateException {
@@ -218,7 +218,7 @@
       locationFileName = location.sourceName();
     }
     catch (AbsentInformationException e) {
-      locationFileName = getSourcePosition().getFile().getName();
+      locationFileName = getFileName();
     }
     final int locationLine = location.lineNumber();
 
@@ -291,10 +291,10 @@
     return (FieldBreakpoint)breakpoint.init();
   }
 
-  @Override
-  public boolean canMoveTo(final SourcePosition position) {
-    return super.canMoveTo(position) && PositionUtil.getPsiElementAt(getProject(), PsiField.class, position) != null;
-  }
+  //@Override
+  //public boolean canMoveTo(final SourcePosition position) {
+  //  return super.canMoveTo(position) && PositionUtil.getPsiElementAt(getProject(), PsiField.class, position) != null;
+  //}
 
   @Override
   public boolean isValid() {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaBreakpointTypeBase.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaBreakpointTypeBase.java
index 0bb20d6..0a223b6 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaBreakpointTypeBase.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaBreakpointTypeBase.java
@@ -15,8 +15,6 @@
  */
 package com.intellij.debugger.ui.breakpoints;
 
-import com.intellij.debugger.DebuggerManagerEx;
-import com.intellij.debugger.ui.JavaDebuggerSupport;
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.PsiClass;
 import com.intellij.xdebugger.XDebuggerUtil;
@@ -62,8 +60,7 @@
   @Nullable
   @Override
   public XSourcePosition getSourcePosition(@NotNull XBreakpoint<T> breakpoint) {
-    BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(JavaDebuggerSupport.getCurrentProject()).getBreakpointManager();
-    Breakpoint javaBreakpoint = breakpointManager.findBreakpoint(breakpoint);
+    Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint(breakpoint);
     if (javaBreakpoint != null) {
       PsiClass aClass = javaBreakpoint.getPsiClass();
       if (aClass != null && aClass.getContainingFile() != null) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java
index 74a6f2d..ea4f30d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaFieldBreakpointType.java
@@ -46,6 +46,11 @@
     super("java-field", DebuggerBundle.message("field.watchpoints.tab.title"));
   }
 
+  @Override
+  public boolean isAddBreakpointButtonVisible() {
+    return true;
+  }
+
   @NotNull
   @Override
   public Icon getEnabledIcon() {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java
index 08b26bb..0c7c17d 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaLineBreakpointTypeBase.java
@@ -15,12 +15,9 @@
  */
 package com.intellij.debugger.ui.breakpoints;
 
-import com.intellij.debugger.DebuggerManagerEx;
 import com.intellij.debugger.engine.DebuggerUtils;
-import com.intellij.debugger.ui.JavaDebuggerSupport;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Ref;
@@ -52,7 +49,7 @@
 
   @Override
   public boolean isAddBreakpointButtonVisible() {
-    return true;
+    return false;
   }
 
   @Override
@@ -74,29 +71,24 @@
 
   @Override
   public String getDisplayText(XLineBreakpoint<P> breakpoint) {
-    BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(JavaDebuggerSupport.getCurrentProject()).getBreakpointManager();
-      BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)breakpointManager.findBreakpoint(breakpoint);
-      if (javaBreakpoint != null) {
-        return javaBreakpoint.getDescription();
-      }
-      else {
-        return super.getDisplayText(breakpoint);
-      }
+    BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)BreakpointManager.findBreakpoint(breakpoint);
+    if (javaBreakpoint != null) {
+      return javaBreakpoint.getDescription();
+    }
+    else {
+      return super.getDisplayText(breakpoint);
+    }
   }
 
   @Override
   public final boolean canPutAt(@NotNull VirtualFile file, final int line, @NotNull Project project) {
     PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
     // JSPX supports jvm debugging, but not in XHTML files
-    // JS has it's own breakpoints
-    if (psiFile == null || psiFile.getVirtualFile().getFileType() == StdFileTypes.XHTML || psiFile.getVirtualFile().getFileType() == StdFileTypes.JS) {
+    if (psiFile == null || psiFile.getVirtualFile().getFileType() == StdFileTypes.XHTML) {
       return false;
     }
 
-    FileType fileType = psiFile.getFileType();
-    if (!StdFileTypes.CLASS.equals(fileType) &&
-        !DebuggerUtils.supportsJVMDebugging(fileType) &&
-        !DebuggerUtils.supportsJVMDebugging(psiFile)) {
+    if (!StdFileTypes.CLASS.equals(psiFile.getFileType()) && !DebuggerUtils.isBreakpointAware(psiFile)) {
       return false;
     }
 
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java
index 94c3c77..54771f0 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/JavaMethodBreakpointType.java
@@ -56,11 +56,6 @@
     return HelpID.METHOD_BREAKPOINTS;
   }
 
-  @Override
-  public boolean isAddBreakpointButtonVisible() {
-    return false;
-  }
-
   //@Override
   public String getDisplayName() {
     return DebuggerBundle.message("method.breakpoints.tab.title");
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java
index 2b32391..1eb22e8 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/LineBreakpoint.java
@@ -34,7 +34,6 @@
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ProjectFileIndex;
@@ -54,6 +53,7 @@
 import com.intellij.util.StringBuilderSpinAllocator;
 import com.intellij.util.containers.ContainerUtil;
 import com.intellij.xdebugger.XDebuggerUtil;
+import com.intellij.xdebugger.XSourcePosition;
 import com.intellij.xdebugger.breakpoints.XBreakpoint;
 import com.sun.jdi.*;
 import com.sun.jdi.event.LocatableEvent;
@@ -124,16 +124,11 @@
   @Override
   protected void reload(PsiFile file) {
     super.reload(file);
-    int offset;
-    final SourcePosition position = getSourcePosition();
+    XSourcePosition position = myXBreakpoint.getSourcePosition();
     if (position != null) {
-      offset = position.getOffset();
+      int offset = position.getOffset();
+      myOwnerMethodName = findOwnerMethod(file, offset);
     }
-    else {
-      final RangeHighlighter highlighter = getHighlighter();
-      offset = highlighter != null? highlighter.getStartOffset() : -1;
-    }
-    myOwnerMethodName = findOwnerMethod(file, offset);
   }
 
   @Override
@@ -347,7 +342,7 @@
 
   private String getDisplayInfoInternal(boolean showPackageInfo, int totalTextLength) {
     if(isValid()) {
-      final int lineNumber = getSourcePosition().getLine() + 1;
+      final int lineNumber = myXBreakpoint.getSourcePosition().getLine() + 1;
       String className = getClassName();
       final boolean hasClassInfo = className != null && className.length() > 0;
       final String methodName = getMethodName();
@@ -356,7 +351,7 @@
       if (hasClassInfo || hasMethodInfo) {
         final StringBuilder info = StringBuilderSpinAllocator.alloc();
         try {
-          boolean isFile = getSourcePosition().getFile().getName().equals(className);
+          boolean isFile = myXBreakpoint.getSourcePosition().getFile().getName().equals(className);
           String packageName = null;
           if (hasClassInfo) {
             final int dotIndex = className.lastIndexOf(".");
@@ -425,7 +420,7 @@
       sourceName = location.sourceName();
     }
     catch (AbsentInformationException e) {
-      sourceName = getSourcePosition().getFile().getName();
+      sourceName = getFileName();
     }
 
     final boolean printFullTrace = Registry.is("debugger.breakpoint.message.full.trace");
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java
index be10d56..f869ee1 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java
@@ -34,7 +34,6 @@
 import com.intellij.icons.AllIcons;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
 import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Computable;
@@ -76,10 +75,6 @@
     super(project, breakpoint);
   }
 
-  private MethodBreakpoint(@NotNull Project project, @NotNull RangeHighlighter highlighter) {
-    super(project, highlighter, null);
-  }
-
   public boolean isStatic() {
     return myIsStatic;
   }
@@ -189,7 +184,7 @@
       locationFileName = location.sourceName();
     }
     catch (AbsentInformationException e) {
-      locationFileName = getSourcePosition().getFile().getName();
+      locationFileName = getFileName();
     }
     final int locationLine = location.lineNumber();
     if (event instanceof MethodEntryEvent) {
@@ -300,9 +295,9 @@
   }
 
 
-  public boolean canMoveTo(final SourcePosition position) {
-    return super.canMoveTo(position) && PositionUtil.getPsiElementAt(getProject(), PsiMethod.class, position) != null;
-  }
+  //public boolean canMoveTo(final SourcePosition position) {
+  //  return super.canMoveTo(position) && PositionUtil.getPsiElementAt(getProject(), PsiMethod.class, position) != null;
+  //}
 
   /**
    * finds FQ method's class name and method's signature
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/RunToCursorBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/RunToCursorBreakpoint.java
index 19a187d..5b5233a 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/RunToCursorBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/RunToCursorBreakpoint.java
@@ -32,7 +32,8 @@
  */
 public class RunToCursorBreakpoint extends LineBreakpoint {
   private final boolean myRestoreBreakpoints;
-  private final SourcePosition myCustomPosition;
+  @NotNull
+  protected final SourcePosition myCustomPosition;
   private String mySuspendPolicy;
 
   protected RunToCursorBreakpoint(@NotNull Project project, @NotNull SourcePosition pos, boolean restoreBreakpoints) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java
index e41127e..72820e0 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/StepIntoBreakpoint.java
@@ -45,24 +45,19 @@
     myFilter = filter;
   }
 
-  protected void createOrWaitPrepare(DebugProcessImpl debugProcess, SourcePosition classPosition) {
-    super.createOrWaitPrepare(debugProcess, classPosition);
-  }
-
   protected void createRequestForPreparedClass(DebugProcessImpl debugProcess, ReferenceType classType) {
     try {
       final CompoundPositionManager positionManager = debugProcess.getPositionManager();
-      final SourcePosition startPosition = getSourcePosition();
-      List<Location> locations = positionManager.locationsOfLine(classType, startPosition);
+      List<Location> locations = positionManager.locationsOfLine(classType, myCustomPosition);
 
       if (locations.isEmpty()) {
         // sometimes first statements are mapped to some weird line number, or there are no executable instructions at first statement's line
         // so if lambda or method body spans for more than one lines, try get some locations from these lines
         final int lastLine = myFilter.getLastStatementLine();
         if (lastLine >= 0) {
-          int nextLine = startPosition.getLine() + 1;
+          int nextLine = myCustomPosition.getLine() + 1;
           while (nextLine <= lastLine && locations.isEmpty()) {
-            locations = positionManager.locationsOfLine(classType, SourcePosition.createFromLine(startPosition.getFile(), nextLine++));
+            locations = positionManager.locationsOfLine(classType, SourcePosition.createFromLine(myCustomPosition.getFile(), nextLine++));
           }
         }
       }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeBase.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeBase.java
index dd25e3f..36cb638 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeBase.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeBase.java
@@ -20,17 +20,15 @@
  */
 package com.intellij.debugger.ui.impl;
 
+import com.intellij.debugger.impl.DebuggerUtilsEx;
 import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
 import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
 import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
 import com.intellij.ide.dnd.aware.DnDAwareTree;
 import com.intellij.openapi.Disposable;
-import com.intellij.openapi.fileTypes.StdFileTypes;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.JDOMUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.ui.ScreenUtil;
 import com.intellij.ui.ScrollPaneFactory;
 import com.intellij.util.text.StringTokenizer;
@@ -239,20 +237,9 @@
   private String getTipText(DebuggerTreeNodeImpl node) {
     NodeDescriptorImpl descriptor = node.getDescriptor();
     if (descriptor instanceof ValueDescriptorImpl) {
-      String text = ((ValueDescriptorImpl)descriptor).getValueLabel();
+      String text = ((ValueDescriptorImpl)descriptor).getValueText();
       if (text != null) {
-        if (StringUtil.startsWithChar(text, '{') && text.indexOf('}') > 0) {
-          int idx = text.indexOf('}');
-          if (idx != text.length() - 1) {
-            text = text.substring(idx + 1);
-          }
-        }
-
-        if (StringUtil.startsWithChar(text, '\"') && StringUtil.endsWithChar(text, '\"')) {
-          text = text.substring(1, text.length() - 1);
-        }
-
-        final String tipText = prepareToolTipText(text);
+        final String tipText = DebuggerUtilsEx.prepareValueText(text, myProject);
         if (!tipText.isEmpty() &&
             (tipText.indexOf('\n') >= 0 || !getVisibleRect().contains(getRowBounds(getRowForPath(new TreePath(node.getPath())))))) {
           return tipText;
@@ -275,47 +262,6 @@
     return null;
   }
 
-  private String prepareToolTipText(String text) {
-    int tabSize = CodeStyleSettingsManager.getSettings(myProject).getTabSize(StdFileTypes.JAVA);
-    if (tabSize < 0) {
-      tabSize = 0;
-    }
-    final StringBuilder buf = new StringBuilder();
-    boolean special = false;
-    for (int idx = 0; idx < text.length(); idx++) {
-      char c = text.charAt(idx);
-      if (special) {
-        if (c == 't') { // convert tabs to spaces
-          for (int i = 0; i < tabSize; i++) {
-            buf.append(' ');
-          }
-        }
-        else if (c == 'r') { // remove occurrences of '\r'
-        }
-        else if (c == 'n') {
-          buf.append('\n');
-        }
-        else if (c == '\"') {
-          buf.append('\"');
-        }
-        else {
-          buf.append('\\');
-          buf.append(c);
-        }
-        special = false;
-      }
-      else {
-        if (c == '\\') {
-          special = true;
-        }
-        else {
-          buf.append(c);
-        }
-      }
-    }
-    return buf.toString();
-  }
-
   @Override
   public void dispose() {
     final JComponent tooltip = myCurrentTooltip;
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java
index e9b513a..c361c85 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/InspectDialog.java
@@ -22,6 +22,7 @@
 import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 
@@ -81,4 +82,10 @@
       close(CANCEL_EXIT_CODE);
     }
   }
+
+  @Nullable
+  @Override
+  public JComponent getPreferredFocusedComponent() {
+    return myInspectView.getInspectTree();
+  }
 }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java
index b58d9e6..a1443a9 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java
@@ -43,16 +43,21 @@
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.EmptyRunnable;
 import com.intellij.openapi.util.SystemInfo;
 import com.intellij.ui.*;
 import com.intellij.ui.border.CustomLineBorder;
+import com.intellij.util.Alarm;
+import com.intellij.util.ui.UIUtil;
 import com.intellij.xdebugger.impl.actions.XDebuggerActions;
+import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
+import java.awt.event.*;
 
 public class MainWatchPanel extends WatchPanel implements DataProvider {
 
@@ -61,30 +66,79 @@
     final WatchDebuggerTree watchTree = getWatchTree();
 
     final AnAction removeWatchesAction = ActionManager.getInstance().getAction(DebuggerActions.REMOVE_WATCH);
-    removeWatchesAction.registerCustomShortcutSet(CommonShortcuts.DELETE, watchTree);
+    removeWatchesAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), watchTree);
 
     final AnAction newWatchAction  = ActionManager.getInstance().getAction(DebuggerActions.NEW_WATCH);
     newWatchAction.registerCustomShortcutSet(CommonShortcuts.INSERT, watchTree);
 
-    final ClickListener mouseListener = new DoubleClickListener() {
+    final Alarm quitePeriod = new Alarm();
+    final Alarm editAlarm = new Alarm();
+    final ClickListener mouseListener = new ClickListener() {
       @Override
-      protected boolean onDoubleClick(MouseEvent e) {
-        AnAction editWatchAction = ActionManager.getInstance().getAction(DebuggerActions.EDIT_WATCH);
+      public boolean onClick(@NotNull MouseEvent event, int clickCount) {
+        if (!SwingUtilities.isLeftMouseButton(event) ||
+            ((event.getModifiers() & (InputEvent.SHIFT_MASK | InputEvent.ALT_MASK | InputEvent.CTRL_MASK | InputEvent.META_MASK)) !=0) ) {
+          return false;
+        }
+        boolean sameRow = isAboveSelectedItem(event, watchTree);
+        final AnAction editWatchAction = ActionManager.getInstance().getAction(DebuggerActions.EDIT_WATCH);
         Presentation presentation = editWatchAction.getTemplatePresentation().clone();
         DataContext context = DataManager.getInstance().getDataContext(watchTree);
-
-        AnActionEvent actionEvent = new AnActionEvent(null, context, "WATCH_TREE", presentation, ActionManager.getInstance(), 0);
-        editWatchAction.actionPerformed(actionEvent);
-        return true;
+        final AnActionEvent actionEvent = new AnActionEvent(null, context, "WATCH_TREE", presentation, ActionManager.getInstance(), 0);
+        Runnable runnable = new Runnable() {
+          public void run() {
+            editWatchAction.actionPerformed(actionEvent);
+          }
+        };
+        if (sameRow && editAlarm.isEmpty() && quitePeriod.isEmpty()) {
+          editAlarm.addRequest(runnable, UIUtil.getMultiClickInterval());
+        } else {
+          editAlarm.cancelAllRequests();
+        }
+        return false;
+      }
+    };
+    final ClickListener mouseEmptySpaceListener = new DoubleClickListener() {
+      @Override
+      protected boolean onDoubleClick(MouseEvent event) {
+        if (!isAboveSelectedItem(event, watchTree)) {
+          newWatch();
+          return true;
+        }
+        return false;
       }
     };
     ListenerUtil.addClickListener(watchTree, mouseListener);
+    ListenerUtil.addClickListener(watchTree, mouseEmptySpaceListener);
+
+    final FocusListener focusListener = new FocusListener() {
+      @Override
+      public void focusGained(FocusEvent e) {
+        quitePeriod.addRequest(EmptyRunnable.getInstance(), UIUtil.getMultiClickInterval());
+      }
+
+      @Override
+      public void focusLost(FocusEvent e) {
+        editAlarm.cancelAllRequests();
+      }
+    };
+    ListenerUtil.addFocusListener(watchTree, focusListener);
+
+    final TreeSelectionListener selectionListener = new TreeSelectionListener() {
+      @Override
+      public void valueChanged(TreeSelectionEvent e) {
+        quitePeriod.addRequest(EmptyRunnable.getInstance(), UIUtil.getMultiClickInterval());
+      }
+    };
+    watchTree.addTreeSelectionListener(selectionListener);
 
     final AnAction editWatchAction  = ActionManager.getInstance().getAction(DebuggerActions.EDIT_WATCH);
     editWatchAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), watchTree);
     registerDisposable(new Disposable() {
       public void dispose() {
         ListenerUtil.removeClickListener(watchTree, mouseListener);
+        ListenerUtil.removeFocusListener(watchTree, focusListener);
+        watchTree.removeTreeSelectionListener(selectionListener);
         removeWatchesAction.unregisterCustomShortcutSet(watchTree);
         newWatchAction.unregisterCustomShortcutSet(watchTree);
         editWatchAction.unregisterCustomShortcutSet(watchTree);
@@ -135,6 +189,17 @@
     }, myTree);
   }
 
+  private static boolean isAboveSelectedItem(MouseEvent event, WatchDebuggerTree watchTree) {
+    Rectangle bounds = watchTree.getRowBounds(watchTree.getLeadSelectionRow());
+    if (bounds != null) {
+      bounds.width = watchTree.getWidth();
+      if (bounds.contains(event.getPoint())) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private void addWatchesFrom(final DebuggerTreeNodeImpl[] nodes) {
     AddToWatchActionHandler.addFromNodes(getContext(), this, nodes);
   }
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java
index e62dfbd..fce05d1 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/TipManager.java
@@ -24,6 +24,7 @@
 import com.intellij.openapi.actionSystem.CustomShortcutSet;
 import com.intellij.openapi.keymap.KeymapUtil;
 import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.Weighted;
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.wm.IdeGlassPane;
 import com.intellij.openapi.wm.IdeGlassPaneUtil;
@@ -80,7 +81,7 @@
 
   boolean myInsideComponent;
 
-  private class MyMouseListener extends MouseAdapter {
+  private class MyMouseListener extends MouseAdapter implements Weighted{
     @Override
     public void mouseExited(final MouseEvent e) {
       myInsideComponent = false;
@@ -94,6 +95,11 @@
     }
 
     @Override
+    public double getWeight() {
+      return 0;
+    }
+
+    @Override
     public void mouseEntered(final MouseEvent e) {
       myInsideComponent = true;
     }
@@ -130,7 +136,7 @@
     }
   }
 
-  private class MyMouseMotionListener extends MouseMotionAdapter {
+  private class MyMouseMotionListener extends MouseMotionAdapter implements Weighted{
     @Override
     public void mouseMoved(final MouseEvent e) {
       myLastMouseEvent = e;
@@ -150,6 +156,10 @@
       }
     }
 
+    @Override
+    public double getWeight() {
+      return 0;
+    }
   }
 
   private boolean isInsideComponent(final MouseEvent e) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
index dc80f8b..1bda597 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/VariablesPanel.java
@@ -64,7 +64,9 @@
     registerDisposable(myXTree);
     myCards.add(myXTree.getTree(), X_TREE);
 
-    add(ScrollPaneFactory.createScrollPane(myCards), BorderLayout.CENTER);
+    JScrollPane pane = ScrollPaneFactory.createScrollPane(myCards);
+    pane.getVerticalScrollBar().setUnitIncrement(10);
+    add(pane, BorderLayout.CENTER);
     registerDisposable(DebuggerAction.installEditAction(frameTree, DebuggerActions.EDIT_NODE_SOURCE));
 
     overrideShortcut(frameTree, DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/FieldDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/FieldDescriptorImpl.java
index e059e78..223b3cc 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/FieldDescriptorImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/FieldDescriptorImpl.java
@@ -109,9 +109,7 @@
               // important: use the last location to be sure the position will be within the anonymous class
               final Location lastLocation = locations.get(locations.size() - 1);
               final SourcePosition position = debugProcess.getPositionManager().getSourcePosition(lastLocation);
-              if (position != null) {
-                aClass = JVMNameUtil.getClassAt(position);
-              }
+              aClass = JVMNameUtil.getClassAt(position);
             }
           }
           catch (AbsentInformationException ignored) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java
index 5e9c817..2c2860e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/ValueDescriptorImpl.java
@@ -56,6 +56,7 @@
   private EvaluateException myValueException;
   protected EvaluationContextImpl myStoredEvaluationContext = null;
 
+  private String myValueText;
   private String myValueLabel;
   @Nullable
   private Icon myValueIcon;
@@ -301,6 +302,7 @@
 
   @Override
   public String setValueLabel(String label) {
+    myValueText = label;
     final String customLabel = getCustomLabel(label);
     myValueLabel = customLabel;
     return setLabel(calcValueName() + " = " + customLabel);
@@ -440,6 +442,10 @@
     return myValueLabel;
   }
 
+  public String getValueText() {
+    return myValueText;
+  }
+
   //Context is set to null
   @Override
   public void clear() {
diff --git a/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/JavaBreakpointAdapterBase.java b/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/JavaBreakpointAdapterBase.java
index 686de9a..15cb3c4 100644
--- a/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/JavaBreakpointAdapterBase.java
+++ b/java/debugger/impl/src/org/jetbrains/java/debugger/breakpoints/JavaBreakpointAdapterBase.java
@@ -2,7 +2,6 @@
 
 import com.intellij.debugger.ui.breakpoints.LineBreakpoint;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.markup.RangeHighlighter;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -34,10 +33,6 @@
   }
 
   protected void configureCreatedBreakpoint(LineBreakpoint oldBreakpoint, XLineBreakpoint<XBreakpointProperties> breakpoint) {
-    final RangeHighlighter highlighter = oldBreakpoint.getHighlighter();
-    if (highlighter != null) {
-      highlighter.dispose();
-    }
   }
 
   @Override
diff --git a/java/debugger/openapi/src/com/intellij/debugger/PositionManager.java b/java/debugger/openapi/src/com/intellij/debugger/PositionManager.java
index 5713483..8b5c3d7 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/PositionManager.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/PositionManager.java
@@ -50,7 +50,7 @@
    * @see com.intellij.debugger.engine.jdi.VirtualMachineProxy#classesByName
    */
   @NotNull
-  List<ReferenceType> getAllClasses(SourcePosition classPosition) throws NoDataException;
+  List<ReferenceType> getAllClasses(@NotNull SourcePosition classPosition) throws NoDataException;
 
   /**
    * Returns the list of bytecode locations in a specific class corresponding to the specified position in the source code.
@@ -62,7 +62,7 @@
    * @see ReferenceType#locationsOfLine(int)
    */
   @NotNull
-  List<Location> locationsOfLine(ReferenceType type, SourcePosition position) throws NoDataException;
+  List<Location> locationsOfLine(@NotNull ReferenceType type, @NotNull SourcePosition position) throws NoDataException;
 
   /**
    * Called to request the JVM to notify the debugger engine when a class corresponding to a breakpoint location is loaded.
@@ -75,5 +75,5 @@
    * @throws NoDataException if the position is not in the code managed by this {@code PositionManager}
    */
   @Nullable
-  ClassPrepareRequest createPrepareRequest(ClassPrepareRequestor requestor, SourcePosition position) throws NoDataException;
+  ClassPrepareRequest createPrepareRequest(@NotNull ClassPrepareRequestor requestor, @NotNull SourcePosition position) throws NoDataException;
 }
diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java b/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java
index 64a7407..9e42c35 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java
@@ -26,7 +26,6 @@
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.fileTypes.LanguageFileType;
 import com.intellij.openapi.project.Project;
@@ -43,6 +42,7 @@
 import com.sun.jdi.*;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
@@ -211,7 +211,8 @@
     }
   }
 
-  protected static ArrayClass getArrayClass(String className) {
+  @Nullable
+  protected static ArrayClass getArrayClass(@NotNull String className) {
     boolean searchBracket = false;
     int dims = 0;
     int pos;
@@ -241,7 +242,7 @@
     return new ArrayClass(className.substring(0, pos + 1), dims);
   }
 
-  public static boolean instanceOf(String subType, String superType, Project project) {
+  public static boolean instanceOf(@NotNull String subType ,@NotNull String superType, @Nullable Project project) {
     if(project == null) {
       return subType.equals(superType);
     }
@@ -348,7 +349,7 @@
   }
 
   @Nullable
-  public static PsiClass findClass(final String className, Project project, final GlobalSearchScope scope) {
+  public static PsiClass findClass(@NotNull final String className, @NotNull Project project, final GlobalSearchScope scope) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
     final PsiManager psiManager = PsiManager.getInstance(project);
     final JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(psiManager.getProject());
@@ -381,7 +382,8 @@
     return aClass;
   }
 
-  public static PsiType getType(String className, Project project) {
+  @Nullable
+  public static PsiType getType(@NotNull String className, @NotNull Project project) {
     ApplicationManager.getApplication().assertReadAccessAllowed();
 
     final PsiManager psiManager = PsiManager.getInstance(project);
@@ -564,13 +566,50 @@
 
   public abstract PsiClass chooseClassDialog(String title, Project project);
 
+  /**
+   * Don't use directly, will be private in IDEA 14.
+   * @deprecated to remove in IDEA 15
+   */
+  @Deprecated
   public static boolean supportsJVMDebugging(FileType type) {
     return type instanceof LanguageFileType && ((LanguageFileType)type).isJVMDebuggingSupported();
   }
 
-  public static boolean supportsJVMDebugging(PsiFile file) {
-    final JVMDebugProvider[] providers = Extensions.getExtensions(JVMDebugProvider.EP_NAME);
-    for (JVMDebugProvider provider : providers) {
+  /**
+   * @deprecated Use {@link #isBreakpointAware(com.intellij.psi.PsiFile)}
+   * to remove in IDEA 15
+   */
+  @Deprecated
+  public static boolean supportsJVMDebugging(@NotNull PsiFile file) {
+    return isBreakpointAware(file);
+  }
+
+  /**
+   * IDEA-122113
+   * Will be removed when Java debugger will be moved to XDebugger API
+   */
+  public static boolean isDebugActionAware(@NotNull PsiFile file) {
+    return isDebugAware(file, false);
+  }
+
+  public static boolean isBreakpointAware(@NotNull PsiFile file) {
+    return isDebugAware(file, true);
+  }
+
+  @SuppressWarnings("deprecation")
+  private static boolean isDebugAware(@NotNull PsiFile file, boolean breakpointAware) {
+    FileType fileType = file.getFileType();
+    if (supportsJVMDebugging(fileType)) {
+      return true;
+    }
+
+    for (JavaDebugAware provider : JavaDebugAware.EP_NAME.getExtensions()) {
+      if (breakpointAware ? provider.isBreakpointAware(file) : provider.isActionAware(file)) {
+        return true;
+      }
+    }
+
+    for (JVMDebugProvider provider : JVMDebugProvider.EP_NAME.getExtensions()) {
       if (provider.supportsJVMDebugging(file)) {
         return true;
       }
diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/JSR45PositionManager.java b/java/debugger/openapi/src/com/intellij/debugger/engine/JSR45PositionManager.java
index b200e0e..f188409 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/engine/JSR45PositionManager.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/engine/JSR45PositionManager.java
@@ -113,7 +113,7 @@
 
   @Override
   @NotNull
-  public List<ReferenceType> getAllClasses(SourcePosition classPosition) throws NoDataException {
+  public List<ReferenceType> getAllClasses(@NotNull SourcePosition classPosition) throws NoDataException {
     checkSourcePositionFileType(classPosition);
 
     final List<ReferenceType> referenceTypes = myDebugProcess.getVirtualMachineProxy().allClasses();
@@ -142,7 +142,7 @@
 
   @Override
   @NotNull
-  public List<Location> locationsOfLine(final ReferenceType type, final SourcePosition position) throws NoDataException {
+  public List<Location> locationsOfLine(@NotNull final ReferenceType type, @NotNull final SourcePosition position) throws NoDataException {
     List<Location> locations = locationsOfClassAt(type, position);
     return locations != null ? locations : Collections.<Location>emptyList();
 
@@ -204,7 +204,7 @@
   }
 
   @Override
-  public ClassPrepareRequest createPrepareRequest(final ClassPrepareRequestor requestor, final SourcePosition position)
+  public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position)
     throws NoDataException {
     checkSourcePositionFileType(position);
 
diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/JVMDebugProvider.java b/java/debugger/openapi/src/com/intellij/debugger/engine/JVMDebugProvider.java
index 15fde83..2643074 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/engine/JVMDebugProvider.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/engine/JVMDebugProvider.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 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.
@@ -19,8 +19,10 @@
 import com.intellij.psi.PsiFile;
 
 /**
- * @author Dennis.Ushakov
+ * @deprecated Use {@link com.intellij.debugger.engine.JavaDebugAware}
+ * to remove in IDEA 15
  */
+@Deprecated
 public interface JVMDebugProvider {
   ExtensionPointName<JVMDebugProvider> EP_NAME = ExtensionPointName.create("com.intellij.debugger.jvmDebugProvider");
 
diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/JavaDebugAware.java b/java/debugger/openapi/src/com/intellij/debugger/engine/JavaDebugAware.java
new file mode 100644
index 0000000..ecb1186
--- /dev/null
+++ b/java/debugger/openapi/src/com/intellij/debugger/engine/JavaDebugAware.java
@@ -0,0 +1,31 @@
+/*
+ * 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.debugger.engine;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.psi.PsiFile;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class JavaDebugAware {
+  static final ExtensionPointName<JavaDebugAware> EP_NAME = ExtensionPointName.create("com.intellij.debugger.javaDebugAware");
+
+  public abstract boolean isBreakpointAware(@NotNull PsiFile psiFile);
+
+  // IDEA-122113, will be removed when Java debugger will be moved to XDebugger API
+  public boolean isActionAware(@NotNull PsiFile psiFile) {
+    return isBreakpointAware(psiFile);
+  }
+}
\ No newline at end of file
diff --git a/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java b/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java
index d397f0d..57efc54 100644
--- a/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java
+++ b/java/execution/impl/src/com/intellij/compiler/options/CompileStepBeforeRun.java
@@ -21,6 +21,7 @@
 import com.intellij.execution.configurations.RunConfiguration;
 import com.intellij.execution.configurations.RunConfigurationBase;
 import com.intellij.execution.configurations.RunProfileWithCompileBeforeLaunchOption;
+import com.intellij.execution.impl.ExecutionManagerImpl;
 import com.intellij.execution.remote.RemoteConfiguration;
 import com.intellij.execution.runners.ExecutionEnvironment;
 import com.intellij.icons.AllIcons;
@@ -152,6 +153,7 @@
           if (!myProject.isDisposed()) {
             scope.putUserData(RUN_CONFIGURATION, configuration);
             scope.putUserData(RUN_CONFIGURATION_TYPE_ID, configuration.getType().getId());
+            ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.set(scope, ExecutionManagerImpl.EXECUTION_SESSION_ID_KEY.get(env));
             compilerManager.make(scope, callback);
           }
           else {
diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationProducer.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationProducer.java
index 792c056..a61a952 100644
--- a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationProducer.java
+++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationProducer.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.execution.application;
 
+import com.intellij.codeInsight.TestFrameworks;
 import com.intellij.execution.JavaExecutionUtil;
 import com.intellij.execution.Location;
 import com.intellij.execution.actions.ConfigurationContext;
@@ -82,8 +83,14 @@
 
   @Override
   public boolean isConfigurationFromContext(ApplicationConfiguration appConfiguration, ConfigurationContext context) {
-    final PsiClass aClass = ApplicationConfigurationType.getMainClass(context.getPsiLocation());
+    final PsiElement location = context.getPsiLocation();
+    final PsiClass aClass = ApplicationConfigurationType.getMainClass(location);
     if (aClass != null && Comparing.equal(JavaExecutionUtil.getRuntimeQualifiedName(aClass), appConfiguration.MAIN_CLASS_NAME)) {
+      final PsiMethod method = PsiTreeUtil.getParentOfType(location, PsiMethod.class, false);
+      if (method != null && TestFrameworks.getInstance().isTestMethod(method)) {
+        return false;
+      }
+
       final Module configurationModule = appConfiguration.getConfigurationModule().getModule();
       if (Comparing.equal(context.getModule(), configurationModule)) return true;
 
diff --git a/java/execution/impl/src/com/intellij/execution/junit/InheritorChooser.java b/java/execution/impl/src/com/intellij/execution/junit/InheritorChooser.java
index 4463e3e..d318ad4 100644
--- a/java/execution/impl/src/com/intellij/execution/junit/InheritorChooser.java
+++ b/java/execution/impl/src/com/intellij/execution/junit/InheritorChooser.java
@@ -22,12 +22,11 @@
 import com.intellij.ide.util.PsiClassListCellRenderer;
 import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileEditor.FileEditor;
 import com.intellij.openapi.fileEditor.TextEditor;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
+import com.intellij.openapi.util.Condition;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
 import com.intellij.psi.util.PsiClassUtil;
@@ -37,7 +36,10 @@
 import com.intellij.util.Processor;
 
 import javax.swing.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * User: anna
@@ -57,7 +59,15 @@
                                           final Runnable performRunnable,
                                           final PsiMethod psiMethod,
                                           final PsiClass containingClass) {
-    if (containingClass != null && containingClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
+    return runMethodInAbstractClass(context, performRunnable, psiMethod, containingClass, Condition.TRUE);
+  }
+
+  public boolean runMethodInAbstractClass(final ConfigurationContext context,
+                                          final Runnable performRunnable,
+                                          final PsiMethod psiMethod,
+                                          final PsiClass containingClass,
+                                          final Condition<PsiClass> acceptAbstractCondition) {
+    if (containingClass != null && containingClass.hasModifierProperty(PsiModifier.ABSTRACT) && acceptAbstractCondition.value(containingClass)) {
       final Location location = context.getLocation();
       if (location instanceof MethodLocation) {
         final PsiClass aClass = ((MethodLocation)location).getContainingClass();
diff --git a/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java b/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java
index 4433413..8abf465 100644
--- a/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java
+++ b/java/execution/impl/src/com/intellij/execution/util/JavaParametersUtil.java
@@ -56,10 +56,8 @@
     if (vmParameters != null) {
       vmParameters = ProgramParametersUtil.expandPath(vmParameters, module, project);
 
-      if (parameters.getEnv() != null) {
-        for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
-          vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false); //replace env usages
-        }
+      for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
+        vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false); //replace env usages
       }
     }
 
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/FrameworkBasedOptionsStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/FrameworkBasedOptionsStep.java
new file mode 100644
index 0000000..36c7e05
--- /dev/null
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/FrameworkBasedOptionsStep.java
@@ -0,0 +1,104 @@
+package com.intellij.ide.projectWizard;
+
+import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurableBase;
+import com.intellij.ide.util.frameworkSupport.FrameworkSupportProviderBase;
+import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelBase;
+import com.intellij.ide.util.projectWizard.ModuleBuilder;
+import com.intellij.ide.util.projectWizard.ModuleWizardStep;
+import com.intellij.ide.util.projectWizard.SdkSettingsStep;
+import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.projectRoots.SdkTypeId;
+import com.intellij.openapi.roots.ModifiableRootModel;
+import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
+import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.ui.components.JBLabel;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public abstract class FrameworkBasedOptionsStep<T extends FrameworkSupportProviderBase, B extends ModuleBuilder> extends ModuleWizardStep {
+
+  private final FrameworkSupportConfigurableBase myConfigurable;
+  private final SdkSettingsStep mySdkSettingsStep;
+  private final JPanel myPanel;
+  protected final FrameworkSupportModelBase myFrameworkSupportModel;
+  protected final B myBuilder;
+  protected final WizardContext myContext;
+
+  public FrameworkBasedOptionsStep(T provider, final B builder, WizardContext context, String sdkLabel) {
+    myContext = context;
+    LibrariesContainer container = LibrariesContainerFactory.createContainer(myContext.getProject());
+    myBuilder = builder;
+    myFrameworkSupportModel = new FrameworkSupportModelBase(context.getProject(), myBuilder, container) {
+      @NotNull
+      @Override
+      public String getBaseDirectoryForLibrariesPath() {
+        return StringUtil.notNullize(builder.getContentEntryPath());
+      }
+    };
+    //noinspection AbstractMethodCallInConstructor
+    myConfigurable = createConfigurable(provider, myFrameworkSupportModel);
+    myFrameworkSupportModel.selectFramework(provider, true);
+
+    builder.addModuleConfigurationUpdater(new ModuleBuilder.ModuleConfigurationUpdater() {
+      @Override
+      public void update(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
+        myConfigurable.addSupport(module, rootModel, null);
+      }
+    });
+
+    mySdkSettingsStep = new SdkSettingsStep(context, builder, new Condition<SdkTypeId>() {
+      @Override
+      public boolean value(SdkTypeId id) {
+        return acceptSdk(id);
+      }
+    });
+
+    mySdkSettingsStep.getJdkComboBox().addActionListener(new ActionListener() {
+      @Override
+      public void actionPerformed(ActionEvent e) {
+        updateDataModel();
+      }
+    });
+
+    myPanel = new JPanel(new BorderLayout(0, 4));
+    if (!mySdkSettingsStep.isEmpty()) {
+      JComponent component = mySdkSettingsStep.getComponent();
+      component.add(new JBLabel(sdkLabel), BorderLayout.WEST);
+      myPanel.add(component, BorderLayout.NORTH);
+    }
+    myPanel.add(myConfigurable.getComponent(), BorderLayout.CENTER);
+    updateDataModel();
+  }
+
+  protected abstract boolean acceptSdk(SdkTypeId id);
+
+  protected abstract FrameworkSupportConfigurableBase createConfigurable(T provider, FrameworkSupportModelBase model);
+
+  @Override
+  public JComponent getComponent() {
+    return myPanel;
+  }
+
+  @Override
+  public void updateDataModel() {
+    mySdkSettingsStep.updateDataModel();
+    myFrameworkSupportModel.fireWizardStepUpdated();
+  }
+
+  @Override
+  public boolean validate() throws ConfigurationException {
+    return mySdkSettingsStep.validate();
+  }
+
+}
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java
index ed2665d..6823778 100644
--- a/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ModuleTypeCategory.java
@@ -1,5 +1,6 @@
 package com.intellij.ide.projectWizard;
 
+import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
 import com.intellij.ide.util.projectWizard.ModuleBuilder;
 import com.intellij.openapi.module.JavaModuleType;
 import com.intellij.openapi.module.ModuleType;
@@ -29,4 +30,11 @@
       super(JavaModuleType.getModuleType());
     }
   }
+
+  public static class JavaSE extends Java {
+    @Override
+    public int getWeight() {
+      return JavaModuleBuilder.JAVA_WEIGHT;
+    }
+  }
 }
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategory.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategory.java
index 67400bc..2eb30c5 100644
--- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategory.java
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectCategory.java
@@ -73,6 +73,10 @@
     return ArrayUtil.EMPTY_STRING_ARRAY;
   }
 
+  public int getWeight() {
+    return 0;
+  }
+
   @Override
   public String toString() {
     return getDisplayName();
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java
index 18c12d2..b964013 100644
--- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectSettingsStep.java
@@ -224,11 +224,11 @@
     addField(label, field, panel);
   }
 
-  private static void addField(String label, JComponent field, JPanel panel) {
+  static void addField(String label, JComponent field, JPanel panel) {
     JLabel jLabel = new JBLabel(label);
     jLabel.setLabelFor(field);
     panel.add(jLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.WEST,
-                                                 GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));
+                                                 GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 4, 0));
     panel.add(field, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST,
                                                 GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0));
   }
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.form b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.form
index 24245d1..7246f2c 100644
--- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.form
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.form
@@ -38,36 +38,51 @@
           </scrollpane>
         </children>
       </grid>
-      <grid id="ad16" binding="myOptionsPanel" layout-manager="CardLayout" hgap="0" vgap="0">
+      <grid id="22e59" layout-manager="BorderLayout" hgap="0" vgap="0">
         <constraints>
-          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
-        <clientProperties>
-          <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
-        </clientProperties>
         <border type="none"/>
         <children>
-          <grid id="27a92" layout-manager="BorderLayout" hgap="0" vgap="0">
-            <constraints>
-              <card name="templates card"/>
-            </constraints>
+          <grid id="9b063" binding="myHeaderPanel" layout-manager="GridBagLayout">
+            <constraints border-constraint="North"/>
             <properties/>
+            <border type="empty">
+              <size top="5" left="5" bottom="5" right="5"/>
+            </border>
+            <children/>
+          </grid>
+          <grid id="ad16" binding="myOptionsPanel" layout-manager="CardLayout" hgap="0" vgap="0">
+            <constraints border-constraint="Center"/>
+            <properties/>
+            <clientProperties>
+              <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
+            </clientProperties>
             <border type="none"/>
             <children>
-              <nested-form id="b063c" form-file="com/intellij/ide/projectWizard/ProjectTemplateList.form" binding="myTemplatesList">
-                <constraints border-constraint="Center"/>
-              </nested-form>
+              <grid id="27a92" layout-manager="BorderLayout" hgap="0" vgap="0">
+                <constraints>
+                  <card name="templates card"/>
+                </constraints>
+                <properties/>
+                <border type="none"/>
+                <children>
+                  <nested-form id="b063c" form-file="com/intellij/ide/projectWizard/ProjectTemplateList.form" binding="myTemplatesList">
+                    <constraints border-constraint="Center"/>
+                  </nested-form>
+                </children>
+              </grid>
+              <grid id="b50ee" binding="myFrameworksPanelPlaceholder" layout-manager="BorderLayout" hgap="0" vgap="0">
+                <constraints>
+                  <card name="frameworks card"/>
+                </constraints>
+                <properties/>
+                <border type="none"/>
+                <children/>
+              </grid>
             </children>
           </grid>
-          <grid id="b50ee" binding="myFrameworksPanelPlaceholder" layout-manager="BorderLayout" hgap="0" vgap="0">
-            <constraints>
-              <card name="frameworks card"/>
-            </constraints>
-            <properties/>
-            <border type="none"/>
-            <children/>
-          </grid>
         </children>
       </grid>
     </children>
diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java
index 2a61684..3047d40 100644
--- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java
+++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java
@@ -25,14 +25,12 @@
 import com.intellij.ide.util.newProjectWizard.TemplatesGroup;
 import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelBase;
 import com.intellij.ide.util.newProjectWizard.modes.CreateFromTemplateMode;
-import com.intellij.ide.util.projectWizard.EmptyModuleBuilder;
-import com.intellij.ide.util.projectWizard.ModuleBuilder;
-import com.intellij.ide.util.projectWizard.ModuleWizardStep;
-import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.ide.util.projectWizard.*;
 import com.intellij.ide.wizard.CommitStepException;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleType;
+import com.intellij.openapi.module.WebModuleTypeBase;
 import com.intellij.openapi.options.ConfigurationException;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
@@ -44,19 +42,24 @@
 import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
 import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
 import com.intellij.openapi.ui.Messages;
+import com.intellij.openapi.ui.popup.ListItemDescriptor;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.platform.ProjectTemplate;
 import com.intellij.platform.ProjectTemplateEP;
-import com.intellij.platform.ProjectTemplatesFactory;
 import com.intellij.platform.templates.*;
-import com.intellij.ui.*;
+import com.intellij.ui.CollectionListModel;
+import com.intellij.ui.IdeBorderFactory;
+import com.intellij.ui.ListSpeedSearch;
 import com.intellij.ui.SingleSelectionModel;
 import com.intellij.ui.components.JBList;
+import com.intellij.ui.popup.list.GroupedItemsListRenderer;
 import com.intellij.util.Function;
+import com.intellij.util.PlatformUtils;
 import com.intellij.util.containers.*;
+import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.TestOnly;
@@ -76,7 +79,7 @@
  *         Date: 04.09.13
  */
 @SuppressWarnings("unchecked")
-public class ProjectTypeStep extends ModuleWizardStep implements Disposable {
+public class ProjectTypeStep extends ModuleWizardStep implements SettingsStep, Disposable {
 
   private static final String TEMPLATES_CARD = "templates card";
   private static final String FRAMEWORKS_CARD = "frameworks card";
@@ -101,12 +104,16 @@
   private JBList myProjectTypeList;
   private ProjectTemplateList myTemplatesList;
   private JPanel myFrameworksPanelPlaceholder;
+  private JPanel myHeaderPanel;
 
   private final WizardContext myContext;
   private final NewProjectWizard myWizard;
   private final ModulesProvider myModulesProvider;
   private final AddSupportForFrameworksPanel myFrameworksPanel;
   private final ModuleBuilder.ModuleConfigurationUpdater myConfigurationUpdater;
+  @Nullable
+  private ModuleWizardStep mySettingsStep;
+
 
   @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
   private final FactoryMap<ProjectTemplate, ModuleBuilder> myBuilders = new FactoryMap<ProjectTemplate, ModuleBuilder>() {
@@ -125,7 +132,7 @@
     myWizard = wizard;
 
     myTemplatesMap = new ConcurrentMultiMap<TemplatesGroup, ProjectTemplate>();
-    List<TemplatesGroup> groups = fillTemplatesMap(context);
+    final List<TemplatesGroup> groups = fillTemplatesMap(context);
 
     myProjectTypeList.setModel(new CollectionListModel<TemplatesGroup>(groups));
     myProjectTypeList.setSelectionModel(new SingleSelectionModel());
@@ -135,22 +142,49 @@
         updateSelection();
       }
     });
-    myProjectTypeList.setCellRenderer(new ColoredListCellRenderer<TemplatesGroup>() {
+    myProjectTypeList.setCellRenderer(new GroupedItemsListRenderer(new ListItemDescriptor<TemplatesGroup>() {
+      @Nullable
       @Override
-      protected void customizeCellRenderer(JList list, TemplatesGroup value, int index, boolean selected, boolean hasFocus) {
-        Font font = list.getFont();
-        if (value.getParentGroup() != null) {
-          setFont(font);
-          append("         ");
-        }
-        else {
-          setBorder(IdeBorderFactory.createEmptyBorder(2, 10, 2, 5));
-          setIcon(value.getIcon());
-          setFont(font.deriveFont(Font.BOLD));
-        }
-        append(value.getName());
+      public String getTextFor(TemplatesGroup value) {
+        return value.getName();
+      }
+
+      @Nullable
+      @Override
+      public String getTooltipFor(TemplatesGroup value) {
+        return value.getDescription();
+      }
+
+      @Nullable
+      @Override
+      public Icon getIconFor(TemplatesGroup value) {
+        return value.getIcon();
+      }
+
+      @Override
+      public boolean hasSeparatorAboveOf(TemplatesGroup value) {
+        int index = groups.indexOf(value);
+        if (index < 1) return false;
+        TemplatesGroup upper = groups.get(index - 1);
+        if (upper.getParentGroup() == null && value.getParentGroup() == null) return true;
+        return !Comparing.equal(upper.getParentGroup(), value.getParentGroup()) &&
+               !Comparing.equal(upper.getName(), value.getParentGroup());
+      }
+
+      @Nullable
+      @Override
+      public String getCaptionAboveOf(TemplatesGroup value) {
+        return null;
+      }
+    }) {
+      @Override
+      protected JComponent createItemComponent() {
+        JComponent component = super.createItemComponent();
+        myTextLabel.setBorder(IdeBorderFactory.createEmptyBorder(3));
+        return component;
       }
     });
+
     new ListSpeedSearch(myProjectTypeList) {
       @Override
       protected String getElementText(Object element) {
@@ -169,8 +203,8 @@
         return StringUtil.notNullize(builder.getContentEntryPath());
       }
     };
-    myFrameworksPanel = new AddSupportForFrameworksPanel(Collections.<FrameworkSupportInModuleProvider>emptyList(), model, true);
-    Disposer.register(wizard.getDisposable(), myFrameworksPanel);
+    myFrameworksPanel = new AddSupportForFrameworksPanel(Collections.<FrameworkSupportInModuleProvider>emptyList(), model, true, myHeaderPanel);
+    Disposer.register(this, myFrameworksPanel);
     myFrameworksPanelPlaceholder.add(myFrameworksPanel.getMainPanel());
 
     myConfigurationUpdater = new ModuleBuilder.ModuleConfigurationUpdater() {
@@ -255,7 +289,9 @@
     myTemplatesMap.putAllValues(map);
 
     for (ProjectCategory category : ProjectCategory.EXTENSION_POINT_NAME.getExtensions()) {
-      myTemplatesMap.put(new TemplatesGroup(category), new ArrayList<ProjectTemplate>());
+      TemplatesGroup group = new TemplatesGroup(category);
+      myTemplatesMap.remove(group);
+      myTemplatesMap.put(group, new ArrayList<ProjectTemplate>());
     }
 
     if (context.isCreatingNewProject()) {
@@ -265,6 +301,16 @@
       }
     }
 
+    // remove Static Web group in IDEA Community if no specific templates found (IDEA-120593)
+    if (PlatformUtils.isIdeaCommunity()) {
+      for (TemplatesGroup group : myTemplatesMap.keySet()) {
+        if (WebModuleTypeBase.WEB_MODULE.equals(group.getId()) && myTemplatesMap.get(group).isEmpty()) {
+          myTemplatesMap.remove(group);
+          break;
+        }
+      }
+    }
+
     List<TemplatesGroup> groups = new ArrayList<TemplatesGroup>(myTemplatesMap.keySet());
 
     // sorting by module type popularity
@@ -276,19 +322,18 @@
     Collections.sort(groups, new Comparator<TemplatesGroup>() {
       @Override
       public int compare(TemplatesGroup o1, TemplatesGroup o2) {
-        int u = Comparing.compare(ProjectTemplatesFactory.CUSTOM_GROUP.equals(o1.getName()), ProjectTemplatesFactory.CUSTOM_GROUP.equals(o2.getName()));
-        if (u != 0) return u;
+        int i = o2.getWeight() - o1.getWeight();
+        if (i != 0) return i;
         int i1 = moduleTypes.get(getModuleType(o2)).size() - moduleTypes.get(getModuleType(o1)).size();
         if (i1 != 0) return i1;
-        int i = myTemplatesMap.get(o2).size() - myTemplatesMap.get(o1).size();
-        return i != 0 ? i : o1.compareTo(o2);
+        return o1.compareTo(o2);
       }
     });
 
     Set<String> groupNames = ContainerUtil.map2Set(groups, new Function<TemplatesGroup, String>() {
       @Override
       public String fun(TemplatesGroup group) {
-        return group.getName();
+        return group.getParentGroup();
       }
     });
 
@@ -297,7 +342,7 @@
     for (ListIterator<TemplatesGroup> iterator = groups.listIterator(); iterator.hasNext(); ) {
       TemplatesGroup group = iterator.next();
       String parentGroup = group.getParentGroup();
-      if (parentGroup != null && groupNames.contains(parentGroup) && !group.getName().equals(parentGroup)) {
+      if (parentGroup != null && groupNames.contains(parentGroup) && !group.getName().equals(parentGroup) && groupMap.containsKey(parentGroup)) {
         subGroups.putValue(parentGroup, group);
         iterator.remove();
       }
@@ -322,6 +367,13 @@
     if (group == null) return;
     PropertiesComponent.getInstance().setValue(PROJECT_WIZARD_GROUP, group.getId() );
     ModuleBuilder groupModuleBuilder = group.getModuleBuilder();
+
+    mySettingsStep = null;
+    myHeaderPanel.removeAll();
+    if (groupModuleBuilder != null && groupModuleBuilder.getModuleType() != null) {
+      mySettingsStep = groupModuleBuilder.modifyProjectTypeStep(this);
+    }
+
     if (groupModuleBuilder == null || groupModuleBuilder.isTemplateBased()) {
       showTemplates(group);
     }
@@ -356,6 +408,21 @@
 
       showCard(FRAMEWORKS_CARD);
     }
+
+    myHeaderPanel.setVisible(myHeaderPanel.getComponentCount() > 0);
+    // align header labels
+    List<JLabel> labels = UIUtil.findComponentsOfType(myHeaderPanel, JLabel.class);
+    int width = 0;
+    for (JLabel label : labels) {
+      int width1 = label.getPreferredSize().width;
+      width = Math.max(width, width1);
+    }
+    for (JLabel label : labels) {
+      label.setPreferredSize(new Dimension(width, label.getPreferredSize().height));
+    }
+    myHeaderPanel.revalidate();
+    myHeaderPanel.repaint();
+
     updateSelection();
   }
 
@@ -477,10 +544,16 @@
     if (step != null) {
       step.updateDataModel();
     }
+    if (mySettingsStep != null) {
+      mySettingsStep.updateDataModel();
+    }
   }
 
   @Override
   public boolean validate() throws ConfigurationException {
+    if (mySettingsStep != null) {
+      if (!mySettingsStep.validate()) return false;
+    }
     ModuleWizardStep step = getCustomStep();
     return step != null ? step.validate() : super.validate();
   }
@@ -575,9 +648,12 @@
   public boolean setSelectedTemplate(String group, String name) {
     ListModel model = myProjectTypeList.getModel();
     for (int i = 0; i < model.getSize(); i++) {
-      if (group.equals(((TemplatesGroup)model.getElementAt(i)).getName())) {
+      TemplatesGroup templatesGroup = (TemplatesGroup)model.getElementAt(i);
+      if (group.equals(templatesGroup.getName())) {
         myProjectTypeList.setSelectedIndex(i);
         if (name == null) return getSelectedGroup().getName().equals(group);
+        Collection<ProjectTemplate> templates = myTemplatesMap.get(templatesGroup);
+        setTemplatesList(templatesGroup, templates, false);
         return myTemplatesList.setSelectedTemplate(name);
       }
     }
@@ -588,4 +664,33 @@
   public AddSupportForFrameworksPanel getFrameworksPanel() {
     return myFrameworksPanel;
   }
+
+  @Override
+  public WizardContext getContext() {
+    return myContext;
+  }
+
+  @Override
+  public void addSettingsField(@NotNull String label, @NotNull JComponent field) {
+    ProjectSettingsStep.addField(label, field, myHeaderPanel);
+  }
+
+  @Override
+  public void addSettingsComponent(@NotNull JComponent component) {
+  }
+
+  @Override
+  public void addExpertPanel(@NotNull JComponent panel) {
+
+  }
+
+  @Override
+  public void addExpertField(@NotNull String label, @NotNull JComponent field) {
+
+  }
+
+  @Override
+  public JTextField getModuleNameField() {
+    return null;
+  }
 }
diff --git a/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/AddFrameworkSupportDialog.java b/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/AddFrameworkSupportDialog.java
index c2af447..42fdab9 100644
--- a/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/AddFrameworkSupportDialog.java
+++ b/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/AddFrameworkSupportDialog.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2000-2013 JetBrains s.r.o.
  *
@@ -52,7 +51,7 @@
     myModule = module;
     final LibrariesContainer container = LibrariesContainerFactory.createContainer(module.getProject());
     final FrameworkSupportModelBase model = new FrameworkSupportModelImpl(module.getProject(), contentRootPath, container);
-    myAddSupportPanel = new AddSupportForFrameworksPanel(providers, model, false) {
+    myAddSupportPanel = new AddSupportForFrameworksPanel(providers, model, false, null) {
       @Override
       protected void onFrameworkStateChanged() {
         setOKActionEnabled(isOKActionEnabled());
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java
index 200d635..540502b 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java
@@ -37,9 +37,9 @@
 import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
 import com.intellij.openapi.ui.Splitter;
-import com.intellij.openapi.ui.VerticalFlowLayout;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.ui.CheckedTreeNode;
+import com.intellij.ui.IdeBorderFactory;
 import com.intellij.ui.ScrollPaneFactory;
 import com.intellij.util.Function;
 import com.intellij.util.containers.ContainerUtil;
@@ -78,15 +78,18 @@
   private FrameworkSupportNodeBase myLastSelectedNode;
 
   private Collection<FrameworkSupportNodeBase> myAssociatedFrameworks;
-  private final JPanel myAssociatedFrameworksPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
+  @Nullable
+  private final JPanel myAssociatedFrameworksPanel;
 
   public AddSupportForFrameworksPanel(final List<FrameworkSupportInModuleProvider> providers,
-                                      final FrameworkSupportModelBase model, boolean vertical) {
+                                      final FrameworkSupportModelBase model, boolean vertical, @Nullable JPanel associatedFrameworksPanel) {
     myModel = model;
+    myAssociatedFrameworksPanel = associatedFrameworksPanel;
     myLibrariesContainer = model.getLibrariesContainer();
 
     myLabel.setVisible(!vertical);
-    Splitter splitter = vertical ? new Splitter(true, 0.6f) : new Splitter(false, 0.3f, 0.1f, 0.7f);
+    Splitter splitter = vertical ? new Splitter(true, 0.6f, 0.2f, 0.8f) : new Splitter(false, 0.3f, 0.3f, 0.7f);
+    splitter.setHonorComponentsMinimumSize(false);
     myFrameworksTree = new FrameworksTree(model) {
       @Override
       protected void onNodeStateChanged(CheckedTreeNode node) {
@@ -108,7 +111,6 @@
         ((DefaultTreeModel)myFrameworksTree.getModel()).nodeChanged(getSelectedNode());
       }
     }, this);
-    setProviders(providers);
 
     myFrameworksTree.addTreeSelectionListener(new TreeSelectionListener() {
       public void valueChanged(TreeSelectionEvent e) {
@@ -118,15 +120,18 @@
 
     JPanel treePanel = new JPanel(new BorderLayout());
     treePanel.add(ScrollPaneFactory.createScrollPane(myFrameworksTree), BorderLayout.CENTER);
-    treePanel.add(myAssociatedFrameworksPanel, BorderLayout.NORTH);
+    treePanel.setMinimumSize(new Dimension(200, 300));
 
     splitter.setFirstComponent(treePanel);
     myOptionsPanel = new JPanel(new CardLayout());
-    myOptionsPanel.add(EMPTY_CARD, new JPanel());
+    JPanel emptyCard = new JPanel();
+    emptyCard.setPreferredSize(new Dimension(400, 100));
+    myOptionsPanel.add(EMPTY_CARD, emptyCard);
 
     splitter.setSecondComponent(myOptionsPanel);
     myFrameworksPanel.add(splitter, BorderLayout.CENTER);
 
+    setProviders(providers);
   }
 
   public void setProviders(List<FrameworkSupportInModuleProvider> providers) {
@@ -150,21 +155,25 @@
 
   public void setAssociatedFrameworks() {
 
-    myAssociatedFrameworksPanel.setVisible(!myAssociatedFrameworks.isEmpty());
-    myAssociatedFrameworksPanel.removeAll();
+    if (myAssociatedFrameworksPanel == null) return;
     for (FrameworkSupportNodeBase nodeBase : myAssociatedFrameworks) {
       if (nodeBase instanceof FrameworkSupportNode) {
         ((FrameworkSupportNode)nodeBase).getConfigurable().onFrameworkSelectionChanged(true);
         FrameworkSupportOptionsComponent component = initializeOptionsPanel((FrameworkSupportNode)nodeBase, false);
-        myAssociatedFrameworksPanel.add(component.getMainPanel());
+        addAssociatedFrameworkComponent(component.getMainPanel(), myAssociatedFrameworksPanel);
       }
       else {
         JPanel panel = initializeGroupPanel((FrameworkGroup<?>)nodeBase.getUserObject(), false);
-        myAssociatedFrameworksPanel.add(panel);
+        addAssociatedFrameworkComponent(panel, myAssociatedFrameworksPanel);
       }
     }
   }
 
+  private static void addAssociatedFrameworkComponent(JPanel component, JPanel panel) {
+    panel.add(component, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0, GridBagConstraints.NORTHWEST,
+                                                GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+  }
+
   protected void onFrameworkStateChanged() {}
 
   private void onSelectionChanged() {
@@ -223,7 +232,7 @@
       panel = component.getMainPanel();
       myInitializedGroupPanels.put(group, panel);
       if (addToOptions) {
-        myOptionsPanel.add(group.getId(), panel);
+        myOptionsPanel.add(group.getId(), wrapInScrollPane(panel));
       }
     }
     return panel;
@@ -249,13 +258,21 @@
       component = new FrameworkSupportOptionsComponent(myModel, myLibrariesContainer, this,
                                                        node.getUserObject(), node.getConfigurable());
       if (addToOptions) {
-        myOptionsPanel.add(node.getId(), component.getMainPanel());
+        myOptionsPanel.add(node.getId(), wrapInScrollPane(component.getMainPanel()));
       }
       myInitializedOptionsComponents.put(node, component);
     }
     return component;
   }
 
+  private static JScrollPane wrapInScrollPane(JPanel panel) {
+    JPanel wrapper = new JPanel(new BorderLayout());
+    wrapper.add(panel);
+    wrapper.setBorder(IdeBorderFactory.createEmptyBorder(5));
+    return ScrollPaneFactory.createScrollPane(wrapper, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+                                              ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+  }
+
   private void showCard(String cardName) {
     ((CardLayout)myOptionsPanel.getLayout()).show(myOptionsPanel, cardName);
   }
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportOptionsComponent.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportOptionsComponent.java
index ec36a20..c0c05d0 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportOptionsComponent.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportOptionsComponent.java
@@ -60,7 +60,7 @@
                                           final FrameworkSupportInModuleConfigurable configurable) {
     myModel = model;
     myConfigurable = configurable;
-    VerticalFlowLayout layout = new VerticalFlowLayout();
+    VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 3, true, false);
     layout.setVerticalFill(true);
     myMainPanel = new JPanel(layout);
     myModel.registerOptionsComponent(provider, this);
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkVersionComponent.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkVersionComponent.java
index 52d6bbe..43def6b 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkVersionComponent.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkVersionComponent.java
@@ -28,7 +28,7 @@
                                    final List<? extends FrameworkVersion> versions_, String labelText) {
     myModel = model;
     myAllVersions = versions_;
-    myMainPanel = new JPanel(new VerticalFlowLayout());
+    myMainPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 3, true, false));
     myFrameworkOrGroupId = frameworkOrGroupId;
     myVersionsBox = new ComboBox();
     myVersionsBox.setRenderer(new ListCellRendererWrapper<FrameworkVersion>() {
@@ -47,7 +47,7 @@
       }
     });
 
-    myVersionsPanel = FormBuilder.createFormBuilder().addLabeledComponent(labelText, myVersionsBox).getPanel();
+    myVersionsPanel = FormBuilder.createFormBuilder().setHorizontalGap(5).addLabeledComponent(labelText, myVersionsBox).getPanel();
     myMainPanel.add(myVersionsPanel);
     updateVersionsList();
   }
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SupportForFrameworksStep.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SupportForFrameworksStep.java
index 74badcc..8945c9f 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SupportForFrameworksStep.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SupportForFrameworksStep.java
@@ -1,6 +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.
@@ -55,7 +54,7 @@
     myBuilder = builder;
     List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getProviders(builder);
     myFrameworkSupportModel = new FrameworkSupportModelInWizard(librariesContainer, builder);
-    mySupportForFrameworksPanel = new AddSupportForFrameworksPanel(providers, myFrameworkSupportModel, false);
+    mySupportForFrameworksPanel = new AddSupportForFrameworksPanel(providers, myFrameworkSupportModel, false, null);
     myConfigurationUpdater = new ModuleBuilder.ModuleConfigurationUpdater() {
       public void update(@NotNull final Module module, @NotNull final ModifiableRootModel rootModel) {
         mySupportForFrameworksPanel.addSupport(module, rootModel);
@@ -69,10 +68,6 @@
     return path != null ? FileUtil.toSystemIndependentName(path) : "";
   }
 
-  public Icon getIcon() {
-    return ICON;
-  }
-
   @Override
   public void disposeUIResources() {
     Disposer.dispose(mySupportForFrameworksPanel);
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/TemplatesGroup.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/TemplatesGroup.java
index f91f378..0a019db 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/TemplatesGroup.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/TemplatesGroup.java
@@ -17,6 +17,7 @@
 
 import com.intellij.ide.projectWizard.ProjectCategory;
 import com.intellij.ide.util.projectWizard.ModuleBuilder;
+import com.intellij.openapi.util.Comparing;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -52,12 +53,12 @@
    * @param category
    */
   public TemplatesGroup(ProjectCategory category) {
-    this(category.getDisplayName(), category.getDescription(), null, 0, category.getGroupName(), category.getId(), category.createModuleBuilder());
+    this(category.getDisplayName(), category.getDescription(), category.getIcon(), category.getWeight(), category.getGroupName(), category.getId(), category.createModuleBuilder());
     myProjectCategory = category;
   }
 
   public TemplatesGroup(ModuleBuilder builder) {
-    this(builder.getPresentableName(), builder.getDescription(), builder.getBigIcon(), 0, builder.getParentGroup(), builder.getBuilderId(), builder);
+    this(builder.getPresentableName(), builder.getDescription(), builder.getNodeIcon(), builder.getWeight(), builder.getParentGroup(), builder.getBuilderId(), builder);
   }
 
   @Nullable
@@ -91,6 +92,10 @@
     return true;
   }
 
+  public int getWeight() {
+    return myWeight;
+  }
+
   @Override
   public int hashCode() {
     return myName.hashCode();
@@ -104,7 +109,10 @@
   @Override
   public int compareTo(@NotNull TemplatesGroup o) {
     int i = o.myWeight - myWeight;
-    return i == 0 ? o.getName().compareTo(getName()) : i;
+    if (i != 0) return i;
+    int i1 = Comparing.compare(o.getParentGroup(), getParentGroup());
+    if (i1 != 0) return i1;
+    return o.getName().compareTo(getName());
   }
 
   public String getParentGroup() {
diff --git a/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/DefaultProjectStructureDetector.java b/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/DefaultProjectStructureDetector.java
new file mode 100644
index 0000000..dab952f
--- /dev/null
+++ b/java/idea-ui/src/com/intellij/ide/util/projectWizard/importSources/DefaultProjectStructureDetector.java
@@ -0,0 +1,48 @@
+/*
+ * 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.ide.util.projectWizard.importSources;
+
+import com.intellij.ide.util.importProject.ProjectDescriptor;
+import com.intellij.openapi.module.WebModuleType;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public class DefaultProjectStructureDetector extends ProjectStructureDetector {
+  @NotNull
+  @Override
+  public DirectoryProcessingResult detectRoots(@NotNull File dir,
+                                               @NotNull File[] children,
+                                               @NotNull File base,
+                                               @NotNull List<DetectedProjectRoot> result) {
+    result.add(new DetectedContentRoot(dir, "Content", WebModuleType.getInstance()));
+    return DirectoryProcessingResult.SKIP_CHILDREN;
+  }
+
+  @Override
+  public void setupProjectStructure(@NotNull Collection<DetectedProjectRoot> roots,
+                                    @NotNull ProjectDescriptor projectDescriptor,
+                                    @NotNull ProjectFromSourcesBuilder builder) {
+    if (!builder.hasRootsFromOtherDetectors(this)) {
+      builder.setupModulesByContentRoots(projectDescriptor, roots);
+    }
+  }
+}
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/IdeaModifiableModelsProvider.java b/java/idea-ui/src/com/intellij/openapi/roots/IdeaModifiableModelsProvider.java
index 59ea8ea..b7b73ff 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/IdeaModifiableModelsProvider.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/IdeaModifiableModelsProvider.java
@@ -2,6 +2,7 @@
 
 import com.intellij.facet.FacetManager;
 import com.intellij.facet.ModifiableFacetModel;
+import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
@@ -104,6 +105,8 @@
 
   @Nullable
   private static StructureConfigurableContext getProjectStructureContext(Project project) {
+    if (ApplicationManager.getApplication().isHeadlessEnvironment()) return null;
+
     final ProjectStructureConfigurable structureConfigurable = ProjectStructureConfigurable.getInstance(project);
     return structureConfigurable.isUiInitialized() ? structureConfigurable.getContext() : null;
   }
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
index 1f5d785..a12c0fe 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/JavadocEditor.java
@@ -106,7 +106,7 @@
             TableUtil.selectRows(myTable, new int[]{tableModel.getRowCount() - 1});
           }
         }
-      }).addExtraAction(new AnActionButton(ProjectBundle.message("module.javadoc.add.url.button"), IconUtil.getAddLinkIcon()) {
+      }).addExtraAction(new DumbAwareActionButton(ProjectBundle.message("module.javadoc.add.url.button"), IconUtil.getAddLinkIcon()) {
         @Override
         public void actionPerformed(AnActionEvent e) {
           VirtualFile[] files = new VirtualFile[]{Util.showSpecifyJavadocUrlDialog(myTable)};
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java
index f553168..7edad1d 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ModulesConfigurator.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.
@@ -47,8 +47,8 @@
 import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.packaging.artifacts.Artifact;
@@ -392,25 +392,19 @@
   }
 
   private Module createModule(final ModuleBuilder builder) {
-    final Exception[] ex = new Exception[]{null};
-    final Module module = ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
-      @Override
-      @SuppressWarnings({"ConstantConditions"})
-      public Module compute() {
-        try {
+    try {
+      return ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Module, Exception>() {
+        @Override
+        public Module compute() throws Exception {
           return builder.createModule(myModuleModel);
         }
-        catch (Exception e) {
-          ex[0] = e;
-          return null;
-        }
-      }
-    });
-    if (ex[0] != null) {
-      Messages.showErrorDialog(ProjectBundle.message("module.add.error.message", ex[0].getMessage()),
-                               ProjectBundle.message("module.add.error.title"));
+      });
     }
-    return module;
+    catch (Exception e) {
+      Messages.showErrorDialog(ProjectBundle.message("module.add.error.message", e.getMessage()),
+                               ProjectBundle.message("module.add.error.title"));
+      return null;
+    }
   }
 
   @Nullable
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java
index bc68b02..15a9cee 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java
@@ -355,7 +355,7 @@
     }
     popupActionGroup.add(createAddNonCompositeElementGroup());
     final RemovePackagingElementAction removeAction = new RemovePackagingElementAction(this);
-    removeAction.registerCustomShortcutSet(CommonShortcuts.DELETE, tree);
+    removeAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), tree);
     popupActionGroup.add(removeAction);
     popupActionGroup.add(new ExtractArtifactAction(this));
     popupActionGroup.add(new InlineArtifactAction(this));
diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java
index b6dd460..120df60 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java
@@ -217,7 +217,7 @@
 
       @Override
       public ShortcutSet getShortcut() {
-        return CommonShortcuts.DELETE;
+        return CommonShortcuts.getDelete();
       }
     });
     toolbarDecorator.setAddAction(new AnActionButtonRunnable() {
diff --git a/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java b/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java
index df6a4c2..7dede7c 100644
--- a/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java
+++ b/java/idea-ui/src/com/intellij/platform/templates/LocalArchivedTemplate.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.platform.templates;
 
-import com.intellij.ide.util.projectWizard.WizardInputField;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleType;
 import com.intellij.openapi.module.ModuleTypeManager;
@@ -34,8 +33,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
-import java.util.Collections;
-import java.util.List;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 
@@ -50,9 +47,7 @@
 
   private final URL myArchivePath;
   private final ModuleType myModuleType;
-  private List<WizardInputField> myInputFields = Collections.emptyList();
   private Icon myIcon;
-  private List<String> myFrameworks = Collections.emptyList();
 
   public LocalArchivedTemplate(@NotNull URL archivePath,
                                @NotNull ClassLoader classLoader) {
@@ -146,18 +141,6 @@
     return myModuleType;
   }
 
-  @NotNull
-  @Override
-  public List<WizardInputField> getInputFields() {
-    return myInputFields;
-  }
-
-  @NotNull
-  @Override
-  public List<String> getFrameworks() {
-    return myFrameworks;
-  }
-
   @Override
   public ZipInputStream getStream() throws IOException {
     return new ZipInputStream(myArchivePath.openStream());
diff --git a/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java b/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java
index a7bb76b..8afa3ba 100644
--- a/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java
+++ b/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.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,11 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-/*
- * User: anna
- * Date: 12-Jul-2007
- */
 package com.intellij.projectImport;
 
 import com.intellij.CommonBundle;
@@ -38,13 +33,11 @@
 import com.intellij.openapi.roots.ProjectRootManager;
 import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
 import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.util.InvalidDataException;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
-import org.jdom.JDOMException;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -55,8 +48,11 @@
 import java.util.Arrays;
 import java.util.Collection;
 
+/**
+ * @author anna
+ * @since 12-Jul-2007
+ */
 public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder> extends ProjectOpenProcessor {
-
   private final T myBuilder;
 
   protected ProjectOpenProcessorBase(@NotNull final T builder) {
@@ -176,16 +172,14 @@
           existingName = "'" + projectFile.getName() + "'";
           pathToOpen = projectFilePath;
         }
-        int result = Messages.showYesNoCancelDialog(projectToClose,
-                                                    IdeBundle.message("project.import.open.existing",
-                                                                      existingName,
-                                                                      projectFile.getParent(),
-                                                                      virtualFile.getName()),
-                                                    IdeBundle.message("title.open.project"),
-                                                    IdeBundle.message("project.import.open.existing.openExisting"),
-                                                    IdeBundle.message("project.import.open.existing.reimport"),
-                                                    CommonBundle.message("button.cancel"),
-                                                    Messages.getQuestionIcon());
+        int result = Messages.showYesNoCancelDialog(
+          projectToClose,
+          IdeBundle.message("project.import.open.existing", existingName, projectFile.getParent(), virtualFile.getName()),
+          IdeBundle.message("title.open.project"),
+          IdeBundle.message("project.import.open.existing.openExisting"),
+          IdeBundle.message("project.import.open.existing.reimport"),
+          CommonBundle.message("button.cancel"),
+          Messages.getQuestionIcon());
         if (result == Messages.CANCEL) return null;
         shouldOpenExisting = result == Messages.YES;
       }
@@ -195,13 +189,7 @@
         try {
           projectToOpen = ProjectManagerEx.getInstanceEx().loadProject(pathToOpen);
         }
-        catch (IOException e) {
-          return null;
-        }
-        catch (JDOMException e) {
-          return null;
-        }
-        catch (InvalidDataException e) {
+        catch (Exception e) {
           return null;
         }
       }
@@ -214,15 +202,20 @@
 
         projectToOpen.save();
 
-
         ApplicationManager.getApplication().runWriteAction(new Runnable() {
+          @Override
           public void run() {
             Sdk jdk = wizardContext.getProjectJdk();
-            if (jdk != null) NewProjectUtil.applyJdkToProject(projectToOpen, jdk);
+            if (jdk != null) {
+              NewProjectUtil.applyJdkToProject(projectToOpen, jdk);
+            }
 
-            final String projectDirPath = wizardContext.getProjectFileDirectory();
-            CompilerProjectExtension.getInstance(projectToOpen).setCompilerOutputUrl(getUrl(
-              StringUtil.endsWithChar(projectDirPath, '/') ? projectDirPath + "classes" : projectDirPath + "/classes"));
+            String projectDirPath = wizardContext.getProjectFileDirectory();
+            String path = StringUtil.endsWithChar(projectDirPath, '/') ? projectDirPath + "classes" : projectDirPath + "/classes";
+            CompilerProjectExtension extension = CompilerProjectExtension.getInstance(projectToOpen);
+            if (extension != null) {
+              extension.setCompilerOutputUrl(getUrl(path));
+            }
           }
         });
 
@@ -246,9 +239,7 @@
     try {
       path = FileUtil.resolveShortWindowsName(path);
     }
-    catch (IOException e) {
-      //file doesn't exist
-    }
-    return VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(path));
+    catch (IOException ignored) { }
+    return VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(path));
   }
 }
diff --git a/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java b/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
index edd7adb..8bbc756 100644
--- a/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
+++ b/java/java-analysis-api/src/com/intellij/codeInsight/intention/QuickFixFactory.java
@@ -179,6 +179,7 @@
                                                   int minUsagesNumberToShowDialog);
 
   @NotNull public abstract IntentionAction createCreateMethodFromUsageFix(@NotNull PsiMethodCallExpression call);
+  @NotNull public abstract IntentionAction createCreateMethodFromUsageFix(PsiMethodReferenceExpression methodReferenceExpression);
 
   @NotNull public abstract IntentionAction createCreateAbstractMethodFromUsageFix(@NotNull PsiMethodCallExpression call);
 
@@ -227,7 +228,7 @@
   public abstract IntentionAction createCreateAnnotationMethodFromUsageFix(@NotNull PsiNameValuePair pair);
 
   @NotNull
-  public abstract IntentionAction createOptimizeImportsFix();
+  public abstract IntentionAction createOptimizeImportsFix(boolean onTheFly);
 
   public abstract void registerFixesForUnusedParameter(@NotNull PsiParameter parameter, @NotNull Object highlightInfo);
 
diff --git a/java/java-analysis-api/src/com/intellij/codeInspection/reference/RefJavaManager.java b/java/java-analysis-api/src/com/intellij/codeInspection/reference/RefJavaManager.java
index cbfb7b9..51ea666 100644
--- a/java/java-analysis-api/src/com/intellij/codeInspection/reference/RefJavaManager.java
+++ b/java/java-analysis-api/src/com/intellij/codeInspection/reference/RefJavaManager.java
@@ -65,6 +65,8 @@
 
   public abstract PsiMethod getAppPremainPattern();
 
+  public abstract PsiMethod getAppAgentmainPattern();
+
   public abstract PsiClass getApplet();
 
   public abstract PsiClass getServlet();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
index 83bec19..0ebedbc 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java
@@ -83,7 +83,6 @@
   private RefCountHolder myRefCountHolder;
   private final PsiFile myFile;
   @Nullable private final Editor myEditor;
-  private final boolean myUnusedImportEnabled;
   @NotNull private final Predicate<PsiElement> myIsEntryPointPredicate;
   private final int myStartOffset;
   private final int myEndOffset;
@@ -104,12 +103,10 @@
                               @Nullable Editor editor,
                               @NotNull Document document,
                               @NotNull HighlightInfoProcessor highlightInfoProcessor,
-                              boolean unusedImportEnabled,
                               @NotNull Predicate<PsiElement> isEntryPoint) {
     super(project, document, "Unused symbols", file, editor, file.getTextRange(), true, highlightInfoProcessor);
     myFile = file;
     myEditor = editor;
-    myUnusedImportEnabled = unusedImportEnabled;
     myIsEntryPointPredicate = isEntryPoint;
     myStartOffset = 0;
     myEndOffset = file.getTextLength();
@@ -187,7 +184,7 @@
 
   private void optimizeImportsOnTheFly(@NotNull final Editor editor) {
     if (myHasRedundantImports || myHasMissortedImports) {
-      IntentionAction optimizeImportsFix = QuickFixFactory.getInstance().createOptimizeImportsFix();
+      IntentionAction optimizeImportsFix = QuickFixFactory.getInstance().createOptimizeImportsFix(true);
       if (optimizeImportsFix.isAvailable(myProject, editor, myFile) && myFile.isWritable()) {
         optimizeImportsFix.invoke(myProject, editor, myFile);
       }
@@ -246,7 +243,7 @@
         }
       }
     }
-    if (myUnusedImportEnabled && myFile instanceof PsiJavaFile && HighlightingLevelManager.getInstance(myProject).shouldHighlight(myFile)) {
+    if (isUnusedImportEnabled(unusedImportKey)) {
       PsiImportList importList = ((PsiJavaFile)myFile).getImportList();
       if (importList != null) {
         final PsiImportStatementBase[] imports = importList.getAllImportStatements();
@@ -264,6 +261,12 @@
     return errorFound;
   }
 
+  protected boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey) {
+    InspectionProfile profile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
+    if (!profile.isToolEnabled(unusedImportKey, myFile)) return false;
+    return myFile instanceof PsiJavaFile && HighlightingLevelManager.getInstance(myProject).shouldHighlight(myFile);
+  }
+
   @Nullable
   private HighlightInfo processIdentifier(@NotNull PsiIdentifier identifier, @NotNull ProgressIndicator progress, @NotNull GlobalUsageHelper helper) {
     if (SuppressionUtil.inspectionResultSuppressed(identifier, myUnusedSymbolInspection)) return null;
@@ -504,6 +507,12 @@
                                              @NotNull PsiIdentifier identifier,
                                              @NotNull ProgressIndicator progress) {
     if (!myRefCountHolder.isReferenced(parameter) && !isImplicitUsage(myProject, parameter, progress)) {
+      //parameter is defined by functional interface
+      final PsiElement declarationScope = parameter.getDeclarationScope();
+      if (declarationScope instanceof PsiMethod && 
+          myRefCountHolder.isReferencedByMethodReference((PsiMethod)declarationScope)) {
+        return null;
+      }
       String message = JavaErrorMessages.message("parameter.is.not.used", identifier.getText());
       return createUnusedSymbolInfo(identifier, message, HighlightInfoType.UNUSED_SYMBOL);
     }
@@ -793,7 +802,7 @@
       HighlightInfo.newHighlightInfo(JavaHighlightInfoTypes.UNUSED_IMPORT).range(importStatement).descriptionAndTooltip(description)
         .create();
 
-    QuickFixAction.registerQuickFixAction(info, QuickFixFactory.getInstance().createOptimizeImportsFix(), unusedImportKey);
+    QuickFixAction.registerQuickFixAction(info, QuickFixFactory.getInstance().createOptimizeImportsFix(false), unusedImportKey);
     QuickFixAction.registerQuickFixAction(info, QuickFixFactory.getInstance().createEnableOptimizeImportsOnTheFlyFix(), unusedImportKey);
     myHasRedundantImports = true;
     return info;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java
index 66de82f..80fa573 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/RefCountHolder.java
@@ -203,6 +203,26 @@
     return usedStatus == Boolean.TRUE;
   }
 
+  public boolean isReferencedByMethodReference(@NotNull PsiMethod method) {
+    if (!PsiUtil.isLanguageLevel8OrHigher(method)) return false;
+
+    List<PsiReference> array;
+    synchronized (myLocalRefsMap) {
+      array = myLocalRefsMap.getKeysByValue(method);
+    }
+
+    if (array != null && !array.isEmpty()) {
+      for (PsiReference reference : array) {
+        final PsiElement element = reference.getElement();
+        if (element != null && element instanceof PsiMethodReferenceExpression) {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
+
   private static boolean isParameterUsedRecursively(@NotNull PsiElement element, @NotNull List<PsiReference> array) {
     if (!(element instanceof PsiParameter)) return false;
     PsiParameter parameter = (PsiParameter)element;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index 72ad0f2..14c3217 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -358,8 +358,8 @@
       if (inheritedSubstitutor != null) {
         final PsiTypeParameter[] typeParameters = superClass.getTypeParameters();
         for (PsiTypeParameter typeParameter : typeParameters) {
-          PsiType type1 = GenericsUtil.eliminateWildcards(inheritedSubstitutor.substitute(typeParameter));
-          PsiType type2 = GenericsUtil.eliminateWildcards(superTypeSubstitutor.substitute(typeParameter));
+          PsiType type1 = inheritedSubstitutor.substitute(typeParameter);
+          PsiType type2 = superTypeSubstitutor.substitute(typeParameter);
 
           if (!Comparing.equal(type1, type2)) {
             String description = JavaErrorMessages.message("generics.cannot.be.inherited.with.different.type.arguments",
@@ -424,17 +424,17 @@
                                                             @NotNull PsiIdentifier classIdentifier) {
     for (HierarchicalMethodSignature methodSignature : signaturesWithSupers) {
       final PsiMethod method = methodSignature.getMethod();
-      if (method.hasModifierProperty(PsiModifier.DEFAULT)) {
+      final boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT);
+      if (method.hasModifierProperty(PsiModifier.DEFAULT) || isAbstract) {
         final PsiClass containingClass = method.getContainingClass();
         List<HierarchicalMethodSignature> superSignatures = methodSignature.getSuperSignatures();
         if (!superSignatures.isEmpty()) {
           for (HierarchicalMethodSignature signature : superSignatures) {
             final PsiMethod superMethod = signature.getMethod();
             final PsiClass superContainingClass = superMethod.getContainingClass();
-            if (containingClass != null && superContainingClass != null && !InheritanceUtil
-              .isInheritorOrSelf(containingClass, superContainingClass, true)) {
+            if (containingClass != null && superContainingClass != null && !InheritanceUtil.isInheritorOrSelf(containingClass, superContainingClass, true)) {
               final boolean isDefault = superMethod.hasModifierProperty(PsiModifier.DEFAULT);
-              if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !isDefault) {
+              if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !isDefault && !isAbstract) {
                 final String message = JavaErrorMessages.message(
                   aClass instanceof PsiEnumConstantInitializer ? "enum.constant.should.implement.method" : "class.must.be.abstract",
                   HighlightUtil.formatClass(superContainingClass),
@@ -445,7 +445,7 @@
                   .create();
               }
 
-              if (isDefault || superMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
+              if (isDefault || !isAbstract && superMethod.hasModifierProperty(PsiModifier.ABSTRACT)) {
                 final String message = isDefault
                                        ? " inherits unrelated defaults for "
                                        : " inherits abstract and default for ";
@@ -715,8 +715,10 @@
   }
 
   @Nullable
-  public static HighlightInfo checkEnumInstantiation(PsiNewExpression expression, PsiClass aClass) {
-    if (aClass != null && aClass.isEnum() && expression.getArrayDimensions().length == 0 && expression.getArrayInitializer() == null) {
+  public static HighlightInfo checkEnumInstantiation(PsiElement expression, PsiClass aClass) {
+    if (aClass != null && aClass.isEnum() && 
+        (!(expression instanceof PsiNewExpression) ||
+         ((PsiNewExpression)expression).getArrayDimensions().length == 0 && ((PsiNewExpression)expression).getArrayInitializer() == null)) {
       String description = JavaErrorMessages.message("enum.types.cannot.be.instantiated");
       return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
     }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
index a7de8c0..640ea3b 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
@@ -786,7 +786,7 @@
       if (PsiKeyword.THIS.equals(methodCallExpression.getMethodExpression().getReferenceName())) continue;
       PsiReferenceExpression referenceExpression = methodCallExpression.getMethodExpression();
       PsiExpression qualifierExpression = PsiUtil.skipParenthesizedExprDown(referenceExpression.getQualifierExpression());
-      if (!(qualifierExpression instanceof PsiReferenceExpression) && !(qualifierExpression instanceof PsiNewExpression)) return false;
+      if (!(qualifierExpression instanceof PsiReferenceExpression) && !(qualifierExpression instanceof PsiCallExpression)) return false;
       PsiType type = qualifierExpression.getType();
       if (!(type instanceof PsiClassType)) return false;
       PsiClass resolved = ((PsiClassType)type).resolve();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
index 0315904..9642390 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
@@ -582,7 +582,7 @@
     final PsiElement resolved = reference == null ? null : reference.resolve();
     PsiVariable variable = resolved instanceof PsiVariable ? (PsiVariable)resolved : null;
     if (variable == null || !variable.hasModifierProperty(PsiModifier.FINAL)) return null;
-    final boolean canWrite = canWriteToFinal(variable, expression, reference, containingFile);
+    final boolean canWrite = canWriteToFinal(variable, expression, reference, containingFile) && checkWriteToFinalInsideLambda(variable, reference) == null;
     if (readBeforeWrite || !canWrite) {
       final String name = variable.getName();
       String description = canWrite ?
@@ -661,6 +661,10 @@
       QuickFixAction.registerQuickFixAction(highlightInfo, QUICK_FIX_FACTORY.createVariableAccessFromInnerClassFix(variable, innerClass));
       return highlightInfo;
     }
+    return checkWriteToFinalInsideLambda(variable, context);
+  }
+
+  private static HighlightInfo checkWriteToFinalInsideLambda(PsiVariable variable, PsiJavaCodeReferenceElement context) {
     final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(context, PsiLambdaExpression.class);
     if (lambdaExpression != null && !PsiTreeUtil.isAncestor(lambdaExpression, variable, true)) {
       final PsiElement parent = variable.getParent();
@@ -675,7 +679,7 @@
     return null;
   }
 
-  public static boolean isEffectivelyFinal(PsiVariable variable, PsiElement scope, PsiJavaCodeReferenceElement context) {
+  public static boolean isEffectivelyFinal(PsiVariable variable, PsiElement scope, @Nullable PsiJavaCodeReferenceElement context) {
     boolean effectivelyFinal;
     if (variable instanceof PsiParameter) {
       effectivelyFinal = notAccessedForWriting(variable, new LocalSearchScope(((PsiParameter)variable).getDeclarationScope()));
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
index ac211ff..975794d 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
@@ -1181,6 +1181,7 @@
             continue;
           }
         }
+        if (JavaGenericsUtil.isRawToGeneric(currentType, otherSuperReturnType)) continue;
       }
       return createIncompatibleReturnTypeMessage(currentMethod, otherSuperMethod, otherSuperReturnType,
                                                  currentType, JavaErrorMessages.message("unrelated.overriding.methods.return.types"),
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
index 5492bb5..66dfd93 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
@@ -550,7 +550,7 @@
       boolean isMethodVoid = returnType == null || PsiType.VOID.equals(returnType);
       final PsiExpression returnValue = statement.getReturnValue();
       if (returnValue != null) {
-        PsiType valueType = returnValue.getType();
+        PsiType valueType = RefactoringChangeUtil.getTypeByExpression(returnValue);
         if (isMethodVoid) {
           description = JavaErrorMessages.message("return.from.void.method");
           errorResult =
@@ -1323,10 +1323,12 @@
       return null;
     }
     HighlightInfo errorResult = null;
-    if (!isValidTypeForSwitchSelector(type, PsiUtil.isLanguageLevel7OrHigher(expression))) {
+    final boolean atLeastJava7 = PsiUtil.isLanguageLevel7OrHigher(expression);
+    if (!isValidTypeForSwitchSelector(type, atLeastJava7)) {
+      final String switchSelectorMessage = atLeastJava7 ? JavaErrorMessages.message("valid.switch.17.selector.types") 
+                                                        : JavaErrorMessages.message("valid.switch.selector.types");
       String message =
-        JavaErrorMessages.message("incompatible.types", JavaErrorMessages.message("valid.switch.selector.types"), JavaHighlightUtil.formatType(
-          type));
+        JavaErrorMessages.message("incompatible.types", switchSelectorMessage, JavaHighlightUtil.formatType(type));
       errorResult = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message).create();
       QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createConvertSwitchToIfIntention(statement));
       if (PsiType.LONG.equals(type) || PsiType.FLOAT.equals(type) || PsiType.DOUBLE.equals(type)) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
index 352e745..aa735a1 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
@@ -37,6 +37,7 @@
 import com.intellij.psi.controlFlow.ControlFlowUtil;
 import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef;
 import com.intellij.psi.impl.source.resolve.JavaResolveUtil;
+import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
 import com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl;
 import com.intellij.psi.javadoc.PsiDocComment;
 import com.intellij.psi.javadoc.PsiDocTagValue;
@@ -337,10 +338,11 @@
                     } else {
                       for (int i = 0; i < lambdaParameters.length; i++) {
                         PsiParameter lambdaParameter = lambdaParameters[i];
-                        if (!TypeConversionUtil.isAssignable(lambdaParameter.getType(),
-                                                             GenericsUtil.eliminateWildcards(substitutor.substitute(parameters[i].getType())))) {
-                          HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(lambdaParameter)
-                            .descriptionAndTooltip(incompatibleTypesMessage).create();
+                        if (!TypeConversionUtil.isAssignable(lambdaParameter.getType(), substitutor.substitute(parameters[i].getType()))) {
+                          HighlightInfo result = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
+                            .range(lambdaParameter)
+                            .descriptionAndTooltip(incompatibleTypesMessage)
+                            .create();
                           myHolder.add(result);
                           break;
                         }
@@ -759,7 +761,8 @@
     if (!myHolder.hasErrorResults() && method.isConstructor()) {
       myHolder.add(HighlightClassUtil.checkThingNotAllowedInInterface(method, aClass));
     }
-    if (!myHolder.hasErrorResults() && method.hasModifierProperty(PsiModifier.DEFAULT)) {
+    if (!myHolder.hasErrorResults() && (method.hasModifierProperty(PsiModifier.DEFAULT) || 
+                                        aClass != null && aClass.isInterface() && method.hasModifierProperty(PsiModifier.STATIC))) {
       myHolder.add(HighlightUtil.checkExtensionMethodsFeature(method, myLanguageLevel, myFile));
     }
 
@@ -1210,9 +1213,11 @@
   @Override
   public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
     myHolder.add(HighlightUtil.checkMethodReferencesFeature(expression, myLanguageLevel,myFile));
-    JavaResolveResult result;
+    final JavaResolveResult result;
+    final JavaResolveResult[] results;
     try {
-      result = expression.advancedResolve(true);
+      results = expression.multiResolve(true);
+      result = results.length == 1 ? results[0] : JavaResolveResult.EMPTY;
     }
     catch (IndexNotReadyException e) {
       return;
@@ -1304,6 +1309,35 @@
       }
       myHolder.add(GenericsHighlightUtil.checkInferredTypeArguments(typeParameters, expression, result.getSubstitutor()));
     }
+
+    if (!myHolder.hasErrorResults()) {
+      if (results.length == 0) {
+        String description = null;
+        if (expression.isConstructor()) {
+          final PsiClass containingClass = PsiMethodReferenceUtil.getQualifierResolveResult(expression).getContainingClass();
+
+          if (containingClass != null) {
+            if (!myHolder.add(HighlightClassUtil.checkInstantiationOfAbstractClass(containingClass, expression)) &&
+                !myHolder.add(GenericsHighlightUtil.checkEnumInstantiation(expression, containingClass)) &&
+                containingClass.isPhysical()) {
+              description = JavaErrorMessages.message("cannot.resolve.constructor", containingClass.getName());
+            }
+          }
+        }
+        else {
+          description = JavaErrorMessages.message("cannot.resolve.method", expression.getReferenceName());
+        }
+
+        if (description != null) {
+          final PsiElement referenceNameElement = expression.getReferenceNameElement();
+          final HighlightInfo highlightInfo =
+            HighlightInfo.newHighlightInfo(HighlightInfoType.WRONG_REF).descriptionAndTooltip(description).range(referenceNameElement).create();
+          myHolder.add(highlightInfo);
+          final TextRange fixRange = HighlightMethodUtil.getFixRange(referenceNameElement);
+          QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, QuickFixFactory.getInstance().createCreateMethodFromUsageFix(expression));
+        }
+      }
+    }
   }
 
   @Override
@@ -1460,4 +1494,25 @@
       return false;
     }
   }
+
+  @Override
+  public void visitConditionalExpression(PsiConditionalExpression expression) {
+    super.visitConditionalExpression(expression);
+    if (PsiUtil.isLanguageLevel8OrHigher(expression) && PsiPolyExpressionUtil.isPolyExpression(expression)) {
+      final PsiExpression thenExpression = expression.getThenExpression();
+      final PsiExpression elseExpression = expression.getElseExpression();
+      if (thenExpression != null && elseExpression != null) {
+        final PsiType conditionalType = expression.getType();
+        if (conditionalType != null) {
+          final PsiExpression[] sides = new PsiExpression[] {thenExpression, elseExpression};
+          for (PsiExpression side : sides) {
+            final PsiType sideType = side.getType();
+            if (sideType != null && !TypeConversionUtil.isAssignable(conditionalType, sideType)) {
+              myHolder.add(HighlightUtil.checkAssignability(conditionalType, sideType, side, side));
+            }
+          }
+        }
+      }
+    }
+  }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java
index 722ec35..b7f7584 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java
@@ -27,13 +27,26 @@
 
 public class JavaHighlightUtil {
   public static boolean isSerializable(@NotNull PsiClass aClass) {
+    return isSerializable(aClass, "java.io.Serializable");
+  }
+
+  public static boolean isSerializable(@NotNull PsiClass aClass,
+                                       String serializableClassName) {
     Project project = aClass.getManager().getProject();
-    PsiClass serializableClass = JavaPsiFacade.getInstance(project).findClass("java.io.Serializable", aClass.getResolveScope());
+    PsiClass serializableClass = JavaPsiFacade.getInstance(project).findClass(serializableClassName, aClass.getResolveScope());
     return serializableClass != null && aClass.isInheritor(serializableClass, true);
   }
 
   public static boolean isSerializationRelatedMethod(PsiMethod method, PsiClass containingClass) {
-    if (containingClass == null || method.isConstructor()) return false;
+    if (containingClass == null) return false;
+    if (method.isConstructor()) {
+      if (isSerializable(containingClass, "java.io.Externalizable") && 
+          method.getParameterList().getParametersCount() == 0 &&
+          method.hasModifierProperty(PsiModifier.PUBLIC)) {
+        return true;
+      }
+      return false;
+    }
     if (method.hasModifierProperty(PsiModifier.STATIC)) return false;
     @NonNls String name = method.getName();
     PsiParameter[] parameters = method.getParameterList().getParameters();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java
index 1a55195..3b7765b 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java
@@ -19,7 +19,9 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.refactoring.util.RefactoringChangeUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
@@ -94,7 +96,7 @@
               methodExpression.setQualifierExpression(qualifierExpression);
             }
 
-            return copy;
+            return (PsiExpression)JavaCodeStyleManager.getInstance(copy.getProject()).shortenClassReferences(copy);
           }
         }
       }
@@ -104,8 +106,7 @@
 
     @Override
     public boolean areTypesConvertible(final PsiType exprType, final PsiType parameterType, final PsiElement context) {
-      return !(exprType instanceof PsiPrimitiveType) &&
-             !(parameterType instanceof PsiPrimitiveType);
+      return !(exprType instanceof PsiPrimitiveType) && !(parameterType instanceof PsiPrimitiveType) || TypeConversionUtil.boxingConversionApplicable(exprType, parameterType);
     }
   }
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java
index 68e3554..0ccad5c 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeCastFix.java
@@ -86,9 +86,10 @@
     PsiElement expression = PsiUtil.deparenthesizeExpression(original);
     if (expression == null) return null;
 
-    PsiElementFactory factory = JavaPsiFacade.getInstance(original.getProject()).getElementFactory();
+    if (type.equals(PsiType.NULL)) return null;
     if (type instanceof PsiEllipsisType) type = ((PsiEllipsisType)type).toArrayType();
     String text = "(" + type.getCanonicalText(false) + ")value";
+    PsiElementFactory factory = JavaPsiFacade.getInstance(original.getProject()).getElementFactory();
     PsiTypeCastExpression typeCast = (PsiTypeCastExpression)factory.createExpressionFromText(text, original);
     typeCast = (PsiTypeCastExpression)CodeStyleManager.getInstance(project).reformat(typeCast);
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
index b89473e..c70aae1 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
@@ -30,6 +30,7 @@
 import com.intellij.psi.controlFlow.AnalysisCanceledException;
 import com.intellij.psi.controlFlow.ControlFlow;
 import com.intellij.psi.controlFlow.ControlFlowUtil;
+import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Function;
@@ -38,10 +39,7 @@
 import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * User: anna
@@ -93,11 +91,6 @@
                   final ForbiddenRefsChecker checker = new ForbiddenRefsChecker(methods[0], aClass);
                   body.accept(checker);
                   if (!checker.hasForbiddenRefs()) {
-                    PsiResolveHelper helper = PsiResolveHelper.SERVICE.getInstance(body.getProject());
-                    for (PsiLocalVariable local : checker.getLocals()) {
-                      final String localName = local.getName();
-                      if (localName != null && helper.resolveReferencedVariable(localName, aClass) != null) return;
-                    }
                     final PsiElement lBrace = aClass.getLBrace();
                     LOG.assertTrue(lBrace != null);
                     final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
@@ -131,6 +124,7 @@
       final PsiElement element = descriptor.getPsiElement();
       if (element instanceof PsiNewExpression) {
         final PsiAnonymousClass anonymousClass = ((PsiNewExpression)element).getAnonymousClass();
+        
         LOG.assertTrue(anonymousClass != null);
         ChangeContextUtil.encodeContextInfo(anonymousClass, true);
         final PsiElement lambdaContext = anonymousClass.getParent().getParent();
@@ -139,20 +133,42 @@
         final PsiMethod method = anonymousClass.getMethods()[0];
         LOG.assertTrue(method != null);
 
+        final PsiCodeBlock body = method.getBody();
+        LOG.assertTrue(body != null);
+
+        final ForbiddenRefsChecker checker = new ForbiddenRefsChecker(method, anonymousClass);
+        body.accept(checker);
+        
+        PsiResolveHelper helper = PsiResolveHelper.SERVICE.getInstance(body.getProject());
+        final Set<PsiLocalVariable> conflictingLocals = checker.getLocals();
+        for (Iterator<PsiLocalVariable> iterator = conflictingLocals.iterator(); iterator.hasNext(); ) {
+          PsiLocalVariable local = iterator.next();
+          final String localName = local.getName();
+          if (localName == null || helper.resolveReferencedVariable(localName, anonymousClass) == null) {
+            iterator.remove();
+          }
+        }
+
+        final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
+
+        giveUniqueNames(project, lambdaContext, elementFactory, body, conflictingLocals.toArray(new PsiVariable[conflictingLocals.size()]));
+        
         final String lambdaWithTypesDeclared = composeLambdaText(method, true);
         final String withoutTypesDeclared = composeLambdaText(method, false);
-        final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);
+       
         PsiLambdaExpression lambdaExpression =
           (PsiLambdaExpression)elementFactory.createExpressionFromText(withoutTypesDeclared, anonymousClass);
 
-        final PsiCodeBlock body = method.getBody();
-        LOG.assertTrue(body != null);
         final PsiStatement[] statements = body.getStatements();
         PsiElement copy = body.copy();
-        if (statements.length == 1 && statements[0] instanceof PsiReturnStatement) {
-          PsiExpression value = ((PsiReturnStatement)statements[0]).getReturnValue();
-          if (value != null) {
-            copy = value.copy();
+        if (statements.length == 1) {
+          if (statements[0] instanceof PsiReturnStatement) {
+            PsiExpression value = ((PsiReturnStatement)statements[0]).getReturnValue();
+            if (value != null) {
+              copy = value.copy();
+            }
+          } else if (statements[0] instanceof PsiExpressionStatement) {
+            copy = ((PsiExpressionStatement)statements[0]).getExpression().copy();
           }
         }
 
@@ -160,42 +176,7 @@
         LOG.assertTrue(lambdaBody != null);
         lambdaBody.replace(copy);
 
-        final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
-        final Map<PsiParameter, String> names = new HashMap<PsiParameter, String>();
-        for (PsiParameter parameter : lambdaExpression.getParameterList().getParameters()) {
-          String parameterName = parameter.getName();
-          final String uniqueVariableName = codeStyleManager.suggestUniqueVariableName(parameterName, lambdaContext, false);
-          if (!Comparing.equal(parameterName, uniqueVariableName)) {
-            names.put(parameter, uniqueVariableName);
-          }
-        }
-
-        final LinkedHashMap<PsiElement, PsiElement> replacements = new LinkedHashMap<PsiElement, PsiElement>();
-        lambdaExpression.accept(new JavaRecursiveElementWalkingVisitor() {
-          @Override
-          public void visitParameter(PsiParameter parameter) {
-            final String newName = names.get(parameter);
-            if (newName != null) {
-              replacements.put(parameter.getNameIdentifier(), elementFactory.createIdentifier(newName));
-            }
-          }
-
-          @Override
-          public void visitReferenceExpression(PsiReferenceExpression expression) {
-            super.visitReferenceExpression(expression);
-            final PsiElement resolve = expression.resolve();
-            if (resolve instanceof PsiParameter) {
-              final String newName = names.get(resolve);
-              if (newName != null) {
-                replacements.put(expression, elementFactory.createExpressionFromText(newName, expression));
-              }
-            }
-          }
-        });
-
-        for (PsiElement psiElement : replacements.keySet()) {
-          psiElement.replace(replacements.get(psiElement));
-        }
+        giveUniqueNames(project, lambdaContext, elementFactory, lambdaExpression, lambdaExpression.getParameterList().getParameters());
 
         final PsiNewExpression newExpression = (PsiNewExpression)anonymousClass.getParent();
         lambdaExpression = (PsiLambdaExpression)newExpression.replace(lambdaExpression);
@@ -243,6 +224,49 @@
       }
     }
 
+    private static void giveUniqueNames(Project project,
+                                        PsiElement lambdaContext,
+                                        final PsiElementFactory elementFactory,
+                                        PsiElement body,
+                                        PsiVariable[] parameters) {
+      final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
+      final Map<PsiVariable, String> names = new HashMap<PsiVariable, String>();
+      for (PsiVariable parameter : parameters) {
+        String parameterName = parameter.getName();
+        final String uniqueVariableName = codeStyleManager.suggestUniqueVariableName(parameterName, lambdaContext, false);
+        if (!Comparing.equal(parameterName, uniqueVariableName)) {
+          names.put(parameter, uniqueVariableName);
+        }
+      }
+
+      final LinkedHashMap<PsiElement, PsiElement> replacements = new LinkedHashMap<PsiElement, PsiElement>();
+      body.accept(new JavaRecursiveElementWalkingVisitor() {
+        @Override
+        public void visitVariable(PsiVariable variable) {
+          final String newName = names.get(variable);
+          if (newName != null) {
+            replacements.put(variable.getNameIdentifier(), elementFactory.createIdentifier(newName));
+          }
+        }
+
+        @Override
+        public void visitReferenceExpression(PsiReferenceExpression expression) {
+          super.visitReferenceExpression(expression);
+          final PsiElement resolve = expression.resolve();
+          if (resolve instanceof PsiParameter) {
+            final String newName = names.get(resolve);
+            if (newName != null) {
+              replacements.put(expression, elementFactory.createExpressionFromText(newName, expression));
+            }
+          }
+        }
+      });
+
+      for (PsiElement psiElement : replacements.keySet()) {
+        psiElement.replace(replacements.get(psiElement));
+      }
+    }
+
     private static boolean isInferred(PsiLambdaExpression lambdaExpression, PsiType interfaceType) {
       return interfaceType == null || !LambdaUtil.isLambdaFullyInferred(lambdaExpression, interfaceType) || !LambdaUtil.isFunctionalType(interfaceType);
     }
@@ -285,6 +309,17 @@
     }
   }
 
+  public static boolean functionalInterfaceMethodReferenced(PsiMethod psiMethod, PsiAnonymousClass anonymClass) {
+    if (psiMethod != null && !psiMethod.hasModifierProperty(PsiModifier.STATIC)) {
+      final PsiClass containingClass = psiMethod.getContainingClass();
+      if (InheritanceUtil.isInheritorOrSelf(anonymClass, containingClass, true) &&
+          !InheritanceUtil.hasEnclosingInstanceInScope(containingClass, anonymClass.getParent(), true, true)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   private static class ForbiddenRefsChecker extends JavaRecursiveElementWalkingVisitor {
     private boolean myBodyContainsForbiddenRefs;
     private final Set<PsiLocalVariable> myLocals = ContainerUtilRt.newHashSet(5);
@@ -305,6 +340,7 @@
       super.visitMethodCallExpression(methodCallExpression);
       final PsiMethod psiMethod = methodCallExpression.resolveMethod();
       if (psiMethod == myMethod ||
+          functionalInterfaceMethodReferenced(psiMethod, myAnonymClass) ||
           psiMethod != null &&
           !methodCallExpression.getMethodExpression().isQualified() &&
           "getClass".equals(psiMethod.getName()) &&
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
index 6eec614..d6a884c 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeMethodReferenceInspection.java
@@ -74,16 +74,19 @@
               final PsiCallExpression callExpression =
                 LambdaCanBeMethodReferenceInspection
                   .canBeMethodReferenceProblem(body, methods[0].getParameterList().getParameters(), baseClassType);
-              if (callExpression != null && callExpression.resolveMethod() != methods[0]) {
-                final PsiElement parent = aClass.getParent();
-                if (parent instanceof PsiNewExpression) {
-                  final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)parent).getClassOrAnonymousClassReference();
-                  if (classReference != null) {
-                    final PsiElement lBrace = aClass.getLBrace();
-                    LOG.assertTrue(lBrace != null);
-                    final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
-                    holder.registerProblem(parent,
-                                           "Anonymous #ref #loc can be replaced with method reference", ProblemHighlightType.LIKE_UNUSED_SYMBOL, rangeInElement, new ReplaceWithMethodRefFix());
+              if (callExpression != null) {
+                final PsiMethod resolveMethod = callExpression.resolveMethod();
+                if (resolveMethod != methods[0] && !AnonymousCanBeLambdaInspection.functionalInterfaceMethodReferenced(resolveMethod, aClass)) {
+                  final PsiElement parent = aClass.getParent();
+                  if (parent instanceof PsiNewExpression) {
+                    final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)parent).getClassOrAnonymousClassReference();
+                    if (classReference != null) {
+                      final PsiElement lBrace = aClass.getLBrace();
+                      LOG.assertTrue(lBrace != null);
+                      final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
+                      holder.registerProblem(parent,
+                                             "Anonymous #ref #loc can be replaced with method reference", ProblemHighlightType.LIKE_UNUSED_SYMBOL, rangeInElement, new ReplaceWithMethodRefFix());
+                    }
                   }
                 }
               }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
index 9bc2a6e..1944f83 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java
@@ -25,6 +25,7 @@
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.ArrayUtil;
 import com.intellij.util.ArrayUtilRt;
 import org.jetbrains.annotations.Nls;
 import org.jetbrains.annotations.NotNull;
@@ -268,21 +269,8 @@
       final String methodReferenceName = methodExpression.getReferenceName();
       if (qualifierExpression != null) {
         boolean isReceiverType = PsiMethodReferenceUtil.isReceiverType(functionalInterfaceType, containingClass, psiMethod);
-        final String qualifier;
-        if (isReceiverType) {
-          final PsiMethod nonAmbiguousMethod = ensureNonAmbiguousMethod(parameters, psiMethod);
-          LOG.assertTrue(nonAmbiguousMethod != null);
-          final PsiClass nonAmbiguousContainingClass = nonAmbiguousMethod.getContainingClass();
-          if (!containingClass.equals(nonAmbiguousContainingClass)) {
-            qualifier = getClassReferenceName(nonAmbiguousContainingClass);
-          } else {
-            final PsiType qualifierExpressionType = qualifierExpression.getType();
-            qualifier = qualifierExpressionType != null ? qualifierExpressionType.getCanonicalText() : getClassReferenceName(nonAmbiguousContainingClass);
-          }
-        }
-        else {
-          qualifier = qualifierExpression.getText();
-        }
+        final String qualifier = isReceiverType ? composeReceiverQualifierText(parameters, psiMethod, containingClass, qualifierExpression) 
+                                                : qualifierExpression.getText();
         methodRefText = qualifier + "::" + ((PsiMethodCallExpression)element).getTypeArgumentList().getText() + methodReferenceName;
       }
       else {
@@ -330,6 +318,28 @@
     return methodRefText;
   }
 
+  private static String composeReceiverQualifierText(PsiParameter[] parameters,
+                                                     PsiMethod psiMethod,
+                                                     PsiClass containingClass,
+                                                     @NotNull PsiExpression qualifierExpression) {
+    final PsiMethod nonAmbiguousMethod = ensureNonAmbiguousMethod(parameters, psiMethod);
+    LOG.assertTrue(nonAmbiguousMethod != null);
+    final PsiClass nonAmbiguousContainingClass = nonAmbiguousMethod.getContainingClass();
+    if (!containingClass.equals(nonAmbiguousContainingClass)) {
+      return getClassReferenceName(nonAmbiguousContainingClass);
+    }
+
+    if (nonAmbiguousContainingClass.isPhysical() && qualifierExpression instanceof PsiReferenceExpression) {
+      final PsiElement resolve = ((PsiReferenceExpression)qualifierExpression).resolve();
+      if (resolve instanceof PsiParameter && ArrayUtil.find(parameters, resolve) > -1 && ((PsiParameter)resolve).getTypeElement() == null) {
+        return getClassReferenceName(nonAmbiguousContainingClass);
+      }
+    }
+
+    final PsiType qualifierExpressionType = qualifierExpression.getType();
+    return qualifierExpressionType != null ? qualifierExpressionType.getCanonicalText() : getClassReferenceName(nonAmbiguousContainingClass);
+  }
+
   private static String getClassReferenceName(PsiClass containingClass) {
     final String qualifiedName = containingClass.getQualifiedName();
     return qualifiedName != null ? qualifiedName : containingClass.getName();
@@ -354,6 +364,7 @@
       final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(element, PsiLambdaExpression.class);
       if (lambdaExpression == null) return;
       final PsiType functionalInterfaceType = lambdaExpression.getFunctionalInterfaceType();
+      if (functionalInterfaceType == null || !functionalInterfaceType.isValid()) return;
       final String methodRefText = createMethodReferenceText(element, functionalInterfaceType,
                                                              lambdaExpression.getParameterList().getParameters());
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantLambdaCodeBlockInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantLambdaCodeBlockInspection.java
index 4e7cccc..0dfa5df 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantLambdaCodeBlockInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantLambdaCodeBlockInspection.java
@@ -95,12 +95,7 @@
           return returnStatement.getReturnValue();
         }
         else {
-          final PsiExpression expression = ((PsiExpressionStatement)statements[0]).getExpression();
-          final PsiType psiType = expression.getType();
-          if (psiType != PsiType.VOID) {
-            return null;
-          }
-          return expression;
+          return ((PsiExpressionStatement)statements[0]).getExpression();
         }
       }
     }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
index b06ba2a..e066685 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/StreamApiMigrationInspection.java
@@ -129,6 +129,7 @@
   }
 
   private static boolean isCollectCall(PsiStatement body) {
+    final PsiIfStatement ifStatement = extractIfStatement(body);
     final PsiMethodCallExpression methodCallExpression = extractAddCall(body);
     if (methodCallExpression != null) {
       final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
@@ -146,6 +147,11 @@
       if (qualifierClass != null && 
           InheritanceUtil.isInheritor(qualifierClass, false, CommonClassNames.JAVA_UTIL_COLLECTION)) {
 
+        if (ifStatement != null) {
+          final PsiExpression condition = ifStatement.getCondition();
+          if (condition != null && isConditionDependsOnUpdatedCollections(condition, qualifierExpression)) return false;
+        }
+
         final PsiElement resolve = methodExpression.resolve();
         if (resolve instanceof PsiMethod &&
             "add".equals(((PsiMethod)resolve).getName()) &&
@@ -163,7 +169,51 @@
     }
     return false;
   }
-  
+
+  private static boolean isConditionDependsOnUpdatedCollections(PsiExpression condition,
+                                                                PsiExpression qualifierExpression) {
+    final PsiElement collection = qualifierExpression != null
+                                  ? ((PsiReferenceExpression)qualifierExpression).resolve()
+                                  : null;
+    final boolean[] dependsOnCollection = {false};
+    condition.accept(new JavaRecursiveElementWalkingVisitor() {
+      @Override
+      public void visitReferenceExpression(PsiReferenceExpression expression) {
+        super.visitReferenceExpression(expression);
+        if (collection != null && collection == expression.resolve()) {
+          dependsOnCollection[0] = true;
+        }
+      }
+
+      @Override
+      public void visitMethodCallExpression(PsiMethodCallExpression expression) {
+        super.visitMethodCallExpression(expression);
+        final PsiExpression callQualifier = expression.getMethodExpression().getQualifierExpression();
+        if (collection == callQualifier) {
+          dependsOnCollection[0] = true;
+        }
+
+        if (collection == null && (callQualifier instanceof PsiThisExpression && ((PsiThisExpression)callQualifier).getQualifier() == null || 
+                                   callQualifier instanceof PsiSuperExpression && ((PsiSuperExpression)callQualifier).getQualifier() == null)) {
+          dependsOnCollection[0] = true;
+        }
+      }
+
+      @Override
+      public void visitThisExpression(PsiThisExpression expression) {
+        super.visitThisExpression(expression);
+        if (collection == null && expression.getQualifier() == null && expression.getParent() instanceof PsiExpressionList) {
+          dependsOnCollection[0] = true;
+        }
+      }
+
+      @Override
+      public void visitClass(PsiClass aClass) {}
+    });
+
+    return dependsOnCollection[0];
+  }
+
   private static boolean isTrivial(PsiStatement body, PsiParameter parameter, PsiType iteratedValueType) {
     final PsiIfStatement ifStatement = extractIfStatement(body);
     //stream
@@ -205,8 +255,11 @@
           final PsiParameter parameter = foreachStatement.getIterationParameter();
           final PsiIfStatement ifStmt = extractIfStatement(body);
 
-          String foreEachText = body.getText();
-          String iterated = iteratedValue.getText();
+          String foreEachText = wrapInBlock(body);
+          String iterated = iteratedValue instanceof PsiCallExpression || 
+                            iteratedValue instanceof PsiReferenceExpression ||
+                            iteratedValue instanceof PsiQualifiedExpression ||
+                            iteratedValue instanceof PsiParenthesizedExpression ? iteratedValue.getText() : "(" + iteratedValue.getText() + ")";
           if (ifStmt != null) {
             final PsiExpression condition = ifStmt.getCondition();
             if (condition != null) {
@@ -214,7 +267,7 @@
               LOG.assertTrue(thenBranch != null);
               if (InheritanceUtil.isInheritor(iteratedValue.getType(), CommonClassNames.JAVA_UTIL_COLLECTION)) {
                 body = thenBranch;
-                foreEachText = thenBranch.getText();
+                foreEachText = wrapInBlock(thenBranch);
                 iterated += ".stream().filter(" + parameter.getName() + " -> " + condition.getText() +")";
               }
             }
@@ -248,6 +301,19 @@
         }
       }
     }
+
+    private static String wrapInBlock(PsiStatement body) {
+
+      if (body instanceof PsiExpressionStatement) {
+        return ((PsiExpressionStatement)body).getExpression().getText();
+      }
+
+      final String bodyText = body.getText();
+      if (!(body instanceof PsiBlockStatement)) {
+        return "{" + bodyText + "}";
+      }
+      return bodyText;
+    }
   }
 
   private static class ReplaceWithCollectCallFix implements LocalQuickFix {
@@ -281,24 +347,23 @@
               iteration += ".filter(" + parameter.getName() + " -> " + condition.getText() +")";
             }
           }
-          iteration +=".map(";
-
           final PsiExpression mapperCall = methodCallExpression.getArgumentList().getExpressions()[0];
-
-          final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
-          final PsiClass functionClass = psiFacade.findClass("java.util.function.Function", GlobalSearchScope.allScope(project));
-          final PsiClassType functionalInterfaceType = functionClass != null ? psiFacade.getElementFactory().createType(functionClass, parameter.getType(), mapperCall.getType()) : null;
-          final PsiCallExpression toConvertCall = LambdaCanBeMethodReferenceInspection.canBeMethodReferenceProblem(mapperCall,
-                                                                                                                   new PsiParameter[]{
-                                                                                                                     parameter},
-                                                                                                                   functionalInterfaceType);
-          final String methodReferenceText = LambdaCanBeMethodReferenceInspection.createMethodReferenceText(toConvertCall, functionalInterfaceType, new PsiParameter[]{parameter});
-          if (methodReferenceText != null) {
-            iteration += methodReferenceText;
-          } else {
-            iteration += parameter.getName() + " -> " + mapperCall.getText();
+          if (!isIdentityMapping(parameter, mapperCall)) {
+            iteration +=".map(";
+            final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
+            final PsiClass functionClass = psiFacade.findClass("java.util.function.Function", GlobalSearchScope.allScope(project));
+            final PsiClassType functionalInterfaceType = functionClass != null ? psiFacade.getElementFactory().createType(functionClass, parameter.getType(), mapperCall.getType()) : null;
+            final PsiCallExpression toConvertCall = LambdaCanBeMethodReferenceInspection.canBeMethodReferenceProblem(mapperCall, new PsiParameter[]{parameter}, functionalInterfaceType);
+            final String methodReferenceText = LambdaCanBeMethodReferenceInspection.createMethodReferenceText(toConvertCall, functionalInterfaceType, new PsiParameter[]{parameter});
+            if (methodReferenceText != null) {
+              iteration += methodReferenceText;
+            } else {
+              iteration += parameter.getName() + " -> " + mapperCall.getText();
+            }
+            iteration += ")";
           }
-          iteration += ").collect(java.util.stream.Collectors.";
+
+          iteration += ".collect(java.util.stream.Collectors.";
 
           String variableName = null;
           PsiExpression primitiveInitializer = null;
@@ -353,6 +418,10 @@
         }
       }
     }
+
+    private static boolean isIdentityMapping(PsiParameter parameter, PsiExpression mapperCall) {
+      return mapperCall instanceof PsiReferenceExpression && ((PsiReferenceExpression)mapperCall).resolve() == parameter;
+    }
   }
 
   public static PsiIfStatement extractIfStatement(PsiStatement body) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
index 68ac7f6..1be69b5 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
@@ -1414,11 +1414,22 @@
       return false;
     }
 
+    PsiMethod method = expression.resolveMethod();
+    if (method == null) {
+      return false;
+    }
+
+    final int paramCount = method.getParameterList().getParametersCount();
+    boolean varArgs = method.isVarArgs();
     final PsiExpression[] args = expression.getArgumentList().getExpressions();
+    if (varArgs && args.length < paramCount - 1 || !varArgs && args.length != paramCount) {
+      return false;
+    }
+    
     List<MethodContract> contracts = ContainerUtil.findAll(_contracts, new Condition<MethodContract>() {
       @Override
       public boolean value(MethodContract contract) {
-        return args.length == contract.arguments.length;
+        return paramCount == contract.arguments.length;
       }
     });
     if (contracts.isEmpty()) {
@@ -1428,24 +1439,28 @@
     for (PsiExpression arg : args) {
       arg.accept(this);
     }
+    if (varArgs) {
+      for (int i = 0; i < args.length - paramCount + 1; i++) {
+        addInstruction(new PopInstruction());
+      }
+      pushUnknown();
+    }
 
     if (contracts.size() > 1) {
       addInstruction(new DupInstruction(args.length, contracts.size() - 1));
     }
     for (int i = 0; i < contracts.size(); i++) {
-      handleContract(expression, contracts.get(i), contracts.size() - 1 - i);
+      handleContract(expression, contracts.get(i), contracts.size() - 1 - i, paramCount);
     }
     pushUnknownReturnValue(expression); // goto here if all contracts are false
     return true;
   }
   
-  private void handleContract(PsiMethodCallExpression expression, MethodContract contract, int remainingContracts) {
-    PsiExpression[] args = expression.getArgumentList().getExpressions();
-
+  private void handleContract(PsiMethodCallExpression expression, MethodContract contract, int remainingContracts, int paramCount) {
     final ControlFlow.ControlFlowOffset exitPoint = getEndOffset(expression);
 
     List<GotoInstruction> gotoContractFalse = new SmartList<GotoInstruction>();
-    for (int i = args.length - 1; i >= 0; i--) {
+    for (int i = paramCount - 1; i >= 0; i--) {
       ValueConstraint arg = contract.arguments[i];
       if (arg == ValueConstraint.NULL_VALUE || arg == ValueConstraint.NOT_NULL_VALUE) {
         addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
@@ -1466,7 +1481,7 @@
       continueCheckingContract.setOffset(myCurrentFlow.getInstructionCount());
     }
 
-    for (int j = 0; j < remainingContracts * args.length; j++) {
+    for (int j = 0; j < remainingContracts * paramCount; j++) {
       addInstruction(new PopInstruction());
     }
 
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
index 2e15ac4..69a0476 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspectionBase.java
@@ -173,21 +173,21 @@
         return super.shouldCheckTimeLimit();
       }
     };
-    analyzeDfaWithNestedClosures(scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()));
+    analyzeDfaWithNestedClosures(scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()), onTheFly);
   }
 
   private void analyzeDfaWithNestedClosures(PsiElement scope,
                                             ProblemsHolder holder,
                                             StandardDataFlowRunner dfaRunner,
-                                            Collection<DfaMemoryState> initialStates) {
+                                            Collection<DfaMemoryState> initialStates, final boolean onTheFly) {
     final DataFlowInstructionVisitor visitor = new DataFlowInstructionVisitor(dfaRunner);
     final RunnerResult rc = dfaRunner.analyzeMethod(scope, visitor, IGNORE_ASSERT_STATEMENTS, initialStates);
     if (rc == RunnerResult.OK) {
-      createDescription(dfaRunner, holder, visitor);
+      createDescription(dfaRunner, holder, visitor, onTheFly);
 
       MultiMap<PsiElement,DfaMemoryState> nestedClosures = dfaRunner.getNestedClosures();
       for (PsiElement closure : nestedClosures.keySet()) {
-        analyzeDfaWithNestedClosures(closure, holder, dfaRunner, nestedClosures.get(closure));
+        analyzeDfaWithNestedClosures(closure, holder, dfaRunner, nestedClosures.get(closure), onTheFly);
       }
     }
     else if (rc == RunnerResult.TOO_COMPLEX) {
@@ -215,7 +215,7 @@
         final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
         final PsiBinaryExpression binary = (PsiBinaryExpression)elementFactory.createExpressionFromText("a != null", null);
         binary.getLOperand().replace(qualifier);
-        fixes.add(new AddAssertStatementFix(binary));
+        ContainerUtil.addIfNotNull(fixes, createAssertFix(binary));
       }
 
       addSurroundWithIfFix(qualifier, fixes, onTheFly);
@@ -231,10 +231,14 @@
     }
   }
 
+  protected LocalQuickFix createAssertFix(PsiBinaryExpression binary) {
+    return null;
+  }
+
   protected void addSurroundWithIfFix(PsiExpression qualifier, List<LocalQuickFix> fixes, boolean onTheFly) {
   }
 
-  private void createDescription(StandardDataFlowRunner runner, ProblemsHolder holder, DataFlowInstructionVisitor visitor) {
+  private void createDescription(StandardDataFlowRunner runner, ProblemsHolder holder, DataFlowInstructionVisitor visitor, final boolean onTheFly) {
     Pair<Set<Instruction>, Set<Instruction>> constConditions = runner.getConstConditionalExpressions();
     Set<Instruction> trueSet = constConditions.getFirst();
     Set<Instruction> falseSet = constConditions.getSecond();
@@ -265,7 +269,7 @@
         reportCastMayFail(holder, (TypeCastInstruction)instruction);
       }
       else if (instruction instanceof BranchingInstruction) {
-        handleBranchingInstruction(holder, visitor, trueSet, falseSet, reportedAnchors, (BranchingInstruction)instruction);
+        handleBranchingInstruction(holder, visitor, trueSet, falseSet, reportedAnchors, (BranchingInstruction)instruction, onTheFly);
       }
     }
 
@@ -287,7 +291,7 @@
   private static void reportConstantReferenceValues(ProblemsHolder holder, StandardInstructionVisitor visitor, Set<PsiElement> reportedAnchors) {
     for (Pair<PsiReferenceExpression, DfaConstValue> pair : visitor.getConstantReferenceValues()) {
       PsiReferenceExpression ref = pair.first;
-      if (!reportedAnchors.add(ref)) {
+      if (ref.getParent() instanceof PsiReferenceExpression || !reportedAnchors.add(ref)) {
         continue;
       }
 
@@ -410,7 +414,7 @@
   private void handleBranchingInstruction(ProblemsHolder holder,
                                           StandardInstructionVisitor visitor,
                                           Set<Instruction> trueSet,
-                                          Set<Instruction> falseSet, HashSet<PsiElement> reportedAnchors, BranchingInstruction instruction) {
+                                          Set<Instruction> falseSet, HashSet<PsiElement> reportedAnchors, BranchingInstruction instruction, final boolean onTheFly) {
     PsiElement psiAnchor = instruction.getPsiAnchor();
     boolean underBinary = isAtRHSOfBooleanAnd(psiAnchor);
     if (instruction instanceof InstanceofInstruction && visitor.isInstanceofRedundant((InstanceofInstruction)instruction)) {
@@ -434,11 +438,12 @@
     }
     else if (psiAnchor != null && !reportedAnchors.contains(psiAnchor) && !isCompileConstantInIfCondition(psiAnchor)) {
       boolean evaluatesToTrue = trueSet.contains(instruction);
-      if (onTheLeftSideOfConditionalAssignment(psiAnchor)) {
+      final PsiElement parent = psiAnchor.getParent();
+      if (parent instanceof PsiAssignmentExpression && ((PsiAssignmentExpression)parent).getLExpression() == psiAnchor) {
         holder.registerProblem(
           psiAnchor,
           InspectionsBundle.message("dataflow.message.pointless.assignment.expression", Boolean.toString(evaluatesToTrue)),
-          createSimplifyToAssignmentFix()
+          createConditionalAssignmentFixes(evaluatesToTrue, (PsiAssignmentExpression)parent, onTheFly)
         );
       }
       else if (!skipReportingConstantCondition(visitor, psiAnchor, evaluatesToTrue)) {
@@ -452,6 +457,10 @@
     }
   }
 
+  protected LocalQuickFix[] createConditionalAssignmentFixes(boolean evaluatesToTrue, PsiAssignmentExpression parent, final boolean onTheFly) {
+    return LocalQuickFix.EMPTY_ARRAY;
+  }
+
   private boolean skipReportingConstantCondition(StandardInstructionVisitor visitor, PsiElement psiAnchor, boolean evaluatesToTrue) {
     return DONT_REPORT_TRUE_ASSERT_STATEMENTS && isAssertionEffectively(psiAnchor, evaluatesToTrue) ||
            visitor.silenceConstantCondition(psiAnchor);
@@ -581,15 +590,6 @@
     return false;
   }
 
-  private static boolean onTheLeftSideOfConditionalAssignment(final PsiElement psiAnchor) {
-    final PsiElement parent = psiAnchor.getParent();
-    if (parent instanceof PsiAssignmentExpression) {
-      final PsiAssignmentExpression expression = (PsiAssignmentExpression)parent;
-      if (expression.getLExpression() == psiAnchor) return true;
-    }
-    return false;
-  }
-
   @Nullable
   private static LocalQuickFix createSimplifyBooleanExpressionFix(PsiElement element, final boolean value) {
     SimplifyBooleanExpressionFix fix = createIntention(element, value);
@@ -626,7 +626,7 @@
   }
 
   @NotNull
-  private static LocalQuickFix createSimplifyToAssignmentFix() {
+  protected static LocalQuickFix createSimplifyToAssignmentFix() {
     return new LocalQuickFix() {
       @NotNull
       @Override
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java
index a1df3bc..c2da3fb 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaMemoryStateImpl.java
@@ -263,18 +263,19 @@
     }
     EqClass aClass = new EqClass(myFactory);
     aClass.add(dfaValue.getID());
-    myEqClasses.add(aClass);
 
+    int freeIndex = myEqClasses.indexOf(null);
+    if (freeIndex >= 0) {
+      myEqClasses.set(freeIndex, aClass);
+      return freeIndex;
+    }
+
+    myEqClasses.add(aClass);
     return myEqClasses.size() - 1;
   }
 
-  boolean areEquivalent(DfaValue val1, DfaValue val2) {
-    int index = getEqClassIndex(val1);
-    return index >= 0 && index == getEqClassIndex(val2);
-  }
-
   @NotNull
-  private List<DfaValue> getEqClassesFor(@NotNull DfaValue dfaValue) {
+  List<DfaValue> getEquivalentValues(@NotNull DfaValue dfaValue) {
     int index = getEqClassIndex(dfaValue);
     EqClass set = index == -1 ? null : myEqClasses.get(index);
     if (set == null) {
@@ -284,7 +285,7 @@
   }
 
   private boolean canBeNaN(@NotNull DfaValue dfaValue) {
-    for (DfaValue eq : getEqClassesFor(dfaValue)) {
+    for (DfaValue eq : getEquivalentValues(dfaValue)) {
       if (eq instanceof DfaBoxedValue) {
         eq = ((DfaBoxedValue)eq).getWrappedValue();
       }
@@ -298,7 +299,7 @@
 
 
   private boolean isEffectivelyNaN(@NotNull DfaValue dfaValue) {
-    for (DfaValue eqClass : getEqClassesFor(dfaValue)) {
+    for (DfaValue eqClass : getEquivalentValues(dfaValue)) {
       if (isNaN(eqClass)) return true;
     }
     return false;
@@ -323,7 +324,7 @@
       }
       if (valueToWrap instanceof DfaVariableValue) {
         if (PsiType.BOOLEAN.equals(((DfaVariableValue)valueToWrap).getVariableType())) return true;
-        for (DfaValue value : getEqClassesFor(valueToWrap)) {
+        for (DfaValue value : getEquivalentValues(valueToWrap)) {
           if (value instanceof DfaConstValue && cacheable((DfaConstValue)value)) return true;
         }
       }
@@ -497,7 +498,7 @@
   public DfaConstValue getConstantValue(DfaVariableValue value) {
     int index = getEqClassIndex(value);
     EqClass ec = index == -1 ? null : myEqClasses.get(index);
-    return ec == null ? null : ec.findConstant(true);
+    return ec == null ? null : (DfaConstValue)unwrap(ec.findConstant(true));
   }
 
   @Override
@@ -818,7 +819,7 @@
     Set<DfaVariableValue> vars = ContainerUtil.newLinkedHashSet(getChangedVariables());
     for (EqClass aClass : myEqClasses) {
       if (aClass != null) {
-        vars.addAll(aClass.getVariables());
+        vars.addAll(aClass.getVariables(true));
       }
     }
     for (DfaVariableValue value : vars) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
index fddd79a..5414a90 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/DfaPsiUtil.java
@@ -54,7 +54,7 @@
       codeBlock = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class);
     }
     else {
-      codeBlock = PsiTreeUtil.getParentOfType(context, PsiCodeBlock.class);
+      codeBlock = getTopmostBlockInSameClass(context);
     }
     while (codeBlock != null) {
       PsiAnonymousClass anon = PsiTreeUtil.getParentOfType(codeBlock, PsiAnonymousClass.class);
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java
index c6fc621..b6e0429 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/EqClass.java
@@ -55,10 +55,12 @@
     return buf.toString();
   }
 
-  List<DfaVariableValue> getVariables() {
+  List<DfaVariableValue> getVariables(boolean unwrap) {
     List<DfaVariableValue> vars = ContainerUtil.newArrayList();
     for (DfaValue value : getMemberValues()) {
-      value = DfaMemoryStateImpl.unwrap(value);
+      if (unwrap) {
+        value = DfaMemoryStateImpl.unwrap(value);
+      }
       if (value instanceof DfaVariableValue) {
         vars.add((DfaVariableValue)value);
       }
@@ -80,13 +82,10 @@
   }
 
   @Nullable
-  DfaConstValue findConstant(boolean wrapped) {
+  DfaValue findConstant(boolean wrapped) {
     for (DfaValue value : getMemberValues()) {
-      if (wrapped) {
-        value = DfaMemoryStateImpl.unwrap(value);
-      }
-      if (value instanceof DfaConstValue) {
-        return (DfaConstValue)value;
+      if (value instanceof DfaConstValue || wrapped && DfaMemoryStateImpl.unwrap(value) instanceof DfaConstValue) {
+        return value;
       }
     }
     return null;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
index 0217b81..be70ba0 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StandardInstructionVisitor.java
@@ -31,6 +31,10 @@
 
 import java.util.*;
 
+import static com.intellij.psi.JavaTokenType.*;
+import static com.intellij.psi.JavaTokenType.EQEQ;
+import static com.intellij.psi.JavaTokenType.NE;
+
 /**
  * @author peter
  */
@@ -184,7 +188,7 @@
     DfaValue dfaExpr = factory.createValue(instruction.getCasted());
     if (dfaExpr != null) {
       DfaTypeValue dfaType = (DfaTypeValue)factory.createTypeValue(instruction.getCastTo(), Nullness.UNKNOWN);
-      DfaRelationValue dfaInstanceof = factory.getRelationFactory().createRelation(dfaExpr, dfaType, JavaTokenType.INSTANCEOF_KEYWORD, false);
+      DfaRelationValue dfaInstanceof = factory.getRelationFactory().createRelation(dfaExpr, dfaType, INSTANCEOF_KEYWORD, false);
       if (dfaInstanceof != null && !memState.applyInstanceofOrNull(dfaInstanceof)) {
         onInstructionProducesCCE(instruction);
       }
@@ -289,7 +293,12 @@
   protected boolean checkNotNullable(DfaMemoryState state,
                                      DfaValue value, NullabilityProblem problem,
                                      PsiElement anchor) {
-    return state.checkNotNullable(value);
+    boolean notNullable = state.checkNotNullable(value);
+    if (notNullable && problem != NullabilityProblem.passingNullableArgumentToNonAnnotatedParameter) {
+      DfaValueFactory factory = ((DfaMemoryStateImpl)state).getFactory();
+      state.applyCondition(factory.getRelationFactory().createRelation(value, factory.getConstFactory().getNull(), NE, false));
+    }
+    return notNullable;
   }
 
   @Override
@@ -309,7 +318,7 @@
         return states;
       }
 
-      if (JavaTokenType.PLUS == opSign) {
+      if (PLUS == opSign) {
         memState.push(instruction.getNonNullStringValue(runner.getFactory()));
       }
       else {
@@ -415,12 +424,12 @@
                                                                 DfaValue dfaRight,
                                                                 DfaValue dfaLeft) {
     final IElementType opSign = instruction.getOperationSign();
-    if (JavaTokenType.EQEQ != opSign && JavaTokenType.NE != opSign ||
+    if (EQEQ != opSign && NE != opSign ||
         !(dfaLeft instanceof DfaConstValue) || !(dfaRight instanceof DfaConstValue)) {
       return null;
     }
 
-    boolean negated = (JavaTokenType.NE == opSign) ^ (DfaMemoryStateImpl.isNaN(dfaLeft) || DfaMemoryStateImpl.isNaN(dfaRight));
+    boolean negated = (NE == opSign) ^ (DfaMemoryStateImpl.isNaN(dfaLeft) || DfaMemoryStateImpl.isNaN(dfaRight));
     if (dfaLeft == dfaRight ^ negated) {
       memState.push(runner.getFactory().getConstFactory().getTrue());
       instruction.setTrueReachable();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java
index 65899e9..1fa6526 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/StateMerger.java
@@ -118,9 +118,10 @@
 
   private static Set<DfaConstValue> getOtherInequalities(Fact removedFact, LinkedHashSet<Fact> memberFacts, DfaMemoryStateImpl state) {
     Set<DfaConstValue> otherInequalities = ContainerUtil.newLinkedHashSet();
+    Set<DfaValue> eqValues = ContainerUtil.newHashSet(state.getEquivalentValues((DfaValue)removedFact.myArg));
     for (Fact candidate : memberFacts) {
       if (candidate.myType == FactType.equality && !candidate.myPositive && candidate.myVar == removedFact.myVar &&
-          !state.areEquivalent((DfaValue)candidate.myArg, (DfaValue)removedFact.myArg) && 
+          !eqValues.contains((DfaValue)candidate.myArg) &&
           candidate.myArg instanceof DfaConstValue) {
         otherInequalities.add((DfaConstValue)candidate.myArg);
       }
@@ -255,8 +256,8 @@
     
     result = ContainerUtil.newLinkedHashSet();
     for (EqClass eqClass : state.getNonTrivialEqClasses()) {
-      DfaConstValue constant = eqClass.findConstant(true);
-      List<DfaVariableValue> vars = eqClass.getVariables();
+      DfaValue constant = eqClass.findConstant(true);
+      List<DfaVariableValue> vars = eqClass.getVariables(false);
       for (DfaVariableValue var : vars) {
         if (constant != null) {
           result.add(Fact.createEqualityFact(var, constant, true));
@@ -270,8 +271,8 @@
     }
     
     for (UnorderedPair<EqClass> classPair : state.getDistinctClassPairs()) {
-      List<DfaVariableValue> vars1 = classPair.first.getVariables();
-      List<DfaVariableValue> vars2 = classPair.second.getVariables();
+      List<DfaVariableValue> vars1 = classPair.first.getVariables(false);
+      List<DfaVariableValue> vars2 = classPair.second.getVariables(false);
       
       LinkedHashSet<DfaValue> firstSet = new LinkedHashSet<DfaValue>(vars1);
       ContainerUtil.addIfNotNull(firstSet, classPair.first.findConstant(true));
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ValuableDataFlowRunner.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ValuableDataFlowRunner.java
index 21a6160..d7d2306 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ValuableDataFlowRunner.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/ValuableDataFlowRunner.java
@@ -61,6 +61,10 @@
       return new ValuableDfaVariableState(var);
     }
 
+    @Override
+    public void flushFields() {
+      // this is a compile time values analysis/resolve so do not flush variables
+    }
   }
 
   static class ValuableDfaVariableState extends DfaVariableState {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java
index bbeb09e..ec65926 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java
@@ -485,12 +485,6 @@
     if (element instanceof PsiModifierListOwner) {
       final EntryPointsManager entryPointsManager = EntryPointsManager.getInstance(project);
       if (entryPointsManager.isEntryPoint(element)) return true;
-      //if (AnnotationUtil
-      //  .checkAnnotatedUsingPatterns((PsiModifierListOwner)element, entryPointsManager.ADDITIONAL_ANNOTATIONS) ||
-      //  AnnotationUtil
-      //  .checkAnnotatedUsingPatterns((PsiModifierListOwner)element, entryPointsManager.getAdditionalAnnotations())) {
-      //  return true;
-      //}
     }
     for (EntryPoint extension : myExtensions) {
       if (extension.isEntryPoint(element)) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java
index 9e3c2a9..327b24c 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/defUse/DefUseInspectionBase.java
@@ -19,6 +19,7 @@
 import com.intellij.codeInspection.*;
 import com.intellij.psi.*;
 import com.intellij.psi.controlFlow.DefUseUtil;
+import com.intellij.util.containers.ContainerUtil;
 import gnu.trove.THashSet;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -89,19 +90,24 @@
           }
           else {
             if (REPORT_REDUNDANT_INITIALIZER) {
+              List<LocalQuickFix> fixes = ContainerUtil.createMaybeSingletonList(isOnTheFly ? createRemoveInitializerFix() : null);
               holder.registerProblem(psiVariable.getInitializer(),
                                      InspectionsBundle.message("inspection.unused.assignment.problem.descriptor2",
                                                                "<code>" + psiVariable.getName() + "</code>", "<code>#ref</code> #loc"),
                                      ProblemHighlightType.LIKE_UNUSED_SYMBOL,
-                                     createRemoveInitializerFix());
+                                     fixes.toArray(new LocalQuickFix[fixes.size()])
+              );
             }
           }
         }
         else if (context instanceof PsiAssignmentExpression) {
           final PsiAssignmentExpression assignment = (PsiAssignmentExpression)context;
+          List<LocalQuickFix> fixes = ContainerUtil.createMaybeSingletonList(isOnTheFly ? createRemoveAssignmentFix() : null);
           holder.registerProblem(assignment.getLExpression(),
                                  InspectionsBundle.message("inspection.unused.assignment.problem.descriptor3",
-                                                           assignment.getRExpression().getText(), "<code>#ref</code>" + " #loc"), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
+                                                           assignment.getRExpression().getText(), "<code>#ref</code>" + " #loc"), 
+                                 ProblemHighlightType.LIKE_UNUSED_SYMBOL, fixes.toArray(new LocalQuickFix[fixes.size()])
+          );
         }
         else {
           if (context instanceof PsiPrefixExpression && REPORT_PREFIX_EXPRESSIONS ||
@@ -153,6 +159,10 @@
     return null;
   }
 
+  protected LocalQuickFix createRemoveAssignmentFix() {
+    return null;
+  }
+
   @Override
   public JComponent createOptionsPanel() {
     return new OptionsPanel();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
index d68f74d..4eed3a2 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java
@@ -400,7 +400,8 @@
         element instanceof PsiDocCommentOwner && ((PsiDocCommentOwner)element).isDeprecated()) {
       return true;
     }
-    return AnnotationUtil.isAnnotated(owner, ADDITIONAL_ANNOTATIONS) ||
-           AnnotationUtil.isAnnotated(owner, getAdditionalAnnotations());
+
+    return AnnotationUtil.checkAnnotatedUsingPatterns(owner, ADDITIONAL_ANNOTATIONS) ||
+           AnnotationUtil.checkAnnotatedUsingPatterns(owner, getAdditionalAnnotations());
   }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
index fbe379b..29169dd 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspectionBase.java
@@ -78,6 +78,7 @@
   static {
     ourGenerifiedClasses.add("javax.swing.JComboBox");
     ourGenerifiedClasses.add("javax.swing.ListModel");
+    ourGenerifiedClasses.add("javax.swing.JList");
   }
 
   protected LanguageLevel myEffectiveLanguageLevel = null;
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/api1.8.txt b/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/api1.8.txt
index c2fbfdf..488f446 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/api1.8.txt
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/java15api/api1.8.txt
@@ -5,7 +5,7 @@
 com.sun.source.tree.IntersectionTypeTree
 com.sun.source.util.Plugin
 com.sun.source.util.DocTrees
-com.sun.source.util.JavacTask#instance(ProcessingEnvironment;)
+com.sun.source.util.JavacTask#instance(javax.annotation.processing.ProcessingEnvironment;)
 com.sun.source.util.JavacTask#addTaskListener(TaskListener;)
 com.sun.source.util.JavacTask#removeTaskListener(TaskListener;)
 com.sun.source.util.DocTreePath
@@ -57,70 +57,70 @@
 java.awt.KeyboardFocusManager#clearFocusOwner()
 java.net.URLPermission
 java.net.HttpConnectSocketImpl
-java.nio.file.attribute.FileTime#from(Instant;)
+java.nio.file.attribute.FileTime#from(java.time.Instant;)
 java.nio.file.attribute.FileTime#toInstant()
-java.nio.file.Files#newBufferedReader(Path;)
-java.nio.file.Files#newBufferedWriter(Path;OpenOption[];)
-java.nio.file.Files#readAllLines(Path;)
-java.nio.file.Files#write(Path;Iterable<? extends CharSequence>;OpenOption[];)
-java.nio.file.Files#list(Path;)
-java.nio.file.Files#walk(Path;int;FileVisitOption[];)
-java.nio.file.Files#walk(Path;FileVisitOption[];)
-java.nio.file.Files#find(Path;int;BiPredicate<Path,BasicFileAttributes>;FileVisitOption[];)
-java.nio.file.Files#lines(Path;Charset;)
-java.nio.file.Files#lines(Path;)
-java.sql.Date#valueOf(LocalDate;)
+java.nio.file.Files#newBufferedReader(java.nio.file.Path;)
+java.nio.file.Files#newBufferedWriter(java.nio.file.Path;java.nio.file.OpenOption[];)
+java.nio.file.Files#readAllLines(java.nio.file.Path;)
+java.nio.file.Files#write(java.nio.file.Path;java.lang.Iterable<? extends java.lang.CharSequence>;java.nio.file.OpenOption[];)
+java.nio.file.Files#list(java.nio.file.Path;)
+java.nio.file.Files#walk(java.nio.file.Path;int;java.nio.file.FileVisitOption[];)
+java.nio.file.Files#walk(java.nio.file.Path;java.nio.file.FileVisitOption[];)
+java.nio.file.Files#find(java.nio.file.Path;int;java.util.function.BiPredicate<java.nio.file.Path,java.nio.file.attribute.BasicFileAttributes>;java.nio.file.FileVisitOption[];)
+java.nio.file.Files#lines(java.nio.file.Path;java.nio.charset.Charset;)
+java.nio.file.Files#lines(java.nio.file.Path;)
+java.sql.Date#valueOf(java.time.LocalDate;)
 java.sql.Date#toLocalDate()
-java.sql.Time#valueOf(LocalTime;)
+java.sql.Time#valueOf(java.time.LocalTime;)
 java.sql.Time#toLocalTime()
 java.sql.Types#REF_CURSOR
 java.sql.Types#TIME_WITH_TIMEZONE
 java.sql.Types#TIMESTAMP_WITH_TIMEZONE
 java.sql.SQLType
 java.sql.JDBCType
-java.sql.SQLInput#readObject(Class<T>;)
-java.sql.ResultSet#updateObject(int;Object;SQLType;int;)
-java.sql.ResultSet#updateObject(String;Object;SQLType;int;)
-java.sql.ResultSet#updateObject(int;Object;SQLType;)
-java.sql.ResultSet#updateObject(String;Object;SQLType;)
-java.sql.SQLOutput#writeObject(Object;SQLType;)
+java.sql.SQLInput#readObject(java.lang.Class<T>;)
+java.sql.ResultSet#updateObject(int;java.lang.Object;java.sql.SQLType;int;)
+java.sql.ResultSet#updateObject(java.lang.String;java.lang.Object;java.sql.SQLType;int;)
+java.sql.ResultSet#updateObject(int;java.lang.Object;java.sql.SQLType;)
+java.sql.ResultSet#updateObject(java.lang.String;java.lang.Object;java.sql.SQLType;)
+java.sql.SQLOutput#writeObject(java.lang.Object;java.sql.SQLType;)
 java.sql.Statement#getLargeUpdateCount()
 java.sql.Statement#setLargeMaxRows(long;)
 java.sql.Statement#getLargeMaxRows()
 java.sql.Statement#executeLargeBatch()
-java.sql.Statement#executeLargeUpdate(String;)
-java.sql.Statement#executeLargeUpdate(String;int;)
-java.sql.Statement#executeLargeUpdate(String;int[];)
-java.sql.Statement#executeLargeUpdate(String;String[];)
-java.sql.Timestamp#valueOf(LocalDateTime;)
+java.sql.Statement#executeLargeUpdate(java.lang.String;)
+java.sql.Statement#executeLargeUpdate(java.lang.String;int;)
+java.sql.Statement#executeLargeUpdate(java.lang.String;int[];)
+java.sql.Statement#executeLargeUpdate(java.lang.String;java.lang.String[];)
+java.sql.Timestamp#valueOf(java.time.LocalDateTime;)
 java.sql.Timestamp#toLocalDateTime()
-java.sql.Timestamp#from(Instant;)
+java.sql.Timestamp#from(java.time.Instant;)
 java.sql.Timestamp#toInstant()
 java.sql.DriverAction#deregister()
 java.sql.DriverAction
 java.sql.DriverManager#DEREGISTER_DRIVER_PERMISSION
-java.sql.DriverManager#registerDriver(java.sql.Driver;DriverAction;)
+java.sql.DriverManager#registerDriver(java.sql.Driver;java.sql.DriverAction;)
 java.sql.DatabaseMetaData#getMaxLogicalLobSize()
 java.sql.DatabaseMetaData#supportsRefCursors()
-java.sql.CallableStatement#setObject(String;Object;SQLType;int;)
-java.sql.CallableStatement#setObject(String;Object;SQLType;)
-java.sql.CallableStatement#registerOutParameter(int;SQLType;)
-java.sql.CallableStatement#registerOutParameter(int;SQLType;int;)
-java.sql.CallableStatement#registerOutParameter(int;SQLType;String;)
-java.sql.CallableStatement#registerOutParameter(String;SQLType;)
-java.sql.CallableStatement#registerOutParameter(String;SQLType;int;)
-java.sql.CallableStatement#registerOutParameter(String;SQLType;String;)
-java.sql.PreparedStatement#setObject(int;Object;SQLType;int;)
-java.sql.PreparedStatement#setObject(int;Object;SQLType;)
+java.sql.CallableStatement#setObject(java.lang.String;java.lang.Object;java.sql.SQLType;int;)
+java.sql.CallableStatement#setObject(java.lang.String;java.lang.Object;java.sql.SQLType;)
+java.sql.CallableStatement#registerOutParameter(int;java.sql.SQLType;)
+java.sql.CallableStatement#registerOutParameter(int;java.sql.SQLType;int;)
+java.sql.CallableStatement#registerOutParameter(int;java.sql.SQLType;java.lang.String;)
+java.sql.CallableStatement#registerOutParameter(java.lang.String;java.sql.SQLType;)
+java.sql.CallableStatement#registerOutParameter(java.lang.String;java.sql.SQLType;int;)
+java.sql.CallableStatement#registerOutParameter(java.lang.String;java.sql.SQLType;java.lang.String;)
+java.sql.PreparedStatement#setObject(int;java.lang.Object;java.sql.SQLType;int;)
+java.sql.PreparedStatement#setObject(int;java.lang.Object;java.sql.SQLType;)
 java.sql.PreparedStatement#executeLargeUpdate()
-java.sql.BatchUpdateException#BatchUpdateException(String;String;int;long[];Throwable;)
+java.sql.BatchUpdateException#BatchUpdateException(java.lang.String;java.lang.String;int;long[];java.lang.Throwable;)
 java.sql.BatchUpdateException#getLargeUpdateCounts()
 java.sql.BatchUpdateException#longUpdateCounts
-java.lang.invoke.MethodHandles#reflectAs(Class<T>;MethodHandle;)
-java.lang.invoke.MethodHandles.Lookup#revealDirect(MethodHandle;)
+java.lang.invoke.MethodHandles#reflectAs(java.lang.Class<T>;java.lang.invoke.MethodHandle;)
+java.lang.invoke.MethodHandles.Lookup#revealDirect(java.lang.invoke.MethodHandle;)
 java.lang.invoke.MethodHandleInfo
 java.lang.reflect.Type#getTypeName()
-java.lang.reflect.Field#getAnnotationsByType(Class<T>;)
+java.lang.reflect.Field#getAnnotationsByType(java.lang.Class<T>;)
 java.lang.reflect.Field#getAnnotatedType()
 java.lang.reflect.Method#isDefault()
 java.lang.reflect.Method#getAnnotatedReturnType()
@@ -128,7 +128,7 @@
 java.lang.reflect.Parameter
 java.lang.reflect.Executable#getParameterCount()
 java.lang.reflect.Executable#getParameters()
-java.lang.reflect.Executable#getAnnotationsByType(Class<T>;)
+java.lang.reflect.Executable#getAnnotationsByType(java.lang.Class<T>;)
 java.lang.reflect.Executable#getAnnotatedReturnType()
 java.lang.reflect.Executable#getAnnotatedReceiverType()
 java.lang.reflect.Executable#getAnnotatedParameterTypes()
@@ -138,12 +138,12 @@
 java.lang.reflect.Constructor#getAnnotatedReceiverType()
 java.lang.reflect.TypeVariable#getAnnotatedBounds()
 java.lang.reflect.AnnotatedType
-java.lang.reflect.AccessibleObject#getAnnotationsByType(Class<T>;)
-java.lang.reflect.AccessibleObject#getDeclaredAnnotation(Class<T>;)
-java.lang.reflect.AccessibleObject#getDeclaredAnnotationsByType(Class<T>;)
-java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class<T>;)
-java.lang.reflect.AnnotatedElement#getDeclaredAnnotation(Class<T>;)
-java.lang.reflect.AnnotatedElement#getDeclaredAnnotationsByType(Class<T>;)
+java.lang.reflect.AccessibleObject#getAnnotationsByType(java.lang.Class<T>;)
+java.lang.reflect.AccessibleObject#getDeclaredAnnotation(java.lang.Class<T>;)
+java.lang.reflect.AccessibleObject#getDeclaredAnnotationsByType(java.lang.Class<T>;)
+java.lang.reflect.AnnotatedElement#getAnnotationsByType(java.lang.Class<T>;)
+java.lang.reflect.AnnotatedElement#getDeclaredAnnotation(java.lang.Class<T>;)
+java.lang.reflect.AnnotatedElement#getDeclaredAnnotationsByType(java.lang.Class<T>;)
 java.lang.reflect.AnnotatedArrayType
 java.lang.reflect.AnnotatedTypeVariable
 java.lang.reflect.AnnotatedWildcardType
@@ -155,8 +155,8 @@
 java.lang.Byte#BYTES
 java.lang.Long#toUnsignedString(long;int;)
 java.lang.Long#toUnsignedString(long;)
-java.lang.Long#parseUnsignedLong(String;int;)
-java.lang.Long#parseUnsignedLong(String;)
+java.lang.Long#parseUnsignedLong(java.lang.String;int;)
+java.lang.Long#parseUnsignedLong(java.lang.String;)
 java.lang.Long#hashCode(long;)
 java.lang.Long#compareUnsigned(long;long;)
 java.lang.Long#divideUnsigned(long;long;)
@@ -205,23 +205,23 @@
 java.lang.annotation.Repeatable
 java.lang.annotation.ElementType#TYPE_PARAMETER
 java.lang.annotation.ElementType#TYPE_USE
-java.lang.management.LockInfo#from(CompositeData;)
+java.lang.management.LockInfo#from(javax.management.openmbean.CompositeData;)
 java.lang.Double#BYTES
 java.lang.Double#isFinite(double;)
 java.lang.Double#hashCode(double;)
 java.lang.Double#sum(double;double;)
 java.lang.Double#max(double;double;)
 java.lang.Double#min(double;double;)
-java.lang.String#join(CharSequence;CharSequence[];)
-java.lang.String#join(CharSequence;Iterable<? extends CharSequence>;)
+java.lang.String#join(java.lang.CharSequence;java.lang.CharSequence[];)
+java.lang.String#join(java.lang.CharSequence;java.lang.Iterable<? extends java.lang.CharSequence>;)
 java.lang.Boolean#hashCode(boolean;)
 java.lang.Boolean#logicalAnd(boolean;boolean;)
 java.lang.Boolean#logicalOr(boolean;boolean;)
 java.lang.Boolean#logicalXor(boolean;boolean;)
 java.lang.Integer#toUnsignedString(int;int;)
 java.lang.Integer#toUnsignedString(int;)
-java.lang.Integer#parseUnsignedInt(String;int;)
-java.lang.Integer#parseUnsignedInt(String;)
+java.lang.Integer#parseUnsignedInt(java.lang.String;int;)
+java.lang.Integer#parseUnsignedInt(java.lang.String;)
 java.lang.Integer#hashCode(int;)
 java.lang.Integer#compareUnsigned(int;int;)
 java.lang.Integer#toUnsignedLong(int;)
@@ -231,13 +231,13 @@
 java.lang.Integer#sum(int;int;)
 java.lang.Integer#max(int;int;)
 java.lang.Integer#min(int;int;)
-java.lang.Package#getAnnotationsByType(Class<A>;)
-java.lang.Package#getDeclaredAnnotation(Class<A>;)
-java.lang.Package#getDeclaredAnnotationsByType(Class<A>;)
-java.lang.Process#waitFor(long;TimeUnit;)
+java.lang.Package#getAnnotationsByType(java.lang.Class<A>;)
+java.lang.Package#getDeclaredAnnotation(java.lang.Class<A>;)
+java.lang.Package#getDeclaredAnnotationsByType(java.lang.Class<A>;)
+java.lang.Process#waitFor(long;java.util.concurrent.TimeUnit;)
 java.lang.Process#destroyForcibly()
 java.lang.Process#isAlive()
-java.lang.Iterable#forEach(Consumer<? super T>;)
+java.lang.Iterable#forEach(java.util.function.Consumer<? super T>;)
 java.lang.Iterable#spliterator()
 java.lang.Character.UnicodeBlock#ARABIC_EXTENDED_A
 java.lang.Character.UnicodeBlock#SUNDANESE_SUPPLEMENT
@@ -265,15 +265,15 @@
 java.lang.StrictMath#floorMod(long;long;)
 java.lang.StrictMath#nextDown(double;)
 java.lang.StrictMath#nextDown(float;)
-java.lang.ThreadLocal#withInitial(Supplier<? extends S>;)
+java.lang.ThreadLocal#withInitial(java.util.function.Supplier<? extends S>;)
 java.lang.CharSequence#chars()
 java.lang.CharSequence#codePoints()
-java.lang.StringBuffer#append(AbstractStringBuilder;)
-java.lang.InternalError#InternalError(String;Throwable;)
-java.lang.InternalError#InternalError(Throwable;)
+java.lang.StringBuffer#append(java.lang.AbstractStringBuilder;)
+java.lang.InternalError#InternalError(java.lang.String;java.lang.Throwable;)
+java.lang.InternalError#InternalError(java.lang.Throwable;)
 java.lang.FunctionalInterface
-java.lang.VirtualMachineError#VirtualMachineError(String;Throwable;)
-java.lang.VirtualMachineError#VirtualMachineError(Throwable;)
+java.lang.VirtualMachineError#VirtualMachineError(java.lang.String;java.lang.Throwable;)
+java.lang.VirtualMachineError#VirtualMachineError(java.lang.Throwable;)
 java.lang.AbstractStringBuilder#append(java.lang.AbstractStringBuilder;)
 java.math.BigInteger#longValueExact()
 java.math.BigInteger#intValueExact()
@@ -361,22 +361,22 @@
 java.time.DateTimeException
 java.util.spi.CalendarDataProvider
 java.util.spi.CalendarNameProvider
-java.util.spi.TimeZoneNameProvider#getGenericDisplayName(String;int;Locale;)
-java.util.spi.LocaleServiceProvider#isSupportedLocale(Locale;)
+java.util.spi.TimeZoneNameProvider#getGenericDisplayName(java.lang.String;int;java.util.Locale;)
+java.util.spi.LocaleServiceProvider#isSupportedLocale(java.util.Locale;)
 java.util.spi.ResourceBundleControlProvider
-java.util.zip.CRC32#update(ByteBuffer;)
-java.util.zip.Adler32#update(ByteBuffer;)
+java.util.zip.CRC32#update(java.nio.ByteBuffer;)
+java.util.zip.Adler32#update(java.nio.ByteBuffer;)
 java.util.zip.ZipFile#stream()
-java.util.zip.ZipEntry#setLastModifiedTime(FileTime;)
+java.util.zip.ZipEntry#setLastModifiedTime(java.nio.file.attribute.FileTime;)
 java.util.zip.ZipEntry#getLastModifiedTime()
-java.util.zip.ZipEntry#setLastAccessTime(FileTime;)
+java.util.zip.ZipEntry#setLastAccessTime(java.nio.file.attribute.FileTime;)
 java.util.zip.ZipEntry#getLastAccessTime()
-java.util.zip.ZipEntry#setCreationTime(FileTime;)
+java.util.zip.ZipEntry#setCreationTime(java.nio.file.attribute.FileTime;)
 java.util.zip.ZipEntry#getCreationTime()
-java.util.regex.Matcher#start(String;)
-java.util.regex.Matcher#end(String;)
+java.util.regex.Matcher#start(java.lang.String;)
+java.util.regex.Matcher#end(java.lang.String;)
 java.util.regex.Pattern#asPredicate()
-java.util.regex.Pattern#splitAsStream(CharSequence;)
+java.util.regex.Pattern#splitAsStream(java.lang.CharSequence;)
 java.util.stream.Node
 java.util.stream.Sink
 java.util.stream.Nodes
@@ -427,34 +427,34 @@
 java.util.stream.StreamSpliterators
 java.util.stream.AbstractSpinedBuffer
 java.util.stream.AbstractShortCircuitTask
-java.util.logging.Logger#log(Level;Throwable;Supplier<String>;)
-java.util.logging.Logger#logp(Level;String;String;Supplier<String>;)
-java.util.logging.Logger#logp(Level;String;String;Throwable;Supplier<String>;)
-java.util.logging.Logger#logrb(Level;String;String;ResourceBundle;String;Object[];)
-java.util.logging.Logger#logrb(Level;String;String;ResourceBundle;String;Throwable;)
-java.util.logging.Logger#severe(Supplier<String>;)
-java.util.logging.Logger#warning(Supplier<String>;)
-java.util.logging.Logger#info(Supplier<String>;)
-java.util.logging.Logger#config(Supplier<String>;)
-java.util.logging.Logger#fine(Supplier<String>;)
-java.util.logging.Logger#finer(Supplier<String>;)
-java.util.logging.Logger#finest(Supplier<String>;)
-java.util.logging.Logger#setResourceBundle(ResourceBundle;)
+java.util.logging.Logger#log(java.util.logging.Level;java.lang.Throwable;java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#logp(java.util.logging.Level;java.lang.String;java.lang.String;java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#logp(java.util.logging.Level;java.lang.String;java.lang.String;java.lang.Throwable;java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#logrb(java.util.logging.Level;java.lang.String;java.lang.String;java.util.ResourceBundle;java.lang.String;java.lang.Object[];)
+java.util.logging.Logger#logrb(java.util.logging.Level;java.lang.String;java.lang.String;java.util.ResourceBundle;java.lang.String;java.lang.Throwable;)
+java.util.logging.Logger#severe(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#warning(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#info(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#config(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#fine(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#finer(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#finest(java.util.function.Supplier<java.lang.String>;)
+java.util.logging.Logger#setResourceBundle(java.util.ResourceBundle;)
 java.util.Map.Entry#comparingByKey()
 java.util.Map.Entry#comparingByValue()
-java.util.Map.Entry#comparingByKey(Comparator<? super K>;)
-java.util.Map.Entry#comparingByValue(Comparator<? super V>;)
-java.util.Map#getOrDefault(Object;V;)
-java.util.Map#forEach(BiConsumer<? super K,? super V>;)
-java.util.Map#replaceAll(BiFunction<? super K,? super V,? extends V>;)
+java.util.Map.Entry#comparingByKey(java.util.Comparator<? super K>;)
+java.util.Map.Entry#comparingByValue(java.util.Comparator<? super V>;)
+java.util.Map#getOrDefault(java.lang.Object;V;)
+java.util.Map#forEach(java.util.function.BiConsumer<? super K,? super V>;)
+java.util.Map#replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V>;)
 java.util.Map#putIfAbsent(K;V;)
-java.util.Map#remove(Object;Object;)
+java.util.Map#remove(java.lang.Object;java.lang.Object;)
 java.util.Map#replace(K;V;V;)
 java.util.Map#replace(K;V;)
-java.util.Map#computeIfAbsent(K;Function<? super K,? extends V>;)
-java.util.Map#computeIfPresent(K;BiFunction<? super K,? super V,? extends V>;)
-java.util.Map#compute(K;BiFunction<? super K,? super V,? extends V>;)
-java.util.Map#merge(K;V;BiFunction<? super V,? super V,? extends V>;)
+java.util.Map#computeIfAbsent(K;java.util.function.Function<? super K,? extends V>;)
+java.util.Map#computeIfPresent(K;java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.Map#compute(K;java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.Map#merge(K;V;java.util.function.BiFunction<? super V,? super V,? extends V>;)
 java.util.Set#spliterator()
 java.util.function.Consumer
 java.util.function.Function
@@ -499,52 +499,52 @@
 java.util.function.DoubleBinaryOperator
 java.util.function.DoubleToLongFunction
 java.util.function.LongToDoubleFunction
-java.util.Date#from(Instant;)
+java.util.Date#from(java.time.Instant;)
 java.util.Date#toInstant()
-java.util.List#replaceAll(UnaryOperator<E>;)
-java.util.List#sort(Comparator<? super E>;)
+java.util.List#replaceAll(java.util.function.UnaryOperator<E>;)
+java.util.List#sort(java.util.Comparator<? super E>;)
 java.util.List#spliterator()
 java.util.concurrent.locks.StampedLock
 java.util.concurrent.atomic.LongAdder
-java.util.concurrent.atomic.AtomicLong#getAndUpdate(LongUnaryOperator;)
-java.util.concurrent.atomic.AtomicLong#updateAndGet(LongUnaryOperator;)
-java.util.concurrent.atomic.AtomicLong#getAndAccumulate(long;LongBinaryOperator;)
-java.util.concurrent.atomic.AtomicLong#accumulateAndGet(long;LongBinaryOperator;)
+java.util.concurrent.atomic.AtomicLong#getAndUpdate(java.util.function.LongUnaryOperator;)
+java.util.concurrent.atomic.AtomicLong#updateAndGet(java.util.function.LongUnaryOperator;)
+java.util.concurrent.atomic.AtomicLong#getAndAccumulate(long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.atomic.AtomicLong#accumulateAndGet(long;java.util.function.LongBinaryOperator;)
 java.util.concurrent.atomic.DoubleAdder
-java.util.concurrent.atomic.AtomicInteger#getAndUpdate(IntUnaryOperator;)
-java.util.concurrent.atomic.AtomicInteger#updateAndGet(IntUnaryOperator;)
-java.util.concurrent.atomic.AtomicInteger#getAndAccumulate(int;IntBinaryOperator;)
-java.util.concurrent.atomic.AtomicInteger#accumulateAndGet(int;IntBinaryOperator;)
-java.util.concurrent.atomic.AtomicLongArray#getAndUpdate(int;LongUnaryOperator;)
-java.util.concurrent.atomic.AtomicLongArray#updateAndGet(int;LongUnaryOperator;)
-java.util.concurrent.atomic.AtomicLongArray#getAndAccumulate(int;long;LongBinaryOperator;)
-java.util.concurrent.atomic.AtomicLongArray#accumulateAndGet(int;long;LongBinaryOperator;)
-java.util.concurrent.atomic.AtomicReference#getAndUpdate(UnaryOperator<V>;)
-java.util.concurrent.atomic.AtomicReference#updateAndGet(UnaryOperator<V>;)
-java.util.concurrent.atomic.AtomicReference#getAndAccumulate(V;BinaryOperator<V>;)
-java.util.concurrent.atomic.AtomicReference#accumulateAndGet(V;BinaryOperator<V>;)
+java.util.concurrent.atomic.AtomicInteger#getAndUpdate(java.util.function.IntUnaryOperator;)
+java.util.concurrent.atomic.AtomicInteger#updateAndGet(java.util.function.IntUnaryOperator;)
+java.util.concurrent.atomic.AtomicInteger#getAndAccumulate(int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.atomic.AtomicInteger#accumulateAndGet(int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.atomic.AtomicLongArray#getAndUpdate(int;java.util.function.LongUnaryOperator;)
+java.util.concurrent.atomic.AtomicLongArray#updateAndGet(int;java.util.function.LongUnaryOperator;)
+java.util.concurrent.atomic.AtomicLongArray#getAndAccumulate(int;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.atomic.AtomicLongArray#accumulateAndGet(int;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.atomic.AtomicReference#getAndUpdate(java.util.function.UnaryOperator<V>;)
+java.util.concurrent.atomic.AtomicReference#updateAndGet(java.util.function.UnaryOperator<V>;)
+java.util.concurrent.atomic.AtomicReference#getAndAccumulate(V;java.util.function.BinaryOperator<V>;)
+java.util.concurrent.atomic.AtomicReference#accumulateAndGet(V;java.util.function.BinaryOperator<V>;)
 java.util.concurrent.atomic.LongAccumulator
 java.util.concurrent.atomic.DoubleAccumulator
-java.util.concurrent.atomic.AtomicIntegerArray#getAndUpdate(int;IntUnaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerArray#updateAndGet(int;IntUnaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerArray#getAndAccumulate(int;int;IntBinaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerArray#accumulateAndGet(int;int;IntBinaryOperator;)
-java.util.concurrent.atomic.AtomicReferenceArray#getAndUpdate(int;UnaryOperator<E>;)
-java.util.concurrent.atomic.AtomicReferenceArray#updateAndGet(int;UnaryOperator<E>;)
-java.util.concurrent.atomic.AtomicReferenceArray#getAndAccumulate(int;E;BinaryOperator<E>;)
-java.util.concurrent.atomic.AtomicReferenceArray#accumulateAndGet(int;E;BinaryOperator<E>;)
-java.util.concurrent.atomic.AtomicLongFieldUpdater#getAndUpdate(T;LongUnaryOperator;)
-java.util.concurrent.atomic.AtomicLongFieldUpdater#updateAndGet(T;LongUnaryOperator;)
-java.util.concurrent.atomic.AtomicLongFieldUpdater#getAndAccumulate(T;long;LongBinaryOperator;)
-java.util.concurrent.atomic.AtomicLongFieldUpdater#accumulateAndGet(T;long;LongBinaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerFieldUpdater#getAndUpdate(T;IntUnaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerFieldUpdater#updateAndGet(T;IntUnaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerFieldUpdater#getAndAccumulate(T;int;IntBinaryOperator;)
-java.util.concurrent.atomic.AtomicIntegerFieldUpdater#accumulateAndGet(T;int;IntBinaryOperator;)
-java.util.concurrent.atomic.AtomicReferenceFieldUpdater#getAndUpdate(T;UnaryOperator<V>;)
-java.util.concurrent.atomic.AtomicReferenceFieldUpdater#updateAndGet(T;UnaryOperator<V>;)
-java.util.concurrent.atomic.AtomicReferenceFieldUpdater#getAndAccumulate(T;V;BinaryOperator<V>;)
-java.util.concurrent.atomic.AtomicReferenceFieldUpdater#accumulateAndGet(T;V;BinaryOperator<V>;)
+java.util.concurrent.atomic.AtomicIntegerArray#getAndUpdate(int;java.util.function.IntUnaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerArray#updateAndGet(int;java.util.function.IntUnaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerArray#getAndAccumulate(int;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerArray#accumulateAndGet(int;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.atomic.AtomicReferenceArray#getAndUpdate(int;java.util.function.UnaryOperator<E>;)
+java.util.concurrent.atomic.AtomicReferenceArray#updateAndGet(int;java.util.function.UnaryOperator<E>;)
+java.util.concurrent.atomic.AtomicReferenceArray#getAndAccumulate(int;E;java.util.function.BinaryOperator<E>;)
+java.util.concurrent.atomic.AtomicReferenceArray#accumulateAndGet(int;E;java.util.function.BinaryOperator<E>;)
+java.util.concurrent.atomic.AtomicLongFieldUpdater#getAndUpdate(T;java.util.function.LongUnaryOperator;)
+java.util.concurrent.atomic.AtomicLongFieldUpdater#updateAndGet(T;java.util.function.LongUnaryOperator;)
+java.util.concurrent.atomic.AtomicLongFieldUpdater#getAndAccumulate(T;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.atomic.AtomicLongFieldUpdater#accumulateAndGet(T;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerFieldUpdater#getAndUpdate(T;java.util.function.IntUnaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerFieldUpdater#updateAndGet(T;java.util.function.IntUnaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerFieldUpdater#getAndAccumulate(T;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.atomic.AtomicIntegerFieldUpdater#accumulateAndGet(T;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.atomic.AtomicReferenceFieldUpdater#getAndUpdate(T;java.util.function.UnaryOperator<V>;)
+java.util.concurrent.atomic.AtomicReferenceFieldUpdater#updateAndGet(T;java.util.function.UnaryOperator<V>;)
+java.util.concurrent.atomic.AtomicReferenceFieldUpdater#getAndAccumulate(T;V;java.util.function.BinaryOperator<V>;)
+java.util.concurrent.atomic.AtomicReferenceFieldUpdater#accumulateAndGet(T;V;java.util.function.BinaryOperator<V>;)
 java.util.concurrent.Executors#newWorkStealingPool(int;)
 java.util.concurrent.Executors#newWorkStealingPool()
 java.util.concurrent.ForkJoinPool#commonPool()
@@ -553,13 +553,13 @@
 java.util.concurrent.ForkJoinTask#getForkJoinTaskTag()
 java.util.concurrent.ForkJoinTask#setForkJoinTaskTag(short;)
 java.util.concurrent.ForkJoinTask#compareAndSetForkJoinTaskTag(short;short;)
-java.util.concurrent.ConcurrentMap#getOrDefault(Object;V;)
-java.util.concurrent.ConcurrentMap#forEach(BiConsumer<? super K,? super V>;)
-java.util.concurrent.ConcurrentMap#replaceAll(BiFunction<? super K,? super V,? extends V>;)
-java.util.concurrent.ConcurrentMap#computeIfAbsent(K;Function<? super K,? extends V>;)
-java.util.concurrent.ConcurrentMap#computeIfPresent(K;BiFunction<? super K,? super V,? extends V>;)
-java.util.concurrent.ConcurrentMap#compute(K;BiFunction<? super K,? super V,? extends V>;)
-java.util.concurrent.ConcurrentMap#merge(K;V;BiFunction<? super V,? super V,? extends V>;)
+java.util.concurrent.ConcurrentMap#getOrDefault(java.lang.Object;V;)
+java.util.concurrent.ConcurrentMap#forEach(java.util.function.BiConsumer<? super K,? super V>;)
+java.util.concurrent.ConcurrentMap#replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.concurrent.ConcurrentMap#computeIfAbsent(K;java.util.function.Function<? super K,? extends V>;)
+java.util.concurrent.ConcurrentMap#computeIfPresent(K;java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.concurrent.ConcurrentMap#compute(K;java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.concurrent.ConcurrentMap#merge(K;V;java.util.function.BiFunction<? super V,? super V,? extends V>;)
 java.util.concurrent.CompletionStage
 java.util.concurrent.CountedCompleter
 java.util.concurrent.SynchronousQueue#spliterator()
@@ -568,37 +568,37 @@
 java.util.concurrent.ConcurrentHashMap#mappingCount()
 java.util.concurrent.ConcurrentHashMap#newKeySet()
 java.util.concurrent.ConcurrentHashMap#newKeySet(int;)
-java.util.concurrent.ConcurrentHashMap#forEach(long;BiConsumer<? super K,? super V>;)
-java.util.concurrent.ConcurrentHashMap#forEach(long;BiFunction<? super K,? super V,? extends U>;Consumer<? super U>;)
-java.util.concurrent.ConcurrentHashMap#search(long;BiFunction<? super K,? super V,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduce(long;BiFunction<? super K,? super V,? extends U>;BiFunction<? super U,? super U,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceToDouble(long;ToDoubleBiFunction<? super K,? super V>;double;DoubleBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceToLong(long;ToLongBiFunction<? super K,? super V>;long;LongBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceToInt(long;ToIntBiFunction<? super K,? super V>;int;IntBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#forEachKey(long;Consumer<? super K>;)
-java.util.concurrent.ConcurrentHashMap#forEachKey(long;Function<? super K,? extends U>;Consumer<? super U>;)
-java.util.concurrent.ConcurrentHashMap#searchKeys(long;Function<? super K,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceKeys(long;BiFunction<? super K,? super K,? extends K>;)
-java.util.concurrent.ConcurrentHashMap#reduceKeys(long;Function<? super K,? extends U>;BiFunction<? super U,? super U,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceKeysToDouble(long;ToDoubleFunction<? super K>;double;DoubleBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceKeysToLong(long;ToLongFunction<? super K>;long;LongBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceKeysToInt(long;ToIntFunction<? super K>;int;IntBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#forEachValue(long;Consumer<? super V>;)
-java.util.concurrent.ConcurrentHashMap#forEachValue(long;Function<? super V,? extends U>;Consumer<? super U>;)
-java.util.concurrent.ConcurrentHashMap#searchValues(long;Function<? super V,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceValues(long;BiFunction<? super V,? super V,? extends V>;)
-java.util.concurrent.ConcurrentHashMap#reduceValues(long;Function<? super V,? extends U>;BiFunction<? super U,? super U,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceValuesToDouble(long;ToDoubleFunction<? super V>;double;DoubleBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceValuesToLong(long;ToLongFunction<? super V>;long;LongBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceValuesToInt(long;ToIntFunction<? super V>;int;IntBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#forEachEntry(long;Consumer<? super Map.Entry<K,V>>;)
-java.util.concurrent.ConcurrentHashMap#forEachEntry(long;Function<Map.Entry<K,V>,? extends U>;Consumer<? super U>;)
-java.util.concurrent.ConcurrentHashMap#searchEntries(long;Function<Map.Entry<K,V>,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceEntries(long;BiFunction<Map.Entry<K,V>,Map.Entry<K,V>,? extends Map.Entry<K,V>>;)
-java.util.concurrent.ConcurrentHashMap#reduceEntries(long;Function<Map.Entry<K,V>,? extends U>;BiFunction<? super U,? super U,? extends U>;)
-java.util.concurrent.ConcurrentHashMap#reduceEntriesToDouble(long;ToDoubleFunction<Map.Entry<K,V>>;double;DoubleBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceEntriesToLong(long;ToLongFunction<Map.Entry<K,V>>;long;LongBinaryOperator;)
-java.util.concurrent.ConcurrentHashMap#reduceEntriesToInt(long;ToIntFunction<Map.Entry<K,V>>;int;IntBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#forEach(long;java.util.function.BiConsumer<? super K,? super V>;)
+java.util.concurrent.ConcurrentHashMap#forEach(long;java.util.function.BiFunction<? super K,? super V,? extends U>;java.util.function.Consumer<? super U>;)
+java.util.concurrent.ConcurrentHashMap#search(long;java.util.function.BiFunction<? super K,? super V,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduce(long;java.util.function.BiFunction<? super K,? super V,? extends U>;java.util.function.BiFunction<? super U,? super U,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceToDouble(long;java.util.function.ToDoubleBiFunction<? super K,? super V>;double;java.util.function.DoubleBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceToLong(long;java.util.function.ToLongBiFunction<? super K,? super V>;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceToInt(long;java.util.function.ToIntBiFunction<? super K,? super V>;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#forEachKey(long;java.util.function.Consumer<? super K>;)
+java.util.concurrent.ConcurrentHashMap#forEachKey(long;java.util.function.Function<? super K,? extends U>;java.util.function.Consumer<? super U>;)
+java.util.concurrent.ConcurrentHashMap#searchKeys(long;java.util.function.Function<? super K,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceKeys(long;java.util.function.BiFunction<? super K,? super K,? extends K>;)
+java.util.concurrent.ConcurrentHashMap#reduceKeys(long;java.util.function.Function<? super K,? extends U>;java.util.function.BiFunction<? super U,? super U,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceKeysToDouble(long;java.util.function.ToDoubleFunction<? super K>;double;java.util.function.DoubleBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceKeysToLong(long;java.util.function.ToLongFunction<? super K>;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceKeysToInt(long;java.util.function.ToIntFunction<? super K>;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#forEachValue(long;java.util.function.Consumer<? super V>;)
+java.util.concurrent.ConcurrentHashMap#forEachValue(long;java.util.function.Function<? super V,? extends U>;java.util.function.Consumer<? super U>;)
+java.util.concurrent.ConcurrentHashMap#searchValues(long;java.util.function.Function<? super V,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceValues(long;java.util.function.BiFunction<? super V,? super V,? extends V>;)
+java.util.concurrent.ConcurrentHashMap#reduceValues(long;java.util.function.Function<? super V,? extends U>;java.util.function.BiFunction<? super U,? super U,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceValuesToDouble(long;java.util.function.ToDoubleFunction<? super V>;double;java.util.function.DoubleBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceValuesToLong(long;java.util.function.ToLongFunction<? super V>;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceValuesToInt(long;java.util.function.ToIntFunction<? super V>;int;java.util.function.IntBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#forEachEntry(long;java.util.function.Consumer<? super java.util.Map.Entry<K,V>>;)
+java.util.concurrent.ConcurrentHashMap#forEachEntry(long;java.util.function.Function<java.util.Map.Entry<K,V>,? extends U>;java.util.function.Consumer<? super U>;)
+java.util.concurrent.ConcurrentHashMap#searchEntries(long;java.util.function.Function<java.util.Map.Entry<K,V>,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceEntries(long;java.util.function.BiFunction<java.util.Map.Entry<K,V>,java.util.Map.Entry<K,V>,? extends java.util.Map.Entry<K,V>>;)
+java.util.concurrent.ConcurrentHashMap#reduceEntries(long;java.util.function.Function<java.util.Map.Entry<K,V>,? extends U>;java.util.function.BiFunction<? super U,? super U,? extends U>;)
+java.util.concurrent.ConcurrentHashMap#reduceEntriesToDouble(long;java.util.function.ToDoubleFunction<java.util.Map.Entry<K,V>>;double;java.util.function.DoubleBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceEntriesToLong(long;java.util.function.ToLongFunction<java.util.Map.Entry<K,V>>;long;java.util.function.LongBinaryOperator;)
+java.util.concurrent.ConcurrentHashMap#reduceEntriesToInt(long;java.util.function.ToIntFunction<java.util.Map.Entry<K,V>>;int;java.util.function.IntBinaryOperator;)
 java.util.concurrent.ConcurrentHashMap.KeySetView
 java.util.concurrent.ThreadLocalRandom#ints(long;)
 java.util.concurrent.ThreadLocalRandom#ints()
@@ -621,11 +621,11 @@
 java.util.concurrent.CopyOnWriteArrayList#spliterator()
 java.util.concurrent.ConcurrentLinkedDeque#spliterator()
 java.util.concurrent.ConcurrentLinkedQueue#spliterator()
-java.util.concurrent.ConcurrentSkipListMap#getOrDefault(Object;V;)
-java.util.concurrent.ConcurrentSkipListMap#computeIfAbsent(K;Function<? super K,? extends V>;)
-java.util.concurrent.ConcurrentSkipListMap#computeIfPresent(K;BiFunction<? super K,? super V,? extends V>;)
-java.util.concurrent.ConcurrentSkipListMap#compute(K;BiFunction<? super K,? super V,? extends V>;)
-java.util.concurrent.ConcurrentSkipListMap#merge(K;V;BiFunction<? super V,? super V,? extends V>;)
+java.util.concurrent.ConcurrentSkipListMap#getOrDefault(java.lang.Object;V;)
+java.util.concurrent.ConcurrentSkipListMap#computeIfAbsent(K;java.util.function.Function<? super K,? extends V>;)
+java.util.concurrent.ConcurrentSkipListMap#computeIfPresent(K;java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.concurrent.ConcurrentSkipListMap#compute(K;java.util.function.BiFunction<? super K,? super V,? extends V>;)
+java.util.concurrent.ConcurrentSkipListMap#merge(K;V;java.util.function.BiFunction<? super V,? super V,? extends V>;)
 java.util.concurrent.ConcurrentSkipListSet#spliterator()
 java.util.concurrent.PriorityBlockingQueue#spliterator()
 java.util.Arrays#parallelSort(byte[];)
@@ -644,24 +644,24 @@
 java.util.Arrays#parallelSort(double[];int;int;)
 java.util.Arrays#parallelSort(T[];)
 java.util.Arrays#parallelSort(T[];int;int;)
-java.util.Arrays#parallelSort(T[];Comparator<? super T>;)
-java.util.Arrays#parallelSort(T[];int;int;Comparator<? super T>;)
-java.util.Arrays#parallelPrefix(T[];BinaryOperator<T>;)
-java.util.Arrays#parallelPrefix(T[];int;int;BinaryOperator<T>;)
-java.util.Arrays#parallelPrefix(long[];LongBinaryOperator;)
-java.util.Arrays#parallelPrefix(long[];int;int;LongBinaryOperator;)
-java.util.Arrays#parallelPrefix(double[];DoubleBinaryOperator;)
-java.util.Arrays#parallelPrefix(double[];int;int;DoubleBinaryOperator;)
-java.util.Arrays#parallelPrefix(int[];IntBinaryOperator;)
-java.util.Arrays#parallelPrefix(int[];int;int;IntBinaryOperator;)
-java.util.Arrays#setAll(T[];IntFunction<? extends T>;)
-java.util.Arrays#parallelSetAll(T[];IntFunction<? extends T>;)
-java.util.Arrays#setAll(int[];IntUnaryOperator;)
-java.util.Arrays#parallelSetAll(int[];IntUnaryOperator;)
-java.util.Arrays#setAll(long[];IntToLongFunction;)
-java.util.Arrays#parallelSetAll(long[];IntToLongFunction;)
-java.util.Arrays#setAll(double[];IntToDoubleFunction;)
-java.util.Arrays#parallelSetAll(double[];IntToDoubleFunction;)
+java.util.Arrays#parallelSort(T[];java.util.Comparator<? super T>;)
+java.util.Arrays#parallelSort(T[];int;int;java.util.Comparator<? super T>;)
+java.util.Arrays#parallelPrefix(T[];java.util.function.BinaryOperator<T>;)
+java.util.Arrays#parallelPrefix(T[];int;int;java.util.function.BinaryOperator<T>;)
+java.util.Arrays#parallelPrefix(long[];java.util.function.LongBinaryOperator;)
+java.util.Arrays#parallelPrefix(long[];int;int;java.util.function.LongBinaryOperator;)
+java.util.Arrays#parallelPrefix(double[];java.util.function.DoubleBinaryOperator;)
+java.util.Arrays#parallelPrefix(double[];int;int;java.util.function.DoubleBinaryOperator;)
+java.util.Arrays#parallelPrefix(int[];java.util.function.IntBinaryOperator;)
+java.util.Arrays#parallelPrefix(int[];int;int;java.util.function.IntBinaryOperator;)
+java.util.Arrays#setAll(T[];java.util.function.IntFunction<? extends T>;)
+java.util.Arrays#parallelSetAll(T[];java.util.function.IntFunction<? extends T>;)
+java.util.Arrays#setAll(int[];java.util.function.IntUnaryOperator;)
+java.util.Arrays#parallelSetAll(int[];java.util.function.IntUnaryOperator;)
+java.util.Arrays#setAll(long[];java.util.function.IntToLongFunction;)
+java.util.Arrays#parallelSetAll(long[];java.util.function.IntToLongFunction;)
+java.util.Arrays#setAll(double[];java.util.function.IntToDoubleFunction;)
+java.util.Arrays#parallelSetAll(double[];java.util.function.IntToDoubleFunction;)
 java.util.Arrays#spliterator(T[];)
 java.util.Arrays#spliterator(T[];int;int;)
 java.util.Arrays#spliterator(int[];)
@@ -686,12 +686,12 @@
 java.util.Locale#stripExtensions()
 java.util.Locale.FilteringMode
 java.util.Locale.LanguageRange
-java.util.Locale#filter(List<LanguageRange>;Collection<Locale>;java.util.Locale.FilteringMode;)
-java.util.Locale#filter(List<LanguageRange>;Collection<Locale>;)
-java.util.Locale#filterTags(List<LanguageRange>;Collection<String>;java.util.Locale.FilteringMode;)
-java.util.Locale#filterTags(List<LanguageRange>;Collection<String>;)
-java.util.Locale#lookup(List<LanguageRange>;Collection<Locale>;)
-java.util.Locale#lookupTag(List<LanguageRange>;Collection<String>;)
+java.util.Locale#filter(java.util.List<java.util.Locale.LanguageRange>;java.util.Collection<java.util.Locale>;java.util.Locale.FilteringMode;)
+java.util.Locale#filter(java.util.List<java.util.Locale.LanguageRange>;java.util.Collection<java.util.Locale>;)
+java.util.Locale#filterTags(java.util.List<java.util.Locale.LanguageRange>;java.util.Collection<java.lang.String>;java.util.Locale.FilteringMode;)
+java.util.Locale#filterTags(java.util.List<java.util.Locale.LanguageRange>;java.util.Collection<java.lang.String>;)
+java.util.Locale#lookup(java.util.List<java.util.Locale.LanguageRange>;java.util.Collection<java.util.Locale>;)
+java.util.Locale#lookupTag(java.util.List<java.util.Locale.LanguageRange>;java.util.Collection<java.lang.String>;)
 java.util.Random#ints(long;)
 java.util.Random#ints()
 java.util.Random#ints(long;int;int;)
@@ -706,10 +706,10 @@
 java.util.Random#doubles(double;double;)
 java.util.Vector#spliterator()
 java.util.HashSet#spliterator()
-java.util.Objects#isNull(Object;)
-java.util.Objects#nonNull(Object;)
-java.util.Objects#requireNonNull(T;Supplier<String>;)
-java.util.TimSort#sort(T[];int;int;Comparator<? super T>;T[];int;int;)
+java.util.Objects#isNull(java.lang.Object;)
+java.util.Objects#nonNull(java.lang.Object;)
+java.util.Objects#requireNonNull(T;java.util.function.Supplier<java.lang.String>;)
+java.util.TimSort#sort(T[];int;int;java.util.Comparator<? super T>;T[];int;int;)
 java.util.TreeSet#spliterator()
 java.util.Calendar#NARROW_FORMAT
 java.util.Calendar#NARROW_STANDALONE
@@ -721,42 +721,42 @@
 java.util.Calendar#getAvailableCalendarTypes()
 java.util.Calendar#getCalendarType()
 java.util.Calendar#toInstant()
-java.util.Iterator#forEachRemaining(Consumer<? super E>;)
+java.util.Iterator#forEachRemaining(java.util.function.Consumer<? super E>;)
 java.util.Optional
-java.util.TimeZone#getTimeZone(ZoneId;)
+java.util.TimeZone#getTimeZone(java.time.ZoneId;)
 java.util.TimeZone#toZoneId()
 java.util.Tripwire
 java.util.ArrayList#spliterator()
 java.util.SortedSet#spliterator()
 java.util.ArrayDeque#spliterator()
-java.util.Collection#removeIf(Predicate<? super E>;)
+java.util.Collection#removeIf(java.util.function.Predicate<? super E>;)
 java.util.Collection#spliterator()
 java.util.Collection#stream()
 java.util.Collection#parallelStream()
 java.util.Comparator#reversed()
 java.util.Comparator#thenComparing(java.util.Comparator<? super T>;)
-java.util.Comparator#thenComparing(Function<? super T,? extends U>;java.util.Comparator<? super U>;)
-java.util.Comparator#thenComparing(Function<? super T,? extends U>;)
-java.util.Comparator#thenComparingInt(ToIntFunction<? super T>;)
-java.util.Comparator#thenComparingLong(ToLongFunction<? super T>;)
-java.util.Comparator#thenComparingDouble(ToDoubleFunction<? super T>;)
+java.util.Comparator#thenComparing(java.util.function.Function<? super T,? extends U>;java.util.Comparator<? super U>;)
+java.util.Comparator#thenComparing(java.util.function.Function<? super T,? extends U>;)
+java.util.Comparator#thenComparingInt(java.util.function.ToIntFunction<? super T>;)
+java.util.Comparator#thenComparingLong(java.util.function.ToLongFunction<? super T>;)
+java.util.Comparator#thenComparingDouble(java.util.function.ToDoubleFunction<? super T>;)
 java.util.Comparator#reverseOrder()
 java.util.Comparator#naturalOrder()
 java.util.Comparator#nullsFirst(java.util.Comparator<? super T>;)
 java.util.Comparator#nullsLast(java.util.Comparator<? super T>;)
-java.util.Comparator#comparing(Function<? super T,? extends U>;java.util.Comparator<? super U>;)
-java.util.Comparator#comparing(Function<? super T,? extends U>;)
-java.util.Comparator#comparingInt(ToIntFunction<? super T>;)
-java.util.Comparator#comparingLong(ToLongFunction<? super T>;)
-java.util.Comparator#comparingDouble(ToDoubleFunction<? super T>;)
+java.util.Comparator#comparing(java.util.function.Function<? super T,? extends U>;java.util.Comparator<? super U>;)
+java.util.Comparator#comparing(java.util.function.Function<? super T,? extends U>;)
+java.util.Comparator#comparingInt(java.util.function.ToIntFunction<? super T>;)
+java.util.Comparator#comparingLong(java.util.function.ToLongFunction<? super T>;)
+java.util.Comparator#comparingDouble(java.util.function.ToDoubleFunction<? super T>;)
 java.util.LinkedList#spliterator()
-java.util.Collections#unmodifiableNavigableSet(NavigableSet<T>;)
-java.util.Collections#unmodifiableNavigableMap(NavigableMap<K,? extends V>;)
-java.util.Collections#synchronizedNavigableSet(NavigableSet<T>;)
-java.util.Collections#synchronizedNavigableMap(NavigableMap<K,V>;)
-java.util.Collections#checkedQueue(Queue<E>;Class<E>;)
-java.util.Collections#checkedNavigableSet(NavigableSet<E>;Class<E>;)
-java.util.Collections#checkedNavigableMap(NavigableMap<K,V>;Class<K>;Class<V>;)
+java.util.Collections#unmodifiableNavigableSet(java.util.NavigableSet<T>;)
+java.util.Collections#unmodifiableNavigableMap(java.util.NavigableMap<K,? extends V>;)
+java.util.Collections#synchronizedNavigableSet(java.util.NavigableSet<T>;)
+java.util.Collections#synchronizedNavigableMap(java.util.NavigableMap<K,V>;)
+java.util.Collections#checkedQueue(java.util.Queue<E>;java.lang.Class<E>;)
+java.util.Collections#checkedNavigableSet(java.util.NavigableSet<E>;java.lang.Class<E>;)
+java.util.Collections#checkedNavigableMap(java.util.NavigableMap<K,V>;java.lang.Class<K>;java.lang.Class<V>;)
 java.util.Collections#emptySortedSet()
 java.util.Collections#emptyNavigableSet()
 java.util.Collections#emptySortedMap()
@@ -775,15 +775,15 @@
 java.util.Spliterators
 java.util.StringJoiner
 java.util.LinkedHashSet#spliterator()
-java.util.PriorityQueue#PriorityQueue(Comparator<? super E>;)
+java.util.PriorityQueue#PriorityQueue(java.util.Comparator<? super E>;)
 java.util.PriorityQueue#spliterator()
 java.util.OptionalDouble
 java.util.ResourceBundle#getBaseBundleName()
 java.util.SplittableRandom
-java.util.ComparableTimSort#sort(Object[];int;int;Object[];int;int;)
+java.util.ComparableTimSort#sort(java.lang.Object[];int;int;java.lang.Object[];int;int;)
 java.util.GregorianCalendar#getCalendarType()
 java.util.GregorianCalendar#toZonedDateTime()
-java.util.GregorianCalendar#from(ZonedDateTime;)
+java.util.GregorianCalendar#from(java.time.ZonedDateTime;)
 java.util.PrimitiveIterator.OfInt
 java.util.PrimitiveIterator.OfLong
 java.util.PrimitiveIterator.OfDouble
@@ -792,56 +792,56 @@
 java.util.IntSummaryStatistics
 java.util.LongSummaryStatistics
 java.util.DoubleSummaryStatistics
-java.security.cert.X509CRL#verify(PublicKey;Provider;)
-java.security.cert.Certificate#verify(PublicKey;Provider;)
+java.security.cert.X509CRL#verify(java.security.PublicKey;java.security.Provider;)
+java.security.cert.Certificate#verify(java.security.PublicKey;java.security.Provider;)
 java.security.cert.CertPathBuilder#getRevocationChecker()
 java.security.cert.CertPathChecker
-java.security.cert.X509Certificate#verify(PublicKey;Provider;)
+java.security.cert.X509Certificate#verify(java.security.PublicKey;java.security.Provider;)
 java.security.cert.CertPathValidator#getRevocationChecker()
 java.security.cert.CertPathBuilderSpi#engineGetRevocationChecker()
 java.security.cert.CertPathValidatorSpi#engineGetRevocationChecker()
 java.security.cert.PKIXRevocationChecker
-java.security.KeyStore.PasswordProtection#PasswordProtection(char[];String;AlgorithmParameterSpec;)
+java.security.KeyStore.PasswordProtection#PasswordProtection(char[];java.lang.String;java.security.spec.AlgorithmParameterSpec;)
 java.security.KeyStore.PasswordProtection#getProtectionAlgorithm()
 java.security.KeyStore.PasswordProtection#getProtectionParameters()
 java.security.KeyStore.Entry#getAttributes()
 java.security.KeyStore.Entry.Attribute
-java.security.KeyStore.PrivateKeyEntry#PrivateKeyEntry(PrivateKey;Certificate[];Set<Attribute>;)
+java.security.KeyStore.PrivateKeyEntry#PrivateKeyEntry(java.security.PrivateKey;java.security.cert.Certificate[];java.util.Set<java.security.KeyStore.Entry.Attribute>;)
 java.security.KeyStore.PrivateKeyEntry#getAttributes()
-java.security.KeyStore.SecretKeyEntry#SecretKeyEntry(SecretKey;Set<Attribute>;)
+java.security.KeyStore.SecretKeyEntry#SecretKeyEntry(javax.crypto.SecretKey;java.util.Set<java.security.KeyStore.Entry.Attribute>;)
 java.security.KeyStore.SecretKeyEntry#getAttributes()
-java.security.KeyStore.TrustedCertificateEntry#TrustedCertificateEntry(Certificate;Set<Attribute>;)
+java.security.KeyStore.TrustedCertificateEntry#TrustedCertificateEntry(java.security.cert.Certificate;java.util.Set<java.security.KeyStore.Entry.Attribute>;)
 java.security.KeyStore.TrustedCertificateEntry#getAttributes()
-java.security.Provider#putIfAbsent(Object;Object;)
-java.security.Provider#remove(Object;Object;)
-java.security.Provider#replace(Object;Object;Object;)
-java.security.Provider#replace(Object;Object;)
-java.security.Provider#replaceAll(BiFunction<? super Object,? super Object,? extends Object>;)
-java.security.Provider#compute(Object;BiFunction<? super Object,? super Object,? extends Object>;)
-java.security.Provider#computeIfAbsent(Object;Function<? super Object,? extends Object>;)
-java.security.Provider#computeIfPresent(Object;BiFunction<? super Object,? super Object,? extends Object>;)
-java.security.Provider#merge(Object;Object;BiFunction<? super Object,? super Object,? extends Object>;)
-java.security.Provider#getOrDefault(Object;Object;)
-java.security.Provider#forEach(BiConsumer<? super Object,? super Object>;)
-java.security.Principal#implies(Subject;)
+java.security.Provider#putIfAbsent(java.lang.Object;java.lang.Object;)
+java.security.Provider#remove(java.lang.Object;java.lang.Object;)
+java.security.Provider#replace(java.lang.Object;java.lang.Object;java.lang.Object;)
+java.security.Provider#replace(java.lang.Object;java.lang.Object;)
+java.security.Provider#replaceAll(java.util.function.BiFunction<? super java.lang.Object,? super java.lang.Object,? extends java.lang.Object>;)
+java.security.Provider#compute(java.lang.Object;java.util.function.BiFunction<? super java.lang.Object,? super java.lang.Object,? extends java.lang.Object>;)
+java.security.Provider#computeIfAbsent(java.lang.Object;java.util.function.Function<? super java.lang.Object,? extends java.lang.Object>;)
+java.security.Provider#computeIfPresent(java.lang.Object;java.util.function.BiFunction<? super java.lang.Object,? super java.lang.Object,? extends java.lang.Object>;)
+java.security.Provider#merge(java.lang.Object;java.lang.Object;java.util.function.BiFunction<? super java.lang.Object,? super java.lang.Object,? extends java.lang.Object>;)
+java.security.Provider#getOrDefault(java.lang.Object;java.lang.Object;)
+java.security.Provider#forEach(java.util.function.BiConsumer<? super java.lang.Object,? super java.lang.Object>;)
+java.security.Principal#implies(javax.security.auth.Subject;)
 java.security.SecureRandom#getInstanceStrong()
 java.security.PKCS12Attribute
-java.security.AccessController#doPrivileged(PrivilegedAction<T>;AccessControlContext;Permission[];)
-java.security.AccessController#doPrivilegedWithCombiner(PrivilegedAction<T>;AccessControlContext;Permission[];)
-java.security.AccessController#doPrivileged(PrivilegedExceptionAction<T>;AccessControlContext;Permission[];)
-java.security.AccessController#doPrivilegedWithCombiner(PrivilegedExceptionAction<T>;AccessControlContext;Permission[];)
+java.security.AccessController#doPrivileged(java.security.PrivilegedAction<T>;java.security.AccessControlContext;java.security.Permission[];)
+java.security.AccessController#doPrivilegedWithCombiner(java.security.PrivilegedAction<T>;java.security.AccessControlContext;java.security.Permission[];)
+java.security.AccessController#doPrivileged(java.security.PrivilegedExceptionAction<T>;java.security.AccessControlContext;java.security.Permission[];)
+java.security.AccessController#doPrivilegedWithCombiner(java.security.PrivilegedExceptionAction<T>;java.security.AccessControlContext;java.security.Permission[];)
 java.security.DomainLoadStoreParameter
 javax.xml.validation.SchemaFactoryConfigurationError
 javax.lang.model.type.TypeKind#INTERSECTION
-javax.lang.model.type.TypeVisitor#visitIntersection(IntersectionType;P;)
+javax.lang.model.type.TypeVisitor#visitIntersection(javax.lang.model.type.IntersectionType;P;)
 javax.lang.model.type.ExecutableType#getReceiverType()
 javax.lang.model.type.IntersectionType
-javax.lang.model.util.Elements#isFunctionalInterface(TypeElement;)
+javax.lang.model.util.Elements#isFunctionalInterface(javax.lang.model.element.TypeElement;)
 javax.lang.model.util.ElementScanner8
 javax.lang.model.util.TypeKindVisitor8
 javax.lang.model.util.SimpleTypeVisitor8
 javax.lang.model.util.ElementKindVisitor8
-javax.lang.model.util.AbstractTypeVisitor6#visitIntersection(IntersectionType;P;)
+javax.lang.model.util.AbstractTypeVisitor6#visitIntersection(javax.lang.model.type.IntersectionType;P;)
 javax.lang.model.util.AbstractTypeVisitor8
 javax.lang.model.util.SimpleElementVisitor8
 javax.lang.model.util.AbstractElementVisitor8
@@ -853,9 +853,9 @@
 javax.lang.model.SourceVersion#RELEASE_8
 javax.lang.model.AnnotatedConstruct
 javax.tools.StandardLocation#NATIVE_HEADER_OUTPUT
-javax.security.auth.kerberos.KeyTab#getUnboundInstance(File;)
-javax.security.auth.kerberos.KeyTab#getInstance(KerberosPrincipal;File;)
+javax.security.auth.kerberos.KeyTab#getUnboundInstance(java.io.File;)
+javax.security.auth.kerberos.KeyTab#getInstance(javax.security.auth.kerberos.KerberosPrincipal;java.io.File;)
 javax.security.auth.kerberos.KeyTab#getUnboundInstance()
-javax.security.auth.kerberos.KeyTab#getInstance(KerberosPrincipal;)
+javax.security.auth.kerberos.KeyTab#getInstance(javax.security.auth.kerberos.KerberosPrincipal;)
 javax.security.auth.kerberos.KeyTab#getPrincipal()
 javax.security.auth.kerberos.KeyTab#isBound()
\ No newline at end of file
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
index 2770432..6321ca3 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
@@ -22,6 +22,7 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
@@ -95,6 +96,12 @@
         }
       }
 
+      @Override
+      public void visitMethodReferenceExpression(PsiMethodReferenceExpression expression) {
+        super.visitMethodReferenceExpression(expression);
+        checkMethodReference(expression, inspectionManager, problems);
+      }
+
       private void checkCallExpression(final PsiJavaCodeReferenceElement reference,
                                        final PsiType[] typeArguments,
                                        PsiCallExpression expression,
@@ -145,6 +152,42 @@
     return problems.toArray(new ProblemDescriptor[problems.size()]);
   }
 
+  private static void checkMethodReference(PsiMethodReferenceExpression expression,
+                                           InspectionManager inspectionManager,
+                                           List<ProblemDescriptor> problems) {
+    final PsiTypeElement qualifierTypeElement = expression.getQualifierType();
+    if (qualifierTypeElement != null) {
+      final PsiType psiType = qualifierTypeElement.getType();
+      if (psiType instanceof PsiClassType && !(((PsiClassType)psiType).isRaw())) {
+        final JavaResolveResult result = expression.advancedResolve(false);
+        final PsiElement element = result.getElement();
+        if (element instanceof PsiTypeParameterListOwner) {
+          final PsiMethodReferenceExpression copy = createMethodReference(expression, qualifierTypeElement);
+          final JavaResolveResult simplifiedResolve = copy.advancedResolve(false);
+          final PsiElement candidate = simplifiedResolve.getElement();
+          if (candidate == element) {
+            final PsiJavaCodeReferenceElement referenceElement = qualifierTypeElement.getInnermostComponentReferenceElement();
+            LOG.assertTrue(referenceElement != null, qualifierTypeElement);
+            final PsiReferenceParameterList parameterList = referenceElement.getParameterList();
+            LOG.assertTrue(parameterList != null);
+            final ProblemDescriptor descriptor = inspectionManager.createProblemDescriptor(parameterList, InspectionsBundle
+              .message("inspection.redundant.type.problem.descriptor"), new MyMethodReferenceFixAction(), ProblemHighlightType.LIKE_UNUSED_SYMBOL, false);
+            problems.add(descriptor);
+          }
+        }
+      }
+    }
+  }
+
+  private static PsiMethodReferenceExpression createMethodReference(PsiMethodReferenceExpression expression,
+                                                                    PsiTypeElement typeElement) {
+    final PsiType type = typeElement.getType();
+    final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(expression.getProject());
+    final PsiMethodReferenceExpression copy = (PsiMethodReferenceExpression)expression.copy();
+    copy.getQualifierType().replace(elementFactory.createTypeElement(((PsiClassType)type).rawType()));
+    return copy;
+  }
+
   private static class MyQuickFixAction implements LocalQuickFix {
     @Override
     @NotNull
@@ -172,4 +215,30 @@
       return getName();
     }
   }
+
+  //separate quickfix is needed to invalidate initial method reference
+  //otherwise it would provide inconsistent substitutors to the next chained calls
+  private static class MyMethodReferenceFixAction implements LocalQuickFix {
+    @Override
+    @NotNull
+    public String getName() {
+      return InspectionsBundle.message("inspection.redundant.type.remove.quickfix");
+    }
+
+    @Override
+    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+      final PsiTypeElement typeElement = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiTypeElement.class);
+      if (!FileModificationService.getInstance().preparePsiElementForWrite(typeElement)) return;
+      final PsiMethodReferenceExpression expression = PsiTreeUtil.getParentOfType(typeElement, PsiMethodReferenceExpression.class);
+      if (expression != null) {
+        expression.replace(createMethodReference(expression, typeElement));
+      }
+    }
+
+    @Override
+    @NotNull
+    public String getFamilyName() {
+      return getName();
+    }
+  }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java
index 2cadd1f..5185d99 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefMethodImpl.java
@@ -103,7 +103,10 @@
     final PsiMethod method = (PsiMethod)getElement();
     LOG.assertTrue(method != null);
     setConstructor(method.isConstructor());
-    setFlag(method.getReturnType() == null || PsiType.VOID.equals(method.getReturnType()), IS_RETURN_VALUE_USED_MASK);
+    final PsiType returnType = method.getReturnType();
+    setFlag(returnType == null || 
+            PsiType.VOID.equals(returnType) || 
+            returnType.equalsToText(CommonClassNames.JAVA_LANG_VOID), IS_RETURN_VALUE_USED_MASK);
 
     if (!isReturnValueUsed()) {
       myReturnValueTemplate = RETURN_VALUE_UNDEFINED;
@@ -157,7 +160,10 @@
     if (MethodSignatureUtil.areSignaturesEqual(psiMethod, appMainPattern)) return true;
 
     PsiMethod appPremainPattern = ((RefMethodImpl)refMethod).getRefJavaManager().getAppPremainPattern();
-    return MethodSignatureUtil.areSignaturesEqual(psiMethod, appPremainPattern);
+    if (MethodSignatureUtil.areSignaturesEqual(psiMethod, appPremainPattern)) return true;
+
+    PsiMethod appAgentmainPattern = ((RefMethodImpl)refMethod).getRefJavaManager().getAppAgentmainPattern();
+    return MethodSignatureUtil.areSignaturesEqual(psiMethod, appAgentmainPattern);
   }
 
   private void checkForSuperCall(PsiMethod method) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java
index 276b451..f84abbb 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspectionBase.java
@@ -18,7 +18,12 @@
 import com.intellij.codeInsight.AnnotationUtil;
 import com.intellij.codeInsight.daemon.GroupNames;
 import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
-import com.intellij.codeInspection.*;
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.codeInspection.BaseJavaBatchLocalInspectionTool;
+import com.intellij.codeInspection.InspectionsBundle;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.ProblemsHolder;
+import com.intellij.codeInspection.util.SpecialAnnotationsUtilBase;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.JDOMExternalizableStringList;
@@ -28,15 +33,14 @@
 import com.intellij.psi.controlFlow.*;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.Processor;
+import com.siyeh.InspectionGadgetsBundle;
 import gnu.trove.THashSet;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 public class FieldCanBeLocalInspectionBase extends BaseJavaBatchLocalInspectionTool {
   @NonNls public static final String SHORT_NAME = "FieldCanBeLocal";
@@ -69,10 +73,26 @@
     if (candidates.isEmpty()) return;
     final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
 
-    for (PsiField field : candidates) {
+    for (final PsiField field : candidates) {
       if (usedFields.contains(field) && !hasImplicitReadOrWriteUsage(field, implicitUsageProviders)) {
         final String message = InspectionsBundle.message("inspection.field.can.be.local.problem.descriptor");
-        holder.registerProblem(field.getNameIdentifier(), message, createFix());
+        final ArrayList<LocalQuickFix> fixes = new ArrayList<LocalQuickFix>();
+        SpecialAnnotationsUtilBase.createAddToSpecialAnnotationFixes(field, new Processor<String>() {
+          @Override
+          public boolean process(String qualifiedName) {
+            final LocalQuickFix quickFix = SpecialAnnotationsUtilBase.createAddToSpecialAnnotationsListQuickFix(
+              InspectionGadgetsBundle.message("add.0.to.ignore.if.annotated.by.list.quickfix", qualifiedName),
+              QuickFixBundle.message("fix.add.special.annotation.family"),
+              EXCLUDE_ANNOS, qualifiedName, field);
+            fixes.add(quickFix);
+            return true;
+          }
+        });
+        final LocalQuickFix fix = createFix();
+        if (fix != null) {
+          fixes.add(fix);
+        }
+        holder.registerProblem(field.getNameIdentifier(), message, fixes.toArray(new LocalQuickFix[fixes.size()]));
       }
     }
   }
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java
index 7540384..66c4f9d 100644
--- a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/DuplicatesFinder.java
@@ -354,6 +354,17 @@
         return false;
       }
 
+      if (qualifier1 == null && qualifier2 == null) {
+        final PsiClass patternClass = RefactoringChangeUtil.getThisClass(pattern);
+        final PsiClass candidateClass = RefactoringChangeUtil.getThisClass(candidate);
+        if (resolveResult1 == resolveResult2 &&
+            resolveResult1 instanceof PsiMember &&
+           !InheritanceUtil.isInheritorOrSelf(candidateClass, patternClass, true) &&
+            InheritanceUtil.isInheritorOrSelf(candidateClass, ((PsiMember)resolveResult1).getContainingClass(), true)) {
+          return false;
+        }
+      }
+
     }
 
     if (pattern instanceof PsiTypeCastExpression) {
diff --git a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java
index ef633f7..40c9632 100644
--- a/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java
+++ b/java/java-analysis-impl/src/com/intellij/refactoring/util/duplicates/Match.java
@@ -402,7 +402,7 @@
         final PsiMethod replacedMethod = PsiTreeUtil.getParentOfType(parent, PsiMethod.class);
         LOG.assertTrue(replacedMethod != null);
         final PsiType replacedMethodReturnType = replacedMethod.getReturnType();
-        if (weakerType(psiMethod, returnType, replacedMethodReturnType)) {
+        if (replacedMethodReturnType != null && weakerType(psiMethod, returnType, replacedMethodReturnType)) {
           return replacedMethodReturnType;
         }
       }
@@ -411,7 +411,7 @@
     return null;
   }
 
-  private static boolean weakerType(final PsiMethod psiMethod, final PsiType returnType, final PsiType currentType) {
+  private static boolean weakerType(final PsiMethod psiMethod, final PsiType returnType, @NotNull final PsiType currentType) {
     final PsiTypeParameter[] typeParameters = psiMethod.getTypeParameters();
     final PsiSubstitutor substitutor =
         JavaPsiFacade.getInstance(psiMethod.getProject()).getResolveHelper().inferTypeArguments(typeParameters, new PsiType[]{returnType}, new PsiType[]{currentType}, PsiUtil.getLanguageLevel(psiMethod));
diff --git a/java/java-impl/java-impl.iml b/java/java-impl/java-impl.iml
index 688a8d3..6067c7e 100644
--- a/java/java-impl/java-impl.iml
+++ b/java/java-impl/java-impl.iml
@@ -53,6 +53,7 @@
     <orderEntry type="library" name="Velocity" level="project" />
     <orderEntry type="module" module-name="testFramework-java" scope="TEST" />
     <orderEntry type="module" module-name="java-structure-view" exported="" />
+    <orderEntry type="module" module-name="spellchecker" />
   </component>
   <component name="copyright">
     <Base>
diff --git a/java/java-impl/src/com/intellij/analysis/BaseClassesAnalysisAction.java b/java/java-impl/src/com/intellij/analysis/BaseClassesAnalysisAction.java
index 7d7692a..383e62d 100644
--- a/java/java-impl/src/com/intellij/analysis/BaseClassesAnalysisAction.java
+++ b/java/java-impl/src/com/intellij/analysis/BaseClassesAnalysisAction.java
@@ -48,8 +48,11 @@
         indicator.setIndeterminate(true);
         indicator.setText(AnalysisScopeBundle.message("checking.class.files"));
 
-        final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
-        final boolean upToDate = compilerManager.isUpToDate(compilerManager.createProjectCompileScope(myProject));
+        if (project.isDisposed()) {
+          return;
+        }
+        final CompilerManager compilerManager = CompilerManager.getInstance(project);
+        final boolean upToDate = compilerManager.isUpToDate(compilerManager.createProjectCompileScope(project));
 
         ApplicationManager.getApplication().invokeLater(new Runnable() {
           @Override
@@ -92,6 +95,9 @@
   }
 
   private void compileAndAnalyze(final Project project, final AnalysisScope scope) {
+    if (project.isDisposed()) {
+      return;
+    }
     final CompilerManager compilerManager = CompilerManager.getInstance(project);
     compilerManager.make(compilerManager.createProjectCompileScope(project), new CompileStatusNotification() {
       @Override
diff --git a/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.form b/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.form
index f3656e9..6c8a5e4 100644
--- a/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.form
+++ b/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.form
@@ -168,7 +168,7 @@
               </grid>
               <grid id="81c32" binding="myMembersPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
                 <constraints>
-                  <grid row="0" column="1" row-span="5" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
+                  <grid row="0" column="1" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/>
                 </constraints>
                 <properties/>
                 <clientProperties>
@@ -283,6 +283,21 @@
                   </component>
                 </children>
               </grid>
+              <grid id="edade" binding="myVisibilityPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
+                <constraints>
+                  <grid row="2" column="1" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+                </constraints>
+                <properties/>
+                <clientProperties>
+                  <BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
+                </clientProperties>
+                <border type="none"/>
+                <children>
+                  <vspacer id="69bbc">
+                    <constraints border-constraint="Center"/>
+                  </vspacer>
+                </children>
+              </grid>
             </children>
           </grid>
         </children>
diff --git a/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.java b/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.java
index aebfb44..91b40d1 100644
--- a/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.java
+++ b/java/java-impl/src/com/intellij/application/options/CodeStyleGenerationConfigurable.java
@@ -16,6 +16,7 @@
 package com.intellij.application.options;
 
 import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
+import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.application.ApplicationBundle;
 import com.intellij.openapi.options.Configurable;
 import com.intellij.openapi.options.ConfigurationException;
@@ -23,6 +24,8 @@
 import com.intellij.openapi.project.ProjectManager;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
+import com.intellij.refactoring.ui.JavaVisibilityPanel;
 import com.intellij.ui.IdeBorderFactory;
 import com.intellij.ui.ToolbarDecorator;
 import com.intellij.ui.components.JBList;
@@ -33,6 +36,7 @@
 import java.util.List;
 
 public class CodeStyleGenerationConfigurable implements Configurable {
+  private final JavaVisibilityPanel myJavaVisibilityPanel;
   JPanel myPanel;
   private JTextField myFieldPrefixField;
   private JTextField myStaticFieldPrefixField;
@@ -57,17 +61,20 @@
   private JCheckBox myInsertOverrideAnnotationCheckBox;
   private JPanel myMembersPanel;
   private JCheckBox myRepeatSynchronizedCheckBox;
+  private JPanel myVisibilityPanel;
 
   public CodeStyleGenerationConfigurable(CodeStyleSettings settings) {
     mySettings = settings;
     myMembersOrderList = new MembersOrderList();
     myPanel.setBorder(IdeBorderFactory.createEmptyBorder(2, 2, 2, 2));
+    myJavaVisibilityPanel = new JavaVisibilityPanel(false, true);
   }
 
   public JComponent createComponent() {
     final JPanel panel = ToolbarDecorator.createDecorator(myMembersOrderList)
       .disableAddAction().disableRemoveAction().createPanel();
     myMembersPanel.add(panel, BorderLayout.CENTER);
+    myVisibilityPanel.add(myJavaVisibilityPanel, BorderLayout.CENTER);
     return myPanel;
   }
 
@@ -204,6 +211,7 @@
   }*/
 
   public void reset(CodeStyleSettings settings) {
+    CommonCodeStyleSettings javaCommonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
     myCbPreferLongerNames.setSelected(settings.PREFER_LONGER_NAMES);
 
     myFieldPrefixField.setText(settings.FIELD_NAME_PREFIX);
@@ -216,8 +224,8 @@
     myParameterSuffixField.setText(settings.PARAMETER_NAME_SUFFIX);
     myLocalVariableSuffixField.setText(settings.LOCAL_VARIABLE_NAME_SUFFIX);
 
-    myCbLineCommentAtFirstColumn.setSelected(settings.LINE_COMMENT_AT_FIRST_COLUMN);
-    myCbBlockCommentAtFirstColumn.setSelected(settings.BLOCK_COMMENT_AT_FIRST_COLUMN);
+    myCbLineCommentAtFirstColumn.setSelected(javaCommonSettings.LINE_COMMENT_AT_FIRST_COLUMN);
+    myCbBlockCommentAtFirstColumn.setSelected(javaCommonSettings.BLOCK_COMMENT_AT_FIRST_COLUMN);
 
     myCbGenerateFinalLocals.setSelected(settings.GENERATE_FINAL_LOCALS);
     myCbGenerateFinalParameters.setSelected(settings.GENERATE_FINAL_PARAMETERS);
@@ -226,6 +234,7 @@
     myCbUseExternalAnnotations.setSelected(settings.USE_EXTERNAL_ANNOTATIONS);
     myInsertOverrideAnnotationCheckBox.setSelected(settings.INSERT_OVERRIDE_ANNOTATION);
     myRepeatSynchronizedCheckBox.setSelected(settings.REPEAT_SYNCHRONIZED);
+    myJavaVisibilityPanel.setVisibility(settings.VISIBILITY);
   }
 
   public void reset() {
@@ -233,6 +242,7 @@
   }
 
   public void apply(CodeStyleSettings settings) throws ConfigurationException {
+    CommonCodeStyleSettings javaCommonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
     settings.PREFER_LONGER_NAMES = myCbPreferLongerNames.isSelected();
 
     settings.FIELD_NAME_PREFIX = setPrefixSuffix(myFieldPrefixField.getText(), true);
@@ -245,8 +255,8 @@
     settings.PARAMETER_NAME_SUFFIX = setPrefixSuffix(myParameterSuffixField.getText(), false);
     settings.LOCAL_VARIABLE_NAME_SUFFIX = setPrefixSuffix(myLocalVariableSuffixField.getText(), false);
 
-    settings.LINE_COMMENT_AT_FIRST_COLUMN = myCbLineCommentAtFirstColumn.isSelected();
-    settings.BLOCK_COMMENT_AT_FIRST_COLUMN = myCbBlockCommentAtFirstColumn.isSelected();
+    javaCommonSettings.LINE_COMMENT_AT_FIRST_COLUMN = myCbLineCommentAtFirstColumn.isSelected();
+    javaCommonSettings.BLOCK_COMMENT_AT_FIRST_COLUMN = myCbBlockCommentAtFirstColumn.isSelected();
 
     settings.GENERATE_FINAL_LOCALS = myCbGenerateFinalLocals.isSelected();
     settings.GENERATE_FINAL_PARAMETERS = myCbGenerateFinalParameters.isSelected();
@@ -254,6 +264,8 @@
     settings.USE_EXTERNAL_ANNOTATIONS = myCbUseExternalAnnotations.isSelected();
     settings.INSERT_OVERRIDE_ANNOTATION = myInsertOverrideAnnotationCheckBox.isSelected();
     settings.REPEAT_SYNCHRONIZED = myRepeatSynchronizedCheckBox.isSelected();
+    
+    settings.VISIBILITY = myJavaVisibilityPanel.getVisibility();
 
     myMembersOrderList.apply(settings);
 
@@ -276,6 +288,8 @@
   }
 
   public boolean isModified(CodeStyleSettings settings) {
+    CommonCodeStyleSettings javaCommonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
+
     boolean isModified = isModified(myCbPreferLongerNames, settings.PREFER_LONGER_NAMES);
 
     isModified |= isModified(myFieldPrefixField, settings.FIELD_NAME_PREFIX);
@@ -288,8 +302,8 @@
     isModified |= isModified(myParameterSuffixField, settings.PARAMETER_NAME_SUFFIX);
     isModified |= isModified(myLocalVariableSuffixField, settings.LOCAL_VARIABLE_NAME_SUFFIX);
 
-    isModified |= isModified(myCbLineCommentAtFirstColumn, settings.LINE_COMMENT_AT_FIRST_COLUMN);
-    isModified |= isModified(myCbBlockCommentAtFirstColumn, settings.BLOCK_COMMENT_AT_FIRST_COLUMN);
+    isModified |= isModified(myCbLineCommentAtFirstColumn, javaCommonSettings.LINE_COMMENT_AT_FIRST_COLUMN);
+    isModified |= isModified(myCbBlockCommentAtFirstColumn, javaCommonSettings.BLOCK_COMMENT_AT_FIRST_COLUMN);
 
 
     isModified |= isModified(myCbGenerateFinalLocals, settings.GENERATE_FINAL_LOCALS);
@@ -300,6 +314,7 @@
     isModified |= isModified(myRepeatSynchronizedCheckBox, settings.REPEAT_SYNCHRONIZED);
 
     isModified |= myMembersOrderList.isModified(settings);
+    isModified |= !settings.VISIBILITY.equals(myJavaVisibilityPanel.getVisibility());
 
     return isModified;
   }
diff --git a/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java b/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java
index e7d0082..9b19ff3 100644
--- a/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java
+++ b/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java
@@ -97,12 +97,12 @@
 
     this.add(
       ToolbarDecorator.createDecorator(myImportLayoutTable = createTableForPackageEntries(myImportLayoutList, this))
-        .addExtraAction(new AnActionButton(ApplicationBundle.message("button.add.package"), IconUtil.getAddPackageIcon()) {
+        .addExtraAction(new DumbAwareActionButton(ApplicationBundle.message("button.add.package"), IconUtil.getAddPackageIcon()) {
           @Override
           public void actionPerformed(AnActionEvent e) {
             addPackageToImportLayouts();
           }
-        }).addExtraAction(new AnActionButton(ApplicationBundle.message("button.add.blank"), IconUtil.getAddBlankLineIcon()) {
+        }).addExtraAction(new DumbAwareActionButton(ApplicationBundle.message("button.add.blank"), IconUtil.getAddBlankLineIcon()) {
         @Override
         public void actionPerformed(AnActionEvent e) {
           addBlankLine();
diff --git a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
index f2445e1..0929b4a 100644
--- a/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/ExpectedTypesProvider.java
@@ -495,7 +495,7 @@
         PsiExpression rExpr = assignment.getRExpression();
         if (rExpr != null) {
           PsiType type = rExpr.getType();
-          if (type != null) {
+          if (type != null && type != PsiType.NULL) {
             if (type instanceof PsiClassType) {
               final PsiClass resolved = ((PsiClassType)type).resolve();
               if (resolved instanceof PsiAnonymousClass) {
@@ -529,7 +529,7 @@
       PsiResolveHelper helper = JavaPsiFacade.getInstance(list.getProject()).getResolveHelper();
       if (list.getParent() instanceof PsiMethodCallExpression) {
         PsiMethodCallExpression methodCall = (PsiMethodCallExpression)list.getParent();
-        CandidateInfo[] candidates = helper.getReferencedMethodCandidates(methodCall, false);
+        CandidateInfo[] candidates = helper.getReferencedMethodCandidates(methodCall, false, true);
         Collections.addAll(myResult, getExpectedArgumentTypesForMethodCall(candidates, list, myExpr, myForCompletion));
       }
       else if (list.getParent() instanceof PsiEnumConstant) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/TargetElementUtil.java b/java/java-impl/src/com/intellij/codeInsight/TargetElementUtil.java
index f1ce89e..87b9c1b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/TargetElementUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/TargetElementUtil.java
@@ -139,6 +139,7 @@
   }
 
 
+  @Nullable
   @Override
   protected PsiElement getNamedElement(final PsiElement element) {
     PsiElement parent = element.getParent();
@@ -156,6 +157,7 @@
         return parent;
       }
     }
+    //TODO: Code below this comment is very similar to parent code. We probably need to use "super()" instead, to prevent copy/paste in inheritors
     else if ((parent = PsiTreeUtil.getParentOfType(element, PsiNamedElement.class, false)) != null) {
       // A bit hacky depends on navigation offset correctly overridden
       if (parent.getTextOffset() == element.getTextRange().getStartOffset() && !(parent instanceof XmlAttribute)
@@ -163,7 +165,10 @@
         return parent;
       }
     }
-    return null;
+    if (element == null) {
+      return null;
+    }
+    return getTargetElementByExtensions(element);
   }
 
   @Nullable
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java
index f18c789..5077c13 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -107,7 +107,7 @@
 
     PsiScopesUtil.treeWalkUp(new BaseScopeProcessor() {
       @Override
-      public boolean execute(@NotNull PsiElement element, ResolveState state) {
+      public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
         if (element instanceof PsiLocalVariable) {
           if (!matcher.prefixMatches(((PsiLocalVariable)element).getName())) {
             return true;
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
index 52725a0..c83b0a9 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
@@ -514,8 +514,7 @@
     addUnfinishedMethodTypeParameters(position, result);
 
     if (JavaSmartCompletionContributor.INSIDE_EXPRESSION.accepts(position) &&
-        !AFTER_DOT.accepts(position) &&
-        !(position.getParent() instanceof PsiLiteralExpression)) {
+        !AFTER_DOT.accepts(position)) {
       addExpectedTypeMembers(parameters, result);
       if (SameSignatureCallParametersProvider.IN_CALL_ARGUMENT.accepts(position)) {
         new SameSignatureCallParametersProvider().addCompletions(parameters, new ProcessingContext(), result);
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
index a5fd607..fd0de03 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionUtil.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.
@@ -303,7 +303,7 @@
     final Ref<PsiSubstitutor> subst = Ref.create(PsiSubstitutor.EMPTY);
     class MyProcessor extends BaseScopeProcessor implements NameHint, ElementClassHint {
       @Override
-      public boolean execute(@NotNull PsiElement element, ResolveState state) {
+      public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
         if (element == member) {
           subst.set(state.get(PsiSubstitutor.KEY));
         }
@@ -311,7 +311,7 @@
       }
 
       @Override
-      public String getName(ResolveState state) {
+      public String getName(@NotNull ResolveState state) {
         return member.getName();
       }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java
index 542e4ad..a484e4b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMemberNameCompletionContributor.java
@@ -109,7 +109,9 @@
     String propertyName = null;
     if (variableKind == VariableKind.PARAMETER) {
       final PsiMethod method = PsiTreeUtil.getParentOfType(var, PsiMethod.class);
-      propertyName = PropertyUtil.getPropertyName(method);
+      if (method != null) {
+        propertyName = PropertyUtil.getPropertyName(method);
+      }
       if (method != null && method.getName().startsWith("with")) {
         propertyName = StringUtil.decapitalize(method.getName().substring(4));
       }
@@ -133,7 +135,7 @@
       addLookupItems(set, null, matcher, project, getOverlappedNameVersions(matcher.getPrefix(), suggestedNames, ""));
     }
     PsiElement parent = PsiTreeUtil.getParentOfType(var, PsiCodeBlock.class);
-    if(parent == null) parent = PsiTreeUtil.getParentOfType(var, PsiMethod.class);
+    if(parent == null) parent = PsiTreeUtil.getParentOfType(var, PsiMethod.class, PsiLambdaExpression.class);
     addLookupItems(set, suggestedNameInfo, matcher, project, getUnresolvedReferences(parent, false));
     if (var instanceof PsiParameter && parent instanceof PsiMethod) {
       addSuggestionsInspiredByFieldNames(set, matcher, var, project, codeStyleManager);
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java
index 1e0fa6c..0cb4d2c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java
@@ -83,7 +83,7 @@
       new GeneratorFilter(AssignableGroupFilter.class, new ThrowsListGetter()),
       new AssignableFromFilter(CommonClassNames.JAVA_LANG_THROWABLE));
   public static final ElementPattern<PsiElement> INSIDE_EXPRESSION = or(
-        psiElement().withParent(PsiExpression.class).andNot(psiElement().withParent(PsiLiteralExpression.class)),
+        psiElement().withParent(PsiExpression.class).andNot(psiElement().withParent(PsiLiteralExpression.class)).andNot(psiElement().withParent(PsiMethodReferenceExpression.class)),
         psiElement().inside(PsiClassObjectAccessExpression.class),
         psiElement().inside(PsiThisExpression.class),
         psiElement().inside(PsiSuperExpression.class)
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/LambdaCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/LambdaCompletionProvider.java
index 3c0e9ac..f169ccd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/LambdaCompletionProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/LambdaCompletionProvider.java
@@ -26,6 +26,7 @@
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Function;
 import com.intellij.util.ProcessingContext;
@@ -44,14 +45,15 @@
     for (ExpectedTypeInfo expectedType : expectedTypes) {
       final PsiType defaultType = expectedType.getDefaultType();
       if (LambdaUtil.isFunctionalType(defaultType)) {
-        final PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(defaultType);
+        final PsiType functionalInterfaceType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(defaultType);
+        final PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType);
         if (method != null) {
           PsiParameter[] params = method.getParameterList().getParameters();
           final Project project = method.getProject();
           final PsiElement originalPosition = parameters.getOriginalPosition();
           final JVMElementFactory jvmElementFactory = originalPosition != null ? JVMElementFactories.getFactory(originalPosition.getLanguage(), project) : null;
           if (jvmElementFactory != null) {
-            final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(method, PsiUtil.resolveGenericsClassInType(defaultType));
+            final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(method, PsiUtil.resolveGenericsClassInType(functionalInterfaceType));
             final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
             params = GenerateMembersUtil.overriddenParameters(params, jvmElementFactory, codeStyleManager, substitutor, originalPosition);
           }
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java
index f060567..1f490bf 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/MethodReferenceCompletionProvider.java
@@ -19,14 +19,19 @@
 import com.intellij.codeInsight.ExpectedTypeInfoImpl;
 import com.intellij.codeInsight.TailType;
 import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.psi.LambdaUtil;
-import com.intellij.psi.PsiType;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Consumer;
 import com.intellij.util.ProcessingContext;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.Map;
+
 public class MethodReferenceCompletionProvider extends CompletionProvider<CompletionParameters> {
+  private static final Logger LOG = Logger.getInstance("#" + MethodReferenceCompletionProvider.class.getName());
+
   @Override
   protected void addCompletions(@NotNull CompletionParameters parameters,
                                 ProcessingContext context,
@@ -36,15 +41,36 @@
     for (ExpectedTypeInfo expectedType : expectedTypes) {
       final PsiType defaultType = expectedType.getDefaultType();
       if (LambdaUtil.isFunctionalType(defaultType)) {
-        final PsiType returnType = LambdaUtil.getFunctionalInterfaceReturnType(defaultType);
+        final PsiType functionalType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(defaultType);
+        final PsiType returnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalType);
         if (returnType != null) {
+          final PsiMethodReferenceExpression ref = (PsiMethodReferenceExpression)parameters.getPosition().getParent();
           final ExpectedTypeInfoImpl typeInfo =
             new ExpectedTypeInfoImpl(returnType, ExpectedTypeInfo.TYPE_OR_SUBTYPE, returnType, TailType.UNKNOWN, null,
                                      ExpectedTypeInfoImpl.NULL);
+          final Map<PsiMethodReferenceExpression, PsiType> map = PsiMethodReferenceUtil.getFunctionalTypeMap();
           Consumer<LookupElement> noTypeCheck = new Consumer<LookupElement>() {
             @Override
             public void consume(final LookupElement lookupElement) {
-              result.addElement(lookupElement);
+              final PsiElement element = lookupElement.getPsiElement();
+              if (element instanceof PsiMethod) {
+               final PsiMethodReferenceExpression referenceExpression = (PsiMethodReferenceExpression)ref.copy();
+                final PsiElement referenceNameElement = referenceExpression.getReferenceNameElement();
+                LOG.assertTrue(referenceNameElement != null, referenceExpression);
+                referenceNameElement.replace(JavaPsiFacade.getElementFactory(element.getProject()).createIdentifier(((PsiMethod)element).getName()));
+                final PsiType added = map.put(referenceExpression, functionalType);
+                try {
+                  final PsiElement resolve = referenceExpression.resolve();
+                  if (resolve == element && PsiMethodReferenceUtil.checkMethodReferenceContext(referenceExpression, resolve, functionalType) == null) {
+                    result.addElement(lookupElement);
+                  }
+                }
+                finally {
+                  if (added == null) {
+                    map.remove(referenceExpression);
+                  }
+                }
+              }
             }
           };
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java
index ab8f6be..c05a29b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/proc/VariablesProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -66,7 +66,7 @@
 
   /** Always return true since we wanna get all vars in scope */
   @Override
-  public boolean execute(@NotNull PsiElement pe, ResolveState state){
+  public boolean execute(@NotNull PsiElement pe, @NotNull ResolveState state){
     if(pe instanceof PsiVariable){
       final PsiVariable pvar = (PsiVariable)pe;
       final String pvar_name = pvar.getName();
@@ -81,7 +81,7 @@
   }
 
   @Override
-  public final void handleEvent(Event event, Object associated){
+  public final void handleEvent(@NotNull Event event, Object associated){
     if(event == JavaScopeProcessorEvent.START_STATIC)
       myStaticScopeFlag = true;
   }
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
index 041b7f6..fb7878d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -77,7 +77,7 @@
   private final Condition<String> myMatcher;
   private final Options myOptions;
   private final Set<PsiField> myNonInitializedFields = new HashSet<PsiField>();
-  private boolean myAllowStaticWithInstanceQualifier;
+  private final boolean myAllowStaticWithInstanceQualifier;
 
   public JavaCompletionProcessor(@NotNull PsiElement element, ElementFilter filter, Options options, @NotNull Condition<String> nameCondition) {
     myOptions = options;
@@ -196,7 +196,7 @@
   }
 
   @Override
-  public void handleEvent(Event event, Object associated){
+  public void handleEvent(@NotNull Event event, Object associated){
     if(event == JavaScopeProcessorEvent.START_STATIC){
       myStatic = true;
     }
@@ -209,7 +209,7 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     //noinspection SuspiciousMethodCalls
     if (myNonInitializedFields.contains(element)) {
       return true;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java
index 0d48f25..aa8ddc5 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/IconLineMarkerProvider.java
@@ -23,6 +23,7 @@
 import com.intellij.openapi.editor.markup.GutterIconRenderer;
 import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.IconLoader;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -30,14 +31,13 @@
 import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.util.ImageLoader;
-import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.event.MouseEvent;
+import java.io.File;
 import java.io.IOException;
 import java.util.*;
 
@@ -208,40 +208,11 @@
 
   private static Icon createOrFindBetterIcon(VirtualFile file, boolean tryToFindBetter) throws IOException {
     if (tryToFindBetter) {
-      VirtualFile parent = file.getParent();
-      String name = file.getNameWithoutExtension();
-      String ext = file.getExtension();
-      VirtualFile newFile;
-      boolean retina = UIUtil.isRetina();
-      boolean dark = UIUtil.isUnderDarcula();
-      if (retina && dark) {
-        newFile = parent.findChild(name + "@2x_dark." + ext);
-        if (newFile != null) {
-          return loadIcon(newFile, 2);
-        }
-      }
-
-      if (dark) {
-        newFile = parent.findChild(name + "_dark." + ext);
-        if (newFile != null) {
-          return loadIcon(file, 1);
-        }
-      }
-
-      if (retina) {
-        newFile = parent.findChild(name + "@2x." + ext);
-        if (newFile != null) {
-          return loadIcon(newFile, 2);
-        }
-      }
+      return IconLoader.findIcon(new File(file.getPath()).toURI().toURL());
     }
     return new ImageIcon(file.contentsToByteArray());
   }
 
-  private static ImageIcon loadIcon(VirtualFile file, int scale) throws IOException {
-    return new ImageIcon(ImageLoader.loadFromStream(file.getInputStream(), scale));
-  }
-
   private static boolean isIconClassType(PsiType type) {
     return InheritanceUtil.isInheritor(type, JAVAX_SWING_ICON);
   }
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPassFactory.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPassFactory.java
index 54a9bc2..de13524 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPassFactory.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPassFactory.java
@@ -23,7 +23,6 @@
 import com.intellij.codeInsight.daemon.impl.analysis.HighlightVisitorImpl;
 import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
-import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
 import com.intellij.openapi.components.AbstractProjectComponent;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
@@ -84,32 +83,29 @@
     return create(file, document, null, highlightInfoProcessor);
   }
 
-  private PostHighlightingPass create(@NotNull PsiFile file,
+  private PostHighlightingPass create(@NotNull final PsiFile file,
                                       @NotNull Document document, Editor editor,
                                       @NotNull HighlightInfoProcessor highlightInfoProcessor) {
-    HighlightDisplayKey unusedImportKey = HighlightDisplayKey.find(UnusedImportLocalInspection.SHORT_NAME);
     InspectionProfile profile = InspectionProjectProfileManager.getInstance(file.getProject()).getInspectionProfile();
-    boolean importEnabled = isUnusedImportEnabled(unusedImportKey, file, profile);
     final UnusedDeclarationInspection myDeadCodeInspection = (UnusedDeclarationInspection)profile.getUnwrappedTool(UnusedDeclarationInspection.SHORT_NAME, file);
     HighlightDisplayKey myDeadCodeKey = HighlightDisplayKey.find(UnusedDeclarationInspection.SHORT_NAME);
     final boolean myDeadCodeEnabled = profile.isToolEnabled(myDeadCodeKey, file);
 
-    return new PostHighlightingPass(myProject, file, editor, document, highlightInfoProcessor, importEnabled, new Predicate<PsiElement>() {
+    return new PostHighlightingPass(myProject, file, editor, document, highlightInfoProcessor, new Predicate<PsiElement>() {
       @Override
       public boolean apply(PsiElement member) {
         return !myDeadCodeEnabled || myDeadCodeInspection.isEntryPoint(member);
       }
-    });
+    }) {
+      @Override
+      protected boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey) {
+        return super.isUnusedImportEnabled(unusedImportKey) && PostHighlightingPassFactory.isUnusedImportEnabled(file);
+      }
+    };
   }
 
-  private static boolean isUnusedImportEnabled(HighlightDisplayKey unusedImportKey, @NotNull PsiFile file, InspectionProfile profile) {
-    boolean unusedImportEnabled = profile.isToolEnabled(unusedImportKey, file);
-    if (unusedImportEnabled && JspPsiUtil.isInJspFile(file)) {
-      final JspFile jspFile = JspPsiUtil.getJspFile(file);
-      if (jspFile != null) {
-        unusedImportEnabled = !JspSpiUtil.isIncludedOrIncludesSomething(jspFile);
-      }
-    }
-    return unusedImportEnabled;
+  private static boolean isUnusedImportEnabled(PsiElement file) {
+    final JspFile jspFile = JspPsiUtil.getJspFile(file);
+    return jspFile == null || !JspSpiUtil.isIncludedOrIncludesSomething(jspFile);
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java
index c20848c..abcff22 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAbstractMethodFromUsageFix.java
@@ -45,7 +45,7 @@
   }
 
   @Override
-  protected String getVisibility(PsiClass parentClass, PsiClass targetClass) {
+  protected String getVisibility(PsiClass parentClass, @NotNull PsiClass targetClass) {
     String result = super.getVisibility(parentClass, targetClass);
     return PsiModifier.PUBLIC.equals(result) ? result : PsiModifier.PROTECTED;
   }
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java
index 4972ed1..b5b93f6 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateEnumConstantFromUsageFix.java
@@ -28,9 +28,11 @@
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Function;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.Collections;
 import java.util.List;
 
 public class CreateEnumConstantFromUsageFix extends CreateVarFromUsageFix implements HighPriorityAction{
@@ -87,6 +89,34 @@
     }
   }
 
+  @NotNull
+  @Override
+  protected List<PsiClass> getTargetClasses(PsiElement element) {
+    final List<PsiClass> classes = super.getTargetClasses(element);
+    PsiClass enumClass = null;
+    for (PsiClass aClass : classes) {
+      if (aClass.isEnum()) {
+        if (enumClass == null) {
+          enumClass = aClass;
+        } else {
+          enumClass = null;
+          break;
+        }
+      }
+    }
+
+    if (enumClass != null) {
+      return Collections.singletonList(enumClass);
+    }
+    ExpectedTypeInfo[] typeInfos = CreateFromUsageUtils.guessExpectedTypes(myReferenceExpression, false);
+    for (final ExpectedTypeInfo typeInfo : typeInfos) {
+      final PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(typeInfo.getType());
+      if (psiClass != null && psiClass.isEnum()) {
+        return Collections.singletonList(psiClass);
+      }
+    }
+    return Collections.emptyList();
+  }
 
   @Override
   protected boolean isAvailableImpl(int offset) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java
index 16eb888..062b8a1 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageBaseFix.java
@@ -35,6 +35,7 @@
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.PsiUtilCore;
@@ -162,20 +163,26 @@
     return FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
   }
 
-  protected void setupVisibility(PsiClass parentClass, PsiClass targetClass, PsiModifierList list) throws IncorrectOperationException {
+  protected void setupVisibility(PsiClass parentClass, @NotNull PsiClass targetClass, PsiModifierList list) throws IncorrectOperationException {
     if (targetClass.isInterface() && list.getFirstChild() != null) {
       list.deleteChildRange(list.getFirstChild(), list.getLastChild());
       return;
     }
-    VisibilityUtil.setVisibility(list, getVisibility(parentClass, targetClass));
+    final String visibility = getVisibility(parentClass, targetClass);
+    if (VisibilityUtil.ESCALATE_VISIBILITY.equals(visibility)) {
+      list.setModifierProperty(PsiModifier.PRIVATE, true);
+      VisibilityUtil.escalateVisibility(list, parentClass);
+    } else {
+      VisibilityUtil.setVisibility(list, visibility);
+    }
   }
 
   @PsiModifier.ModifierConstant
-  protected String getVisibility(PsiClass parentClass, PsiClass targetClass) {
+  protected String getVisibility(PsiClass parentClass, @NotNull PsiClass targetClass) {
     if (parentClass != null && (parentClass.equals(targetClass) || PsiTreeUtil.isAncestor(targetClass, parentClass, true))) {
       return PsiModifier.PRIVATE;
     } else {
-      return PsiModifier.PUBLIC;
+      return CodeStyleSettingsManager.getSettings(targetClass.getProject()).VISIBILITY;
     }
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
index 1df89f7..70fa107 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateFromUsageUtils.java
@@ -523,7 +523,7 @@
     final List<PsiVariable> list = new ArrayList<PsiVariable>();
     VariablesProcessor varproc = new VariablesProcessor("", true, list){
       @Override
-      public boolean execute(@NotNull PsiElement element, ResolveState state) {
+      public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
         if(!(element instanceof PsiField) ||
            JavaPsiFacade.getInstance(element.getProject()).getResolveHelper().isAccessible((PsiField)element, expression, null)) {
           return super.execute(element, state);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateLocalVarFromInstanceofAction.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateLocalVarFromInstanceofAction.java
index 2325057..9c3e36b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateLocalVarFromInstanceofAction.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateLocalVarFromInstanceofAction.java
@@ -206,6 +206,7 @@
       final PsiStatement statementInside = isNegated(instanceOfExpression) ? null : getExpressionStatementInside(file, editor, instanceOfExpression.getOperand());
       PsiDeclarationStatement decl = createLocalVariableDeclaration(instanceOfExpression, statementInside);
       if (decl == null) return;
+      decl = (PsiDeclarationStatement)CodeStyleManager.getInstance(project).reformat(decl);
       decl = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(decl);
 
       PsiLocalVariable localVariable = (PsiLocalVariable)decl.getDeclaredElements()[0];
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java
new file mode 100644
index 0000000..b0c29bf
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromMethodReferenceFix.java
@@ -0,0 +1,156 @@
+/*
+ * 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.daemon.impl.quickfix;
+
+import com.intellij.codeInsight.ExpectedTypeInfo;
+import com.intellij.codeInsight.ExpectedTypeInfoImpl;
+import com.intellij.codeInsight.TailType;
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+public class CreateMethodFromMethodReferenceFix extends CreateFromUsageBaseFix {
+  private static final Logger LOG = Logger.getInstance("#" + CreateMethodFromMethodReferenceFix.class.getName());
+
+  private final SmartPsiElementPointer myMethodReferenceExpression;
+
+  public CreateMethodFromMethodReferenceFix(@NotNull PsiMethodReferenceExpression methodRef) {
+    myMethodReferenceExpression = SmartPointerManager.getInstance(methodRef.getProject()).createSmartPsiElementPointer(methodRef);
+  }
+
+  @Override
+  protected boolean isAvailableImpl(int offset) {
+    final PsiMethodReferenceExpression call = getMethodReference();
+    if (call == null || !call.isValid()) return false;
+    final PsiType functionalInterfaceType = call.getFunctionalInterfaceType();
+    if (functionalInterfaceType == null || 
+        LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType) == null){
+      return false;
+    }
+
+    final String name = call.getReferenceName();
+
+    if (name == null) return false;
+    if (call.isConstructor() && name.equals("new") || PsiNameHelper.getInstance(call.getProject()).isIdentifier(name)) {
+      setText(call.isConstructor() ? QuickFixBundle.message("create.constructor.from.new.text") : QuickFixBundle.message("create.method.from.usage.text", name));
+      return true;
+    }
+    return false;
+  }
+
+  @Override
+  protected PsiElement getElement() {
+    final PsiMethodReferenceExpression call = getMethodReference();
+    if (call == null || !call.getManager().isInProject(call)) return null;
+    return call;
+  }
+
+  @Override
+  @NotNull
+  protected List<PsiClass> getTargetClasses(PsiElement element) {
+    List<PsiClass> targets = super.getTargetClasses(element);
+    PsiMethodReferenceExpression call = getMethodReference();
+    if (call == null) return Collections.emptyList();
+    return targets;
+  }
+
+  @Override
+  protected void invokeImpl(final PsiClass targetClass) {
+    if (targetClass == null) return;
+    PsiMethodReferenceExpression expression = getMethodReference();
+    if (expression == null) return;
+
+    if (isValidElement(expression)) return;
+
+    PsiClass parentClass = PsiTreeUtil.getParentOfType(expression, PsiClass.class);
+    PsiMember enclosingContext = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, PsiField.class, PsiClassInitializer.class);
+
+    String methodName = expression.getReferenceName();
+    LOG.assertTrue(methodName != null);
+
+
+    final Project project = targetClass.getProject();
+    JVMElementFactory elementFactory = JVMElementFactories.getFactory(targetClass.getLanguage(), project);
+    if (elementFactory == null) elementFactory = JavaPsiFacade.getElementFactory(project);
+
+    PsiMethod method = expression.isConstructor() ? (PsiMethod)targetClass.add(elementFactory.createConstructor()) 
+                                                  : CreateMethodFromUsageFix.createMethod(targetClass, parentClass, enclosingContext, methodName);
+    if (method == null) {
+      return;
+    }
+
+    if (!expression.isConstructor()) {
+      setupVisibility(parentClass, targetClass, method.getModifierList());
+    }
+
+    expression = getMethodReference();
+    LOG.assertTrue(expression.isValid());
+
+    if (!expression.isConstructor() && shouldCreateStaticMember(expression, targetClass)) {
+      PsiUtil.setModifierProperty(method, PsiModifier.STATIC, true);
+    }
+
+    final PsiElement context = PsiTreeUtil.getParentOfType(expression, PsiClass.class, PsiMethod.class);
+
+    final PsiType functionalInterfaceType = expression.getFunctionalInterfaceType();
+    final PsiClassType.ClassResolveResult classResolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
+    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(classResolveResult);
+    LOG.assertTrue(interfaceMethod != null);
+
+    final PsiType interfaceReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
+    LOG.assertTrue(interfaceReturnType != null);
+
+    final ExpectedTypeInfo[] expectedTypes = {new ExpectedTypeInfoImpl(interfaceReturnType, ExpectedTypeInfo.TYPE_OR_SUBTYPE, interfaceReturnType, TailType.NONE, null, ExpectedTypeInfoImpl.NULL)};
+    CreateMethodFromUsageFix.doCreate(targetClass, method, false,
+                                      ContainerUtil.map2List(interfaceMethod.getParameterList().getParameters(), new Function<PsiParameter, Pair<PsiExpression, PsiType>>() {
+                                        @Override
+                                        public Pair<PsiExpression, PsiType> fun(PsiParameter parameter) {
+                                          return Pair.create(null, parameter.getType());
+                                        }
+                                      }),
+                                      LambdaUtil.getSubstitutor(interfaceMethod, classResolveResult),
+                                      expectedTypes, context);
+  }
+
+  
+
+  @Override
+  protected boolean isValidElement(PsiElement element) {
+    return false;
+  }
+
+  @Override
+  @NotNull
+  public String getFamilyName() {
+    return QuickFixBundle.message("create.method.from.usage.family");
+  }
+
+  @Nullable
+  protected PsiMethodReferenceExpression getMethodReference() {
+    return (PsiMethodReferenceExpression)myMethodReferenceExpression.getElement();
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java
index 3f02e6e..3ce0127 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateMethodFromUsageFix.java
@@ -66,7 +66,7 @@
     PsiReferenceExpression ref = call.getMethodExpression();
     String name = ref.getReferenceName();
 
-    if (name == null || !JavaPsiFacade.getInstance(ref.getProject()).getNameHelper().isIdentifier(name)) return false;
+    if (name == null || !PsiNameHelper.getInstance(ref.getProject()).isIdentifier(name)) return false;
     if (hasErrorsInArgumentList(call)) return false;
     setText(getDisplayString(name));
     return true;
@@ -133,7 +133,6 @@
     if (targetClass == null) return;
     PsiMethodCallExpression expression = getMethodCall();
     if (expression == null) return;
-    final Project project = expression.getProject();
     PsiReferenceExpression ref = expression.getMethodExpression();
 
     if (isValidElement(expression)) return;
@@ -144,30 +143,11 @@
     String methodName = ref.getReferenceName();
     LOG.assertTrue(methodName != null);
 
-    JVMElementFactory factory = JVMElementFactories.getFactory(targetClass.getLanguage(), project);
-    if (factory == null) {
+    PsiMethod method = createMethod(targetClass, parentClass, enclosingContext, methodName);
+    if (method == null) {
       return;
     }
 
-    PsiMethod method = factory.createMethod(methodName, PsiType.VOID);
-
-    if (targetClass.equals(parentClass)) {
-      method = (PsiMethod)targetClass.addAfter(method, enclosingContext);
-    }
-    else {
-      PsiElement anchor = enclosingContext;
-      while (anchor != null && anchor.getParent() != null && !anchor.getParent().equals(targetClass)) {
-        anchor = anchor.getParent();
-      }
-      if (anchor != null && anchor.getParent() == null) anchor = null;
-      if (anchor != null) {
-        method = (PsiMethod)targetClass.addAfter(method, anchor);
-      }
-      else {
-        method = (PsiMethod)targetClass.add(method);
-      }
-    }
-
     if (enclosingContext instanceof PsiMethod && methodName.equals(enclosingContext.getName()) &&
         PsiTreeUtil.isAncestor(targetClass, parentClass, true) && !ref.isQualified()) {
       RefactoringChangeUtil.qualifyReference(ref, method, null);
@@ -201,6 +181,36 @@
              context);
   }
 
+  protected static PsiMethod createMethod(PsiClass targetClass,
+                                          PsiClass parentClass,
+                                          PsiMember enclosingContext,
+                                          String methodName) {
+    JVMElementFactory factory = JVMElementFactories.getFactory(targetClass.getLanguage(), targetClass.getProject());
+    if (factory == null) {
+      return null;
+    }
+
+    PsiMethod method = factory.createMethod(methodName, PsiType.VOID);
+
+    if (targetClass.equals(parentClass)) {
+      method = (PsiMethod)targetClass.addAfter(method, enclosingContext);
+    }
+    else {
+      PsiElement anchor = enclosingContext;
+      while (anchor != null && anchor.getParent() != null && !anchor.getParent().equals(targetClass)) {
+        anchor = anchor.getParent();
+      }
+      if (anchor != null && anchor.getParent() == null) anchor = null;
+      if (anchor != null) {
+        method = (PsiMethod)targetClass.addAfter(method, anchor);
+      }
+      else {
+        method = (PsiMethod)targetClass.add(method);
+      }
+    }
+    return method;
+  }
+
   public static void doCreate(PsiClass targetClass, PsiMethod method, List<Pair<PsiExpression, PsiType>> arguments, PsiSubstitutor substitutor,
                               ExpectedTypeInfo[] expectedTypes, @Nullable PsiElement context) {
     doCreate(targetClass, method, shouldBeAbstractImpl(targetClass), arguments, substitutor, expectedTypes, context);
@@ -227,8 +237,11 @@
     TemplateBuilderImpl builder = new TemplateBuilderImpl(method);
 
     CreateFromUsageUtils.setupMethodParameters(method, builder, context, substitutor, arguments);
-    new GuessTypeParameters(JavaPsiFacade.getInstance(project).getElementFactory())
-      .setupTypeElement(method.getReturnTypeElement(), expectedTypes, substitutor, builder, context, targetClass);
+    final PsiTypeElement returnTypeElement = method.getReturnTypeElement();
+    if (returnTypeElement != null) {
+      new GuessTypeParameters(JavaPsiFacade.getInstance(project).getElementFactory())
+        .setupTypeElement(returnTypeElement, expectedTypes, substitutor, builder, context, targetClass);
+    }
     PsiCodeBlock body = method.getBody();
     builder.setEndVariableAfter(shouldBeAbstract || body == null ? method : body.getLBrace());
     method = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(method);
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateParameterFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateParameterFromUsageFix.java
index a280e02..86651f4 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateParameterFromUsageFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateParameterFromUsageFix.java
@@ -26,7 +26,6 @@
 import com.intellij.openapi.util.Comparing;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTreeUtil;
-import com.intellij.psi.util.PsiTypesUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
@@ -89,7 +88,7 @@
 
     final List<ParameterInfoImpl> parameterInfos =
       new ArrayList<ParameterInfoImpl>(Arrays.asList(ParameterInfoImpl.fromMethod(method)));
-    ParameterInfoImpl parameterInfo = new ParameterInfoImpl(-1, varName, type, PsiTypesUtil.getDefaultValueOfType(type), false);
+    ParameterInfoImpl parameterInfo = new ParameterInfoImpl(-1, varName, type, varName, false);
     if (!method.isVarArgs()) {
       parameterInfos.add(parameterInfo);
     }
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java
index d4b9877..67d3c23 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MethodReturnTypeFix.java
@@ -108,7 +108,7 @@
     final PsiMethod myMethod = (PsiMethod)startElement;
 
     if (!FileModificationService.getInstance().prepareFileForWrite(myMethod.getContainingFile())) return;
-    PsiType myReturnType = myReturnTypePointer.getType();
+    final PsiType myReturnType = myReturnTypePointer.getType();
     if (myReturnType == null) return;
     if (myFixWholeHierarchy) {
       final PsiMethod superMethod = myMethod.findDeepestSuperMethod();
@@ -202,12 +202,17 @@
   }
 
   @Nullable
-  private PsiMethod[] getChangeRoots(final PsiMethod method) {
+  private PsiMethod[] getChangeRoots(final PsiMethod method, @NotNull PsiType returnType) {
     if (!myFixWholeHierarchy) return new PsiMethod[]{method};
 
     final PsiMethod[] methods = method.findDeepestSuperMethods();
 
     if (methods.length > 0) {
+      for (PsiMethod psiMethod : methods) {
+        if (returnType.equals(psiMethod.getReturnType())) {
+          return new PsiMethod[] {method};
+        }
+      }
       return methods;
     }
     // no - only base
@@ -215,8 +220,8 @@
   }
 
   @NotNull
-  private List<PsiMethod> changeReturnType(final PsiMethod method, final PsiType returnType) {
-    final PsiMethod[] methods = getChangeRoots(method);
+  private List<PsiMethod> changeReturnType(final PsiMethod method, @NotNull final PsiType returnType) {
+    final PsiMethod[] methods = getChangeRoots(method, returnType);
     if (methods == null) {
       // canceled
       return Collections.emptyList();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java
index b628b9f..8581de6 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -40,23 +40,24 @@
   @Override
   @NotNull
   public String getText() {
-    String text = myPrefixExpression.getOperand().getText();
-    text += " ";
+    PsiExpression operand = myPrefixExpression.getOperand();
+    String text = operand == null ? "" : operand.getText() + " ";
     PsiElement parent = myPrefixExpression.getParent();
-    String operation = parent instanceof PsiInstanceOfExpression
-                       ? PsiKeyword.INSTANCEOF
-                       : ((PsiBinaryExpression)parent).getOperationSign().getText();
-    text += operation + " ";
 
     String rop;
     if (parent instanceof PsiInstanceOfExpression) {
+      text += PsiKeyword.INSTANCEOF + " ";
       final PsiTypeElement type = ((PsiInstanceOfExpression)parent).getCheckType();
       rop = type == null ? "" : type.getText();
     }
-    else {
+    else if (parent instanceof PsiBinaryExpression) {
+      text += ((PsiBinaryExpression)parent).getOperationSign().getText() + " ";
       final PsiExpression rOperand = ((PsiBinaryExpression)parent).getROperand();
       rop = rOperand == null ? "" : rOperand.getText();
     }
+    else {
+      rop = "<expr>";
+    }
 
     text += rop;
     return QuickFixBundle.message("negation.broader.scope.text", text);
@@ -70,7 +71,7 @@
 
   @Override
   public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
-    if (!myPrefixExpression.isValid()) return false;
+    if (!myPrefixExpression.isValid() || myPrefixExpression.getOperand() == null) return false;
 
     PsiElement parent = myPrefixExpression.getParent();
     if (parent instanceof PsiInstanceOfExpression && ((PsiInstanceOfExpression)parent).getOperand() == myPrefixExpression) {
@@ -83,7 +84,7 @@
 
   @Override
   public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
-    if (!FileModificationService.getInstance().preparePsiElementForWrite(myPrefixExpression)) return;
+    if (!isAvailable(project, editor, file) || !FileModificationService.getInstance().preparePsiElementForWrite(myPrefixExpression)) return;
     PsiExpression operand = myPrefixExpression.getOperand();
     PsiElement unnegated = myPrefixExpression.replace(operand);
     PsiElement parent = unnegated.getParent();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java
index 6dc619d..acdcfc8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/RenameWrongRefFix.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -160,7 +160,7 @@
         }
 
         @Override
-        public boolean execute(@NotNull PsiElement element, ResolveState state) {
+        public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
           if (element instanceof PsiNamedElement
               && element instanceof PsiModifierListOwner
               && myFilterMethods == element instanceof PsiMethod) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java
index 9909e6f..de19787 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java
@@ -17,6 +17,7 @@
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.search.LocalSearchScope;
@@ -64,13 +65,51 @@
     }
 
     final PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
+    final PsiExpression initializerExpression = getInitializerExpression(var, assignment);
+    if (initializerExpression == null) return -1;
+
+    PsiExpressionStatement statement = (PsiExpressionStatement)assignment.getParent();
+
+    int startOffset = decl.getTextRange().getStartOffset();
+    try {
+      PsiDeclarationStatement newDecl = factory.createVariableDeclarationStatement(var.getName(), var.getType(), initializerExpression);
+      PsiVariable newVar = (PsiVariable)newDecl.getDeclaredElements()[0];
+      if (var.getModifierList().getText().length() > 0) {
+        PsiUtil.setModifierProperty(newVar, PsiModifier.FINAL, true);
+      }
+      newVar.getModifierList().replace(var.getModifierList());
+      PsiVariable variable = (PsiVariable)newDecl.getDeclaredElements()[0];
+      final int offsetBeforeEQ = variable.getNameIdentifier().getTextRange().getEndOffset();
+      final int offsetAfterEQ = variable.getInitializer().getTextRange().getStartOffset() + 1;
+      newDecl = (PsiDeclarationStatement)CodeStyleManager.getInstance(psiManager).reformatRange(newDecl, offsetBeforeEQ, offsetAfterEQ);
+
+      PsiElement child = statement.getLastChild();
+      while (child instanceof PsiComment || child instanceof PsiWhiteSpace) {
+        child = child.getPrevSibling();
+      }
+      if (child != null && child.getNextSibling() != null) {
+        newDecl.addRangeBefore(child.getNextSibling(), statement.getLastChild(), null);
+      }
+
+      decl.replace(newDecl);
+      statement.delete();
+      return startOffset + newDecl.getTextRange().getEndOffset() - newDecl.getTextRange().getStartOffset();
+    }
+    catch (IncorrectOperationException e) {
+      LOG.error(e);
+      return -1;
+    }
+  }
+
+  public static PsiExpression getInitializerExpression(PsiLocalVariable var,
+                                                       PsiAssignmentExpression assignment) {
     PsiExpression initializerExpression;
     final IElementType originalOpSign = assignment.getOperationTokenType();
     if (originalOpSign == JavaTokenType.EQ) {
       initializerExpression = assignment.getRExpression();
     }
     else {
-      if (var.getInitializer() == null) return -1;
+      if (var.getInitializer() == null) return null;
       String opSign = null;
       if (originalOpSign == JavaTokenType.ANDEQ) {
         opSign = "&";
@@ -107,46 +146,16 @@
       }
 
       try {
-        initializerExpression =
-          factory.createExpressionFromText(var.getInitializer().getText() + opSign + assignment.getRExpression().getText(), var);
-        initializerExpression = (PsiExpression)CodeStyleManager.getInstance(psiManager).reformat(initializerExpression);
+        final Project project = var.getProject();
+        final String initializerText = var.getInitializer().getText() + opSign + assignment.getRExpression().getText();
+        initializerExpression = JavaPsiFacade.getElementFactory(project).createExpressionFromText(initializerText, var);
+        initializerExpression = (PsiExpression)CodeStyleManager.getInstance(project).reformat(initializerExpression);
       }
       catch (IncorrectOperationException e) {
         LOG.error(e);
-        return -1;
+        return null;
       }
     }
-
-    PsiExpressionStatement statement = (PsiExpressionStatement)assignment.getParent();
-
-    int startOffset = decl.getTextRange().getStartOffset();
-    try {
-      PsiDeclarationStatement newDecl = factory.createVariableDeclarationStatement(var.getName(), var.getType(), initializerExpression);
-      PsiVariable newVar = (PsiVariable)newDecl.getDeclaredElements()[0];
-      if (var.getModifierList().getText().length() > 0) {
-        PsiUtil.setModifierProperty(newVar, PsiModifier.FINAL, true);
-      }
-      newVar.getModifierList().replace(var.getModifierList());
-      PsiVariable variable = (PsiVariable)newDecl.getDeclaredElements()[0];
-      final int offsetBeforeEQ = variable.getNameIdentifier().getTextRange().getEndOffset();
-      final int offsetAfterEQ = variable.getInitializer().getTextRange().getStartOffset() + 1;
-      newDecl = (PsiDeclarationStatement)CodeStyleManager.getInstance(psiManager).reformatRange(newDecl, offsetBeforeEQ, offsetAfterEQ);
-
-      PsiElement child = statement.getLastChild();
-      while (child instanceof PsiComment || child instanceof PsiWhiteSpace) {
-        child = child.getPrevSibling();
-      }
-      if (child != null && child.getNextSibling() != null) {
-        newDecl.addRangeBefore(child.getNextSibling(), statement.getLastChild(), null);
-      }
-
-      decl.replace(newDecl);
-      statement.delete();
-      return startOffset + newDecl.getTextRange().getEndOffset() - newDecl.getTextRange().getStartOffset();
-    }
-    catch (IncorrectOperationException e) {
-      LOG.error(e);
-      return -1;
-    }
+    return initializerExpression;
   }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java
index ae7dfb9..ee371f8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -20,7 +20,6 @@
 import com.intellij.codeInsight.completion.JavaClassReferenceCompletionContributor;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.EditorModificationUtil;
-import com.intellij.openapi.editor.ScrollType;
 import com.intellij.openapi.editor.ex.EditorEx;
 import com.intellij.openapi.editor.highlighter.HighlighterIterator;
 import com.intellij.openapi.fileTypes.FileType;
@@ -132,7 +131,7 @@
         return Result.CONTINUE;
       }
       if (PsiTreeUtil.getParentOfType(leaf, PsiCodeBlock.class, false, PsiMember.class) != null) {
-        EditorModificationUtil.insertStringAtCaret(editor, "{", false, true);
+        EditorModificationUtil.typeInStringAtCaretHonorMultipleCarets(editor, "{");
         TypedHandler.indentOpenedBrace(project, editor);
         return Result.STOP;
       }
@@ -170,8 +169,7 @@
     char charAt = editor.getDocument().getCharsSequence().charAt(offset);
     if (charAt != ';') return false;
 
-    editor.getCaretModel().moveToOffset(offset + 1);
-    editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+    EditorModificationUtil.moveAllCaretsRelatively(editor, 1);
     return true;
   }
 
@@ -211,8 +209,7 @@
     }
 
     if (balance == 0) {
-      editor.getCaretModel().moveToOffset(offset + 1);
-      editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+      EditorModificationUtil.moveAllCaretsRelatively(editor, 1);
       return true;
     }
 
@@ -251,7 +248,12 @@
     }
 
     if (balance == 1) {
-      editor.getDocument().insertString(offset, ">");
+      if (editor.getCaretModel().supportsMultipleCarets()) {
+        EditorModificationUtil.typeInStringAtCaretHonorMultipleCarets(editor, ">", 0);
+      }
+      else {
+        editor.getDocument().insertString(offset, ">");
+      }
     }
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java
index 736b9ed..7b36bdc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateConstructorHandler.java
@@ -29,7 +29,6 @@
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.codeStyle.VariableKind;
 import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
@@ -217,11 +216,8 @@
     CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(manager.getProject());
 
     PsiMethod constructor = factory.createConstructor(aClass.getName(), aClass);
-    String modifier = PsiUtil.getMaximumModifierForMember(aClass, false);
 
-    if (modifier != null) {
-      PsiUtil.setModifierProperty(constructor, modifier, true);
-    }
+    GenerateMembersUtil.setVisibility(aClass, constructor);
 
     if (baseConstructor != null){
       PsiJavaCodeReferenceElement[] throwRefs = baseConstructor.getThrowsList().getReferenceElements();
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
index be7450b..4236da3 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
@@ -32,9 +32,7 @@
 import com.intellij.psi.scope.processor.VariablesProcessor;
 import com.intellij.psi.scope.util.PsiScopesUtil;
 import com.intellij.psi.util.*;
-import com.intellij.util.ArrayUtil;
 import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashMap;
 import com.intellij.util.containers.HashSet;
 import org.jetbrains.annotations.NonNls;
@@ -263,7 +261,7 @@
         superSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, targetClass, substitutor);
         superSubstitutors.put(superClass, superSubstitutor);
       }
-      PsiSubstitutor methodSubstitutor = OverrideImplementUtil.correctSubstitutor(method, superSubstitutor);
+      PsiSubstitutor methodSubstitutor = OverrideImplementExploreUtil.correctSubstitutor(method, superSubstitutor);
       MethodSignature signature = method.getSignature(methodSubstitutor);
       if (!signatures.contains(signature)) {
         signatures.add(signature);
@@ -357,14 +355,16 @@
       final PsiType type = field.getType();
       if (helper.isAccessible(field, aClass, aClass) && type instanceof PsiClassType && !PsiTreeUtil.isAncestor(field, element, false)) {
         final PsiClass containingClass = field.getContainingClass();
-        result.add(new PsiFieldMember(field, TypeConversionUtil.getSuperClassSubstitutor(containingClass, aClass, PsiSubstitutor.EMPTY)));
+        if (containingClass != null) {
+          result.add(new PsiFieldMember(field, TypeConversionUtil.getSuperClassSubstitutor(containingClass, aClass, PsiSubstitutor.EMPTY)));
+        }
       }
     }
 
     final PsiMethod[] methods = aClass.getAllMethods();
     for (PsiMethod method : methods) {
       final PsiClass containingClass = method.getContainingClass();
-      if (CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) continue;
+      if (containingClass == null || CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) continue;
       final PsiType returnType = method.getReturnType();
       if (returnType != null && PropertyUtil.isSimplePropertyGetter(method) && helper.isAccessible(method, aClass, aClass) &&
           returnType instanceof PsiClassType && !PsiTreeUtil.isAncestor(method, element, false)) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersUtil.java
index 1288318..f7972b8 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateMembersUtil.java
@@ -30,7 +30,10 @@
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.codeStyle.VariableKind;
 import com.intellij.psi.impl.light.LightTypeElement;
 import com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl;
 import com.intellij.psi.javadoc.PsiDocComment;
@@ -44,6 +47,7 @@
 import com.intellij.util.VisibilityUtil;
 import com.intellij.util.containers.HashMap;
 import com.intellij.util.text.UniqueNameGenerator;
+import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -582,12 +586,24 @@
 
   @Nullable
   public static PsiMethod generateGetterPrototype(@NotNull PsiField field) {
-    return annotateOnOverrideImplement(field.getContainingClass(), PropertyUtil.generateGetterPrototype(field));
+    return setVisibility(field, annotateOnOverrideImplement(field.getContainingClass(), PropertyUtil.generateGetterPrototype(field)));
   }
 
   @Nullable
   public static PsiMethod generateSetterPrototype(@NotNull PsiField field) {
-    return annotateOnOverrideImplement(field.getContainingClass(), PropertyUtil.generateSetterPrototype(field));
+    return setVisibility(field, annotateOnOverrideImplement(field.getContainingClass(), PropertyUtil.generateSetterPrototype(field)));
+  }
+
+  @Contract("_, null -> null")
+  public static PsiMethod setVisibility(PsiMember member, PsiMethod prototype) {
+    if (prototype == null) return null;
+    final String visibility = CodeStyleSettingsManager.getSettings(member.getProject()).VISIBILITY;
+    final PsiModifierList modifierList = prototype.getModifierList();
+    final String newVisibility = VisibilityUtil.ESCALATE_VISIBILITY.equals(visibility)
+                                 ? PsiUtil.getMaximumModifierForMember(member instanceof PsiClass ? (PsiClass)member : member.getContainingClass(), false)
+                                 : visibility;
+    VisibilityUtil.setVisibility(modifierList, newVisibility);
+    return prototype;
   }
 
   @Nullable
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GetterSetterPrototypeProvider.java b/java/java-impl/src/com/intellij/codeInsight/generation/GetterSetterPrototypeProvider.java
index 5214457..782843c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GetterSetterPrototypeProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GetterSetterPrototypeProvider.java
@@ -52,7 +52,7 @@
         return generateGetter ? provider.generateGetters(field) : provider.generateSetters(field);
       }
     }
-    return new PsiMethod[] {generateGetter ? PropertyUtil.generateGetterPrototype(field) : PropertyUtil.generateSetterPrototype(field)};
+    return new PsiMethod[]{generateGetter ? GenerateMembersUtil.generateGetterPrototype(field) : GenerateMembersUtil.generateSetterPrototype(field)};
   }
 
   public static boolean isReadOnlyProperty(PsiField field) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
index 8f854b1..9b5b37f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
@@ -568,7 +568,7 @@
       if (name != null) {
         MethodSignature signature = MethodSignatureUtil.createMethodSignature(name, prevBaseMethod.getParameterList(), prevBaseMethod.getTypeParameterList(), substitutor, prevBaseMethod.isConstructor());
         PsiMethod prevMethod = MethodSignatureUtil.findMethodBySignature(aClass, signature, false);
-        if (prevMethod != null){
+        if (prevMethod != null && prevMethod.isPhysical()){
           return prevMethod.getNextSibling();
         }
       }
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/PsiDocCommentOwnerMemberChooserObject.java b/java/java-impl/src/com/intellij/codeInsight/generation/PsiDocCommentOwnerMemberChooserObject.java
index ae58622..c9ff5f0 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/PsiDocCommentOwnerMemberChooserObject.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/PsiDocCommentOwnerMemberChooserObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -17,6 +17,7 @@
 
 import com.intellij.psi.PsiDocCommentOwner;
 import com.intellij.ui.SimpleTextAttributes;
+import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 
@@ -24,7 +25,7 @@
  * @author peter
 */
 public class PsiDocCommentOwnerMemberChooserObject extends PsiElementMemberChooserObject {
-  public PsiDocCommentOwnerMemberChooserObject(final PsiDocCommentOwner owner, final String text, Icon icon) {
+  public PsiDocCommentOwnerMemberChooserObject(@NotNull PsiDocCommentOwner owner, final String text, Icon icon) {
     super(owner, text, icon);
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/PsiElementClassMember.java b/java/java-impl/src/com/intellij/codeInsight/generation/PsiElementClassMember.java
index 54db066..287fd66 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/PsiElementClassMember.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/PsiElementClassMember.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -21,6 +21,7 @@
 import com.intellij.psi.PsiSubstitutor;
 import com.intellij.psi.util.PsiFormatUtil;
 import com.intellij.psi.util.PsiFormatUtilBase;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * @author peter
@@ -29,17 +30,18 @@
   private final T myPsiMember;
   private PsiSubstitutor mySubstitutor;
 
-  protected PsiElementClassMember(final T psiMember, String text) {
+  protected PsiElementClassMember(@NotNull T psiMember, String text) {
     this(psiMember, PsiSubstitutor.EMPTY, text);
   }
 
-  protected PsiElementClassMember(final T psiMember, final PsiSubstitutor substitutor, String text) {
+  protected PsiElementClassMember(@NotNull T psiMember, @NotNull PsiSubstitutor substitutor, String text) {
     super(psiMember, text, psiMember.getIcon(Iconable.ICON_FLAG_VISIBILITY));
     myPsiMember = psiMember;
     mySubstitutor = substitutor;
   }
 
   @Override
+  @NotNull
   public T getElement() {
     return myPsiMember;
   }
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/PsiFieldMember.java b/java/java-impl/src/com/intellij/codeInsight/generation/PsiFieldMember.java
index 0f64be3..e69bb55 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/PsiFieldMember.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/PsiFieldMember.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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,11 +15,14 @@
  */
 package com.intellij.codeInsight.generation;
 
-import com.intellij.psi.*;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiSubstitutor;
 import com.intellij.psi.util.PsiFormatUtil;
 import com.intellij.psi.util.PsiFormatUtilBase;
-import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
@@ -31,11 +34,11 @@
 public class PsiFieldMember extends PsiElementClassMember<PsiField> implements PropertyClassMember {
   private static final int FIELD_OPTIONS = PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.TYPE_AFTER;
 
-  public PsiFieldMember(final PsiField field) {
+  public PsiFieldMember(@NotNull PsiField field) {
     super(field, PsiFormatUtil.formatVariable(field, FIELD_OPTIONS, PsiSubstitutor.EMPTY));
   }
 
-  public PsiFieldMember(PsiField psiMember, PsiSubstitutor substitutor) {
+  public PsiFieldMember(@NotNull PsiField psiMember, PsiSubstitutor substitutor) {
     super(psiMember, substitutor, PsiFormatUtil.formatVariable(psiMember, FIELD_OPTIONS, PsiSubstitutor.EMPTY));
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/PsiMethodMember.java b/java/java-impl/src/com/intellij/codeInsight/generation/PsiMethodMember.java
index 7bf3293..4e8311f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/PsiMethodMember.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/PsiMethodMember.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -20,6 +20,7 @@
 import com.intellij.psi.infos.CandidateInfo;
 import com.intellij.psi.util.PsiFormatUtil;
 import com.intellij.psi.util.PsiFormatUtilBase;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * @author peter
@@ -28,15 +29,15 @@
   private static final int PARAM_OPTIONS = PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.TYPE_AFTER;
   private static final int METHOD_OPTIONS = PARAM_OPTIONS | PsiFormatUtilBase.SHOW_PARAMETERS;
 
-  public PsiMethodMember(final PsiMethod method) {
+  public PsiMethodMember(@NotNull PsiMethod method) {
     this(method, PsiSubstitutor.EMPTY);
   }
 
-  public PsiMethodMember(CandidateInfo info) {
+  public PsiMethodMember(@NotNull CandidateInfo info) {
     this((PsiMethod)info.getElement(), info.getSubstitutor());
   }
 
-  public PsiMethodMember(final PsiMethod method, final PsiSubstitutor substitutor) {
+  public PsiMethodMember(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor) {
     super(method, substitutor, PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, METHOD_OPTIONS, PARAM_OPTIONS));
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithIfExpressionSurrounder.java b/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithIfExpressionSurrounder.java
index aff61fa..a72d9fd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithIfExpressionSurrounder.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/surroundWith/JavaWithIfExpressionSurrounder.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2000-2014 JetBrains s.r.o.
  *
@@ -26,16 +25,22 @@
 import com.intellij.psi.util.FileTypeUtils;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
 
 public class JavaWithIfExpressionSurrounder extends JavaBooleanExpressionSurrounder {
   @Override
   public boolean isApplicable(PsiExpression expr) {
     if (!super.isApplicable(expr)) return false;
     if (!expr.isPhysical()) return false;
-    PsiElement parent = expr.getParent();
-    if (!(parent instanceof PsiExpressionStatement)) return false;
-    final PsiElement element = parent.getParent();
-    if (!(element instanceof PsiCodeBlock) && !(FileTypeUtils.isInServerPageFile(element)  && element instanceof PsiFile)) return false;
+    PsiElement expressionStatement = expr.getParent();
+    if (!(expressionStatement instanceof PsiExpressionStatement)) return false;
+
+    PsiElement statementParent = expressionStatement.getParent();
+    if (!isElseBranch(expr, statementParent) &&
+        !(statementParent instanceof PsiCodeBlock) &&
+        !(FileTypeUtils.isInServerPageFile(statementParent) && statementParent instanceof PsiFile)) {
+      return false;
+    }
     return true;
   }
 
@@ -49,20 +54,37 @@
     PsiIfStatement ifStatement = (PsiIfStatement)factory.createStatementFromText(text, null);
     ifStatement = (PsiIfStatement)codeStyleManager.reformat(ifStatement);
 
-    ifStatement.getCondition().replace(expr);
+    PsiExpression condition = ifStatement.getCondition();
+    if (condition != null) {
+      condition.replace(expr);
+    }
 
     PsiExpressionStatement statement = (PsiExpressionStatement)expr.getParent();
     ifStatement = (PsiIfStatement)statement.replace(ifStatement);
 
-    PsiCodeBlock block = ((PsiBlockStatement)ifStatement.getThenBranch()).getCodeBlock();
-    block = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(block);
-    TextRange range = block.getStatements()[0].getTextRange();
-    editor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset());
-    return new TextRange(range.getStartOffset(), range.getStartOffset());
+    PsiStatement thenBranch = ifStatement.getThenBranch();
+    if (thenBranch != null && thenBranch instanceof PsiBlockStatement) {
+      PsiCodeBlock block = ((PsiBlockStatement)thenBranch).getCodeBlock();
+      block = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(block);
+      TextRange range = block.getStatements()[0].getTextRange();
+      editor.getDocument().deleteString(range.getStartOffset(), range.getEndOffset());
+      return TextRange.from(range.getStartOffset(), 0);
+    }
+    return TextRange.from(editor.getCaretModel().getOffset(), 0);
   }
 
   @Override
   public String getTemplateDescription() {
     return CodeInsightBundle.message("surround.with.if.expression.template");
   }
+
+  private static boolean isElseBranch(@NotNull PsiExpression expression, @NotNull PsiElement statementParent) {
+    if (statementParent instanceof PsiIfStatement) {
+      PsiStatement elseBranch = ((PsiIfStatement)statementParent).getElseBranch();
+      if (elseBranch != null && elseBranch.getFirstChild() == expression) {
+        return true;
+      }
+    }
+    return false;
+  }
 }
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java
index b3918fd..b332873 100644
--- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java
@@ -356,7 +356,6 @@
     }
   }
 
-  @NotNull
   public static String updateMethodPresentation(@NotNull PsiMethod method, @Nullable PsiSubstitutor substitutor, @NotNull ParameterInfoUIContext context) {
     CodeInsightSettings settings = CodeInsightSettings.getInstance();
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/JoinDeclarationAndAssignmentAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/JoinDeclarationAndAssignmentAction.java
new file mode 100644
index 0000000..bdf63bc
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/JoinDeclarationAndAssignmentAction.java
@@ -0,0 +1,115 @@
+/*
+ * 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.intention.impl;
+
+import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.codeInsight.FileModificationService;
+import com.intellij.codeInsight.editorActions.DeclarationJoinLinesHandler;
+import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import com.intellij.psi.*;
+import com.intellij.psi.search.LocalSearchScope;
+import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+public class JoinDeclarationAndAssignmentAction extends PsiElementBaseIntentionAction {
+  @Override
+  @NotNull
+  public String getFamilyName() {
+    return CodeInsightBundle.message("intention.join.declaration.family");
+  }
+
+  @Override
+  public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
+
+    if (element instanceof PsiCompiledElement) return false;
+    if (!element.getManager().isInProject(element)) return false;
+    if (!element.getLanguage().isKindOf(JavaLanguage.INSTANCE)) return false;
+
+    if (getPair(element) != null) {
+      setText(CodeInsightBundle.message("intention.join.declaration.text"));
+      return true;
+    }
+    return false;
+  }
+
+  private static Pair<PsiLocalVariable, PsiAssignmentExpression> getPair(PsiElement element) {
+    PsiAssignmentExpression assignmentExpression = PsiTreeUtil.getParentOfType(element, PsiAssignmentExpression.class);
+    PsiDeclarationStatement declarationStatement = PsiTreeUtil.getParentOfType(element, PsiDeclarationStatement.class);
+    if (declarationStatement != null) {
+      assignmentExpression = getAssignmentStatement(declarationStatement);
+    } else if (assignmentExpression != null) {
+      declarationStatement = getDeclarationStatement(assignmentExpression);
+    }
+
+    if (declarationStatement != null && assignmentExpression != null) {
+      final PsiExpression lExpression = assignmentExpression.getLExpression();
+      final PsiExpression rExpression = assignmentExpression.getRExpression();
+      if (lExpression instanceof PsiReferenceExpression && rExpression != null) {
+        final PsiElement resolve = ((PsiReferenceExpression)lExpression).resolve();
+        if (resolve instanceof PsiLocalVariable && resolve.getParent() == declarationStatement) {
+          final PsiLocalVariable variable = (PsiLocalVariable)resolve;
+          if (ReferencesSearch.search(variable, new LocalSearchScope(rExpression), false).findFirst() != null) {
+            return null;
+          }
+          return Pair.create(variable, assignmentExpression);
+        }
+      }
+    }
+    return null;
+  }
+
+  private static PsiAssignmentExpression getAssignmentStatement(PsiDeclarationStatement statement) {
+    final PsiElement element = PsiTreeUtil.skipSiblingsForward(statement, PsiWhiteSpace.class);
+    if (element instanceof PsiExpressionStatement) {
+      final PsiExpression expression = ((PsiExpressionStatement)element).getExpression();
+      if (expression instanceof PsiAssignmentExpression) {
+        return (PsiAssignmentExpression)expression;
+      }
+    }
+    return null;
+  }
+ 
+  private static PsiDeclarationStatement getDeclarationStatement(PsiAssignmentExpression assignmentExpression) {
+    final PsiElement parent = assignmentExpression.getParent();
+    if (parent instanceof PsiExpressionStatement) {
+      final PsiElement element = PsiTreeUtil.skipSiblingsBackward(parent, PsiWhiteSpace.class);
+      if (element instanceof PsiDeclarationStatement) {
+        return (PsiDeclarationStatement)element;
+      }
+    }
+    return null;
+  }
+
+  @Override
+  public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
+    if (!FileModificationService.getInstance().preparePsiElementForWrite(element)) return;
+
+    final Pair<PsiLocalVariable, PsiAssignmentExpression> pair = getPair(element);
+    final PsiLocalVariable variable = pair.getFirst();
+    final PsiAssignmentExpression assignmentExpression = pair.getSecond();
+    final PsiExpression initializerExpression = DeclarationJoinLinesHandler.getInitializerExpression(variable, assignmentExpression);
+    variable.setInitializer(initializerExpression);
+    assignmentExpression.delete();
+  }
+
+  
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
index 0bc9f29..5f95da05 100644
--- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java
@@ -469,6 +469,12 @@
 
   @NotNull
   @Override
+  public IntentionAction createCreateMethodFromUsageFix(PsiMethodReferenceExpression methodReferenceExpression) {
+    return new CreateMethodFromMethodReferenceFix(methodReferenceExpression);
+  }
+
+  @NotNull
+  @Override
   public IntentionAction createCreateAbstractMethodFromUsageFix(@NotNull PsiMethodCallExpression call) {
     return new CreateAbstractMethodFromUsageFix(call);
   }
@@ -600,7 +606,7 @@
 
   @NotNull
   @Override
-  public IntentionAction createOptimizeImportsFix() {
+  public IntentionAction createOptimizeImportsFix(final boolean onTheFly) {
     final OptimizeImportsFix fix = new OptimizeImportsFix();
 
     return new IntentionAction() {
@@ -618,7 +624,7 @@
 
       @Override
       public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
-        return timeToOptimizeImports(file) && fix.isAvailable(project, editor, file);
+        return (!onTheFly || timeToOptimizeImports(file)) && fix.isAvailable(project, editor, file);
       }
 
       @Override
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/macro/MacroUtil.java b/java/java-impl/src/com/intellij/codeInsight/template/macro/MacroUtil.java
index 6010a7a..263bf7e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/macro/MacroUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/macro/MacroUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -164,7 +164,7 @@
     final List<PsiVariable> list = new ArrayList<PsiVariable>();
     VariablesProcessor varproc = new VariablesProcessor(prefix, true, list) {
       @Override
-      public boolean execute(@NotNull PsiElement pe, ResolveState state) {
+      public boolean execute(@NotNull PsiElement pe, @NotNull ResolveState state) {
         if (pe instanceof PsiVariable) {
           if (!usedNames.add(((PsiVariable)pe).getName())) {
             return false;
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplateLookupElement.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplateLookupElement.java
index 414d9a0..0aeba2b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplateLookupElement.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplateLookupElement.java
@@ -47,6 +47,7 @@
     }
     else {
       presentation.setTypeText(myTemplate.getExample());
+      presentation.setTypeGrayed(true);
     }
   }
 
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java
index d5e98c4..db253a6 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/completion/PostfixTemplatesCompletionProvider.java
@@ -18,13 +18,11 @@
 import com.intellij.codeInsight.completion.CompletionParameters;
 import com.intellij.codeInsight.completion.CompletionProvider;
 import com.intellij.codeInsight.completion.CompletionResultSet;
-import com.intellij.codeInsight.template.CustomTemplateCallback;
+import com.intellij.codeInsight.completion.PrefixMatcher;
 import com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor;
 import com.intellij.codeInsight.template.postfix.settings.PostfixTemplatesSettings;
 import com.intellij.codeInsight.template.postfix.templates.PostfixLiveTemplate;
-import com.intellij.codeInsight.template.postfix.templates.PostfixTemplate;
 import com.intellij.patterns.StandardPatterns;
-import com.intellij.psi.PsiFile;
 import com.intellij.util.ProcessingContext;
 import org.jetbrains.annotations.NotNull;
 
@@ -33,7 +31,8 @@
 class PostfixTemplatesCompletionProvider extends CompletionProvider<CompletionParameters> {
   @Override
   protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet result) {
-    if (!isCompletionEnabled(parameters) || LiveTemplateCompletionContributor.shouldShowAllTemplates()) {
+    if (!isCompletionEnabled(parameters) || LiveTemplateCompletionContributor.shouldShowAllTemplates() ||
+        parameters.getEditor().getCaretModel().getCaretCount() != 1) {
       /**
        * disabled or covered with {@link com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor}
        */
@@ -42,17 +41,7 @@
 
     PostfixLiveTemplate postfixLiveTemplate = getPostfixLiveTemplate(parameters.getOriginalFile(), parameters.getEditor());
     if (postfixLiveTemplate != null) {
-      PsiFile file = parameters.getPosition().getContainingFile();
-      final CustomTemplateCallback callback = new CustomTemplateCallback(parameters.getEditor(), file, false);
-      String computedKey = postfixLiveTemplate.computeTemplateKey(callback);
-      if (computedKey != null) {
-        PostfixTemplate template = postfixLiveTemplate.getTemplateByKey(computedKey);
-        if (template != null) {
-          result = result.withPrefixMatcher(computedKey);
-          result.addElement(new PostfixTemplateLookupElement(postfixLiveTemplate, template, computedKey, true));
-        }
-      }
-
+      postfixLiveTemplate.addCompletions(parameters, result.withPrefixMatcher(new MyPrefixMatcher(result.getPrefixMatcher().getPrefix())));
       CharSequence documentContent = parameters.getEditor().getDocument().getCharsSequence();
       String possibleKey = postfixLiveTemplate.computeTemplateKeyWithoutContextChecking(documentContent, parameters.getOffset());
       if (possibleKey != null) {
@@ -74,4 +63,21 @@
 
     return true;
   }
+
+  private static class MyPrefixMatcher extends PrefixMatcher {
+    protected MyPrefixMatcher(String prefix) {
+      super(prefix);
+    }
+
+    @Override
+    public boolean prefixMatches(@NotNull String name) {
+      return name.equalsIgnoreCase(myPrefix);
+    }
+
+    @NotNull
+    @Override
+    public PrefixMatcher cloneWithPrefix(@NotNull String prefix) {
+      return new MyPrefixMatcher(prefix);
+    }
+  }
 }
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.java
index b8c6a9d..75c7d93 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesConfigurable.java
@@ -34,8 +34,8 @@
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import java.awt.*;
-import java.util.Arrays;
-import java.util.Map;
+import java.util.*;
+import java.util.List;
 
 public class PostfixTemplatesConfigurable implements SearchableConfigurable, EditorOptionsProvider, Configurable.NoScroll {
   @Nullable
@@ -61,7 +61,14 @@
     }
 
     myTemplatesSettings = settings;
-    myTemplatesListPanel = new PostfixTemplatesListPanel(Arrays.asList(PostfixTemplate.EP_NAME.getExtensions()));
+    List<PostfixTemplate> templates = Arrays.asList(PostfixTemplate.EP_NAME.getExtensions());
+    ContainerUtil.sort(templates, new Comparator<PostfixTemplate>() {
+      @Override
+      public int compare(PostfixTemplate o1, PostfixTemplate o2) {
+        return o1.getKey().compareTo(o2.getKey());
+      }
+    });
+    myTemplatesListPanel = new PostfixTemplatesListPanel(templates);
     myTemplatesListPanelContainer.setLayout(new BorderLayout());
     myTemplatesListPanelContainer.add(myTemplatesListPanel.getComponent(), BorderLayout.CENTER);
     myPostfixTemplatesEnabled.addChangeListener(new ChangeListener() {
@@ -90,7 +97,7 @@
   @Nls
   @Override
   public String getDisplayName() {
-    return "Postfix Templates";
+    return "Postfix Completion";
   }
 
   @Nullable
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesListPanel.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesListPanel.java
index 581b774..0c21e04 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesListPanel.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/settings/PostfixTemplatesListPanel.java
@@ -29,7 +29,7 @@
       @NotNull
       @Override
       public String fun(@NotNull PostfixTemplate template) {
-        return template.getKey();
+        return template.getKey().replaceFirst(".", "");
       }
     };
 
@@ -58,10 +58,11 @@
   public PostfixTemplatesListPanel(@NotNull List<PostfixTemplate> templates) {
     ColumnInfo[] columns = generateColumns(templates);
     ListTableModel<PostfixTemplate> templatesTableModel = new ListTableModel<PostfixTemplate>(columns, templates, 0);
+    templatesTableModel.setSortable(true);
     myTemplatesTableView = new TableView<PostfixTemplate>();
     myTemplatesTableView.setModelAndUpdateColumns(templatesTableModel);
+    myTemplatesTableView.setAutoCreateRowSorter(true);
     myTemplatesTableView.setShowGrid(false);
-    myTemplatesTableView.setStriped(true);
     myTemplatesTableView.setBorder(null);
 
     new TableViewSpeedSearch<PostfixTemplate>(myTemplatesTableView) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ExpressionPostfixTemplateWithChooser.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ExpressionPostfixTemplateWithChooser.java
index 7efead3..8de5365 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ExpressionPostfixTemplateWithChooser.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ExpressionPostfixTemplateWithChooser.java
@@ -81,7 +81,8 @@
 
   @NotNull
   protected List<PsiExpression> getExpressions(@NotNull PsiElement context, @NotNull Document document, final int offset) {
-    List<PsiExpression> expressions = ContainerUtil.filter(IntroduceVariableBase.collectExpressions(context.getContainingFile(), document, offset - 1, false), 
+    List<PsiExpression> expressions = ContainerUtil.filter(IntroduceVariableBase.collectExpressions(context.getContainingFile(), document, 
+                                                                                                    Math.max(offset - 1, 0), false), 
                                                            new Condition<PsiExpression>() {
                                                              @Override
                                                              public boolean value(PsiExpression expression) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java
new file mode 100644
index 0000000..5d99745
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplate.java
@@ -0,0 +1,43 @@
+/*
+ * 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 com.intellij.codeInsight.template.postfix.util.PostfixTemplatesUtils;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.CommonClassNames;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiExpression;
+import com.intellij.psi.PsiType;
+import org.jetbrains.annotations.NotNull;
+
+public class FormatPostfixTemplate extends PostfixTemplate {
+  public FormatPostfixTemplate() {
+    super("format", "Creates String.format call", "String.format(expr);");
+  }
+
+  @Override
+  public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
+    PostfixTemplatesUtils.createStatement(context, editor, "String.format(", ", )", -2);
+  }
+
+  @Override
+  public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
+    PsiExpression expr = getTopmostExpression(context);
+    PsiType type = expr != null ? expr.getType() : null;
+    return expr != null && type != null && CommonClassNames.JAVA_LANG_STRING.equals(type.getCanonicalText());
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/NonVoidPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/NonVoidPostfixTemplate.java
new file mode 100644
index 0000000..906a943
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/NonVoidPostfixTemplate.java
@@ -0,0 +1,34 @@
+/*
+ * 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 com.intellij.codeInsight.template.postfix.util.PostfixTemplatesUtils;
+import com.intellij.openapi.editor.Document;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiExpression;
+import org.jetbrains.annotations.NotNull;
+
+abstract public class NonVoidPostfixTemplate extends PostfixTemplate {
+  protected NonVoidPostfixTemplate(@NotNull String name, @NotNull String description, @NotNull String example) {
+    super(name, description, example);
+  }
+
+  @Override
+  public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
+    PsiExpression expr = getTopmostExpression(context);
+    return expr != null && PostfixTemplatesUtils.isNonVoid(expr.getType());
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java
index 95b1ceb..a165dcb 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/PostfixLiveTemplate.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.
@@ -24,6 +24,7 @@
 import com.intellij.codeInsight.template.postfix.completion.PostfixTemplateLookupElement;
 import com.intellij.codeInsight.template.postfix.settings.PostfixTemplatesSettings;
 import com.intellij.codeInsight.template.postfix.util.Aliases;
+import com.intellij.featureStatistics.FeatureUsageTracker;
 import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.CommandProcessor;
@@ -91,6 +92,11 @@
     return computeTemplateKeyWithoutContextChecking(editor.getDocument().getCharsSequence(), editor.getCaretModel().getOffset());
   }
 
+  @Override
+  public boolean supportsMultiCaret() {
+    return false;
+  }
+
   @Nullable
   public String computeTemplateKeyWithoutContextChecking(@NotNull CharSequence documentContent, int currentOffset) {
     int startOffset = currentOffset;
@@ -115,6 +121,8 @@
   public void expand(@NotNull final String key, @NotNull final CustomTemplateCallback callback) {
     ApplicationManager.getApplication().assertIsDispatchThread();
 
+    FeatureUsageTracker.getInstance().triggerFeatureUsed("editing.completion.postfix");
+
     final PostfixTemplate template = getTemplateByKey(key);
     final Editor editor = callback.getEditor();
     final PsiFile file = callback.getContext().getContainingFile();
@@ -124,7 +132,8 @@
       newContext = addSemicolonIfNeeded(editor, editor.getDocument(), newContext, currentOffset - key.length());
       expandTemplate(template, editor, newContext);
     }
-    else {
+    // don't care about errors in multiCaret mode
+    else if (editor.getCaretModel().getAllCarets().size() == 1) {
       LOG.error("Template not found by key: " + key);
     }
   }
@@ -170,13 +179,13 @@
   @Override
   public Collection<? extends CustomLiveTemplateLookupElement> getLookupElements(@NotNull PsiFile file, @NotNull Editor editor, int offset) {
     String key = computeTemplateKeyWithoutContextChecking(editor.getDocument().getCharsSequence(), offset);
-    if (key != null) {
+    if (key != null && editor.getCaretModel().getCaretCount() == 1) {
       Map<String, CustomLiveTemplateLookupElement> result = ContainerUtil.newHashMap();
       Condition<PostfixTemplate> isApplicationTemplateFunction = createIsApplicationTemplateFunction(key, file, editor);
       for (Map.Entry<String, PostfixTemplate> entry : myTemplates.entrySet()) {
         PostfixTemplate postfixTemplate = entry.getValue();
         if (entry.getKey().startsWith(key) && isApplicationTemplateFunction.value(postfixTemplate)) {
-          result.put(postfixTemplate.getKey(), new PostfixTemplateLookupElement(this, postfixTemplate, postfixTemplate.getKey(), false));
+          result.put(postfixTemplate.getKey(), new PostfixTemplateLookupElement(this, postfixTemplate, entry.getKey(), false));
         }
       }
       return result.values();
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java
index e15f6c4..277a6f2 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ReturnStatementPostfixTemplate.java
@@ -15,25 +15,16 @@
  */
 package com.intellij.codeInsight.template.postfix.templates;
 
-import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.psi.*;
 import org.jetbrains.annotations.NotNull;
 
-public class ReturnStatementPostfixTemplate extends PostfixTemplate {
+public class ReturnStatementPostfixTemplate extends NonVoidPostfixTemplate {
   public ReturnStatementPostfixTemplate() {
     super("return", "Returns value from containing method", "return expr;");
   }
 
   @Override
-  public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
-    PsiExpression expr = getTopmostExpression(context);
-    if (expr == null) return false;
-    PsiType type = expr.getType();
-    return type != null && !PsiType.VOID.equals(type);
-  }
-
-  @Override
   public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
     PsiExpression expr = getTopmostExpression(context);
     PsiElement parent = expr != null ? expr.getParent() : null;
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java
new file mode 100644
index 0000000..4f0667f
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplate.java
@@ -0,0 +1,32 @@
+/*
+ * 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 com.intellij.codeInsight.template.postfix.util.PostfixTemplatesUtils;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+
+public class SoutPostfixTemplate extends NonVoidPostfixTemplate {
+  public SoutPostfixTemplate() {
+    super("sout", "Creates System.out.println call", "System.out.println(expr);");
+  }
+
+  @Override
+  public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
+    PostfixTemplatesUtils.createStatement(context, editor, "System.out.println(", ")");
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java
new file mode 100644
index 0000000..f14754f
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryStatementPostfixTemplate.java
@@ -0,0 +1,66 @@
+/*
+ * 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 com.intellij.codeInsight.generation.surroundWith.JavaWithTryCatchSurrounder;
+import com.intellij.codeInsight.template.postfix.util.PostfixTemplatesUtils;
+import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.util.ArrayUtil;
+import org.jetbrains.annotations.NotNull;
+
+public class TryStatementPostfixTemplate extends PostfixTemplate {
+
+  protected TryStatementPostfixTemplate() {
+    super("try", "Insert statement in try-catch block", "try { exp } catch (Exception e) { e.printStackTrace(); }");
+  }
+
+  @Override
+  public boolean isApplicable(@NotNull PsiElement context, @NotNull Document copyDocument, int newOffset) {
+    return null != PsiTreeUtil.getNonStrictParentOfType(context, PsiStatement.class);
+  }
+
+  @Override
+  public void expand(@NotNull PsiElement context, @NotNull Editor editor) {
+    PsiStatement statement = PsiTreeUtil.getNonStrictParentOfType(context, PsiStatement.class);
+    assert statement != null;
+
+    PsiFile file = statement.getContainingFile();
+    Project project = context.getProject();
+
+    JavaWithTryCatchSurrounder surrounder = new JavaWithTryCatchSurrounder();
+    TextRange range = surrounder.surroundElements(project, editor, new PsiElement[]{statement});
+
+    if (range == null) {
+      PostfixTemplatesUtils.showErrorHint(project, editor);
+      return;
+    }
+
+    PsiElement element = file.findElementAt(range.getStartOffset());
+    PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(element, PsiTryStatement.class);
+    assert tryStatement != null;
+    PsiCodeBlock block = tryStatement.getTryBlock();
+    assert block != null;
+    PsiStatement statementInTry = ArrayUtil.getFirstElement(block.getStatements());
+    if (null != statementInTry) {
+      editor.getCaretModel().moveToOffset(statementInTry.getTextRange().getEndOffset());
+    }
+  }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/PostfixTemplatesUtils.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/PostfixTemplatesUtils.java
index 09cf4fb..370c986 100644
--- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/PostfixTemplatesUtils.java
+++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/util/PostfixTemplatesUtils.java
@@ -37,13 +37,21 @@
   }
 
   public static void createSimpleStatement(@NotNull PsiElement context, @NotNull Editor editor, @NotNull String text) {
+    createStatement(context, editor, text + " ", "");
+  }
+
+  public static void createStatement(@NotNull PsiElement context, @NotNull Editor editor, @NotNull String prefix, @NotNull String suffix) {
+    createStatement(context, editor, prefix, suffix, 0);
+  }
+
+  public static void createStatement(@NotNull PsiElement context, @NotNull Editor editor, @NotNull String prefix, @NotNull String suffix, int offset) {
     PsiExpression expr = PostfixTemplate.getTopmostExpression(context);
     PsiElement parent = expr != null ? expr.getParent() : null;
     assert parent instanceof PsiStatement;
     PsiElementFactory factory = JavaPsiFacade.getInstance(context.getProject()).getElementFactory();
-    PsiStatement assertStatement = factory.createStatementFromText(text + " " + expr.getText() + ";", parent);
-    PsiElement replace = parent.replace(assertStatement);
-    editor.getCaretModel().moveToOffset(replace.getTextRange().getEndOffset());
+    PsiStatement statement = factory.createStatementFromText(prefix + expr.getText() + suffix + ";", parent);
+    PsiElement replace = parent.replace(statement);
+    editor.getCaretModel().moveToOffset(replace.getTextRange().getEndOffset() + offset);
   }
 
   @Contract("null -> false")
@@ -72,6 +80,11 @@
   }
 
   @Contract("null -> false")
+  public static boolean isNonVoid(@Nullable PsiType type) {
+    return type != null && !PsiType.VOID.equals(type);
+  }
+
+  @Contract("null -> false")
   public static boolean isNumber(@Nullable PsiType type) {
     if (type == null) {
       return false;
diff --git a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaAnonymousUnwrapper.java b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaAnonymousUnwrapper.java
index 53ef126..b9d2f83 100644
--- a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaAnonymousUnwrapper.java
+++ b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaAnonymousUnwrapper.java
@@ -43,7 +43,26 @@
   protected void doUnwrap(PsiElement element, Context context) throws IncorrectOperationException {
     PsiElement from = findElementToExtractFrom(element);
 
-    for (PsiMethod m : ((PsiAnonymousClass)element).getMethods()) {
+    final PsiMethod[] methods = ((PsiAnonymousClass)element).getMethods();
+
+    if (methods.length == 1) {
+      final PsiCodeBlock body = methods[0].getBody();
+      if (body != null) {
+        final PsiStatement[] statements = body.getStatements();
+        if (statements.length == 1 && statements[0] instanceof PsiReturnStatement) {
+          final PsiExpression returnValue = ((PsiReturnStatement)statements[0]).getReturnValue();
+          if (from instanceof PsiDeclarationStatement) {
+            final PsiElement[] declaredElements = ((PsiDeclarationStatement)from).getDeclaredElements();
+            if (declaredElements.length == 1 && declaredElements[0] instanceof PsiVariable) {
+              context.setInitializer((PsiVariable)declaredElements[0], returnValue);
+              return;
+            }
+          }
+        }
+      }
+    }
+
+    for (PsiMethod m : methods) {
       context.extractFromCodeBlock(m.getBody(), from);
     }
 
@@ -59,9 +78,11 @@
     el = findTopmostParentOfType(el, PsiMethodCallExpression.class);
     el = findTopmostParentOfType(el, PsiAssignmentExpression.class);
     el = findTopmostParentOfType(el, PsiDeclarationStatement.class);
-
-    while (el.getParent() instanceof PsiExpressionStatement) {
-      el = el.getParent();
+    
+    PsiElement parent = el.getParent();
+    while (parent instanceof PsiExpressionStatement || parent instanceof PsiReturnStatement) {
+      el = parent;
+      parent = el.getParent();
     }
 
     return el;
diff --git a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaUnwrapper.java b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaUnwrapper.java
index c826eef..58738d5 100644
--- a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaUnwrapper.java
+++ b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaUnwrapper.java
@@ -65,5 +65,34 @@
       PsiElementFactory factory = JavaPsiFacade.getInstance(e.getProject()).getElementFactory();
       return factory.createStatementFromText(e.getText(), null);
     }
+
+    public void setInitializer(PsiVariable variable, PsiExpression returnValue) {
+      PsiExpression toExtract = returnValue;
+      if (myIsEffective) {
+        final PsiExpression initializer = copyExpression(returnValue);
+        if (variable instanceof PsiLocalVariable) {
+          ((PsiLocalVariable)variable).setInitializer(initializer);
+        } else if (variable instanceof PsiField) {
+          ((PsiField)variable).setInitializer(initializer);
+        }
+        toExtract = variable.getInitializer();
+      }
+      addElementToExtract(toExtract);
+    }
+
+    private static PsiExpression copyExpression(PsiExpression returnValue) {
+      return JavaPsiFacade.getElementFactory(returnValue.getProject()).createExpressionFromText(returnValue.getText(), null);
+    }
+
+    public void setReturnValue(PsiReturnStatement returnStatement, PsiExpression returnValue) {
+      PsiElement toExtract = returnValue;
+      if (myIsEffective) {
+        final PsiExpression copyExpression = copyExpression(returnValue);
+        final PsiExpression initialValue = returnStatement.getReturnValue();
+        assert initialValue != null;
+        toExtract = initialValue.replace(copyExpression);
+      }
+      addElementToExtract(toExtract);
+    }
   }
 }
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AddAssertStatementFix.java b/java/java-impl/src/com/intellij/codeInspection/AddAssertStatementFix.java
similarity index 90%
rename from java/java-analysis-impl/src/com/intellij/codeInspection/AddAssertStatementFix.java
rename to java/java-impl/src/com/intellij/codeInspection/AddAssertStatementFix.java
index 257b9a6..ec4b2de 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AddAssertStatementFix.java
+++ b/java/java-impl/src/com/intellij/codeInspection/AddAssertStatementFix.java
@@ -20,6 +20,7 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.refactoring.util.RefactoringUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
@@ -51,7 +52,7 @@
     if (expressionToAssert == null) return;
     if (!FileModificationService.getInstance().preparePsiElementForWrite(descriptor.getPsiElement())) return;
     PsiElement element = descriptor.getPsiElement();
-    PsiElement anchorElement = PsiTreeUtil.getParentOfType(element, PsiStatement.class);
+    PsiElement anchorElement = RefactoringUtil.getParentStatement(element, false);
     LOG.assertTrue(anchorElement != null);
     final PsiElement tempParent = anchorElement.getParent();
     if (tempParent instanceof PsiForStatement && !PsiTreeUtil.isAncestor(((PsiForStatement)tempParent).getBody(), anchorElement, false)) {
@@ -75,11 +76,7 @@
         parent.addBefore(assertStatement, anchorElement);
       }
       else {
-        PsiBlockStatement blockStatement = (PsiBlockStatement)factory.createStatementFromText("{}", null);
-        final PsiCodeBlock block = blockStatement.getCodeBlock();
-        block.add(assertStatement);
-        block.add(anchorElement);
-        anchorElement.replace(blockStatement);
+        RefactoringUtil.putStatementInLoopBody(assertStatement, parent, anchorElement);
       }
     }
     catch (IncorrectOperationException e) {
diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
index b1c0421..e80dd14 100644
--- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
@@ -16,14 +16,20 @@
 package com.intellij.codeInspection.dataFlow;
 
 import com.intellij.codeInsight.NullableNotNullDialog;
+import com.intellij.codeInspection.AddAssertStatementFix;
 import com.intellij.codeInspection.InspectionsBundle;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.SurroundWithIfFix;
+import com.intellij.codeInspection.defUse.DefUseInspection;
 import com.intellij.ide.DataManager;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
+import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.PsiAssignmentExpression;
+import com.intellij.psi.PsiBinaryExpression;
 import com.intellij.psi.PsiExpression;
+import com.intellij.psi.tree.IElementType;
 
 import javax.swing.*;
 import javax.swing.event.ChangeEvent;
@@ -40,11 +46,27 @@
       fixes.add(new SurroundWithIfFix(qualifier));
     }
   }
+
+  @Override
+  protected LocalQuickFix[] createConditionalAssignmentFixes(boolean evaluatesToTrue, PsiAssignmentExpression assignment, final boolean onTheFly) {
+    IElementType op = assignment.getOperationTokenType();
+    boolean toRemove = op == JavaTokenType.ANDEQ && !evaluatesToTrue || op == JavaTokenType.OREQ && evaluatesToTrue;
+    if (toRemove && !onTheFly) {
+      return LocalQuickFix.EMPTY_ARRAY;
+    }
+    return new LocalQuickFix[]{toRemove ? new DefUseInspection.RemoveAssignmentFix() : createSimplifyToAssignmentFix()};
+  }
+
   @Override
   public JComponent createOptionsPanel() {
     return new OptionsPanel();
   }
 
+  @Override
+  protected AddAssertStatementFix createAssertFix(PsiBinaryExpression binary) {
+    return new AddAssertStatementFix(binary);
+  }
+
   private class OptionsPanel extends JPanel {
     private final JCheckBox myIgnoreAssertions;
     private final JCheckBox myReportConstantReferences;
diff --git a/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java b/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java
index 8b19def..5d2ab66 100644
--- a/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/defUse/DefUseInspection.java
@@ -50,6 +50,41 @@
     return new RemoveInitializerFix();
   }
 
+  @Override
+  protected LocalQuickFix createRemoveAssignmentFix() {
+    return new RemoveAssignmentFix();
+  }
+  
+  public static class RemoveAssignmentFix extends RemoveInitializerFix {
+    @NotNull
+    @Override
+    public String getName() {
+      return InspectionsBundle.message("inspection.unused.assignment.remove.assignment.quickfix");
+    }
+
+    @Override
+    public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+      final PsiElement left = descriptor.getPsiElement();
+      if (!(left instanceof PsiReferenceExpression)) return;
+      final PsiElement parent = left.getParent();
+      if (!(parent instanceof PsiAssignmentExpression)) return;
+      final PsiExpression rExpression = ((PsiAssignmentExpression)parent).getRExpression();
+      final PsiElement gParent = parent.getParent();
+      if (gParent instanceof PsiExpression && rExpression != null) {
+        if (!FileModificationService.getInstance().prepareFileForWrite(gParent.getContainingFile())) return;
+        if (gParent instanceof PsiParenthesizedExpression) {
+          gParent.replace(rExpression);
+        } else {
+          parent.replace(rExpression);
+        }
+        return;
+      }
+
+      final PsiElement resolve = ((PsiReferenceExpression)left).resolve();
+      if (!(resolve instanceof PsiVariable)) return;
+      sideEffectAwareRemove(project, rExpression, parent, (PsiVariable)resolve);
+    }
+  }
   private static class RemoveInitializerFix implements LocalQuickFix {
     @Override
     @NotNull
@@ -62,10 +97,15 @@
       final PsiElement psiInitializer = descriptor.getPsiElement();
       if (!(psiInitializer instanceof PsiExpression)) return;
       if (!(psiInitializer.getParent() instanceof PsiVariable)) return;
-      if (!FileModificationService.getInstance().prepareFileForWrite(psiInitializer.getContainingFile())) return;
 
       final PsiVariable variable = (PsiVariable)psiInitializer.getParent();
-      final PsiDeclarationStatement declaration = (PsiDeclarationStatement)variable.getParent();
+      sideEffectAwareRemove(project, psiInitializer, psiInitializer, variable);
+    }
+
+    protected void sideEffectAwareRemove(Project project, PsiElement psiInitializer, PsiElement elementToDelete, PsiVariable variable) {
+      if (!FileModificationService.getInstance().prepareFileForWrite(elementToDelete.getContainingFile())) return;
+
+      final PsiElement declaration = variable.getParent();
       final List<PsiElement> sideEffects = new ArrayList<PsiElement>();
       boolean hasSideEffects = RemoveUnusedVariableUtil.checkSideEffects(psiInitializer, variable, sideEffects);
       int res = RemoveUnusedVariableUtil.DELETE_ALL;
@@ -74,25 +114,35 @@
         res = RemoveUnusedVariableFix.showSideEffectsWarning(sideEffects, variable,
                                                              FileEditorManager.getInstance(project).getSelectedTextEditor(),
                                                              hasSideEffects, sideEffects.get(0).getText(),
-                                                             variable.getTypeElement().getText() + " " + variable.getName() + ";<br>" + PsiExpressionTrimRenderer
-                                                               .render((PsiExpression)psiInitializer));
+                                                             variable.getTypeElement().getText() +
+                                                             " " +
+                                                             variable.getName() +
+                                                             ";<br>" +
+                                                             PsiExpressionTrimRenderer
+                                                               .render((PsiExpression)psiInitializer)
+        );
       }
       try {
         if (res == RemoveUnusedVariableUtil.DELETE_ALL) {
-          psiInitializer.delete();
+          elementToDelete.delete();
         }
         else if (res == RemoveUnusedVariableUtil.MAKE_STATEMENT) {
-          final PsiElementFactory factory = JavaPsiFacade.getInstance(variable.getProject()).getElementFactory();
+          final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
           final PsiStatement statementFromText = factory.createStatementFromText(psiInitializer.getText() + ";", null);
-          declaration.getParent().addAfter(statementFromText, declaration);
-          psiInitializer.delete();
+          final PsiElement parent = elementToDelete.getParent();
+          if (parent instanceof PsiExpressionStatement) {
+            parent.replace(statementFromText);
+          } else {
+            declaration.getParent().addAfter(statementFromText, declaration);
+            elementToDelete.delete();
+          }
         }
       }
       catch (IncorrectOperationException e) {
         LOG.error(e);
       }
     }
-
+    
     @Override
     @NotNull
     public String getFamilyName() {
diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java
index 3cc23f4..a7fd8ff 100644
--- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java
+++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/AnnotateTask.java
@@ -18,23 +18,24 @@
 import com.intellij.codeInsight.NullableNotNullManager;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.project.Project;
+import com.intellij.usageView.UsageInfo;
 import com.intellij.util.SequentialModalProgressTask;
 import com.intellij.util.SequentialTask;
 
 class AnnotateTask implements SequentialTask {
   private final Project myProject;
-  private final NullityInferrer myInferrer;
+  private UsageInfo[] myInfos;
   private final SequentialModalProgressTask myTask;
   private int myCount = 0;
   private final int myTotal;
   private final NullableNotNullManager myNotNullManager;
 
-  public AnnotateTask(Project project, NullityInferrer inferrer, SequentialModalProgressTask progressTask) {
+  public AnnotateTask(Project project, SequentialModalProgressTask progressTask, UsageInfo[] infos) {
     myProject = project;
+    myInfos = infos;
     myNotNullManager = NullableNotNullManager.getInstance(myProject);
-    myInferrer = inferrer;
     myTask = progressTask;
-    myTotal = myInferrer.getCount();
+    myTotal = infos.length;
   }
 
   @Override
@@ -53,7 +54,7 @@
       indicator.setFraction(((double)myCount) / myTotal);
     }
 
-    myInferrer.apply(myCount++, myProject, myNotNullManager);
+    NullityInferrer.apply(myProject, myNotNullManager, myInfos[myCount++]);
 
     return isDone();
   }
diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java
index ae45a6f..c3d6102 100644
--- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java
+++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/InferNullityAnnotationsAction.java
@@ -23,13 +23,16 @@
 import com.intellij.codeInsight.daemon.QuickFixBundle;
 import com.intellij.codeInsight.daemon.impl.quickfix.LocateLibraryDialog;
 import com.intellij.codeInsight.daemon.impl.quickfix.OrderEntryFix;
+import com.intellij.history.LocalHistory;
+import com.intellij.history.LocalHistoryAction;
+import com.intellij.ide.util.PropertiesComponent;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.application.Result;
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
 import com.intellij.openapi.progress.ProgressIndicator;
 import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.project.Project;
@@ -39,24 +42,35 @@
 import com.intellij.openapi.roots.libraries.LibraryUtil;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.ui.VerticalFlowLayout;
+import com.intellij.openapi.util.Computable;
+import com.intellij.openapi.util.Factory;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.ui.TitledSeparator;
+import com.intellij.usageView.UsageInfo;
+import com.intellij.usageView.UsageViewUtil;
+import com.intellij.usages.*;
 import com.intellij.util.Function;
+import com.intellij.util.Processor;
 import com.intellij.util.SequentialModalProgressTask;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 public class InferNullityAnnotationsAction extends BaseAnalysisAction {
   @NonNls private static final String INFER_NULLITY_ANNOTATIONS = "Infer Nullity Annotations";
+  @NonNls private static final String ANNOTATE_LOCAL_VARIABLES = "annotate.local.variables";
   private JCheckBox myAnnotateLocalVariablesCb;
 
   public InferNullityAnnotationsAction() {
@@ -65,6 +79,9 @@
 
   @Override
   protected void analyze(@NotNull final Project project, @NotNull final AnalysisScope scope) {
+
+    PropertiesComponent.getInstance().setValue(ANNOTATE_LOCAL_VARIABLES, String.valueOf(myAnnotateLocalVariablesCb.isSelected()));
+
     final ProgressManager progressManager = ProgressManager.getInstance();
     final int totalFiles = scope.getFileCount();
 
@@ -89,7 +106,7 @@
               }
               progressIndicator.setFraction(((double)myFileCount) / totalFiles);
             }
-            final Module module = ModuleUtil.findModuleForPsiElement(file);
+            final Module module = ModuleUtilCore.findModuleForPsiElement(file);
             if (module != null && !processed.contains(module)) {
               processed.add(module);
               if (JavaPsiFacade.getInstance(project)
@@ -171,12 +188,32 @@
       return;
     }
     if (scope.checkScopeWritable(project)) return;
+
     PsiDocumentManager.getInstance(project).commitAllDocuments();
+    final UsageInfo[] usageInfos = findUsages(project, scope);
+    if (usageInfos == null) return;
+
+    if (usageInfos.length < 5) {
+      SwingUtilities.invokeLater(applyRunnable(project, new Computable<UsageInfo[]>() {
+        @Override
+        public UsageInfo[] compute() {
+          return usageInfos;
+        }
+      }));
+    }
+    else {
+      showUsageView(project, usageInfos, scope);
+    }
+  }
+
+  private UsageInfo[] findUsages(final Project project,
+                               final AnalysisScope scope) {
     final NullityInferrer inferrer = new NullityInferrer(myAnnotateLocalVariablesCb.isSelected(), project);
     final PsiManager psiManager = PsiManager.getInstance(project);
-    if (!progressManager.runProcessWithProgressSynchronously(new Runnable() {
+    final Runnable searchForUsages = new Runnable() {
       @Override
       public void run() {
+        final int totalFiles = scope.getFileCount();
         scope.accept(new PsiElementVisitor() {
           int myFileCount = 0;
 
@@ -189,9 +226,7 @@
             if (document == null || virtualFile.getFileType().isBinary()) return; //do not inspect binary files
             final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
             if (progressIndicator != null) {
-              if (virtualFile != null) {
-                progressIndicator.setText2(ProjectUtil.calcRelativeToProjectPath(virtualFile, project));
-              }
+              progressIndicator.setText2(ProjectUtil.calcRelativeToProjectPath(virtualFile, project));
               progressIndicator.setFraction(((double)myFileCount) / totalFiles);
             }
             if (file instanceof PsiJavaFile) {
@@ -200,27 +235,46 @@
           }
         });
       }
-    }, INFER_NULLITY_ANNOTATIONS, true, project)) {
-      return;
+    };
+    if (ApplicationManager.getApplication().isDispatchThread()) {
+      if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(searchForUsages, INFER_NULLITY_ANNOTATIONS, true, project)) {
+        return null;
+      }
+    } else {
+      searchForUsages.run();
     }
 
-    final Runnable applyRunnable = new Runnable() {
+    final List<UsageInfo> usages = new ArrayList<UsageInfo>();
+    inferrer.collect(usages);
+    return usages.toArray(new UsageInfo[usages.size()]);
+  }
+
+  private static Runnable applyRunnable(final Project project, final Computable<UsageInfo[]> computable) {
+    return new Runnable() {
       @Override
       public void run() {
-        new WriteCommandAction(project, INFER_NULLITY_ANNOTATIONS) {
-          @Override
-          protected void run(Result result) throws Throwable {
-            if (!inferrer.nothingFoundMessage(project)) {
-              final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, INFER_NULLITY_ANNOTATIONS, false);
-              progressTask.setMinIterationTime(200);
-              progressTask.setTask(new AnnotateTask(project, inferrer, progressTask));
-              ProgressManager.getInstance().run(progressTask);
+        final LocalHistoryAction action = LocalHistory.getInstance().startAction(INFER_NULLITY_ANNOTATIONS);
+        try {
+          new WriteCommandAction(project, INFER_NULLITY_ANNOTATIONS) {
+            @Override
+            protected void run(Result result) throws Throwable {
+              final UsageInfo[] infos = computable.compute();
+              if (infos.length > 0) {
+                final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, INFER_NULLITY_ANNOTATIONS, false);
+                progressTask.setMinIterationTime(200);
+                progressTask.setTask(new AnnotateTask(project, progressTask, infos));
+                ProgressManager.getInstance().run(progressTask);
+              } else {
+                NullityInferrer.nothingFoundMessage(project);
+              }
             }
-          }
-        }.execute();
+          }.execute();
+        }
+        finally {
+          action.finish();
+        }
       }
     };
-    SwingUtilities.invokeLater(applyRunnable);
   }
 
   private void restartAnalysis(final Project project, final AnalysisScope scope) {
@@ -233,11 +287,69 @@
   }
 
 
+  private void showUsageView(final Project project, final UsageInfo[] usageInfos, AnalysisScope scope) {
+    final UsageTarget[] targets = UsageTarget.EMPTY_ARRAY;
+    final Ref<Usage[]> convertUsagesRef = new Ref<Usage[]>();
+    if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
+      @Override
+      public void run() {
+        ApplicationManager.getApplication().runReadAction(new Runnable() {
+          @Override
+          public void run() {
+            convertUsagesRef.set(UsageInfo2UsageAdapter.convert(usageInfos));
+          }
+        });
+      }
+    }, "Preprocess usages", true, project)) return;
+
+    if (convertUsagesRef.isNull()) return;
+    final Usage[] usages = convertUsagesRef.get();
+
+    final UsageViewPresentation presentation = new UsageViewPresentation();
+    presentation.setTabText("Infer Nullity Preview");
+    presentation.setShowReadOnlyStatusAsRed(true);
+    presentation.setShowCancelButton(true);
+    presentation.setUsagesString(RefactoringBundle.message("usageView.usagesText"));
+
+    final UsageView usageView = UsageViewManager.getInstance(project).showUsages(targets, usages, presentation, rerunFactory(project, scope));
+
+    final Runnable refactoringRunnable = applyRunnable(project, new Computable<UsageInfo[]>() {
+      @Override
+      public UsageInfo[] compute() {
+        final Set<UsageInfo> infos = UsageViewUtil.getNotExcludedUsageInfos(usageView);
+        return infos.toArray(new UsageInfo[infos.size()]);
+      }
+    });
+
+    String canNotMakeString = "Cannot perform operation.\nThere were changes in code after usages have been found.\nPlease perform operation search again.";
+
+    usageView.addPerformOperationAction(refactoringRunnable, INFER_NULLITY_ANNOTATIONS, canNotMakeString, INFER_NULLITY_ANNOTATIONS, false);
+  }
+
+  private Factory<UsageSearcher> rerunFactory(final Project project, final AnalysisScope scope) {
+    return new Factory<UsageSearcher>() {
+      @Override
+      public UsageSearcher create() {
+        return new UsageInfoSearcherAdapter() {
+          @Override
+          protected UsageInfo[] findUsages() {
+            return InferNullityAnnotationsAction.this.findUsages(project, scope);
+          }
+
+          @Override
+          public void generate(@NotNull Processor<Usage> processor) {
+            processUsages(processor, project);
+          }
+        };
+      }
+    };
+  }
+
   @Override
   protected JComponent getAdditionalActionSettings(Project project, BaseAnalysisActionDialog dialog) {
     final JPanel panel = new JPanel(new VerticalFlowLayout());
     panel.add(new TitledSeparator());
-    myAnnotateLocalVariablesCb = new JCheckBox("Annotate local variables", false);
+    myAnnotateLocalVariablesCb = new JCheckBox("Annotate local variables", PropertiesComponent.getInstance().getBoolean(ANNOTATE_LOCAL_VARIABLES, false));
     panel.add(myAnnotateLocalVariablesCb);
     return panel;
   }
diff --git a/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java b/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java
index 6496349..7ce5e3f 100644
--- a/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java
+++ b/java/java-impl/src/com/intellij/codeInspection/inferNullity/NullityInferrer.java
@@ -17,7 +17,6 @@
 
 import com.intellij.codeInsight.NullableNotNullManager;
 import com.intellij.codeInsight.intention.AddAnnotationFix;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
@@ -27,6 +26,7 @@
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.usageView.UsageInfo;
 import com.intellij.util.ArrayUtil;
 import com.intellij.util.Query;
 import org.jetbrains.annotations.NotNull;
@@ -145,49 +145,40 @@
   public void apply(final Project project) {
     final NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
     for (SmartPsiElementPointer<? extends PsiModifierListOwner> pointer : myNullableSet) {
-      annotateNullable(project, manager, pointer);
+      annotateNullable(project, manager, pointer.getElement());
     }
 
     for (SmartPsiElementPointer<? extends PsiModifierListOwner> pointer : myNotNullSet) {
-      annotateNotNull(project, manager, pointer);
+      annotateNotNull(project, manager, pointer.getElement());
     }
 
-    nothingFoundMessage(project);
-  }
-
-  public boolean nothingFoundMessage(final Project project) {
     if (myNullableSet.isEmpty() && myNotNullSet.isEmpty()) {
-      if (ApplicationManager.getApplication().isUnitTestMode()) {
-        throw new RuntimeException(NOTHING_FOUND_TO_INFER);
-      }
-      SwingUtilities.invokeLater(new Runnable() {
-        @Override
-        public void run() {
-          Messages.showInfoMessage(project, "No places found to infer @Nullable/@NotNull", "Infer Nullity Results");
-        }
-      });
-      return true;
+      throw new RuntimeException(NOTHING_FOUND_TO_INFER);
     }
-    return false;
   }
 
-  private void annotateNotNull(Project project,
-                               NullableNotNullManager manager,
-                               SmartPsiElementPointer<? extends PsiModifierListOwner> pointer) {
-    final PsiModifierListOwner element = pointer.getElement();
+  public static void nothingFoundMessage(final Project project) {
+    SwingUtilities.invokeLater(new Runnable() {
+      @Override
+      public void run() {
+        Messages.showInfoMessage(project, "No places found to infer @Nullable/@NotNull", "Infer Nullity Results");
+      }
+    });
+  }
+
+  private static void annotateNotNull(Project project,
+                                      NullableNotNullManager manager,
+                                      final PsiModifierListOwner element) {
     if (element != null) {
-      if (shouldIgnore(element)) return;
       if (element instanceof PsiField && ((PsiField)element).hasInitializer() && element.hasModifierProperty(PsiModifier.FINAL)) return;
       invoke(project, element, manager.getDefaultNotNull(), manager.getDefaultNullable());
     }
   }
 
-  private void annotateNullable(Project project,
-                                NullableNotNullManager manager,
-                                SmartPsiElementPointer<? extends PsiModifierListOwner> pointer) {
-    final PsiModifierListOwner element = pointer.getElement();
+  private static void annotateNullable(Project project,
+                                       NullableNotNullManager manager,
+                                       final PsiModifierListOwner element) {
     if (element != null) {
-      if (shouldIgnore(element)) return;
       invoke(project, element, manager.getDefaultNullable(), manager.getDefaultNotNull());
     }
   }
@@ -207,12 +198,11 @@
     return myNotNullSet.size() + myNullableSet.size();
   }
 
-  public void apply(int i, Project project, NullableNotNullManager manager) {
-    if (i < myNullableSet.size()) {
-      annotateNullable(project, manager, myNullableSet.get(i));
-    } else {
-      i -= myNullableSet.size();
-      annotateNotNull(project, manager, myNotNullSet.get(i));
+  public static void apply(Project project, NullableNotNullManager manager, UsageInfo info) {
+    if (info instanceof NullableUsageInfo) {
+      annotateNullable(project, manager, (PsiModifierListOwner)info.getElement());
+    } else if (info instanceof NotNullUsageInfo) {
+      annotateNotNull(project, manager, (PsiModifierListOwner)info.getElement());
     }
   }
 
@@ -243,6 +233,33 @@
     numAnnotationsAdded++;
   }
 
+  private static class NullableUsageInfo extends UsageInfo {
+    public NullableUsageInfo(@NotNull PsiElement element) {
+      super(element);
+    }
+  }
+
+  private static class NotNullUsageInfo extends UsageInfo {
+    private NotNullUsageInfo(@NotNull PsiElement element) {
+      super(element);
+    }
+  }
+
+  public void collect(List<UsageInfo> usages) {
+    collect(usages, true);
+    collect(usages, false);
+  }
+
+  private void collect(List<UsageInfo> usages, boolean nullable) {
+    final List<SmartPsiElementPointer<? extends PsiModifierListOwner>> set = nullable ? myNullableSet : myNotNullSet;
+    for (SmartPsiElementPointer<? extends PsiModifierListOwner> elementPointer : set) {
+      final PsiModifierListOwner element = elementPointer.getElement();
+      if (element != null && !shouldIgnore(element)) {
+        usages.add(nullable ? new NullableUsageInfo(element) : new NotNullUsageInfo(element));
+      }
+    }
+  }
+
   private class ExpressionIsNeverNullVisitor extends JavaElementVisitor {
     private boolean neverNull = true;
 
diff --git a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
index b65366b..ea4b7da 100644
--- a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
+++ b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
@@ -43,6 +43,7 @@
   private static final Logger LOG = Logger.getInstance("#" + RefJavaManagerImpl.class.getName());
   private PsiMethod myAppMainPattern;
   private PsiMethod myAppPremainPattern;
+  private PsiMethod myAppAgentmainPattern;
   private PsiClass myApplet;
   private PsiClass myServlet;
   private RefPackage myDefaultPackage;
@@ -59,6 +60,7 @@
     try {
       myAppMainPattern = factory.createMethodFromText("void main(String[] args);", null);
       myAppPremainPattern = factory.createMethodFromText("void premain(String[] args, java.lang.instrument.Instrumentation i);", null);
+      myAppAgentmainPattern = factory.createMethodFromText("void agentmain(String[] args, java.lang.instrument.Instrumentation i);", null);
     }
     catch (IncorrectOperationException e) {
       LOG.error(e);
@@ -141,6 +143,11 @@
   }
 
   @Override
+  public PsiMethod getAppAgentmainPattern() {
+    return myAppAgentmainPattern;
+  }
+
+  @Override
   public PsiClass getApplet() {
     return myApplet;
   }
@@ -194,6 +201,7 @@
     myApplet = null;
     myAppMainPattern = null;
     myAppPremainPattern = null;
+    myAppAgentmainPattern = null;
     myServlet = null;
     myDefaultPackage = null;
     myProjectIterator = null;
diff --git a/java/java-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspection.java b/java/java-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspection.java
index ca134c5..38ee744 100644
--- a/java/java-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspection.java
@@ -85,7 +85,7 @@
     private static void groupByCodeBlocks(final Collection<PsiReference> allReferences, Map<PsiCodeBlock, Collection<PsiReference>> refs) {
       for (PsiReference psiReference : allReferences) {
         final PsiElement element = psiReference.getElement();
-        final PsiCodeBlock block = PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class);
+        final PsiCodeBlock block = PsiTreeUtil.getTopmostParentOfType(element, PsiCodeBlock.class);
         LOG.assertTrue(block != null);
         Collection<PsiReference> references = refs.get(block);
         if (references == null) {
diff --git a/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java b/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java
index ce04618..3fd1161 100644
--- a/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java
+++ b/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java
@@ -39,13 +39,13 @@
 import com.intellij.psi.meta.PsiMetaData;
 import com.intellij.psi.meta.PsiMetaOwner;
 import com.intellij.psi.search.*;
-import com.intellij.psi.search.searches.ClassInheritorsSearch;
-import com.intellij.psi.search.searches.MethodReferencesSearch;
-import com.intellij.psi.search.searches.OverridingMethodsSearch;
-import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.search.searches.*;
 import com.intellij.psi.targets.AliasingPsiTarget;
 import com.intellij.psi.targets.AliasingPsiTargetMapper;
-import com.intellij.psi.util.*;
+import com.intellij.psi.util.MethodSignature;
+import com.intellij.psi.util.PropertyUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.psi.xml.XmlAttributeValue;
 import com.intellij.refactoring.util.JavaNonCodeSearchElementDescriptionProvider;
 import com.intellij.refactoring.util.NonCodeSearchDescriptionLocation;
@@ -346,6 +346,13 @@
         }
         else if (classOptions.isImplementingClasses){
           if (!addImplementingClasses(psiClass, processor, classOptions)) return false;
+          FunctionalExpressionSearch.search(psiClass, classOptions.searchScope).forEach(new PsiElementProcessorAdapter<PsiFunctionalExpression>(
+            new PsiElementProcessor<PsiFunctionalExpression>() {
+              @Override
+              public boolean execute(@NotNull PsiFunctionalExpression expression) {
+                return addResult(processor, expression, options);
+              }
+            }));
         }
       }
       else if (classOptions.isDerivedClasses) {
@@ -364,6 +371,13 @@
       final JavaMethodFindUsagesOptions methodOptions = (JavaMethodFindUsagesOptions)options;
       if (isAbstract && methodOptions.isImplementingMethods || methodOptions.isOverridingMethods) {
         if (!processOverridingMethods(psiMethod, processor, methodOptions)) return false;
+        FunctionalExpressionSearch.search(psiMethod, methodOptions.searchScope).forEach(new PsiElementProcessorAdapter<PsiFunctionalExpression>(
+          new PsiElementProcessor<PsiFunctionalExpression>() {
+            @Override
+            public boolean execute(@NotNull PsiFunctionalExpression expression) {
+              return addResult(processor, expression, options);
+            }
+          }));
       }
     }
 
diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyNodeDescriptor.java b/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyNodeDescriptor.java
index 3e0a0e1..61e5303 100644
--- a/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyNodeDescriptor.java
+++ b/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyNodeDescriptor.java
@@ -24,10 +24,7 @@
 import com.intellij.openapi.roots.ui.util.CompositeAppearance;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Iconable;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiModifier;
+import com.intellij.psi.*;
 import com.intellij.psi.presentation.java.ClassPresentationUtil;
 import com.intellij.ui.LayeredIcon;
 import com.intellij.ui.RowIcon;
@@ -41,13 +38,12 @@
   private Icon myStateIcon;
   private MethodHierarchyTreeStructure myTreeStructure;
 
-  public MethodHierarchyNodeDescriptor(
-    final Project project,
-    final HierarchyNodeDescriptor parentDescriptor,
-    final PsiClass aClass,
-    final boolean isBase,
-    final MethodHierarchyTreeStructure treeStructure
-  ){
+  public MethodHierarchyNodeDescriptor(final Project project,
+                                       final HierarchyNodeDescriptor parentDescriptor,
+                                       final PsiElement aClass,
+                                       final boolean isBase,
+                                       final MethodHierarchyTreeStructure treeStructure
+  ) {
     super(project, parentDescriptor, aClass, isBase);
     myTreeStructure = treeStructure;
   }
@@ -60,24 +56,26 @@
     return MethodHierarchyUtil.findBaseMethodInClass(myTreeStructure.getBaseMethod(), aClass, checkBases);
   }
 
-  public final PsiClass getPsiClass() {
-    return (PsiClass)myElement;
+  public final PsiElement getPsiClass() {
+    return myElement;
   }
 
   /**
    * Element for OpenFileDescriptor
    */
   public final PsiElement getTargetElement() {
-    final PsiClass aClass = getPsiClass();
-    if (aClass == null || !aClass.isValid()) return null;
+    final PsiElement element = getPsiClass();
+    if (!(element instanceof PsiClass)) return element;
+    final PsiClass aClass = (PsiClass)getPsiClass();
+    if (!aClass.isValid()) return null;
     final PsiMethod method = getMethod(aClass, false);
     if (method != null) return method;
     return aClass;
   }
 
   public final boolean isValid() {
-    final PsiClass aClass = getPsiClass();
-    return aClass != null && aClass.isValid();
+    final PsiElement psiElement = getPsiClass();
+    return psiElement != null && psiElement.isValid();
   }
 
   public final boolean update() {
@@ -88,7 +86,7 @@
 
     boolean changes = super.update();
 
-    final PsiClass psiClass = getPsiClass();
+    final PsiElement psiClass = getPsiClass();
 
     if (psiClass == null){
       final String invalidPrefix = IdeBundle.message("node.hierarchy.invalid");
@@ -99,7 +97,7 @@
     }
 
     final Icon newRawIcon = psiClass.getIcon(flags);
-    final Icon newStateIcon = calculateState(psiClass);
+    final Icon newStateIcon = psiClass instanceof PsiClass ? calculateState((PsiClass)psiClass) : AllIcons.Hierarchy.MethodDefined;
 
     if (changes || newRawIcon != myRawIcon || newStateIcon != myStateIcon) {
       changes = true;
@@ -133,8 +131,12 @@
     if (myColor != null) {
       classNameAttributes = new TextAttributes(myColor, null, null, null, Font.PLAIN);
     }
-    myHighlightedText.getEnding().addText(ClassPresentationUtil.getNameForClass(psiClass, false), classNameAttributes);
-    myHighlightedText.getEnding().addText("  (" + JavaHierarchyUtil.getPackageName(psiClass) + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
+    if (psiClass instanceof PsiClass) {
+      myHighlightedText.getEnding().addText(ClassPresentationUtil.getNameForClass((PsiClass)psiClass, false), classNameAttributes);
+      myHighlightedText.getEnding().addText("  (" + JavaHierarchyUtil.getPackageName((PsiClass)psiClass) + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
+    } else if (psiClass instanceof PsiFunctionalExpression) {
+      myHighlightedText.getEnding().addText(ClassPresentationUtil.getFunctionalExpressionPresentation((PsiFunctionalExpression)psiClass, false));
+    }
     myName = myHighlightedText.getText();
 
     if (!Comparing.equal(myHighlightedText, oldText)) {
diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyTreeStructure.java b/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyTreeStructure.java
index acc9064..7a5e869 100644
--- a/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyTreeStructure.java
+++ b/java/java-impl/src/com/intellij/ide/hierarchy/method/MethodHierarchyTreeStructure.java
@@ -21,6 +21,9 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.Processor;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -152,11 +155,12 @@
   @NotNull
   @Override
   protected final Object[] buildChildren(@NotNull final HierarchyNodeDescriptor descriptor) {
-    final PsiClass psiClass = ((MethodHierarchyNodeDescriptor)descriptor).getPsiClass();
-
+    final PsiElement psiElement = ((MethodHierarchyNodeDescriptor)descriptor).getPsiClass();
+    if (!(psiElement instanceof PsiClass)) return ArrayUtil.EMPTY_OBJECT_ARRAY;
+    final PsiClass psiClass = (PsiClass)psiElement;
     final Collection<PsiClass> subclasses = getSubclasses(psiClass);
 
-    List<HierarchyNodeDescriptor> descriptors = new ArrayList<HierarchyNodeDescriptor>(subclasses.size());
+    final List<HierarchyNodeDescriptor> descriptors = new ArrayList<HierarchyNodeDescriptor>(subclasses.size());
     for (final PsiClass aClass : subclasses) {
       if (HierarchyBrowserManager.getInstance(myProject).getState().HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED) {
         if (shouldHideClass(aClass)) {
@@ -167,6 +171,15 @@
       final MethodHierarchyNodeDescriptor d = new MethodHierarchyNodeDescriptor(myProject, descriptor, aClass, false, this);
       descriptors.add(d);
     }
+
+    FunctionalExpressionSearch.search(getBaseMethod()).forEach(new Processor<PsiFunctionalExpression>() {
+      @Override
+      public boolean process(PsiFunctionalExpression expression) {
+        descriptors.add(new MethodHierarchyNodeDescriptor(myProject, descriptor, expression, false, MethodHierarchyTreeStructure.this));
+        return true;
+      }
+    });
+
     return descriptors.toArray(new HierarchyNodeDescriptor[descriptors.size()]);
   }
 
diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java b/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java
index cf7ea89..73504e6 100644
--- a/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java
+++ b/java/java-impl/src/com/intellij/ide/hierarchy/method/OverrideImplementMethodAction.java
@@ -68,7 +68,10 @@
                 final ReadonlyStatusHandler.OperationStatus status = ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(VfsUtil.toVirtualFileArray(files));
                 if (!status.hasReadonlyFiles()) {
                   for (HierarchyNodeDescriptor selectedDescriptor : selectedDescriptors) {
-                    OverrideImplementUtil.overrideOrImplement(((MethodHierarchyNodeDescriptor)selectedDescriptor).getPsiClass(), methodHierarchyBrowser.getBaseMethod());
+                    final PsiElement aClass = ((MethodHierarchyNodeDescriptor)selectedDescriptor).getPsiClass();
+                    if (aClass instanceof PsiClass) {
+                      OverrideImplementUtil.overrideOrImplement((PsiClass)aClass, methodHierarchyBrowser.getBaseMethod());
+                    }
                   }
                   ToolWindowManager.getInstance(project).activateEditorComponent();
                 }
@@ -146,8 +149,10 @@
   protected abstract void update(Presentation presentation, int toImplement, int toOverride);
 
   private static boolean canImplementOverride(final MethodHierarchyNodeDescriptor descriptor, final MethodHierarchyBrowser methodHierarchyBrowser, final boolean toImplement) {
-    final PsiClass psiClass = descriptor.getPsiClass();
-    if (psiClass == null || psiClass instanceof PsiSyntheticClass) return false;
+    final PsiElement psiElement = descriptor.getPsiClass();
+    if (!(psiElement instanceof PsiClass)) return false;
+    final PsiClass psiClass = (PsiClass)psiElement;
+    if (psiClass instanceof PsiSyntheticClass) return false;
     final PsiMethod baseMethod = methodHierarchyBrowser.getBaseMethod();
     if (baseMethod == null) return false;
     final MethodSignature signature = baseMethod.getSignature(PsiSubstitutor.EMPTY);
diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/type/SubtypesHierarchyTreeStructure.java b/java/java-impl/src/com/intellij/ide/hierarchy/type/SubtypesHierarchyTreeStructure.java
index 478ecd2..dd10433 100644
--- a/java/java-impl/src/com/intellij/ide/hierarchy/type/SubtypesHierarchyTreeStructure.java
+++ b/java/java-impl/src/com/intellij/ide/hierarchy/type/SubtypesHierarchyTreeStructure.java
@@ -19,12 +19,12 @@
 import com.intellij.ide.hierarchy.HierarchyNodeDescriptor;
 import com.intellij.ide.hierarchy.HierarchyTreeStructure;
 import com.intellij.openapi.project.Project;
-import com.intellij.psi.CommonClassNames;
-import com.intellij.psi.PsiAnonymousClass;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiModifier;
+import com.intellij.psi.*;
+import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.util.ArrayUtil;
+import com.intellij.util.Processor;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.ArrayList;
@@ -45,17 +45,27 @@
 
   @NotNull
   protected final Object[] buildChildren(@NotNull final HierarchyNodeDescriptor descriptor) {
-    final PsiClass psiClass = ((TypeHierarchyNodeDescriptor)descriptor).getPsiClass();
+    final Object element = ((TypeHierarchyNodeDescriptor)descriptor).getPsiClass();
+    if (!(element instanceof PsiClass)) return ArrayUtil.EMPTY_OBJECT_ARRAY;
+    final PsiClass psiClass = (PsiClass)element;
     if (CommonClassNames.JAVA_LANG_OBJECT.equals(psiClass.getQualifiedName())) {
       return new Object[]{IdeBundle.message("node.hierarchy.java.lang.object")};
     }
     if (psiClass instanceof PsiAnonymousClass) return ArrayUtil.EMPTY_OBJECT_ARRAY;
     if (psiClass.hasModifierProperty(PsiModifier.FINAL)) return ArrayUtil.EMPTY_OBJECT_ARRAY;
-    final List<PsiClass> classes = new ArrayList<PsiClass>(ClassInheritorsSearch.search(psiClass, psiClass.getUseScope().intersectWith(getSearchScope(myCurrentScopeType, psiClass)), false).findAll());
-    final HierarchyNodeDescriptor[] descriptors = new HierarchyNodeDescriptor[classes.size()];
-    for (int i = 0; i < classes.size(); i++) {
-      descriptors[i] = new TypeHierarchyNodeDescriptor(myProject, descriptor, classes.get(i), false);
+    final SearchScope searchScope = psiClass.getUseScope().intersectWith(getSearchScope(myCurrentScopeType, psiClass));
+    final List<PsiClass> classes = new ArrayList<PsiClass>(ClassInheritorsSearch.search(psiClass, searchScope, false).findAll());
+    final List<HierarchyNodeDescriptor> descriptors = new ArrayList<HierarchyNodeDescriptor>(classes.size());
+    for (PsiClass aClass : classes) {
+      descriptors.add(new TypeHierarchyNodeDescriptor(myProject, descriptor, aClass, false));
     }
-    return descriptors;
+    FunctionalExpressionSearch.search(psiClass, searchScope).forEach(new Processor<PsiFunctionalExpression>() {
+      @Override
+      public boolean process(PsiFunctionalExpression expression) {
+        descriptors.add(new TypeHierarchyNodeDescriptor(myProject, descriptor, expression, false));
+        return true;
+      }
+    });
+    return descriptors.toArray(new HierarchyNodeDescriptor[descriptors.size()]);
   }
 }
diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/type/SupertypesHierarchyTreeStructure.java b/java/java-impl/src/com/intellij/ide/hierarchy/type/SupertypesHierarchyTreeStructure.java
index fe7bb82..b5c6bf0 100644
--- a/java/java-impl/src/com/intellij/ide/hierarchy/type/SupertypesHierarchyTreeStructure.java
+++ b/java/java-impl/src/com/intellij/ide/hierarchy/type/SupertypesHierarchyTreeStructure.java
@@ -18,9 +18,9 @@
 import com.intellij.ide.hierarchy.HierarchyNodeDescriptor;
 import com.intellij.ide.hierarchy.HierarchyTreeStructure;
 import com.intellij.openapi.project.Project;
-import com.intellij.psi.CommonClassNames;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.ArrayUtil;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.ArrayList;
@@ -34,15 +34,24 @@
 
   @NotNull
   protected final Object[] buildChildren(@NotNull final HierarchyNodeDescriptor descriptor) {
-    final PsiClass psiClass = ((TypeHierarchyNodeDescriptor)descriptor).getPsiClass();
-    final PsiClass[] supers = psiClass.getSupers();
-    final List<HierarchyNodeDescriptor> descriptors = new ArrayList<HierarchyNodeDescriptor>();
-    PsiClass objectClass = JavaPsiFacade.getInstance(myProject).findClass(CommonClassNames.JAVA_LANG_OBJECT, psiClass.getResolveScope());
-    for (PsiClass aSuper : supers) {
-      if (!psiClass.isInterface() || !aSuper.equals(objectClass)) {
-        descriptors.add(new TypeHierarchyNodeDescriptor(myProject, descriptor, aSuper, false));
+    final Object element = ((TypeHierarchyNodeDescriptor)descriptor).getPsiClass();
+    if (element instanceof PsiClass) {
+      final PsiClass psiClass = (PsiClass)element;
+      final PsiClass[] supers = psiClass.getSupers();
+      final List<HierarchyNodeDescriptor> descriptors = new ArrayList<HierarchyNodeDescriptor>();
+      final PsiClass objectClass = JavaPsiFacade.getInstance(myProject).findClass(CommonClassNames.JAVA_LANG_OBJECT, psiClass.getResolveScope());
+      for (PsiClass aSuper : supers) {
+        if (!psiClass.isInterface() || !aSuper.equals(objectClass)) {
+          descriptors.add(new TypeHierarchyNodeDescriptor(myProject, descriptor, aSuper, false));
+        }
+      }
+      return descriptors.toArray(new HierarchyNodeDescriptor[descriptors.size()]);
+    } else if (element instanceof PsiFunctionalExpression) {
+      final PsiClass functionalInterfaceClass = PsiUtil.resolveClassInType(((PsiFunctionalExpression)element).getFunctionalInterfaceType());
+      if (functionalInterfaceClass != null) {
+        return new HierarchyNodeDescriptor[] {new TypeHierarchyNodeDescriptor(myProject, descriptor, functionalInterfaceClass, false)};
       }
     }
-    return descriptors.toArray(new HierarchyNodeDescriptor[descriptors.size()]);
+    return ArrayUtil.EMPTY_OBJECT_ARRAY;
   }
 }
diff --git a/java/java-impl/src/com/intellij/ide/hierarchy/type/TypeHierarchyNodeDescriptor.java b/java/java-impl/src/com/intellij/ide/hierarchy/type/TypeHierarchyNodeDescriptor.java
index 0423264..2351f6f 100644
--- a/java/java-impl/src/com/intellij/ide/hierarchy/type/TypeHierarchyNodeDescriptor.java
+++ b/java/java-impl/src/com/intellij/ide/hierarchy/type/TypeHierarchyNodeDescriptor.java
@@ -24,23 +24,25 @@
 import com.intellij.openapi.roots.ui.util.CompositeAppearance;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFunctionalExpression;
 import com.intellij.psi.presentation.java.ClassPresentationUtil;
 import com.intellij.ui.LayeredIcon;
 
 import java.awt.*;
 
 public final class TypeHierarchyNodeDescriptor extends HierarchyNodeDescriptor {
-  public TypeHierarchyNodeDescriptor(final Project project, final HierarchyNodeDescriptor parentDescriptor, final PsiClass psiClass, final boolean isBase) {
-    super(project, parentDescriptor, psiClass, isBase);
+  public TypeHierarchyNodeDescriptor(final Project project, final HierarchyNodeDescriptor parentDescriptor, final PsiElement classOrFunctionalExpression, final boolean isBase) {
+    super(project, parentDescriptor, classOrFunctionalExpression, isBase);
   }
 
-  public final PsiClass getPsiClass() {
-    return (PsiClass)myElement;
+  public final PsiElement getPsiClass() {
+    return myElement;
   }
 
   public final boolean isValid() {
-    final PsiClass aClass = getPsiClass();
-    return aClass != null && aClass.isValid();
+    final PsiElement psiElement = getPsiClass();
+    return psiElement != null && psiElement.isValid();
   }
 
   public final boolean update() {
@@ -61,7 +63,7 @@
       setIcon(icon);
     }
 
-    final PsiClass psiClass = getPsiClass();
+    final PsiElement psiElement = getPsiClass();
 
     final CompositeAppearance oldText = myHighlightedText;
 
@@ -71,8 +73,12 @@
     if (myColor != null) {
       classNameAttributes = new TextAttributes(myColor, null, null, null, Font.PLAIN);
     }
-    myHighlightedText.getEnding().addText(ClassPresentationUtil.getNameForClass(psiClass, false), classNameAttributes);
-    myHighlightedText.getEnding().addText(" (" + JavaHierarchyUtil.getPackageName(psiClass) + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
+    if (psiElement instanceof PsiClass) {
+      myHighlightedText.getEnding().addText(ClassPresentationUtil.getNameForClass((PsiClass)psiElement, false), classNameAttributes);
+      myHighlightedText.getEnding().addText(" (" + JavaHierarchyUtil.getPackageName((PsiClass)psiElement) + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
+    } else if (psiElement instanceof PsiFunctionalExpression) {
+      myHighlightedText.getEnding().addText(ClassPresentationUtil.getFunctionalExpressionPresentation(((PsiFunctionalExpression)psiElement), false));
+    }
     myName = myHighlightedText.getText();
 
     if (!Comparing.equal(myHighlightedText, oldText)) {
diff --git a/java/java-impl/src/com/intellij/ide/util/scopeChooser/ClassHierarchyScopeDescriptor.java b/java/java-impl/src/com/intellij/ide/util/scopeChooser/ClassHierarchyScopeDescriptor.java
index 99826b8..3b9e249 100644
--- a/java/java-impl/src/com/intellij/ide/util/scopeChooser/ClassHierarchyScopeDescriptor.java
+++ b/java/java-impl/src/com/intellij/ide/util/scopeChooser/ClassHierarchyScopeDescriptor.java
@@ -26,11 +26,14 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFunctionalExpression;
 import com.intellij.psi.presentation.java.ClassPresentationUtil;
 import com.intellij.psi.search.LocalSearchScope;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.util.Processor;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.LinkedList;
@@ -59,11 +62,19 @@
       PsiClass aClass = chooser.getSelected();
       if (aClass == null) return null;
 
-      List<PsiElement> classesToSearch = new LinkedList<PsiElement>();
+      final List<PsiElement> classesToSearch = new LinkedList<PsiElement>();
       classesToSearch.add(aClass);
 
       classesToSearch.addAll(ClassInheritorsSearch.search(aClass, true).findAll());
 
+      FunctionalExpressionSearch.search(aClass).forEach(new Processor<PsiFunctionalExpression>() {
+        @Override
+        public boolean process(PsiFunctionalExpression expression) {
+          classesToSearch.add(expression);
+          return true;
+        }
+      });
+
       myCachedScope = new LocalSearchScope(PsiUtilCore.toPsiElementArray(classesToSearch),
                                            IdeBundle.message("scope.hierarchy", ClassPresentationUtil.getNameForClass(aClass, true)));
     }
diff --git a/java/java-impl/src/com/intellij/lang/java/JavaPsiElementExternalizer.java b/java/java-impl/src/com/intellij/lang/java/JavaPsiElementExternalizer.java
new file mode 100644
index 0000000..ff7bbf8
--- /dev/null
+++ b/java/java-impl/src/com/intellij/lang/java/JavaPsiElementExternalizer.java
@@ -0,0 +1,64 @@
+/*
+ * 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.lang.java;
+
+import com.intellij.lang.PsiElementExternalizer;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class JavaPsiElementExternalizer implements PsiElementExternalizer {
+  @Override
+  public String getQualifiedName(PsiElement element) {
+    if (element instanceof PsiClass) {
+      return ((PsiClass)element).getQualifiedName();
+    } else if (element instanceof PsiMember) {
+      final String name = getQualifiedName(((PsiMember)element).getContainingClass());
+      return name + "#" + ((PsiMember)element).getName();
+    }
+    return null;
+  }
+
+  @Nullable
+  @Override
+  public PsiElement findByQualifiedName(Project project, @NotNull String qualifiedName) {
+    final String[] parts = qualifiedName.split("#");
+    if (parts.length > 0) {
+      final String fqn = parts[0];
+      final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(fqn, GlobalSearchScope.projectScope(project));
+      if (psiClass != null) {
+        if (parts.length == 2) {
+          final String memberName = parts[1];
+          final PsiField field = psiClass.findFieldByName(memberName, false);
+          if (field != null) {
+            return field;
+          }
+          final PsiMethod[] methods = psiClass.findMethodsByName(memberName, false);
+          if (methods.length > 0) {
+            return methods[0];
+          }
+        }
+        return psiClass;
+      }
+    }
+    return null;
+  }
+}
diff --git a/java/java-impl/src/com/intellij/openapi/module/BasePackageParameterFactory.java b/java/java-impl/src/com/intellij/openapi/module/BasePackageParameterFactory.java
index 809f65d..c59ab2c 100644
--- a/java/java-impl/src/com/intellij/openapi/module/BasePackageParameterFactory.java
+++ b/java/java-impl/src/com/intellij/openapi/module/BasePackageParameterFactory.java
@@ -78,13 +78,15 @@
         HashMap<String, String> map = new HashMap<String, String>(2);
         map.put(getId(), getValue());
         map.put("IJ_BASE_PACKAGE_DIR", getValue().replace('.', '/'));
+        map.put("IJ_BASE_PACKAGE_PREFIX", StringUtil.isEmpty(getValue()) ? "" : getValue() + ".");
         return map;
       }
 
       @Override
       public boolean validate() throws ConfigurationException {
-        if (!PsiNameHelperImpl.getInstance().isQualifiedName(getValue())) {
-          throw new ConfigurationException(getValue() + " is not a valid package name");
+        String value = getValue();
+        if (!StringUtil.isEmpty(value) && !PsiNameHelperImpl.getInstance().isQualifiedName(value)) {
+          throw new ConfigurationException(value + " is not a valid package name");
         }
         return true;
       }
diff --git a/java/java-impl/src/com/intellij/openapi/module/JavaModuleType.java b/java/java-impl/src/com/intellij/openapi/module/JavaModuleType.java
index 4de05e2..3b38560 100644
--- a/java/java-impl/src/com/intellij/openapi/module/JavaModuleType.java
+++ b/java/java-impl/src/com/intellij/openapi/module/JavaModuleType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -22,7 +22,6 @@
 import com.intellij.openapi.projectRoots.SdkTypeId;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.IconLoader;
 import com.intellij.psi.CommonClassNames;
 import com.intellij.psi.JavaPsiFacade;
 import org.jetbrains.annotations.NonNls;
@@ -40,6 +39,8 @@
 
   public static final String MODULE_NAME = ProjectBundle.message("module.type.java.name");
   public static final String JAVA_GROUP = "Java";
+  public static final String BUILD_TOOLS_GROUP = "Build Tools";
+  public static final String MOBILE_GROUP = "Mobile Java";
   private static final String JAVA_MODULE = ModuleTypeId.JAVA_MODULE;
 
   public JavaModuleType() {
@@ -80,7 +81,7 @@
 
   @Nullable
   @Override
-  public ModuleWizardStep modifySettingsStep(@NotNull SettingsStep settingsStep, @NotNull final ModuleBuilder moduleBuilder) {
+  public ModuleWizardStep modifyProjectTypeStep(@NotNull SettingsStep settingsStep, @NotNull final ModuleBuilder moduleBuilder) {
     return ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, moduleBuilder, new Condition<SdkTypeId>() {
       @Override
       public boolean value(SdkTypeId sdkType) {
@@ -97,15 +98,6 @@
     return AllIcons.Nodes.Module;
   }
 
-  private static class WizardIconHolder {
-    private static final Icon WIZARD_ICON = IconLoader.getIcon("/addmodulewizard.png");
-  }
-
-  private static Icon getWizardIcon() {
-
-    return WizardIconHolder.WIZARD_ICON;
-  }
-
   @Override
   public boolean isValidSdk(@NotNull final Module module, final Sdk projectSdk) {
     return isValidJavaSdk(module);
diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
index eb3ea75..2aa495c 100644
--- a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
+++ b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
@@ -333,6 +333,10 @@
     if(sources != null){
       sdkModificator.addRoot(sources, OrderRootType.SOURCES);
     }
+    final VirtualFile javaFxSources = findSources(jdkHome, "javafx-src");
+    if (javaFxSources != null) {
+      sdkModificator.addRoot(javaFxSources, OrderRootType.SOURCES);
+    }
     if(docs != null){
       sdkModificator.addRoot(docs, JavadocOrderRootType.getInstance());
     }
@@ -362,6 +366,10 @@
           sdkModificator.addRoot(VirtualFileManager.getInstance().findFileByUrl(url), JavadocOrderRootType.getInstance());
         }
       }
+    } else {
+      if (getVersion(sdk) == JavaSdkVersion.JDK_1_7) {
+        sdkModificator.addRoot(VirtualFileManager.getInstance().findFileByUrl("http://docs.oracle.com/javafx/2/api/"), JavadocOrderRootType.getInstance());
+      }
     }
     attachJdkAnnotations(sdkModificator);
     sdkModificator.commitChanges();
@@ -493,10 +501,16 @@
   @Nullable
   @SuppressWarnings({"HardCodedStringLiteral"})
   public static VirtualFile findSources(File file) {
+    return findSources(file, "src");
+  }
+
+  @Nullable
+  @SuppressWarnings({"HardCodedStringLiteral"})
+  public static VirtualFile findSources(File file, final String srcName) {
     File srcDir = new File(file, "src");
-    File jarFile = new File(file, "src.jar");
+    File jarFile = new File(file, srcName + ".jar");
     if (!jarFile.exists()) {
-      jarFile = new File(file, "src.zip");
+      jarFile = new File(file, srcName + ".zip");
     }
 
     if (jarFile.exists()) {
diff --git a/java/java-impl/src/com/intellij/packageDependencies/JavaDependenciesVisitorFactory.java b/java/java-impl/src/com/intellij/packageDependencies/JavaDependenciesVisitorFactory.java
index 98270dc..c056919 100644
--- a/java/java-impl/src/com/intellij/packageDependencies/JavaDependenciesVisitorFactory.java
+++ b/java/java-impl/src/com/intellij/packageDependencies/JavaDependenciesVisitorFactory.java
@@ -74,7 +74,9 @@
           if (returnType != null) {
             PsiClass psiClass = PsiUtil.resolveClassInType(returnType);
             if (psiClass != null) {
-              processor.process(expression, psiClass);
+              if (!(psiClass instanceof PsiTypeParameter)) {
+                processor.process(expression, psiClass);
+              }
             }
           }
         }
diff --git a/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java b/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java
index c9d53ae..d0d7cce 100644
--- a/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.java
+++ b/java/java-impl/src/com/intellij/psi/AbstractQualifiedReference.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.
@@ -249,7 +249,7 @@
     private final Set<ResolveResult> myResults = new LinkedHashSet<ResolveResult>();
 
     @Override
-    public boolean execute(@NotNull final PsiElement element, final ResolveState state) {
+    public boolean execute(@NotNull final PsiElement element, @NotNull final ResolveState state) {
       if (isFound()) return false;
       process(element);
       return true;
@@ -264,7 +264,7 @@
     }
 
     @Override
-    public void handleEvent(final Event event, final Object associated) {
+    public void handleEvent(@NotNull final Event event, final Object associated) {
       if ((event == JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT || event == Event.SET_DECLARATION_HOLDER) && !myResults.isEmpty()) {
         setFound();
       }
diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java b/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java
index 975bece..65f556e 100644
--- a/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java
+++ b/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java
@@ -70,11 +70,9 @@
           }
           result.add(createJavaBlock(child, mySettings, myJavaSettings, myChildIndent, arrangeChildWrap(child, childWrap), alignment));
         } else {
-          if (myAlignmentStrategy != null) {
-            Alignment candidate = myAlignmentStrategy.getAlignment(child.getElementType());
-            if (candidate != null) {
-              alignment = myChildAlignment = candidate;
-            }
+          Alignment candidate = myAlignmentStrategy.getAlignment(child.getElementType());
+          if (candidate != null) {
+            alignment = myChildAlignment = candidate;
           }
           processChild(elementsExceptKeyword, child, myChildAlignment, childWrap, myChildIndent);
         }
diff --git a/java/java-impl/src/com/intellij/psi/impl/light/LightParameter.java b/java/java-impl/src/com/intellij/psi/impl/light/LightParameter.java
index 6f5b426..44834f7 100644
--- a/java/java-impl/src/com/intellij/psi/impl/light/LightParameter.java
+++ b/java/java-impl/src/com/intellij/psi/impl/light/LightParameter.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.
@@ -25,7 +25,6 @@
 public class LightParameter extends LightVariableBuilder<LightVariableBuilder> implements PsiParameter {
   public static final LightParameter[] EMPTY_ARRAY = new LightParameter[0];
 
-  private final String myName;
   private final PsiElement myDeclarationScope;
   private final boolean myVarArgs;
 
@@ -35,7 +34,6 @@
 
   public LightParameter(@NotNull String name, @NotNull PsiType type, PsiElement declarationScope, Language language, boolean isVarArgs) {
     super(declarationScope.getManager(), name, type, language);
-    myName = name;
     myDeclarationScope = declarationScope;
     myVarArgs = isVarArgs;
   }
@@ -61,10 +59,4 @@
   public boolean isVarArgs() {
     return myVarArgs;
   }
-
-  @Override
-  @NotNull
-  public String getName() {
-    return myName;
-  }
 }
diff --git a/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java b/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
index 0309800..c3319d2 100644
--- a/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
+++ b/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.psi.impl.smartPointers;
 
+import com.intellij.lang.LanguageUtil;
 import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.util.ProperTextRange;
 import com.intellij.openapi.util.TextRange;
@@ -38,7 +39,7 @@
 
   AnchorElementInfo(@NotNull PsiElement anchor, @NotNull PsiFile containingFile) {
     super(containingFile.getProject(), ProperTextRange.create(anchor.getTextRange()), anchor.getClass(), containingFile,
-          containingFile.getLanguage());
+          LanguageUtil.getRootLanguage(anchor));
     assert !(anchor instanceof PsiFile) : "FileElementInfo must be used for file: "+anchor;
   }
   // will restore by stub index until file tree get loaded
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/BraceEnforcer.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/BraceEnforcer.java
index b902a02..4adad41 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/BraceEnforcer.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/BraceEnforcer.java
@@ -16,14 +16,12 @@
 package com.intellij.psi.impl.source.codeStyle;
 
 import com.intellij.lang.java.JavaLanguage;
-import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.codeStyle.CodeStyleSettings;
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
-import com.intellij.psi.formatter.FormatterUtil;
 import com.intellij.psi.impl.source.SourceTreeToPsiMap;
 import com.intellij.psi.jsp.JavaJspRecursiveElementVisitor;
 import com.intellij.psi.jsp.JspFile;
@@ -99,17 +97,14 @@
   
   private void processStatement(PsiStatement statement, PsiStatement blockCandidate, int options) {
     if (blockCandidate instanceof PsiBlockStatement || blockCandidate == null) return;
-    boolean forceNewLine = !FormatterUtil.isFormatterCalledExplicitly() && !ApplicationManager.getApplication().isUnitTestMode()
-                           && !myPostProcessor.getSettings().KEEP_CONTROL_STATEMENT_IN_ONE_LINE;
-    if (forceNewLine
-        || options == CommonCodeStyleSettings.FORCE_BRACES_ALWAYS
+    if (options == CommonCodeStyleSettings.FORCE_BRACES_ALWAYS
         || (options == CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE && PostFormatProcessorHelper.isMultiline(statement)))
     {
-      replaceWithBlock(statement, blockCandidate, forceNewLine);
+      replaceWithBlock(statement, blockCandidate);
     }
   }
 
-  private void replaceWithBlock(@NotNull PsiStatement statement, PsiStatement blockCandidate, boolean forceNewLine) {
+  private void replaceWithBlock(@NotNull PsiStatement statement, PsiStatement blockCandidate) {
     if (!statement.isValid()) {
       LOG.assertTrue(false);
     }
@@ -130,7 +125,7 @@
     int lastLineCommentIndex = oldText.indexOf("//", lastLineFeedIndex);
     StringBuilder buf = new StringBuilder(oldText.length() + 5);
     buf.append("{ ").append(oldText);
-    if (forceNewLine || lastLineCommentIndex >= 0) {
+    if (lastLineCommentIndex >= 0) {
       buf.append("\n");
     }
     buf.append(" }");
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
index 7749d95..b151628 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
@@ -729,7 +729,7 @@
 
   @Override
   public String variableNameToPropertyName(String name, VariableKind variableKind) {
-    if (variableKind == VariableKind.STATIC_FINAL_FIELD) {
+    if (variableKind == VariableKind.STATIC_FINAL_FIELD || variableKind == VariableKind.STATIC_FIELD && name.contains("_")) {
       StringBuilder buffer = new StringBuilder();
       for (int i = 0; i < name.length(); i++) {
         char c = name.charAt(i);
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java
index 08d4405..71e40e5 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.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.
@@ -118,7 +118,7 @@
       }
       processorToUse = new PsiScopeProcessor() {
         @Override
-        public boolean execute(@NotNull PsiElement element, ResolveState state) {
+        public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
           return !(element instanceof PsiClass || element instanceof PsiPackage) || processor.execute(element, state);
         }
 
@@ -128,7 +128,7 @@
         }
 
         @Override
-        public void handleEvent(Event event, Object associated) {
+        public void handleEvent(@NotNull Event event, Object associated) {
           processor.handleEvent(event, associated);
         }
       };
diff --git a/java/java-impl/src/com/intellij/psi/resolve/JavaMethodResolveHelper.java b/java/java-impl/src/com/intellij/psi/resolve/JavaMethodResolveHelper.java
index c89ac72..dbf656a 100644
--- a/java/java-impl/src/com/intellij/psi/resolve/JavaMethodResolveHelper.java
+++ b/java/java-impl/src/com/intellij/psi/resolve/JavaMethodResolveHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -54,7 +54,7 @@
                                                                                                                                       languageLevel);
     myProcessor = new MethodResolverProcessor(argumentList, containingFile, new PsiConflictResolver[]{resolver}) {
       @Override
-      protected MethodCandidateInfo createCandidateInfo(final PsiMethod method, final PsiSubstitutor substitutor,
+      protected MethodCandidateInfo createCandidateInfo(@NotNull final PsiMethod method, @NotNull final PsiSubstitutor substitutor,
                                                         final boolean staticProblem,
                                                         final boolean accessible, final boolean varargs) {
         return JavaMethodResolveHelper.this
@@ -69,7 +69,7 @@
     };
   }
 
-  protected MethodCandidateInfo createCandidateInfo(PsiMethod method,
+  protected MethodCandidateInfo createCandidateInfo(@NotNull PsiMethod method,
                                                     PsiSubstitutor substitutor,
                                                     boolean staticProblem,
                                                     PsiElement currentFileContext,
@@ -81,7 +81,7 @@
                                    PsiType.EMPTY_ARRAY, languageLevel);
   }
 
-  public void addMethod(PsiMethod method, PsiSubstitutor substitutor, boolean staticError) {
+  public void addMethod(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor, boolean staticError) {
     if (myDuplicates.add(method.getSignature(substitutor))) {
       myProcessor.addMethod(method, substitutor, staticError);
     }
diff --git a/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java b/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
index 8f187d1..0746117 100644
--- a/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
+++ b/java/java-impl/src/com/intellij/refactoring/JavaRefactoringSettings.java
@@ -83,6 +83,7 @@
   public boolean INLINE_METHOD_THIS;
   public boolean INLINE_SUPER_CLASS_THIS;
   public boolean INLINE_FIELD_THIS;
+  public boolean INLINE_LOCAL_THIS;
   //public boolean INHERITANCE_TO_DELEGATION_PREVIEW_USAGES;
   public boolean INHERITANCE_TO_DELEGATION_DELEGATE_OTHER;
   //public boolean REPLACE_CONSTRUCTOR_WITH_FACTORY_PREVIEW_USAGES;
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureProcessor.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureProcessor.java
index 5653701..0a831d2 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureProcessor.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,11 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-/**
- * created at Sep 17, 2001
- * @author Jeka
- */
 package com.intellij.refactoring.changeSignature;
 
 import com.intellij.openapi.application.ApplicationManager;
@@ -36,6 +31,7 @@
 import com.intellij.usageView.UsageViewDescriptor;
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.VisibilityUtil;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashSet;
 import com.intellij.util.containers.MultiMap;
 import org.jetbrains.annotations.NotNull;
@@ -43,6 +39,12 @@
 
 import java.util.*;
 
+import static com.intellij.util.ObjectUtils.assertNotNull;
+
+/**
+ * @author Jeka
+ * @since Sep 17, 2001
+ */
 public class ChangeSignatureProcessor extends ChangeSignatureProcessorBase {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.changeSignature.ChangeSignatureProcessor");
 
@@ -99,18 +101,22 @@
                                                    ThrownExceptionInfo[] thrownExceptions,
                                                    Set<PsiMethod> propagateParametersMethods,
                                                    Set<PsiMethod> propagateExceptionsMethods) {
-    Set<PsiMethod> myPropagateParametersMethods =
-      propagateParametersMethods != null ? propagateParametersMethods : new HashSet<PsiMethod>();
-    Set<PsiMethod> myPropagateExceptionsMethods =
-      propagateExceptionsMethods != null ? propagateExceptionsMethods : new HashSet<PsiMethod>();
-
     LOG.assertTrue(method.isValid());
+
+    if (propagateParametersMethods == null) {
+      propagateParametersMethods = ContainerUtil.newHashSet();
+    }
+
+    if (propagateExceptionsMethods == null) {
+      propagateExceptionsMethods = ContainerUtil.newHashSet();
+    }
+
     if (newVisibility == null) {
       newVisibility = VisibilityUtil.getVisibilityModifier(method.getModifierList());
     }
 
     return new JavaChangeInfoImpl(newVisibility, method, newName, newType, parameterInfo, thrownExceptions, generateDelegate,
-                                  myPropagateParametersMethods, myPropagateExceptionsMethods);
+                                  propagateParametersMethods, propagateExceptionsMethods);
   }
 
   @NotNull
@@ -177,7 +183,7 @@
       for (UsageInfo usageInfo : usages) {
         if (usageInfo instanceof OverriderUsageInfo) {
           final OverriderUsageInfo info = (OverriderUsageInfo)usageInfo;
-          PsiMethod overrider = info.getElement();
+          PsiMethod overrider = assertNotNull(info.getElement());
           PsiMethod baseMethod = info.getBaseMethod();
           PsiSubstitutor substitutor = calculateSubstitutor(overrider, baseMethod);
           PsiType type;
@@ -212,9 +218,8 @@
   }
 
   protected boolean isProcessCovariantOverriders() {
-    return Messages
-             .showYesNoDialog(myProject, RefactoringBundle.message("do.you.want.to.process.overriding.methods.with.covariant.return.type"),
-                              JavaChangeSignatureHandler.REFACTORING_NAME, Messages.getQuestionIcon()) == Messages.YES;
+    String message = RefactoringBundle.message("do.you.want.to.process.overriding.methods.with.covariant.return.type");
+    return Messages.showYesNoDialog(myProject, message, ChangeSignatureHandler.REFACTORING_NAME, Messages.getQuestionIcon()) == Messages.YES;
   }
 
   public static void makeEmptyBody(final PsiElementFactory factory, final PsiMethod delegate) throws IncorrectOperationException {
@@ -229,7 +234,7 @@
   }
 
   @Nullable
-  public static PsiCallExpression addDelegatingCallTemplate(final PsiMethod delegate, final String newName) throws IncorrectOperationException {
+  public static PsiCallExpression addDelegatingCallTemplate(PsiMethod delegate, String newName) throws IncorrectOperationException {
     Project project = delegate.getProject();
     PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
     PsiCodeBlock body = delegate.getBody();
@@ -240,7 +245,8 @@
       callStatement = CodeStyleManager.getInstance(project).reformat(callStatement);
       callStatement = body.add(callStatement);
       callExpression = (PsiCallExpression)((PsiExpressionStatement) callStatement).getExpression();
-    } else {
+    }
+    else {
       if (PsiType.VOID.equals(delegate.getReturnType())) {
         PsiElement callStatement = factory.createStatementFromText(newName + "();", null);
         callStatement = CodeStyleManager.getInstance(project).reformat(callStatement);
@@ -261,16 +267,18 @@
     PsiSubstitutor substitutor;
     if (derivedMethod.getManager().areElementsEquivalent(derivedMethod, baseMethod)) {
       substitutor = PsiSubstitutor.EMPTY;
-    } else {
-      final PsiClass baseClass = baseMethod.getContainingClass();
-      final PsiClass derivedClass = derivedMethod.getContainingClass();
-      if(baseClass != null && derivedClass != null && InheritanceUtil.isInheritorOrSelf(derivedClass, baseClass, true)) {
-        final PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(baseClass, derivedClass, PsiSubstitutor.EMPTY);
-        final MethodSignature superMethodSignature = baseMethod.getSignature(superClassSubstitutor);
-        final MethodSignature methodSignature = derivedMethod.getSignature(PsiSubstitutor.EMPTY);
-        final PsiSubstitutor superMethodSubstitutor = MethodSignatureUtil.getSuperMethodSignatureSubstitutor(methodSignature, superMethodSignature);
+    }
+    else {
+      PsiClass baseClass = baseMethod.getContainingClass();
+      PsiClass derivedClass = derivedMethod.getContainingClass();
+      if (baseClass != null && derivedClass != null && InheritanceUtil.isInheritorOrSelf(derivedClass, baseClass, true)) {
+        PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getSuperClassSubstitutor(baseClass, derivedClass, PsiSubstitutor.EMPTY);
+        MethodSignature superMethodSignature = baseMethod.getSignature(superClassSubstitutor);
+        MethodSignature methodSignature = derivedMethod.getSignature(PsiSubstitutor.EMPTY);
+        PsiSubstitutor superMethodSubstitutor = MethodSignatureUtil.getSuperMethodSignatureSubstitutor(methodSignature, superMethodSignature);
         substitutor = superMethodSubstitutor != null ? superMethodSubstitutor : superClassSubstitutor;
-      } else {
+      }
+      else {
         substitutor = PsiSubstitutor.EMPTY;
       }
     }
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureUtil.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureUtil.java
index ccf13bc..c83a0ba 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -17,12 +17,15 @@
 
 import com.intellij.lang.LanguageRefactoringSupport;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Comparing;
 import com.intellij.psi.JavaTokenType;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiType;
 import com.intellij.psi.impl.source.tree.Factory;
 import com.intellij.psi.impl.source.tree.SharedImplUtil;
-import com.intellij.psi.util.PsiUtilBase;
+import com.intellij.psi.util.PsiUtilCore;
+import com.intellij.util.CharTable;
 import com.intellij.util.IncorrectOperationException;
 
 import java.util.ArrayList;
@@ -32,16 +35,19 @@
  * @author dsl
  */
 public class ChangeSignatureUtil {
-  private ChangeSignatureUtil() {
+  private ChangeSignatureUtil() { }
+
+  public interface ChildrenGenerator<Parent extends PsiElement, Child extends PsiElement> {
+    List<Child> getChildren(Parent parent);
   }
 
-  public static <Parent extends PsiElement, Child extends PsiElement> void synchronizeList(Parent list,
-                                                                                           final List<Child> newElements,
-                                                                                           ChildrenGenerator<Parent, Child> generator,
-                                                                                           final boolean[] shouldRemoveChild)
-    throws IncorrectOperationException {
-
-    ArrayList<Child> elementsToRemove = null;
+  public static <Parent extends PsiElement, Child extends PsiElement> void synchronizeList(
+    Parent list,
+    List<Child> newElements,
+    ChildrenGenerator<Parent, Child> generator,
+    boolean[] shouldRemoveChild) throws IncorrectOperationException
+  {
+    List<Child> elementsToRemove = null;
     List<Child> elements;
 
     int index = 0;
@@ -67,33 +73,36 @@
             index--;
           }
           else {
-            assert list.isWritable() : PsiUtilBase.getVirtualFile(list);
+            assert list.isWritable() : PsiUtilCore.getVirtualFile(list);
             list.addBefore(newElement, oldElement);
             if (list.equals(newElement.getParent())) {
               newElement.delete();
             }
           }
         }
-      } else {
+      }
+      else {
         if (newElements.size() > 1 && (!elements.isEmpty() || index < newElements.size() - 1)) {
           PsiElement anchor;
           if (index == 0) {
             anchor = list.getFirstChild();
-          } else {
+          }
+          else {
             anchor = index - 1 < elements.size() ? elements.get(index - 1) : null;
           }
-          final PsiElement psi = Factory
-            .createSingleLeafElement(JavaTokenType.COMMA, ",", 0, 1, SharedImplUtil.findCharTableByTree(list.getNode()), list.getManager())
-            .getPsi();
+          CharTable charTable = SharedImplUtil.findCharTableByTree(list.getNode());
+          PsiElement psi = Factory.createSingleLeafElement(JavaTokenType.COMMA, ",", 0, 1, charTable, list.getManager()).getPsi();
           if (anchor != null) {
             list.addAfter(psi, anchor);
-          } else {
+          }
+          else {
             list.add(psi);
           }
         }
       }
       index++;
     }
+
     for (int i = newElements.size(); i < elements.size(); i++) {
       Child element = elements.get(i);
       element.delete();
@@ -101,12 +110,15 @@
   }
 
   public static void invokeChangeSignatureOn(PsiMethod method, Project project) {
-    final ChangeSignatureHandler handler =
-      LanguageRefactoringSupport.INSTANCE.forLanguage(method.getLanguage()).getChangeSignatureHandler();
-    handler.invoke(project, new PsiElement[]{method}, null);
+    ChangeSignatureHandler handler = LanguageRefactoringSupport.INSTANCE.forLanguage(method.getLanguage()).getChangeSignatureHandler();
+    if (handler != null) {
+      handler.invoke(project, new PsiElement[]{method}, null);
+    }
   }
 
-  public interface ChildrenGenerator<Parent extends PsiElement, Child extends PsiElement> {
-    List<Child> getChildren(Parent parent);
+  public static boolean deepTypeEqual(PsiType type1, PsiType type2) {
+    if (type1 == type2) return true;
+    if (type1 == null || !type1.equals(type2)) return false;
+    return Comparing.equal(type1.getCanonicalText(true), type2.getCanonicalText(true));
   }
 }
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeInfoImpl.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeInfoImpl.java
index 8b721b6..2157b70 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeInfoImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeInfoImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 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.
@@ -33,6 +33,8 @@
 
 import java.util.*;
 
+import static com.intellij.refactoring.changeSignature.ChangeSignatureUtil.deepTypeEqual;
+
 class JavaChangeInfoImpl implements JavaChangeInfo {
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.changeSignature.JavaChangeInfoImpl");
 
@@ -195,22 +197,22 @@
     if (isNameChanged) {
       newNameIdentifier = factory.createIdentifier(newName);
     }
-
   }
 
   protected void fillOldParams(PsiMethod method) {
     PsiParameter[] parameters = method.getParameterList().getParameters();
     oldParameterNames = new String[parameters.length];
     oldParameterTypes = new String[parameters.length];
-    for(int i = 0; i < parameters.length; i++){
+
+    PsiElementFactory factory = JavaPsiFacade.getInstance(method.getProject()).getElementFactory();
+    for (int i = 0; i < parameters.length; i++) {
       PsiParameter parameter = parameters[i];
       oldParameterNames[i] = parameter.getName();
-      oldParameterTypes[i] =
-        JavaPsiFacade.getInstance(parameter.getProject()).getElementFactory().createTypeElement(parameter.getType()).getText();
+      oldParameterTypes[i] = factory.createTypeElement(parameter.getType()).getText();
     }
     if (!method.isConstructor()){
       try {
-        isReturnTypeChanged = !newReturnType.getType(this.method, method.getManager()).equals(this.method.getReturnType());
+        isReturnTypeChanged = !deepTypeEqual(newReturnType.getType(this.method, method.getManager()), this.method.getReturnType());
       }
       catch (IncorrectOperationException e) {
         isReturnTypeChanged = true;
@@ -233,7 +235,9 @@
   }
 
   private void setupExceptions(ThrownExceptionInfo[] newExceptions, final PsiMethod method) {
-    if (newExceptions == null) newExceptions = JavaThrownExceptionInfo.extractExceptions(method);
+    if (newExceptions == null) {
+      newExceptions = JavaThrownExceptionInfo.extractExceptions(method);
+    }
 
     this.newExceptions = newExceptions;
 
@@ -242,7 +246,7 @@
     if (!isExceptionSetChanged) {
       for (int i = 0; i < newExceptions.length; i++) {
         try {
-          if (newExceptions[i].getOldIndex() < 0 || !types[i].equals(newExceptions[i].createType(method, method.getManager()))) {
+          if (newExceptions[i].getOldIndex() < 0 || !deepTypeEqual(types[i], newExceptions[i].createType(method, method.getManager()))) {
             isExceptionSetChanged = true;
             break;
           }
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
index 83de0ed..eedfda8 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2010 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.
@@ -62,6 +62,7 @@
     return element.getLanguage() == StdLanguages.JAVA;
   }
 
+  @Override
   public UsageInfo[] findUsages(ChangeInfo info) {
     if (info instanceof JavaChangeInfo) {
       return new JavaChangeSignatureUsageSearcher((JavaChangeInfo)info).findUsages();
@@ -71,6 +72,7 @@
     }
   }
 
+  @Override
   public MultiMap<PsiElement, String> findConflicts(ChangeInfo info, Ref<UsageInfo[]> refUsages) {
     if (info instanceof JavaChangeInfo) {
       return new ConflictSearcher((JavaChangeInfo)info).findConflicts(refUsages);
@@ -80,6 +82,7 @@
     }
   }
 
+  @Override
   public boolean processUsage(ChangeInfo changeInfo, UsageInfo usage, boolean beforeMethodChange, UsageInfo[] usages) {
     if (!isJavaUsage(usage)) return false;
     if (!(changeInfo instanceof JavaChangeInfo)) return false;
@@ -510,6 +513,7 @@
       final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(list.getProject()).getResolveHelper();
       final PsiType type = info.getTypeWrapper().getType(changeInfo.getMethod(), list.getManager());
       final VariablesProcessor processor = new VariablesProcessor(false) {
+        @Override
         protected boolean check(PsiVariable var, ResolveState state) {
           if (var instanceof PsiField && !resolveHelper.isAccessible((PsiField)var, list, null)) return false;
           if (var instanceof PsiLocalVariable && list.getTextRange().getStartOffset() <= var.getTextRange().getStartOffset()) return false;
@@ -518,7 +522,8 @@
           return type.isAssignableFrom(varType);
         }
 
-        public boolean execute(@NotNull PsiElement pe, ResolveState state) {
+        @Override
+        public boolean execute(@NotNull PsiElement pe, @NotNull ResolveState state) {
           super.execute(pe, state);
           return size() < 2;
         }
@@ -549,10 +554,12 @@
     }
     final PsiCallExpression callExpression = PsiTreeUtil.getParentOfType(list, PsiCallExpression.class);
     final String defaultValue = info.getDefaultValue();
-    return callExpression != null ? info.getValue(callExpression) : defaultValue.length() > 0 ? factory.createExpressionFromText(defaultValue, list) : null;
+    return callExpression != null ? info.getValue(callExpression) : !defaultValue.isEmpty()
+                                                                    ? factory.createExpressionFromText(defaultValue, list) : null;
   }
 
 
+  @Override
   public boolean processPrimaryMethod(ChangeInfo changeInfo) {
     if (!StdLanguages.JAVA.equals(changeInfo.getLanguage()) || !(changeInfo instanceof JavaChangeInfo)) return false;
     final PsiElement element = changeInfo.getMethod();
@@ -564,6 +571,7 @@
     return true;
   }
 
+  @Override
   public boolean shouldPreviewUsages(ChangeInfo changeInfo, UsageInfo[] usages) {
     return false;
   }
@@ -869,6 +877,7 @@
   private static class ParameterList implements ChangeSignatureUtil.ChildrenGenerator<PsiParameterList, PsiParameter> {
     public static final ParameterList INSTANCE = new ParameterList();
 
+    @Override
     public List<PsiParameter> getChildren(PsiParameterList psiParameterList) {
       return Arrays.asList(psiParameterList.getParameters());
     }
@@ -877,6 +886,7 @@
   private static class ThrowsList implements ChangeSignatureUtil.ChildrenGenerator<PsiReferenceList, PsiJavaCodeReferenceElement> {
     public static final ThrowsList INSTANCE = new ThrowsList();
 
+    @Override
     public List<PsiJavaCodeReferenceElement> getChildren(PsiReferenceList throwsList) {
       return Arrays.asList(throwsList.getReferenceElements());
     }
@@ -1013,6 +1023,7 @@
   private static class ExpressionList implements ChangeSignatureUtil.ChildrenGenerator<PsiExpressionList, PsiExpression> {
     public static final ExpressionList INSTANCE = new ExpressionList();
 
+    @Override
     public List<PsiExpression> getChildren(PsiExpressionList psiExpressionList) {
       return Arrays.asList(psiExpressionList.getExpressions());
     }
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageSearcher.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageSearcher.java
index 7ab6ce9..b56779f 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageSearcher.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageSearcher.java
@@ -21,6 +21,7 @@
 import com.intellij.psi.*;
 import com.intellij.psi.javadoc.PsiDocTagValue;
 import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.search.searches.MethodReferencesSearch;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
 import com.intellij.psi.search.searches.ReferencesSearch;
@@ -39,6 +40,7 @@
 import com.intellij.util.containers.HashSet;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Set;
 
 /**
@@ -71,6 +73,15 @@
     PsiMethod[] overridingMethods = findSimpleUsagesWithoutParameters(method, result, true, true, true);
     findUsagesInCallers(result);
 
+    final ArrayList<PsiMethod> methods = new ArrayList<PsiMethod>(Arrays.asList(overridingMethods));
+    methods.add(method);
+
+    for (PsiMethod psiMethod : methods) {
+      for (PsiFunctionalExpression functionalExpression : FunctionalExpressionSearch.search(psiMethod)) {
+        result.add(new FunctionalInterfaceChangedUsageInfo(functionalExpression, psiMethod));
+      }
+    }
+
     //Parameter name changes are not propagated
     findParametersUsage(method, result, overridingMethods);
   }
@@ -318,4 +329,16 @@
                                        RefactoringUIUtil.getDescription(myMethod, true));
     }
   }
+  
+  private static class FunctionalInterfaceChangedUsageInfo extends UnresolvableCollisionUsageInfo {
+
+    public FunctionalInterfaceChangedUsageInfo(PsiElement element, PsiElement referencedElement) {
+      super(element, referencedElement);
+    }
+
+    @Override
+    public String getDescription() {
+      return "Functional expression will be corrupted";
+    }
+  }
 }
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java
index 69fc990..ecb6890 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java
@@ -33,8 +33,6 @@
 import java.util.List;
 
 public class ParameterInfoImpl implements JavaParameterInfo {
-  public static final ParameterInfoImpl[] EMPTY_ARRAY = {};
-
   private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.changeSignature.ParameterInfoImpl");
 
   public int oldParameterIndex;
diff --git a/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java b/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java
index 93d9f08..c398b84 100644
--- a/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/encapsulateFields/EncapsulateFieldsProcessor.java
@@ -235,9 +235,11 @@
         if (element == null) continue;
 
         final EncapsulateFieldHelper helper = EncapsulateFieldHelper.getHelper(element.getLanguage());
-        EncapsulateFieldUsageInfo usageInfo = helper.createUsage(myDescriptor, fieldDescriptor, reference);
-        if (usageInfo != null) {
-          array.add(usageInfo);
+        if (helper != null) {
+          EncapsulateFieldUsageInfo usageInfo = helper.createUsage(myDescriptor, fieldDescriptor, reference);
+          if (usageInfo != null) {
+            array.add(usageInfo);
+          }
         }
       }
     }
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalDialog.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalDialog.java
new file mode 100644
index 0000000..78d9609
--- /dev/null
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalDialog.java
@@ -0,0 +1,82 @@
+/*
+ * 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.refactoring.inline;
+
+import com.intellij.openapi.help.HelpManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiJavaCodeReferenceElement;
+import com.intellij.psi.PsiVariable;
+import com.intellij.refactoring.HelpID;
+import com.intellij.refactoring.JavaRefactoringSettings;
+import com.intellij.refactoring.RefactoringBundle;
+
+public class InlineLocalDialog extends InlineOptionsDialog {
+  public static final String REFACTORING_NAME = RefactoringBundle.message("inline.method.title");
+
+  private final PsiVariable myVariable;
+
+  private int myOccurrencesNumber = -1;
+
+  public InlineLocalDialog(Project project, PsiVariable variable, PsiJavaCodeReferenceElement ref, int occurrencesCount) {
+    super(project, true, variable);
+    myVariable = variable;
+    myInvokedOnReference = ref != null;
+
+    setTitle(REFACTORING_NAME);
+    myOccurrencesNumber = occurrencesCount;
+    init();
+  }
+
+  @Override
+  protected String getNameLabelText() {
+    return "Local variable " + myVariable.getName();
+  }
+
+  @Override
+  protected String getBorderTitle() {
+    return RefactoringBundle.message("inline.method.border.title");
+  }
+
+  @Override
+  protected String getInlineThisText() {
+    return "Inline this occurrence and leave the variable";
+  }
+
+  @Override
+  protected String getInlineAllText() {
+    final String occurrencesString = myOccurrencesNumber > -1 ? " (" + myOccurrencesNumber + " occurrence" + (myOccurrencesNumber == 1 ? ")" : "s)") : "";
+    return RefactoringBundle.message("all.references.and.remove.the.local") + occurrencesString;
+  }
+
+  @Override
+  protected void doAction() {
+    JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();
+    if(myRbInlineThisOnly.isEnabled() && myRbInlineAll.isEnabled()) {
+      settings.INLINE_LOCAL_THIS = isInlineThisOnly();
+    }
+    close(OK_EXIT_CODE);
+  }
+
+  @Override
+  protected void doHelpAction() {
+    HelpManager.getInstance().invokeHelp(HelpID.INLINE_VARIABLE);
+  }
+
+  @Override
+  protected boolean isInlineThis() {
+    return JavaRefactoringSettings.getInstance().INLINE_LOCAL_THIS;
+  }
+}
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalHandler.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalHandler.java
index 622a9ab..44fd8cb 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineLocalHandler.java
@@ -28,6 +28,7 @@
 import com.intellij.openapi.editor.colors.EditorColorsManager;
 import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Ref;
 import com.intellij.openapi.wm.WindowManager;
 import com.intellij.psi.*;
 import com.intellij.psi.controlFlow.DefUseUtil;
@@ -43,7 +44,6 @@
 import com.intellij.refactoring.listeners.RefactoringEventListener;
 import com.intellij.refactoring.util.CommonRefactoringUtil;
 import com.intellij.refactoring.util.InlineUtil;
-import com.intellij.refactoring.util.RefactoringMessageDialog;
 import com.intellij.util.*;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
@@ -131,7 +131,7 @@
       return;
     }
 
-    final List<PsiElement> refsToInlineList = new ArrayList<PsiElement>();
+    List<PsiElement> refsToInlineList = new ArrayList<PsiElement>();
     Collections.addAll(refsToInlineList, DefUseUtil.getRefs(containerBlock, local, defToInline));
     for (PsiElement innerClassUsage : innerClassUsages) {
       if (!refsToInlineList.contains(innerClassUsage)) {
@@ -143,11 +143,38 @@
       CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, HelpID.INLINE_VARIABLE);
       return;
     }
+
+    final Ref<Boolean> inlineAll = new Ref<Boolean>(true);
+    if (editor != null && !ApplicationManager.getApplication().isUnitTestMode()) {
+      int occurrencesCount = refsToInlineList.size();
+      final InlineLocalDialog inlineLocalDialog = new InlineLocalDialog(project, local, refExpr, occurrencesCount);
+      inlineLocalDialog.show();
+      if (!inlineLocalDialog.isOK()){
+        WindowManager.getInstance().getStatusBar(project).setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting"));
+        return;
+      }
+      if (refExpr != null && inlineLocalDialog.isInlineThis()) {
+        refsToInlineList = Collections.<PsiElement>singletonList(refExpr);
+        inlineAll.set(false);
+      }
+    }
+
     final PsiElement[] refsToInline = PsiUtilCore.toPsiElementArray(refsToInlineList);
 
-    EditorColorsManager manager = EditorColorsManager.getInstance();
+    final EditorColorsManager manager = EditorColorsManager.getInstance();
     final TextAttributes attributes = manager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
     final TextAttributes writeAttributes = manager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
+
+    if (editor != null && !ApplicationManager.getApplication().isUnitTestMode()) {
+      // TODO : check if initializer uses fieldNames that possibly will be hidden by other
+      // locals with the same names after inlining
+      highlightManager.addOccurrenceHighlights(
+        editor,
+        refsToInline,
+        attributes, true, null
+      );
+    }
+
     if (refExpr != null && PsiUtil.isAccessedForReading(refExpr) && ArrayUtil.find(refsToInline, refExpr) < 0) {
       final PsiElement[] defs = DefUseUtil.getDefs(containerBlock, local, refExpr);
       LOG.assertTrue(defs.length > 0);
@@ -204,33 +231,6 @@
       return;
     }
 
-    if (editor != null && !ApplicationManager.getApplication().isUnitTestMode()) {
-      // TODO : check if initializer uses fieldNames that possibly will be hidden by other
-      // locals with the same names after inlining
-      highlightManager.addOccurrenceHighlights(
-        editor,
-        refsToInline,
-        attributes, true, null
-      );
-      int occurrencesCount = refsToInline.length;
-      String occurencesString = RefactoringBundle.message("occurences.string", occurrencesCount);
-      final String promptKey = isInliningVariableInitializer(defToInline)
-                               ? "inline.local.variable.prompt" : "inline.local.variable.definition.prompt";
-      final String question = RefactoringBundle.message(promptKey, localName) + " " + occurencesString;
-      RefactoringMessageDialog dialog = new RefactoringMessageDialog(
-        REFACTORING_NAME,
-        question,
-        HelpID.INLINE_VARIABLE,
-        "OptionPane.questionIcon",
-        true,
-        project);
-      dialog.show();
-      if (!dialog.isOK()){
-        WindowManager.getInstance().getStatusBar(project).setInfo(RefactoringBundle.message("press.escape.to.remove.the.highlighting"));
-        return;
-      }
-    }
-
     final Runnable runnable = new Runnable() {
       public void run() {
         final String refactoringId = "refactoring.inline.local.variable";
@@ -247,15 +247,18 @@
             exprs[idx] = pointerManager.createSmartPsiElementPointer(InlineUtil.inlineVariable(local, defToInline, refElement));
           }
 
-          if (!isInliningVariableInitializer(defToInline)) {
-            defToInline.getParent().delete();
-          } else {
-            defToInline.delete();
+          if (inlineAll.get()) {
+            if (!isInliningVariableInitializer(defToInline)) {
+              defToInline.getParent().delete();
+            } else {
+              defToInline.delete();
+            }
+
+            if (ReferencesSearch.search(local).findFirst() == null) {
+              QuickFixFactory.getInstance().createRemoveUnusedVariableFix(local).invoke(project, editor, local.getContainingFile());
+            }
           }
 
-          if (ReferencesSearch.search(local).findFirst() == null) {
-            QuickFixFactory.getInstance().createRemoveUnusedVariableFix(local).invoke(project, editor, local.getContainingFile());
-          }
 
           if (editor != null && !ApplicationManager.getApplication().isUnitTestMode()) {
             highlightManager.addOccurrenceHighlights(editor, ContainerUtil.convert(exprs, new PsiExpression[refsToInline.length], new Function<SmartPsiElementPointer<PsiExpression>, PsiExpression>() {
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
index c9649a0..7b68e33 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodProcessor.java
@@ -48,7 +48,6 @@
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.introduceParameter.Util;
 import com.intellij.refactoring.listeners.RefactoringEventData;
-import com.intellij.refactoring.listeners.RefactoringEventListener;
 import com.intellij.refactoring.rename.NonCodeUsageInfoFactory;
 import com.intellij.refactoring.rename.RenameJavaVariableProcessor;
 import com.intellij.refactoring.util.*;
@@ -233,7 +232,7 @@
       GenericInlineHandler.collectConflicts(ref, myMethod, myInliners, conflicts);
     }
 
-    final PsiReturnStatement[] returnStatements = RefactoringUtil.findReturnStatements(myMethod);
+    final PsiReturnStatement[] returnStatements = PsiUtil.findReturnStatements(myMethod);
     for (PsiReturnStatement statement : returnStatements) {
       PsiExpression value = statement.getReturnValue();
       if (value != null && !(value instanceof PsiCallExpression)) {
@@ -820,7 +819,7 @@
     }
 
     if (resultName != null || tailCallType == InlineUtil.TailCallType.Simple) {
-      PsiReturnStatement[] returnStatements = RefactoringUtil.findReturnStatements(myMethodCopy);
+      PsiReturnStatement[] returnStatements = PsiUtil.findReturnStatements(myMethodCopy);
       for (PsiReturnStatement returnStatement : returnStatements) {
         final PsiExpression returnValue = returnStatement.getReturnValue();
         if (returnValue == null) continue;
@@ -1265,7 +1264,7 @@
       if (parentStatement != null) {
         PsiElement parent = ref.getParent();
         while (!parent.equals(parentStatement)) {
-          if (parent instanceof PsiStatement && !(parent instanceof PsiDeclarationStatement)) {
+          if (parent instanceof PsiExpressionStatement) {
             String text = "{\n}";
             PsiBlockStatement blockStatement = (PsiBlockStatement)myFactory.createStatementFromText(text, null);
             blockStatement = (PsiBlockStatement)myCodeStyleManager.reformat(blockStatement);
@@ -1465,7 +1464,7 @@
   }
 
   public static boolean checkBadReturns(PsiMethod method) {
-    PsiReturnStatement[] returns = RefactoringUtil.findReturnStatements(method);
+    PsiReturnStatement[] returns = PsiUtil.findReturnStatements(method);
     if (returns.length == 0) return false;
     PsiCodeBlock body = method.getBody();
     ControlFlow controlFlow;
diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java
index a884461..e173268 100644
--- a/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java
@@ -26,6 +26,7 @@
 import com.intellij.patterns.PlatformPatterns;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.TypeConversionUtil;
@@ -70,14 +71,22 @@
   }
 
   private static boolean findClassInheritors(final PsiClass element) {
-    final Collection<PsiClass> inheritors = new ArrayList<PsiClass>();
+    final Collection<PsiElement> inheritors = new ArrayList<PsiElement>();
     if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable(){
       @Override
       public void run() {
         ApplicationManager.getApplication().runReadAction(new Runnable() {
           @Override
           public void run() {
-            inheritors.addAll(ClassInheritorsSearch.search(element).findAll());
+            final PsiClass inheritor = ClassInheritorsSearch.search(element).findFirst();
+            if (inheritor != null) {
+              inheritors.add(inheritor);
+            } else {
+              final PsiFunctionalExpression functionalExpression = FunctionalExpressionSearch.search(element).findFirst();
+              if (functionalExpression != null) {
+                inheritors.add(functionalExpression);
+              }
+            }
           }
         });
       }
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/ElementToWorkOn.java b/java/java-impl/src/com/intellij/refactoring/introduceField/ElementToWorkOn.java
index 9e4f79c..ca867bc 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/ElementToWorkOn.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/ElementToWorkOn.java
@@ -17,6 +17,7 @@
 
 import com.intellij.codeInsight.CodeInsightUtil;
 import com.intellij.codeInsight.TargetElementUtilBase;
+import com.intellij.codeInsight.unwrap.ScopeHighlighter;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.RangeMarker;
 import com.intellij.openapi.project.Project;
@@ -90,7 +91,7 @@
         final int offset = editor.getCaretModel().getOffset();
         final PsiElement[] statementsInRange = IntroduceVariableBase.findStatementsAtOffset(editor, file, offset);
 
-        if (statementsInRange.length == 1 && (PsiUtilCore.hasErrorElementChild(statementsInRange[0]) || !PsiUtil.isStatement(statementsInRange[0]))) {
+        if (statementsInRange.length == 1 && IntroduceVariableBase.selectLineAtCaret(offset, statementsInRange)) {
           editor.getSelectionModel().selectLineAtCaret();
           final ElementToWorkOn elementToWorkOn = getElementToWorkOn(editor, file, refactoringName, helpId, project, localVar, expr);
           if (elementToWorkOn == null || elementToWorkOn.getLocalVariable() == null && elementToWorkOn.getExpression() == null || !processor.accept(elementToWorkOn)) {
@@ -114,6 +115,7 @@
             expr = expressions.get(0);
           }
           else {
+            final int selection = IntroduceVariableBase.preferredSelection(statementsInRange, expressions);
             IntroduceTargetChooser.showChooser(editor, expressions, new Pass<PsiExpression>() {
               @Override
               public void pass(final PsiExpression selectedValue) {
@@ -123,7 +125,7 @@
                 }
                 processor.pass(getElementToWorkOn(editor, file, refactoringName, helpId, project, var, selectedValue));
               }
-            }, new PsiExpressionTrimRenderer.RenderFunction());
+            }, new PsiExpressionTrimRenderer.RenderFunction(), "Expressions", selection, ScopeHighlighter.NATURAL_RANGER);
             return;
           }
         }
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/AbstractJavaInplaceIntroducer.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/AbstractJavaInplaceIntroducer.java
index dac214d..85d7a9d 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/AbstractJavaInplaceIntroducer.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/AbstractJavaInplaceIntroducer.java
@@ -139,7 +139,9 @@
     final PsiElement refVariableElementParent = refVariableElement != null ? refVariableElement.getParent() : null;
     PsiExpression expression = refVariableElement instanceof PsiKeyword && refVariableElementParent instanceof PsiNewExpression 
                                ? (PsiNewExpression)refVariableElementParent 
-                               : PsiTreeUtil.getParentOfType(refVariableElement, PsiReferenceExpression.class);
+                               : refVariableElementParent instanceof PsiParenthesizedExpression 
+                                 ? ((PsiParenthesizedExpression)refVariableElementParent).getExpression() 
+                                 : PsiTreeUtil.getParentOfType(refVariableElement, PsiReferenceExpression.class);
     if (expression instanceof PsiReferenceExpression && !(expression.getParent() instanceof PsiMethodCallExpression)) {
       final String referenceName = ((PsiReferenceExpression)expression).getReferenceName();
       if (((PsiReferenceExpression)expression).resolve() == psiVariable ||
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java
index 79c9b1d..99e5dcd 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceParameter/InplaceIntroduceParameterPopup.java
@@ -32,6 +32,7 @@
 import com.intellij.psi.codeStyle.VariableKind;
 import com.intellij.psi.search.LocalSearchScope;
 import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.refactoring.JavaRefactoringSettings;
 import com.intellij.refactoring.RefactoringActionHandler;
@@ -128,7 +129,8 @@
 
   @Override
   protected PsiElement checkLocalScope() {
-    return myMethod;
+    final PsiVariable variable = getLocalVariable();
+    return variable == null ? myMethod : PsiTreeUtil.getParentOfType(variable, PsiMethod.class);
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
index 5386aaf..0e513d4 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceVariable/IntroduceVariableBase.java
@@ -111,10 +111,7 @@
       final PsiElement[] statementsInRange = findStatementsAtOffset(editor, file, offset);
 
       //try line selection
-      if (statementsInRange.length == 1 && (!PsiUtil.isStatement(statementsInRange[0]) ||
-                                            statementsInRange[0].getTextRange().getStartOffset() > offset ||
-                                            statementsInRange[0].getTextRange().getEndOffset() < offset ||
-                                            isPreferStatements())) {
+      if (statementsInRange.length == 1 && selectLineAtCaret(offset, statementsInRange)) {
         selectionModel.selectLineAtCaret();
         final PsiExpression expressionInRange =
           findExpressionInRange(project, file, selectionModel.getSelectionStart(), selectionModel.getSelectionEnd());
@@ -132,27 +129,13 @@
           selectionModel.setSelection(textRange.getStartOffset(), textRange.getEndOffset());
         }
         else {
-          int selection;
-          if (statementsInRange.length == 1 &&
-              statementsInRange[0] instanceof PsiExpressionStatement &&
-              PsiUtilCore.hasErrorElementChild(statementsInRange[0])) {
-            selection = expressions.indexOf(((PsiExpressionStatement)statementsInRange[0]).getExpression());
-          } else {
-            PsiExpression expression = expressions.get(0);
-            if (expression instanceof PsiReferenceExpression && ((PsiReferenceExpression)expression).resolve() instanceof PsiLocalVariable) {
-              selection = 1;
-            }
-            else {
-              selection = -1;
-            }
-          }
           IntroduceTargetChooser.showChooser(editor, expressions,
             new Pass<PsiExpression>(){
               public void pass(final PsiExpression selectedValue) {
                 invoke(project, editor, file, selectedValue.getTextRange().getStartOffset(), selectedValue.getTextRange().getEndOffset());
               }
             },
-            new PsiExpressionTrimRenderer.RenderFunction(), "Expressions", selection, ScopeHighlighter.NATURAL_RANGER);
+            new PsiExpressionTrimRenderer.RenderFunction(), "Expressions", preferredSelection(statementsInRange, expressions), ScopeHighlighter.NATURAL_RANGER);
           return;
         }
       }
@@ -163,6 +146,31 @@
     }
   }
 
+  public static boolean selectLineAtCaret(int offset, PsiElement[] statementsInRange) {
+    return !PsiUtil.isStatement(statementsInRange[0]) ||
+            statementsInRange[0].getTextRange().getStartOffset() > offset ||
+            statementsInRange[0].getTextRange().getEndOffset() < offset ||
+            isPreferStatements();
+  }
+
+  public static int preferredSelection(PsiElement[] statementsInRange, List<PsiExpression> expressions) {
+    int selection;
+    if (statementsInRange.length == 1 &&
+        statementsInRange[0] instanceof PsiExpressionStatement &&
+        PsiUtilCore.hasErrorElementChild(statementsInRange[0])) {
+      selection = expressions.indexOf(((PsiExpressionStatement)statementsInRange[0]).getExpression());
+    } else {
+      PsiExpression expression = expressions.get(0);
+      if (expression instanceof PsiReferenceExpression && ((PsiReferenceExpression)expression).resolve() instanceof PsiLocalVariable) {
+        selection = 1;
+      }
+      else {
+        selection = -1;
+      }
+    }
+    return selection;
+  }
+
   public static boolean isPreferStatements() {
     return Boolean.valueOf(PropertiesComponent.getInstance().getOrInit(PREFER_STATEMENTS_OPTION, "false")).booleanValue() || Registry.is(PREFER_STATEMENTS_OPTION, false);
   }
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java
index 59799c1..7378c2e 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectDialog.java
@@ -259,7 +259,7 @@
         IntroduceParameterObjectDialog.this.doCancelAction();
       }
     };
-    myParamsPanel.add(paramsPanel, BorderLayout.CENTER);
+    myParamsPanel.add(paramsPanel, BorderLayout.NORTH);
     return myWholePanel;
   }
 
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectForm.form b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectForm.form
index ac14419..7a86ace 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectForm.form
+++ b/java/java-impl/src/com/intellij/refactoring/introduceparameterobject/IntroduceParameterObjectForm.form
@@ -3,7 +3,7 @@
   <grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
     <margin top="0" left="0" bottom="0" right="0"/>
     <constraints>
-      <xy x="20" y="20" width="579" height="440"/>
+      <xy x="20" y="20" width="579" height="446"/>
     </constraints>
     <properties/>
     <clientProperties>
@@ -207,7 +207,7 @@
       </grid>
       <grid id="783a4" binding="myParamsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
         <constraints>
-          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
+          <grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
         </constraints>
         <properties/>
         <clientProperties>
diff --git a/java/java-impl/src/com/intellij/refactoring/invertBoolean/InvertBooleanProcessor.java b/java/java-impl/src/com/intellij/refactoring/invertBoolean/InvertBooleanProcessor.java
index 0b84dfe..5ef2cab 100644
--- a/java/java-impl/src/com/intellij/refactoring/invertBoolean/InvertBooleanProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/invertBoolean/InvertBooleanProcessor.java
@@ -271,6 +271,10 @@
         }
       }
     }
+
+    if (myElement instanceof PsiField && ((PsiField)myElement).getInitializer() == null) {
+      ((PsiField)myElement).setInitializer(JavaPsiFacade.getElementFactory(myProject).createExpressionFromText("true", myElement));
+    }
   }
 
   @Override
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHandler.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHandler.java
index d9c3a61..2cbf7a0 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHandler.java
@@ -26,7 +26,6 @@
 
 import com.intellij.openapi.actionSystem.CommonDataKeys;
 import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.editor.ScrollType;
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java
index f799c78..cd423cb 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpConflictsUtil.java
@@ -24,10 +24,12 @@
  */
 package com.intellij.refactoring.memberPullUp;
 
+import com.intellij.codeInsight.AnnotationUtil;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.util.*;
 import com.intellij.refactoring.RefactoringBundle;
 import com.intellij.refactoring.classMembers.MemberInfoBase;
@@ -104,6 +106,18 @@
           }
         }
       }
+
+      if (newAbstractMethodInSuper(infos)) {
+        final PsiAnnotation annotation = AnnotationUtil.findAnnotation(superClass, CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE);
+        if (annotation != null) {
+          conflicts.putValue(annotation, RefactoringBundle.message("functional.interface.broken"));
+        } else {
+          final PsiFunctionalExpression functionalExpression = FunctionalExpressionSearch.search(superClass).findFirst();
+          if (functionalExpression != null) {
+            conflicts.putValue(functionalExpression, RefactoringBundle.message("functional.interface.broken"));
+          }
+        }
+      }
     }
     RefactoringConflictsUtil.analyzeAccessibilityConflicts(movedMembers, superClass, conflicts, VisibilityUtil.ESCALATE_VISIBILITY, targetRepresentativeElement, abstrMethods);
     if (superClass != null) {
@@ -191,6 +205,16 @@
     return conflicts;
   }
 
+  private static boolean newAbstractMethodInSuper(MemberInfoBase<? extends PsiMember>[] infos) {
+    boolean toAbstract = false;
+    for (MemberInfoBase<? extends PsiMember> info : infos) {
+      if (info.isToAbstract()) {
+        toAbstract = true;
+      }
+    }
+    return toAbstract;
+  }
+
   private static void checkInterfaceTarget(MemberInfoBase<? extends PsiMember>[] infos, MultiMap<PsiElement, String> conflictsList) {
     for (MemberInfoBase<? extends PsiMember> info : infos) {
       PsiElement member = info.getMember();
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java b/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
index d6f7367..ca3298b 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
@@ -29,6 +29,7 @@
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.javadoc.PsiDocComment;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.MethodSignatureUtil;
 import com.intellij.psi.util.PsiTreeUtil;
@@ -46,6 +47,7 @@
 import com.intellij.usageView.UsageViewDescriptor;
 import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.Processor;
 import com.intellij.util.containers.HashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -117,11 +119,32 @@
   @NotNull
   protected UsageInfo[] findUsages() {
     final PsiClass[] inheritors = ClassInheritorsSearch.search(myClass, false).toArray(PsiClass.EMPTY_ARRAY);
-    UsageInfo[] usages = new UsageInfo[inheritors.length];
-    for (int i = 0; i < inheritors.length; i++) {
-      usages[i] = new UsageInfo(inheritors[i]);
+    final List<UsageInfo> usages = new ArrayList<UsageInfo>(inheritors.length);
+    for (PsiClass inheritor : inheritors) {
+      usages.add(new UsageInfo(inheritor));
     }
-    return usages;
+
+    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(myClass);
+    if (interfaceMethod != null && isMoved(interfaceMethod)) {
+      FunctionalExpressionSearch.search(myClass).forEach(new Processor<PsiFunctionalExpression>() {
+        @Override
+        public boolean process(PsiFunctionalExpression expression) {
+          usages.add(new UsageInfo(expression));
+          return true;
+        }
+      });
+    }
+
+    return usages.toArray(new UsageInfo[usages.size()]);
+  }
+
+  private boolean isMoved(PsiMember member) {
+    for (MemberInfo info : myMemberInfos) {
+      if (member == info.getMember()) {
+        return true;
+      }
+    }
+    return false;
   }
 
   protected boolean preprocessUsages(final Ref<UsageInfo[]> refUsages) {
@@ -167,6 +190,17 @@
     if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, RefactoringBundle.message("detecting.possible.conflicts"), true, myProject)) {
       return false;
     }
+
+    for (UsageInfo info : usagesIn) {
+      final PsiElement element = info.getElement();
+      if (element instanceof PsiFunctionalExpression) {
+        pushDownConflicts.getConflicts().putValue(element, RefactoringBundle.message("functional.interface.broken"));
+      }
+    }
+    final PsiAnnotation annotation = AnnotationUtil.findAnnotation(myClass, CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE);
+    if (annotation != null && isMoved(LambdaUtil.getFunctionalInterfaceMethod(myClass))) {
+      pushDownConflicts.getConflicts().putValue(annotation, RefactoringBundle.message("functional.interface.broken"));
+    }
     return showConflicts(pushDownConflicts.getConflicts(), usagesIn);
   }
 
@@ -397,6 +431,11 @@
       PsiMember newMember = null;
       if (member instanceof PsiField) {
         ((PsiField)member).normalizeDeclaration();
+        if (myClass.isInterface() && !targetClass.isInterface()) {
+          PsiUtil.setModifierProperty(member, PsiModifier.PUBLIC, true);
+          PsiUtil.setModifierProperty(member, PsiModifier.STATIC, true);
+          PsiUtil.setModifierProperty(member, PsiModifier.FINAL, true);
+        }
         newMember = (PsiMember)targetClass.add(member);
       }
       else if (member instanceof PsiMethod) {
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java
index ddff1f0..d4239e5 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveInnerProcessor.java
@@ -250,6 +250,23 @@
         reference.bindToElement(newClass);
       }
 
+      for (UsageInfo usage : usages) {
+        final PsiElement element = usage.getElement();
+        final PsiElement parent = element != null ? element.getParent() : null;
+        if (parent instanceof PsiNewExpression) {
+          final PsiMethod resolveConstructor = ((PsiNewExpression)parent).resolveConstructor();
+          for (PsiMethod method : newClass.getConstructors()) {
+            if (resolveConstructor == method) {
+              final PsiElement place = usage.getElement();
+              if (place != null) {
+                VisibilityUtil.escalateVisibility(method, place);
+              }
+              break;
+            }
+          }
+        }
+      }
+
       if (field != null) {
         final PsiExpression paramAccessExpression = factory.createExpressionFromText(myParameterNameOuterClass, null);
         for (final PsiMethod constructor : newClass.getConstructors()) {
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveJavaInnerHandler.java b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveJavaInnerHandler.java
index 11addce..fba459f 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveJavaInnerHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveInner/MoveJavaInnerHandler.java
@@ -28,7 +28,7 @@
 
     PsiClass newClass;
     if (options.getTargetContainer() instanceof PsiDirectory) {
-      newClass = JavaDirectoryService.getInstance().createClass((PsiDirectory)options.getTargetContainer(), options.getNewClassName());
+      newClass = createNewClass(options);
       PsiDocComment defaultDocComment = newClass.getDocComment();
       if (defaultDocComment != null && innerClass.getDocComment() == null) {
         innerClass = (PsiClass)innerClass.addAfter(defaultDocComment, null).getParent();
@@ -42,16 +42,6 @@
       if (makePublic) {
         PsiUtil.setModifierProperty(newClass, PsiModifier.PUBLIC, true);
       }
-
-      final PsiMethod[] constructors = newClass.getConstructors();
-      for (PsiMethod constructor : constructors) {
-        final PsiModifierList modifierList = constructor.getModifierList();
-        modifierList.setModifierProperty(PsiModifier.PRIVATE, false);
-        modifierList.setModifierProperty(PsiModifier.PROTECTED, false);
-        if (makePublic && !newClass.isEnum()) {
-          modifierList.setModifierProperty(PsiModifier.PUBLIC, true);
-        }
-      }
     }
     else {
       newClass = (PsiClass)options.getTargetContainer().add(innerClass);
@@ -62,6 +52,10 @@
     return newClass;
   }
 
+  protected PsiClass createNewClass(MoveInnerOptions options) {
+    return JavaDirectoryService.getInstance().createClass((PsiDirectory)options.getTargetContainer(), options.getNewClassName());
+  }
+
   protected static boolean needPublicAccess(final PsiClass outerClass, final PsiElement targetContainer) {
     if (outerClass.isInterface()) {
       return true;
diff --git a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java
index d1c23a9..91fc85c 100644
--- a/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java
+++ b/java/java-impl/src/com/intellij/refactoring/rename/JavaNameSuggestionProvider.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.refactoring.rename;
 
+import com.intellij.lang.java.JavaLanguage;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -33,6 +34,7 @@
 public class JavaNameSuggestionProvider implements NameSuggestionProvider {
   @Nullable
   public SuggestedNameInfo getSuggestedNames(final PsiElement element, final PsiElement nameSuggestionContext, Set<String> result) {
+    if (!element.getLanguage().isKindOf(JavaLanguage.INSTANCE)) return null;
     String initialName = UsageViewUtil.getShortName(element);
     SuggestedNameInfo info = suggestNamesForElement(element, nameSuggestionContext);
     if (info != null) {
@@ -95,6 +97,7 @@
   @Nullable
   private static String[] suggestProperlyCasedName(PsiElement psiElement) {
     if (!(psiElement instanceof PsiNamedElement)) return null;
+    if (psiElement instanceof PsiFile) return null;
     String name = ((PsiNamedElement)psiElement).getName();
     if (name == null) return null;
     String prefix = "";
diff --git a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java
index 09d752f..807700b 100644
--- a/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java
@@ -30,6 +30,7 @@
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
 import com.intellij.psi.codeStyle.VariableKind;
 import com.intellij.psi.javadoc.PsiDocTag;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.MethodSignatureUtil;
@@ -48,6 +49,7 @@
 import com.intellij.util.IncorrectOperationException;
 import com.intellij.util.Processor;
 import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.*;
@@ -456,6 +458,8 @@
             removeDeletedMethods(OverridingMethodsSearch.search(psiMethod, true).toArray(PsiMethod.EMPTY_ARRAY),
                                  allElementsToDelete);
 
+    findFunctionalExpressions(usages, ArrayUtil.prepend(psiMethod, overridingMethods));
+
     final HashMap<PsiMethod, Collection<PsiReference>> methodToReferences = new HashMap<PsiMethod, Collection<PsiReference>>();
     for (PsiMethod overridingMethod : overridingMethods) {
       final Collection<PsiReference> overridingReferences = ReferencesSearch.search(overridingMethod).findAll();
@@ -478,6 +482,19 @@
     };
   }
 
+  private static void findFunctionalExpressions(final List<UsageInfo> usages, PsiMethod... methods) {
+    for (PsiMethod method : methods) {
+      final PsiClass containingClass = method.getContainingClass();
+      FunctionalExpressionSearch.search(method).forEach(new Processor<PsiFunctionalExpression>() {
+        @Override
+        public boolean process(PsiFunctionalExpression expression) {
+          usages.add(new SafeDeleteFunctionalExpressionUsageInfo(expression, containingClass));
+          return true;
+        }
+      });
+    }
+  }
+
   private static PsiMethod[] removeDeletedMethods(PsiMethod[] methods, final PsiElement[] allElementsToDelete) {
     ArrayList<PsiMethod> list = new ArrayList<PsiMethod>();
     for (PsiMethod method : methods) {
@@ -730,6 +747,8 @@
         return true;
       }
     });
+
+    findFunctionalExpressions(usages, method);
   }
 
 
@@ -760,4 +779,13 @@
 
     return false;
   }
+  
+  private static class SafeDeleteFunctionalExpressionUsageInfo extends SafeDeleteReferenceUsageInfo {
+    public SafeDeleteFunctionalExpressionUsageInfo(@NotNull PsiElement element, PsiElement referencedElement) {
+      super(element, referencedElement, false);
+    }
+
+    @Override
+    public void deleteElement() throws IncorrectOperationException {}
+  }
 }
diff --git a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java
index 53c1b70..1ed6de9 100644
--- a/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java
+++ b/java/java-impl/src/com/intellij/refactoring/turnRefsToSuper/TurnRefsToSuperProcessorBase.java
@@ -557,7 +557,7 @@
       addLink(parent, returnType);
     }
 
-    final PsiReturnStatement[] returnStatements = RefactoringUtil.findReturnStatements(method);
+    final PsiReturnStatement[] returnStatements = PsiUtil.findReturnStatements(method);
     for (final PsiReturnStatement returnStatement : returnStatements) {
       final PsiExpression returnValue = returnStatement.getReturnValue();
       if (returnValue != null) {
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java
index 29d7c37..7c765e7 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/MigrationPanel.java
@@ -367,7 +367,7 @@
   private class ExcludeAction extends ExcludeIncludeActionBase {
     public ExcludeAction() {
       super(RefactoringBundle.message("type.migration.exclude.action.text"));
-      registerCustomShortcutSet(CommonShortcuts.DELETE, myRootsTree);
+      registerCustomShortcutSet(CommonShortcuts.getDelete(), myRootsTree);
     }
 
     protected void processUsage(final TypeMigrationUsageInfo usageInfo) {
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java
index 3ba66bb..21145be 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/ui/TypeMigrationDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -27,7 +27,6 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.DialogWrapper;
 import com.intellij.openapi.ui.LabeledComponent;
-import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
@@ -35,12 +34,12 @@
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
+import com.intellij.refactoring.changeSignature.ChangeSignatureUtil;
 import com.intellij.refactoring.typeMigration.TypeMigrationLabeler;
 import com.intellij.refactoring.typeMigration.TypeMigrationProcessor;
 import com.intellij.refactoring.typeMigration.TypeMigrationRules;
 import com.intellij.refactoring.ui.RefactoringDialog;
 import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
-import com.intellij.refactoring.util.CanonicalTypes;
 import com.intellij.ui.EditorComboBox;
 import com.intellij.util.VisibilityUtil;
 import org.jetbrains.annotations.NotNull;
@@ -51,6 +50,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author anna
@@ -74,8 +74,8 @@
 
     final PsiType migrationRootType = rules != null ? rules.getMigrationRootType() : null;
     final PsiType rootType = getRootType();
-    final String text = migrationRootType != null ? migrationRootType.getPresentableText()
-                                                  : rootType != null ? rootType.getPresentableText() : "";
+    final String text = migrationRootType != null ? migrationRootType.getCanonicalText(true) :
+                        rootType != null ? rootType.getCanonicalText(true) : "";
     int flags = 0;
     if (root instanceof PsiParameter) {
       final PsiElement scope = ((PsiParameter)root).getDeclarationScope();
@@ -93,11 +93,7 @@
     assert document != null;
     myToTypeEditor = new EditorComboBox(document, project, StdFileTypes.JAVA);
     final String[] types = getValidTypes(project, root);
-    if (types != null) {
-      myToTypeEditor.setHistory(types);
-    } else {
-      myToTypeEditor.setHistory(new String[]{document.getText()});
-    }
+    myToTypeEditor.setHistory(types != null ? types : new String[]{document.getText()});
     document.addDocumentListener(new DocumentAdapter() {
       @Override
       public void documentChanged(final DocumentEvent e) {
@@ -138,12 +134,12 @@
 
   @Nullable
   private String[] getValidTypes(final Project project, final PsiElement root) {
-    final ArrayList<PsiExpression> expressions = new ArrayList<PsiExpression>();
     if (root instanceof PsiField || root instanceof PsiMethod) {
       final PsiModifierList modifierList = ((PsiModifierListOwner)root).getModifierList();
       if (VisibilityUtil.compare(VisibilityUtil.getVisibilityModifier(modifierList), PsiModifier.PRIVATE) < 0) return null;
     }
 
+    final List<PsiExpression> expressions = new ArrayList<PsiExpression>();
     for (PsiReference reference : ReferencesSearch.search(root, GlobalSearchScope.fileScope(root.getContainingFile()))) {
       final PsiElement element = reference.getElement();
       final PsiExpression expr = PsiTreeUtil.getParentOfType(element, PsiExpression.class, false);
@@ -158,7 +154,7 @@
         final String[] history = new String[psiTypes.length];
         for (int i = 0; i < psiTypes.length; i++) {
           PsiType psiType = psiTypes[i];
-          history[i] = psiType.getCanonicalText();
+          history[i] = psiType.getCanonicalText(true);
         }
         return history;
       }
@@ -188,7 +184,8 @@
       if (psiClassType.resolve() == null) return false;
       final PsiType[] types = psiClassType.getParameters();
       for (PsiType paramType : types) {
-        if (paramType instanceof PsiPrimitiveType || (paramType instanceof PsiWildcardType && ((PsiWildcardType)paramType).getBound() instanceof PsiPrimitiveType)) return false;
+        if (paramType instanceof PsiPrimitiveType ||
+            (paramType instanceof PsiWildcardType && ((PsiWildcardType)paramType).getBound() instanceof PsiPrimitiveType)) return false;
         if (!checkType(paramType)) return false;
       }
     }
@@ -198,15 +195,14 @@
     return true;
   }
 
+  @Override
   protected void doAction() {
     FindSettings.getInstance().setDefaultScopeName(myScopeChooserCombo.getSelectedScopeName());
 
     final PsiType rootType = getRootType();
-    final CanonicalTypes.Type typeWrapper = CanonicalTypes.createTypeWrapper(getMigrationType());
-    assert typeWrapper != null : getMigrationType();
-    final PsiType migrationType = typeWrapper.getType(myRoot, myRoot.getManager());
+    final PsiType migrationType = getMigrationType();
 
-    if (Comparing.equal(rootType, migrationType)) {
+    if (migrationType == null || ChangeSignatureUtil.deepTypeEqual(rootType, migrationType)) {
       close(DialogWrapper.OK_EXIT_CODE);
       return;
     }
@@ -224,12 +220,14 @@
     return TypeMigrationLabeler.getElementType(myRoot);
   }
 
+  @Override
   protected JComponent createCenterPanel() {
     final JPanel panel = new JPanel(new GridBagLayout());
     final GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
                                                          GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0);
     final PsiType type = getRootType();
-    panel.add(new JLabel("Migrate " + getElementPresentation(myRoot) + " \"" + (type != null ? type.getCanonicalText() : "<unknown>") + "\" to"), gc);
+    final String typeText = type != null ? type.getPresentableText() : "<unknown>";
+    panel.add(new JLabel("Migrate " + getElementPresentation(myRoot) + " \"" + typeText + "\" to"), gc);
     panel.add(myToTypeEditor, gc);
 
     LabeledComponent<ScopeChooserCombo> scopeChooserComponent = new LabeledComponent<ScopeChooserCombo>();
@@ -260,7 +258,7 @@
     if (element instanceof PsiReferenceParameterList) {
       return "class type arguments ";
     }
-    
+
     if (element instanceof PsiParameter) {
       final PsiParameter param = (PsiParameter)element;
       String result = "type of parameter " + param.getName();
@@ -275,6 +273,7 @@
     return element.toString();
   }
 
+  @Override
   protected void doHelpAction() {
     HelpManager.getInstance().invokeHelp("reference.typeMigrationDialog");
   }
diff --git a/java/java-impl/src/com/intellij/refactoring/util/CanonicalTypes.java b/java/java-impl/src/com/intellij/refactoring/util/CanonicalTypes.java
index f7fac63..131750f 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/CanonicalTypes.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/CanonicalTypes.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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,18 +15,16 @@
  */
 package com.intellij.refactoring.util;
 
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
+import com.intellij.util.ObjectUtils;
 import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -34,61 +32,72 @@
  * @author dsl
  */
 public class CanonicalTypes {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.util.CanonicalTypes");
-
   private CanonicalTypes() { }
 
   public abstract static class Type {
     @NotNull
-    public abstract PsiType getType(PsiElement context, final PsiManager manager) throws IncorrectOperationException;
+    public abstract PsiType getType(PsiElement context, PsiManager manager) throws IncorrectOperationException;
 
     @NonNls
     public abstract String getTypeText();
 
-    public abstract void addImportsTo(final JavaCodeFragment codeFragment);
+    public void addImportsTo(JavaCodeFragment fragment) { }
 
     public boolean isValid() {
       return true;
     }
   }
 
-  private static class Primitive extends Type {
+  private abstract static class AnnotatedType extends Type {
+    protected final PsiAnnotation[] myAnnotations;
+
+    protected AnnotatedType(PsiAnnotation[] annotations) {
+      myAnnotations = annotations;
+    }
+  }
+
+  private static class Primitive extends AnnotatedType {
     private final PsiPrimitiveType myType;
 
     private Primitive(PsiPrimitiveType type) {
+      super(type.getAnnotations());
       myType = type;
     }
 
     @NotNull
-    public PsiType getType(PsiElement context, final PsiManager manager) {
-      return myType;
+    @Override
+    public PsiType getType(PsiElement context, PsiManager manager) {
+      return myAnnotations.length == 0 ? myType : new PsiPrimitiveType(myType.getCanonicalText(false), myAnnotations);
     }
 
+    @Override
     public String getTypeText() {
       return myType.getPresentableText();
     }
-
-    public void addImportsTo(final JavaCodeFragment codeFragment) {}
   }
 
-  private static class Array extends Type {
-    private final Type myComponentType;
+  private static class Array extends AnnotatedType {
+    protected final Type myComponentType;
 
-    private Array(Type componentType) {
+    private Array(PsiType original, Type componentType) {
+      super(original.getAnnotations());
       myComponentType = componentType;
     }
 
     @NotNull
-    public PsiType getType(PsiElement context, final PsiManager manager) throws IncorrectOperationException {
-      return myComponentType.getType(context, manager).createArrayType();
+    @Override
+    public PsiType getType(PsiElement context, PsiManager manager) throws IncorrectOperationException {
+      return myComponentType.getType(context, manager).createArrayType(myAnnotations);
     }
 
+    @Override
     public String getTypeText() {
       return myComponentType.getTypeText() + "[]";
     }
 
-    public void addImportsTo(final JavaCodeFragment codeFragment) {
-      myComponentType.addImportsTo(codeFragment);
+    @Override
+    public void addImportsTo(JavaCodeFragment fragment) {
+      myComponentType.addImportsTo(fragment);
     }
 
     @Override
@@ -97,59 +106,64 @@
     }
   }
 
-  private static class Ellipsis extends Type {
-    private final Type myComponentType;
-
-    private Ellipsis(Type componentType) {
-      myComponentType = componentType;
+  private static class Ellipsis extends Array {
+    private Ellipsis(PsiType original, Type componentType) {
+      super(original, componentType);
     }
 
     @NotNull
-    public PsiType getType(PsiElement context, final PsiManager manager) throws IncorrectOperationException {
-      return new PsiEllipsisType(myComponentType.getType(context, manager));
-    }
-
-    public String getTypeText() {
-      return myComponentType.getTypeText() + "...";
-    }
-
-    public void addImportsTo(final JavaCodeFragment codeFragment) {
-      myComponentType.addImportsTo(codeFragment);
+    @Override
+    public PsiType getType(PsiElement context, PsiManager manager) throws IncorrectOperationException {
+      return new PsiEllipsisType(myComponentType.getType(context, manager), myAnnotations);
     }
 
     @Override
-    public boolean isValid() {
-      return myComponentType.isValid();
+    public String getTypeText() {
+      return myComponentType.getTypeText() + "...";
     }
   }
 
-  private static class WildcardType extends Type {
+  private static class WildcardType extends AnnotatedType {
     private final boolean myIsExtending;
     private final Type myBound;
 
-    private WildcardType(boolean isExtending, Type bound) {
+    private WildcardType(PsiType original, boolean isExtending, Type bound) {
+      super(original.getAnnotations());
       myIsExtending = isExtending;
       myBound = bound;
     }
 
     @NotNull
-    public PsiType getType(PsiElement context, final PsiManager manager) throws IncorrectOperationException {
-      if(myBound == null) return PsiWildcardType.createUnbounded(context.getManager());
-      if (myIsExtending) {
-        return PsiWildcardType.createExtends(context.getManager(), myBound.getType(context, manager));
+    @Override
+    public PsiType getType(PsiElement context, PsiManager manager) throws IncorrectOperationException {
+      PsiWildcardType type;
+      if (myBound == null) {
+        type = PsiWildcardType.createUnbounded(manager);
+      }
+      else if (myIsExtending) {
+        type = PsiWildcardType.createExtends(manager, myBound.getType(context, manager));
       }
       else {
-        return PsiWildcardType.createSuper(context.getManager(), myBound.getType(context, manager));
+        type = PsiWildcardType.createSuper(manager, myBound.getType(context, manager));
+      }
+      return type.annotate(myAnnotations);
+    }
+
+    @Override
+    public String getTypeText() {
+      if (myBound == null) {
+        return "?";
+      }
+      else {
+        return "? " + (myIsExtending ? "extends " : "super ") + myBound.getTypeText();
       }
     }
 
-    public String getTypeText() {
-      if (myBound == null) return "?";
-      return "? " + (myIsExtending ? "extends " : "super ") + myBound.getTypeText();
-    }
-
-    public void addImportsTo(final JavaCodeFragment codeFragment) {
-      if (myBound != null) myBound.addImportsTo(codeFragment);
+    @Override
+    public void addImportsTo(JavaCodeFragment fragment) {
+      if (myBound != null) {
+        myBound.addImportsTo(fragment);
+      }
     }
 
     @Override
@@ -158,73 +172,74 @@
     }
   }
 
-  private static class WrongType extends Type {
-    private final String myText;
+  private static class UnresolvedType extends Type {
+    private final String myPresentableText;
+    private final String myCanonicalText;
 
-    private WrongType(String text) {
-      myText = text;
+    private UnresolvedType(PsiType original) {
+      myPresentableText = original.getPresentableText();
+      myCanonicalText = original.getCanonicalText(true);
     }
 
     @NotNull
-    public PsiType getType(PsiElement context, final PsiManager manager) throws IncorrectOperationException {
-      return JavaPsiFacade.getInstance(context.getProject()).getElementFactory().createTypeFromText(myText, context);
+    @Override
+    public PsiType getType(PsiElement context, PsiManager manager) throws IncorrectOperationException {
+      return JavaPsiFacade.getInstance(manager.getProject()).getElementFactory().createTypeFromText(myCanonicalText, context);
     }
 
+    @Override
     public String getTypeText() {
-      return myText;
+      return myPresentableText;
     }
 
-    public void addImportsTo(final JavaCodeFragment codeFragment) {}
-
     @Override
     public boolean isValid() {
       return false;
     }
   }
 
-  private static class ClassType extends Type {
-    private final String myOriginalText;
+  private static class ClassType extends AnnotatedType {
+    private final String myPresentableText;
     private final String myClassQName;
-    private final Map<String,Type> mySubstitutor;
+    private final Map<String, Type> mySubstitutor;
 
-    private ClassType(String originalText, String classQName, Map<String, Type> substitutor) {
-      myOriginalText = originalText;
+    private ClassType(PsiType original, String classQName, Map<String, Type> substitutor) {
+      super(original.getAnnotations());
+      myPresentableText = original.getPresentableText();
       myClassQName = classQName;
       mySubstitutor = substitutor;
     }
 
     @NotNull
-    public PsiType getType(PsiElement context, final PsiManager manager) throws IncorrectOperationException {
-      final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
-      final PsiElementFactory factory = facade.getElementFactory();
-      final PsiResolveHelper resolveHelper = facade.getResolveHelper();
-      final PsiClass aClass = resolveHelper.resolveReferencedClass(myClassQName, context);
+    @Override
+    public PsiType getType(PsiElement context, PsiManager manager) throws IncorrectOperationException {
+      JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
+      PsiElementFactory factory = facade.getElementFactory();
+
+      PsiClass aClass = facade.getResolveHelper().resolveReferencedClass(myClassQName, context);
       if (aClass == null) {
         return factory.createTypeFromText(myClassQName, context);
       }
-      Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<PsiTypeParameter,PsiType>();
+
+      Map<PsiTypeParameter, PsiType> substitutionMap = ContainerUtil.newHashMap();
       for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(aClass)) {
-        final String name = typeParameter.getName();
-        final Type type = mySubstitutor.get(name);
-        if (type != null) {
-          substitutionMap.put(typeParameter, type.getType(context, manager));
-        } else {
-          substitutionMap.put(typeParameter, null);
-        }
+        Type substitute = mySubstitutor.get(typeParameter.getName());
+        substitutionMap.put(typeParameter, substitute != null ? substitute.getType(context, manager) : null);
       }
-      return factory.createType(aClass, factory.createSubstitutor(substitutionMap));
+      return factory.createType(aClass, factory.createSubstitutor(substitutionMap), null, myAnnotations);
     }
 
+    @Override
     public String getTypeText() {
-      return myOriginalText;
+      return myPresentableText;
     }
 
-    public void addImportsTo(final JavaCodeFragment codeFragment) {
-      codeFragment.addImportsFromString(myClassQName);
-      final Collection<Type> types = mySubstitutor.values();
-      for (Type type : types) {
+    @Override
+    public void addImportsTo(JavaCodeFragment fragment) {
+      fragment.addImportsFromString(myClassQName);
+      for (Type type : mySubstitutor.values()) {
         if (type != null) {
-          type.addImportsTo(codeFragment);
+          type.addImportsTo(fragment);
         }
       }
     }
@@ -233,15 +248,18 @@
   private static class DisjunctionType extends Type {
     private final List<Type> myTypes;
 
-    private DisjunctionType(final List<Type> types) {
+    private DisjunctionType(List<Type> types) {
       myTypes = types;
     }
 
     @NotNull
     @Override
     public PsiType getType(final PsiElement context, final PsiManager manager) throws IncorrectOperationException {
-      final List<PsiType> types = ContainerUtil.map(myTypes, new Function<Type, PsiType>() {
-        @Override public PsiType fun(Type type) { return type.getType(context, manager); }
+      List<PsiType> types = ContainerUtil.map(myTypes, new Function<Type, PsiType>() {
+        @Override
+        public PsiType fun(Type type) {
+          return type.getType(context, manager);
+        }
       });
       return new PsiDisjunctionType(types, manager);
     }
@@ -249,14 +267,17 @@
     @Override
     public String getTypeText() {
       return StringUtil.join(myTypes, new Function<Type, String>() {
-        @Override public String fun(Type type) { return type.getTypeText(); }
+        @Override
+        public String fun(Type type) {
+          return type.getTypeText();
+        }
       }, "|");
     }
 
     @Override
-    public void addImportsTo(final JavaCodeFragment codeFragment) {
+    public void addImportsTo(JavaCodeFragment fragment) {
       for (Type type : myTypes) {
-        type.addImportsTo(codeFragment);
+        type.addImportsTo(fragment);
       }
     }
   }
@@ -265,65 +286,61 @@
     public static final Creator INSTANCE = new Creator();
 
     @Override
-    public Type visitPrimitiveType(final PsiPrimitiveType primitiveType) {
-      return new Primitive(primitiveType);
+    public Type visitPrimitiveType(PsiPrimitiveType type) {
+      return new Primitive(type);
     }
 
     @Override
-    public Type visitEllipsisType(final PsiEllipsisType ellipsisType) {
-      return new Ellipsis(ellipsisType.getComponentType().accept(this));
+    public Type visitEllipsisType(PsiEllipsisType type) {
+      return new Ellipsis(type, type.getComponentType().accept(this));
     }
 
     @Override
-    public Type visitArrayType(final PsiArrayType arrayType) {
-      return new Array(arrayType.getComponentType().accept(this));
+    public Type visitArrayType(PsiArrayType type) {
+      return new Array(type, type.getComponentType().accept(this));
     }
 
     @Override
-    public Type visitWildcardType(final PsiWildcardType wildcardType) {
-      final PsiType wildcardBound = wildcardType.getBound();
-      final Type bound = wildcardBound == null ? null : wildcardBound.accept(this);
-      return new WildcardType(wildcardType.isExtends(), bound);
+    public Type visitWildcardType(PsiWildcardType type) {
+      PsiType bound = type.getBound();
+      return new WildcardType(type, type.isExtends(), bound == null ? null : bound.accept(this));
     }
 
     @Override
-    public Type visitClassType(final PsiClassType classType) {
-      final PsiClassType.ClassResolveResult resolveResult = classType.resolveGenerics();
-      final PsiClass aClass = resolveResult.getElement();
+    public Type visitClassType(PsiClassType type) {
+      PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics();
+      PsiClass aClass = resolveResult.getElement();
       if (aClass instanceof PsiAnonymousClass) {
         return visitClassType(((PsiAnonymousClass)aClass).getBaseClassType());
       }
-      final String originalText = classType.getPresentableText();
-      if (aClass == null) {
-        return new WrongType(originalText);
-      } else {
-        final Map<String,Type> substitutionMap = new HashMap<String,Type>();
-        final PsiSubstitutor substitutor = resolveResult.getSubstitutor();
+      else if (aClass == null) {
+        return new UnresolvedType(type);
+      }
+      else {
+        Map<String, Type> substitutionMap = ContainerUtil.newHashMap();
+        PsiSubstitutor substitutor = resolveResult.getSubstitutor();
         for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(aClass)) {
-          final PsiType type = substitutor.substitute(typeParameter);
-          final String name = typeParameter.getName();
-          if (type == null) {
-            substitutionMap.put(name, null);
-          } else {
-            substitutionMap.put(name, type.accept(this));
-          }
+          PsiType substitute = substitutor.substitute(typeParameter);
+          substitutionMap.put(typeParameter.getName(), substitute != null ? substitute.accept(this) : null);
         }
-        final String qualifiedName = aClass.getQualifiedName();
-        LOG.assertTrue(aClass.getName() != null);
-        return new ClassType(originalText, qualifiedName != null ? qualifiedName : aClass.getName(), substitutionMap);
+        String qualifiedName = ObjectUtils.notNull(aClass.getQualifiedName(), aClass.getName());
+        return new ClassType(type, qualifiedName, substitutionMap);
       }
     }
 
     @Override
-    public Type visitDisjunctionType(final PsiDisjunctionType disjunctionType) {
-      final List<Type> types = ContainerUtil.map(disjunctionType.getDisjunctions(), new Function<PsiType, Type>() {
-        @Override public Type fun(PsiType type) { return createTypeWrapper(type); }
+    public Type visitDisjunctionType(PsiDisjunctionType type) {
+      List<Type> types = ContainerUtil.map(type.getDisjunctions(), new Function<PsiType, Type>() {
+        @Override
+        public Type fun(PsiType type) {
+          return type.accept(Creator.this);
+        }
       });
       return new DisjunctionType(types);
     }
   }
 
-  public static Type createTypeWrapper(@NotNull final PsiType type) {
+  public static Type createTypeWrapper(@NotNull PsiType type) {
     return type.accept(Creator.INSTANCE);
   }
 }
diff --git a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
index 3a9f796..5fb9e50 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/RefactoringUtil.java
@@ -252,27 +252,6 @@
     }
   }
 
-  public static PsiReturnStatement[] findReturnStatements(PsiMethod method) {
-    ArrayList<PsiReturnStatement> vector = new ArrayList<PsiReturnStatement>();
-    PsiCodeBlock body = method.getBody();
-    if (body != null) {
-      addReturnStatements(vector, body);
-    }
-    return vector.toArray(new PsiReturnStatement[vector.size()]);
-  }
-
-  private static void addReturnStatements(ArrayList<PsiReturnStatement> vector, PsiElement element) {
-    if (element instanceof PsiReturnStatement) {
-      vector.add((PsiReturnStatement)element);
-    }
-    else if (!(element instanceof PsiClass)) {
-      PsiElement[] children = element.getChildren();
-      for (PsiElement child : children) {
-        addReturnStatements(vector, child);
-      }
-    }
-  }
-
 
   public static PsiElement getParentStatement(PsiElement place, boolean skipScopingStatements) {
     PsiElement parent = place;
@@ -444,26 +423,7 @@
   }
 
   private static PsiType getTypeByExpression(PsiExpression expr, final PsiElementFactory factory) {
-    PsiType type = expr.getType();
-    if (type == null) {
-      if (expr instanceof PsiArrayInitializerExpression) {
-        PsiExpression[] initializers = ((PsiArrayInitializerExpression)expr).getInitializers();
-        if (initializers.length > 0) {
-          PsiType initType = getTypeByExpression(initializers[0]);
-          if (initType == null) return null;
-          return initType.createArrayType();
-        }
-      }
-
-      if (expr instanceof PsiReferenceExpression && PsiUtil.isOnAssignmentLeftHand(expr)) {
-        return getTypeByExpression(((PsiAssignmentExpression)expr.getParent()).getRExpression());
-      }
-      return null;
-    }
-    PsiClass refClass = PsiUtil.resolveClassInType(type);
-    if (refClass instanceof PsiAnonymousClass) {
-      type = ((PsiAnonymousClass)refClass).getBaseClassType();
-    }
+    PsiType type = RefactoringChangeUtil.getTypeByExpression(expr);
     if (PsiType.NULL.equals(type)) {
       ExpectedTypeInfo[] infos = ExpectedTypesProvider.getInstance(expr.getProject()).getExpectedTypes(expr, false);
       if (infos.length == 1) {
@@ -474,7 +434,7 @@
       }
     }
 
-    return GenericsUtil.getVariableTypeByExpressionType(type);
+    return type;
   }
 
   public static boolean isAssignmentLHS(PsiElement element) {
diff --git a/java/java-impl/src/com/intellij/spellchecker/DocCommentTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/DocCommentTokenizer.java
new file mode 100644
index 0000000..d91a4cc
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/DocCommentTokenizer.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2009 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.spellchecker;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.psi.javadoc.PsiDocTag;
+import com.intellij.spellchecker.inspections.CommentSplitter;
+import com.intellij.spellchecker.tokenizer.TokenConsumer;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Set;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author shkate@jetbrains.com
+ */
+public class DocCommentTokenizer extends Tokenizer<PsiDocComment> {
+  private static final Set<String> excludedTags = ContainerUtil.immutableSet("author", "see", "by", "link");
+
+  @Override
+  public void tokenize(@NotNull PsiDocComment comment, TokenConsumer consumer) {
+    final CommentSplitter splitter = CommentSplitter.getInstance();
+
+    for (PsiElement el : comment.getChildren()) {
+      if (el instanceof PsiDocTag) {
+        PsiDocTag tag = (PsiDocTag)el;
+        if (!excludedTags.contains(tag.getName())) {
+          for (PsiElement data : tag.getDataElements()) {
+            consumer.consumeToken(data, splitter);
+          }
+        }
+      }
+      else {
+        consumer.consumeToken(el, splitter);
+      }
+    }
+  }
+}
diff --git a/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java b/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java
new file mode 100644
index 0000000..ee19872
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.spellchecker;
+
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.codeInspection.BatchSuppressManager;
+import com.intellij.codeInspection.SuppressManager;
+import com.intellij.codeInspection.SuppressQuickFix;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiLiteralExpression;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiNamedElement;
+import com.intellij.psi.javadoc.PsiDocComment;
+import com.intellij.spellchecker.tokenizer.SuppressibleSpellcheckingStrategy;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author shkate@jetbrains.com
+ */
+public class JavaSpellcheckingStrategy extends SuppressibleSpellcheckingStrategy {
+  private final MethodNameTokenizerJava myMethodNameTokenizer = new MethodNameTokenizerJava();
+  private final DocCommentTokenizer myDocCommentTokenizer = new DocCommentTokenizer();
+  private final LiteralExpressionTokenizer myLiteralExpressionTokenizer = new LiteralExpressionTokenizer();
+  private final NamedElementTokenizer myNamedElementTokenizer = new NamedElementTokenizer();
+
+  @NotNull
+  @Override
+  public Tokenizer getTokenizer(PsiElement element) {
+    if (element instanceof PsiMethod) {
+      return myMethodNameTokenizer;
+    }
+    if (element instanceof PsiDocComment) {
+      return myDocCommentTokenizer;
+    }
+    if (element instanceof PsiLiteralExpression) {
+      if (SuppressManager.isSuppressedInspectionName((PsiLiteralExpression)element)) {
+        return EMPTY_TOKENIZER;
+      }
+      return myLiteralExpressionTokenizer;
+    }
+    if (element instanceof PsiNamedElement) {
+      return myNamedElementTokenizer;
+    }
+
+    return super.getTokenizer(element);
+  }
+
+  @Override
+  public boolean isSuppressedFor(@NotNull PsiElement element, @NotNull String name) {
+    return SuppressManager.getInstance().isSuppressedFor(element, name);
+  }
+
+  @Override
+  public SuppressQuickFix[] getSuppressActions(@NotNull PsiElement element, @NotNull String name) {
+    return BatchSuppressManager.SERVICE.getInstance().createBatchSuppressActions(HighlightDisplayKey.find(name));
+  }
+}
diff --git a/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java
new file mode 100644
index 0000000..77246ec
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package com.intellij.spellchecker;
+
+import com.intellij.codeInsight.AnnotationUtil;
+import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.PsiLiteralExpression;
+import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.spellchecker.inspections.PlainTextSplitter;
+import com.intellij.spellchecker.tokenizer.EscapeSequenceTokenizer;
+import com.intellij.spellchecker.tokenizer.TokenConsumer;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collections;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author shkate@jetbrains.com
+ */
+public class LiteralExpressionTokenizer extends Tokenizer<PsiLiteralExpression> {
+  @Override
+  public void tokenize(@NotNull PsiLiteralExpression element, TokenConsumer consumer) {
+    PsiLiteralExpressionImpl literalExpression = (PsiLiteralExpressionImpl) element;
+    if (literalExpression.getLiteralElementType() != JavaTokenType.STRING_LITERAL) {
+      return;  // not a string literal
+    }
+
+    final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(element, PsiModifierListOwner.class);
+    if (listOwner != null && AnnotationUtil.isAnnotated(listOwner, Collections.singleton(AnnotationUtil.NON_NLS), false, false)) {
+      return;
+    }
+
+    String text = literalExpression.getInnerText();
+    if (text == null) {
+      return;
+    }
+    if (!text.contains("\\")) {
+      consumer.consumeToken(element, PlainTextSplitter.getInstance());
+    }
+    else {
+      processTextWithEscapeSequences(element, text, consumer);
+    }
+  }
+
+  public static void processTextWithEscapeSequences(PsiLiteralExpression element, String text, TokenConsumer consumer) {
+    StringBuilder unescapedText = new StringBuilder();
+    int[] offsets = new int[text.length()+1];
+    PsiLiteralExpressionImpl.parseStringCharacters(text, unescapedText, offsets);
+
+    EscapeSequenceTokenizer.processTextWithOffsets(element, consumer, unescapedText, offsets, 1);
+  }
+}
diff --git a/java/java-impl/src/com/intellij/spellchecker/MethodNameTokenizerJava.java b/java/java-impl/src/com/intellij/spellchecker/MethodNameTokenizerJava.java
new file mode 100644
index 0000000..7cdda49
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/MethodNameTokenizerJava.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2009 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.spellchecker;
+
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiMethod;
+import com.intellij.spellchecker.tokenizer.TokenConsumer;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author shkate@jetbrains.com
+ */
+public class MethodNameTokenizerJava extends NamedElementTokenizer<PsiMethod> {
+
+  @Override
+  public void tokenize(@NotNull PsiMethod element, TokenConsumer consumer) {
+    final PsiMethod[] methods = (element).findDeepestSuperMethods();
+    boolean isInSource = true;
+    for (PsiMethod psiMethod : methods) {
+      isInSource &= isMethodDeclarationInSource(psiMethod);
+    }
+    if (isInSource) {
+      super.tokenize(element, consumer);
+    }
+  }
+
+  private static boolean isMethodDeclarationInSource(@NotNull PsiMethod psiMethod) {
+    if (psiMethod.getContainingFile() == null) return false;
+    final VirtualFile virtualFile = psiMethod.getContainingFile().getVirtualFile();
+    if (virtualFile == null) return false;
+    return ProjectRootManager.getInstance(psiMethod.getProject()).getFileIndex().isInSource(virtualFile);
+  }
+}
diff --git a/java/java-impl/src/com/intellij/spellchecker/NamedElementTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/NamedElementTokenizer.java
new file mode 100644
index 0000000..eb85da6
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/NamedElementTokenizer.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2009 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.spellchecker;
+
+import com.intellij.psi.PsiIdentifier;
+import com.intellij.psi.PsiNamedElement;
+import com.intellij.psi.PsiTypeElement;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.spellchecker.tokenizer.TokenConsumer;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author shkate@jetbrains.com
+ */
+public class NamedElementTokenizer<T extends PsiNamedElement> extends Tokenizer<T> {
+  private final Tokenizer<PsiIdentifier> myIdentifierTokenizer = new PsiIdentifierTokenizer();
+  private final PsiTypeTokenizer myTypeTokenizer = new PsiTypeTokenizer();
+
+  @Override
+   public void tokenize(@NotNull T element, TokenConsumer consumer) {
+    final PsiIdentifier psiIdentifier = PsiTreeUtil.getChildOfType(element, PsiIdentifier.class);
+    final PsiTypeElement psiType = PsiTreeUtil.getChildOfType(element, PsiTypeElement.class);
+
+    if (psiIdentifier == null) {
+      return;
+    }
+
+    final String identifier = psiIdentifier.getText();
+    final String type = psiType==null?null:psiType.getText();
+
+    if (identifier == null) {
+      return;
+    }
+
+    if (type == null || !type.equalsIgnoreCase(identifier)) {
+      myIdentifierTokenizer.tokenize(psiIdentifier, consumer);      
+    }
+    if (psiType != null) {
+      myTypeTokenizer.tokenize(psiType, consumer);
+    }
+  }
+}
+
+
diff --git a/java/java-impl/src/com/intellij/spellchecker/PsiIdentifierTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/PsiIdentifierTokenizer.java
new file mode 100644
index 0000000..d40bf1e
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/PsiIdentifierTokenizer.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2011 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.spellchecker;
+
+import com.intellij.psi.PsiIdentifier;
+import com.intellij.spellchecker.inspections.IdentifierSplitter;
+import com.intellij.spellchecker.tokenizer.TokenConsumer;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author yole
+ */
+public class PsiIdentifierTokenizer extends Tokenizer<PsiIdentifier> {
+  @Override
+  public void tokenize(@NotNull PsiIdentifier element, TokenConsumer consumer) {
+    consumer.consumeToken(element, true, IdentifierSplitter.getInstance());
+  }
+}
diff --git a/java/java-impl/src/com/intellij/spellchecker/PsiTypeTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/PsiTypeTokenizer.java
new file mode 100644
index 0000000..6406c79
--- /dev/null
+++ b/java/java-impl/src/com/intellij/spellchecker/PsiTypeTokenizer.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2000-2009 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.spellchecker;
+
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiDisjunctionType;
+import com.intellij.psi.PsiType;
+import com.intellij.psi.PsiTypeElement;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.spellchecker.inspections.IdentifierSplitter;
+import com.intellij.spellchecker.tokenizer.TokenConsumer;
+import com.intellij.spellchecker.tokenizer.Tokenizer;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @author shkate@jetbrains.com
+ */
+public class PsiTypeTokenizer extends Tokenizer<PsiTypeElement> {
+
+  @Override
+  public void tokenize(@NotNull PsiTypeElement element, TokenConsumer consumer) {
+    final PsiType type = element.getType();
+    if (type instanceof PsiDisjunctionType) {
+      tokenizeComplexType(element, consumer);
+      return;
+    }
+
+    final PsiClass psiClass = PsiUtil.resolveClassInType(type);
+
+    if (psiClass == null || psiClass.getContainingFile() == null || psiClass.getContainingFile().getVirtualFile() == null) {
+      return;
+    }
+
+    final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
+
+    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
+
+    final boolean isInSource = (virtualFile != null) && fileIndex.isInContent(virtualFile);
+    if (isInSource) {
+      consumer.consumeToken(element, element.getText(), true, 0, getRangeToCheck(element.getText(), psiClass.getName()),
+                            IdentifierSplitter.getInstance());
+    }
+  }
+
+  private void tokenizeComplexType(PsiTypeElement element, TokenConsumer consumer) {
+    final List<PsiTypeElement> subTypes = PsiTreeUtil.getChildrenOfTypeAsList(element, PsiTypeElement.class);
+    for (PsiTypeElement subType : subTypes) {
+      tokenize(subType, consumer);
+    }
+  }
+
+  @NotNull
+  private static TextRange getRangeToCheck(@NotNull String text, @NotNull String name) {
+    final int i = text.indexOf(name);
+    return new TextRange(i, i + name.length());
+  }
+}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/spi/SPIFileType.java b/java/java-impl/src/com/intellij/spi/SPIFileType.java
index 5075404..215ca3b 100644
--- a/java/java-impl/src/com/intellij/spi/SPIFileType.java
+++ b/java/java-impl/src/com/intellij/spi/SPIFileType.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.
@@ -18,13 +18,14 @@
 import com.intellij.icons.AllIcons;
 import com.intellij.lang.spi.SPILanguage;
 import com.intellij.openapi.extensions.Extensions;
-import com.intellij.openapi.fileTypes.*;
+import com.intellij.openapi.fileTypes.FileTypeRegistry;
+import com.intellij.openapi.fileTypes.FileTypes;
+import com.intellij.openapi.fileTypes.LanguageFileType;
 import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile;
+import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.CharsetToolkit;
 import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -43,9 +44,9 @@
   @Override
   public boolean isMyFileType(VirtualFile file) {
     VirtualFile parent = file.getParent();
-    if (parent != null && "services".equals(parent.getName())) {
+    if (parent != null && Comparing.equal("services", parent.getNameSequence())) {
       final VirtualFile gParent = parent.getParent();
-      if (gParent != null && "META-INF".equals(gParent.getName())) {
+      if (gParent != null && Comparing.equal("META-INF", gParent.getNameSequence())) {
         final String fileName = file.getName();
         for (Object condition : Extensions.getExtensions("com.intellij.vetoSPICondition")) {
           if (((Condition<String>)condition).value(fileName)) return false;
@@ -87,7 +88,7 @@
 
   @Nullable
   @Override
-  public String getCharset(@NotNull VirtualFile file, byte[] content) {
+  public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
     return CharsetToolkit.UTF8;
   }
 }
diff --git a/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java b/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java
index 99ab4ce..f705125 100644
--- a/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java
+++ b/java/java-impl/src/com/intellij/testIntegration/JavaTestFinder.java
@@ -98,10 +98,11 @@
 
     HashSet<String> names = new HashSet<String>();
     cache.getAllClassNames(names);
+    final TestFrameworks frameworks = TestFrameworks.getInstance();
     for (String eachName : names) {
       if (pattern.matcher(eachName).matches()) {
         for (PsiClass eachClass : cache.getClassesByName(eachName, scope)) {
-          if (TestFrameworks.getInstance().isTestClass(eachClass)) {
+          if (frameworks.isTestClass(eachClass) || frameworks.isPotentialTestClass(eachClass)) {
             classesWithProximities.add(
                 new Pair<PsiClass, Integer>(eachClass, TestFinderHelper.calcTestNameProximity(klassName, eachName)));
           }
diff --git a/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java b/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java
index 5b4a1f3..4006480 100644
--- a/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java
+++ b/java/java-impl/src/com/intellij/testIntegration/JavaTestFramework.java
@@ -115,4 +115,8 @@
     final String templateText = StringUtil.replace(StringUtil.replace(template.getText(), "${BODY}\n", ""), "${NAME}", "setUp");
     return factory.createMethodFromText(templateText, null);
   }
+
+  public FileTemplateDescriptor getTestClassFileTemplateDescriptor() {
+    return null;
+  }
 }
diff --git a/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java b/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
index fd8d812..2f2ce9e 100644
--- a/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
+++ b/java/java-impl/src/com/intellij/testIntegration/TestIntegrationUtils.java
@@ -70,6 +70,15 @@
         }
         return null;
       }
+    },
+    TEST_CLASS("testClass") {
+      @Override
+      public FileTemplateDescriptor getFileTemplateDescriptor(@NotNull TestFramework framework) {
+        if (framework instanceof JavaTestFramework) {
+          return ((JavaTestFramework)framework).getTestClassFileTemplateDescriptor();
+        }
+        return null;
+      }
     };
     private String myDefaultName;
 
diff --git a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
index a23c6ca..68d9d46 100644
--- a/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
+++ b/java/java-impl/src/com/intellij/testIntegration/createTest/JavaTestGenerator.java
@@ -17,6 +17,10 @@
 
 import com.intellij.codeInsight.CodeInsightBundle;
 import com.intellij.codeInsight.CodeInsightUtil;
+import com.intellij.ide.fileTemplates.FileTemplate;
+import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
+import com.intellij.ide.fileTemplates.FileTemplateManager;
+import com.intellij.ide.fileTemplates.FileTemplateUtil;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
@@ -34,6 +38,7 @@
 
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Properties;
 import java.util.Set;
 
 public class JavaTestGenerator implements TestGenerator {
@@ -48,7 +53,7 @@
             try {
               IdeDocumentHistory.getInstance(project).includeCurrentPlaceAsChangePlace();
 
-              PsiClass targetClass = JavaDirectoryService.getInstance().createClass(d.getTargetDirectory(), d.getClassName());
+              PsiClass targetClass = createTestClass(d);
               addSuperClass(targetClass, project, d.getSuperClassName());
 
               Editor editor = CodeInsightUtil.positionCursor(project, targetClass.getContainingFile(), targetClass.getLBrace());
@@ -70,8 +75,44 @@
     });
   }
 
+  private static PsiClass createTestClass(CreateTestDialog d) {
+    final TestFramework testFrameworkDescriptor = d.getSelectedTestFrameworkDescriptor();
+    final FileTemplateDescriptor fileTemplateDescriptor = TestIntegrationUtils.MethodKind.TEST_CLASS.getFileTemplateDescriptor(testFrameworkDescriptor);
+    final PsiDirectory targetDirectory = d.getTargetDirectory();
+    if (fileTemplateDescriptor != null) {
+      final PsiClass classFromTemplate = createTestClassFromCodeTemplate(d, fileTemplateDescriptor, targetDirectory);
+      if (classFromTemplate != null) {
+        return classFromTemplate;
+      }
+    }
+
+    return JavaDirectoryService.getInstance().createClass(targetDirectory, d.getClassName());
+  }
+
+  private static PsiClass createTestClassFromCodeTemplate(final CreateTestDialog d,
+                                                          final FileTemplateDescriptor fileTemplateDescriptor,
+                                                          final PsiDirectory targetDirectory) {
+    final String templateName = fileTemplateDescriptor.getFileName();
+    final FileTemplate fileTemplate = FileTemplateManager.getInstance().getCodeTemplate(templateName);
+    final Properties defaultProperties = FileTemplateManager.getInstance().getDefaultProperties(targetDirectory.getProject());
+    Properties properties = new Properties(defaultProperties);
+    properties.setProperty(FileTemplate.ATTRIBUTE_NAME, d.getClassName());
+    try {
+      final PsiElement psiElement = FileTemplateUtil.createFromTemplate(fileTemplate, templateName, properties, targetDirectory);
+      if (psiElement instanceof PsiClass) {
+        return (PsiClass)psiElement;
+      }
+      return null;
+    }
+    catch (Exception e) {
+      return null;
+    }
+  }
+
   private static void addSuperClass(PsiClass targetClass, Project project, String superClassName) throws IncorrectOperationException {
     if (superClassName == null) return;
+    final PsiReferenceList extendsList = targetClass.getExtendsList();
+    if (extendsList == null || extendsList.getReferencedTypes().length > 0) return;
 
     PsiElementFactory ef = JavaPsiFacade.getInstance(project).getElementFactory();
     PsiJavaCodeReferenceElement superClassRef;
@@ -83,7 +124,7 @@
     else {
       superClassRef = ef.createFQClassNameReferenceElement(superClassName, GlobalSearchScope.allScope(project));
     }
-    targetClass.getExtendsList().add(superClassRef);
+    extendsList.add(superClassRef);
   }
 
   @Nullable
diff --git a/java/java-impl/src/com/intellij/util/xml/CanonicalPsiTypeConverterImpl.java b/java/java-impl/src/com/intellij/util/xml/CanonicalPsiTypeConverterImpl.java
index 254dc03..1dc7961 100644
--- a/java/java-impl/src/com/intellij/util/xml/CanonicalPsiTypeConverterImpl.java
+++ b/java/java-impl/src/com/intellij/util/xml/CanonicalPsiTypeConverterImpl.java
@@ -37,6 +37,7 @@
   @NonNls private static final String ARRAY_PREFIX = "[L";
   private static final JavaClassReferenceProvider CLASS_REFERENCE_PROVIDER = new JavaClassReferenceProvider();
 
+  @Override
   public PsiType fromString(final String s, final ConvertContext context) {
     if (s == null) return null;
     try {
@@ -47,10 +48,12 @@
     }
   }
 
+  @Override
   public String toString(final PsiType t, final ConvertContext context) {
     return t == null ? null : t.getCanonicalText();
   }
 
+  @Override
   @NotNull
   public PsiReference[] createReferences(final GenericDomValue<PsiType> genericDomValue, final PsiElement element, ConvertContext context) {
     final String typeText = genericDomValue.getStringValue();
@@ -60,7 +63,7 @@
     return getReferences(genericDomValue.getValue(), typeText, 0, element);
   }
 
-  public PsiReference[] getReferences(@Nullable PsiType type, String typeText, int startOffsetInText, final PsiElement element) {
+  public PsiReference[] getReferences(@Nullable PsiType type, String typeText, int startOffsetInText, @NotNull final PsiElement element) {
     final ElementManipulator<PsiElement> manipulator = ElementManipulators.getManipulator(element);
     assert manipulator != null;
     String trimmed = typeText.trim();
@@ -80,13 +83,16 @@
     final boolean isPrimitiveType = type instanceof PsiPrimitiveType;
 
     return new JavaClassReferenceSet(trimmed, element, offset, false, CLASS_REFERENCE_PROVIDER) {
+      @Override
       @NotNull
       protected JavaClassReference createReference(int refIndex, @NotNull String subRefText, @NotNull TextRange textRange, boolean staticImport) {
         return new JavaClassReference(this, textRange, refIndex, subRefText, staticImport) {
+          @Override
           public boolean isSoft() {
             return true;
           }
 
+          @Override
           @NotNull
           public JavaResolveResult advancedResolve(final boolean incompleteCode) {
             if (isPrimitiveType) {
@@ -96,6 +102,7 @@
             return super.advancedResolve(incompleteCode);
           }
 
+          @Override
           public void processVariants(@NotNull final PsiScopeProcessor processor) {
             if (processor instanceof JavaCompletionProcessor) {
               ((JavaCompletionProcessor)processor).setCompletionElements(getVariants());
@@ -104,6 +111,7 @@
             }
           }
 
+          @Override
           @NotNull
           public Object[] getVariants() {
             final Object[] variants = super.getVariants();
diff --git a/java/java-impl/src/resources/projectTemplates/Java/Command_Line_App.zip b/java/java-impl/src/resources/projectTemplates/Java/Command_Line_App.zip
index 03fcc25..11be02e 100644
--- a/java/java-impl/src/resources/projectTemplates/Java/Command_Line_App.zip
+++ b/java/java-impl/src/resources/projectTemplates/Java/Command_Line_App.zip
Binary files differ
diff --git a/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java b/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java
new file mode 100644
index 0000000..8ad915c
--- /dev/null
+++ b/java/java-indexing-api/src/com/intellij/psi/search/searches/FunctionalExpressionSearch.java
@@ -0,0 +1,74 @@
+/*
+ * 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.psi.search.searches;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiFunctionalExpression;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifier;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.PsiSearchHelper;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.util.EmptyQuery;
+import com.intellij.util.Query;
+import com.intellij.util.QueryExecutor;
+import org.jetbrains.annotations.NotNull;
+
+public class FunctionalExpressionSearch extends ExtensibleQueryFactory<PsiFunctionalExpression, FunctionalExpressionSearch.SearchParameters> {
+  public static ExtensionPointName<QueryExecutor> EP_NAME = ExtensionPointName.create("com.intellij.functionalInterfaceSearch");
+  public static final FunctionalExpressionSearch INSTANCE = new FunctionalExpressionSearch();
+
+  public static class SearchParameters {
+    private final PsiClass myElementToSearch;
+    private final SearchScope myScope;
+
+    public SearchParameters(PsiClass aClass, SearchScope scope) {
+      myElementToSearch = aClass;
+      myScope = scope;
+    }
+
+    public PsiClass getElementToSearch() {
+      return myElementToSearch;
+    }
+
+    @NotNull
+    public SearchScope getEffectiveSearchScope () {
+      SearchScope accessScope = PsiSearchHelper.SERVICE.getInstance(myElementToSearch.getProject()).getUseScope(myElementToSearch);
+      return myScope.intersectWith(accessScope);
+    }
+  }
+
+  public static Query<PsiFunctionalExpression> search(final PsiClass aClass, SearchScope scope) {
+    return INSTANCE.createUniqueResultsQuery(new SearchParameters(aClass, scope));
+  }
+
+  public static Query<PsiFunctionalExpression> search(final PsiMethod psiMethod) {
+    return search(psiMethod, GlobalSearchScope.allScope(psiMethod.getProject()));
+  }
+
+  public static Query<PsiFunctionalExpression> search(final PsiMethod psiMethod, SearchScope scope) {
+    if (!psiMethod.hasModifierProperty(PsiModifier.STATIC) && !psiMethod.hasModifierProperty(PsiModifier.DEFAULT)) {
+      return INSTANCE.createUniqueResultsQuery(new SearchParameters(psiMethod.getContainingClass(), scope));
+    }
+
+    return EmptyQuery.getEmptyQuery();
+  }
+
+  public static Query<PsiFunctionalExpression> search(final PsiClass aClass) {
+    return search(aClass, GlobalSearchScope.allScope(aClass.getProject()));
+  }
+}
diff --git a/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/ClassImplementationsSearch.java b/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/ClassImplementationsSearch.java
index 128cf27..9818649 100644
--- a/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/ClassImplementationsSearch.java
+++ b/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/ClassImplementationsSearch.java
@@ -18,11 +18,13 @@
 import com.intellij.openapi.util.registry.Registry;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFunctionalExpression;
 import com.intellij.psi.search.PsiElementProcessor;
 import com.intellij.psi.search.PsiElementProcessorAdapter;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.search.searches.ClassInheritorsSearch;
 import com.intellij.psi.search.searches.DefinitionsScopedSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.util.Processor;
 import com.intellij.util.QueryExecutor;
 import org.jetbrains.annotations.NotNull;
@@ -34,7 +36,16 @@
     return !(sourceElement instanceof PsiClass) || processImplementations((PsiClass)sourceElement, consumer, queryParameters.getScope());
   }
 
-  public static boolean processImplementations(final PsiClass psiClass, final Processor<? super PsiClass> processor, SearchScope scope) {
+  public static boolean processImplementations(final PsiClass psiClass, final Processor<PsiElement> processor, SearchScope scope) {
+    if (!FunctionalExpressionSearch.search(psiClass, scope).forEach(new Processor<PsiFunctionalExpression>() {
+      @Override
+      public boolean process(PsiFunctionalExpression expression) {
+        return processor.process(expression);
+      }
+    })) {
+      return false;
+    }
+
     final boolean showInterfaces = Registry.is("ide.goto.implementation.show.interfaces");
     return ClassInheritorsSearch.search(psiClass, scope, true).forEach(new PsiElementProcessorAdapter<PsiClass>(new PsiElementProcessor<PsiClass>() {
       public boolean execute(@NotNull PsiClass element) {
diff --git a/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/MethodImplementationsSearch.java b/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/MethodImplementationsSearch.java
index fd73976..f77b536 100644
--- a/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/MethodImplementationsSearch.java
+++ b/java/java-indexing-impl/src/com/intellij/codeInsight/navigation/MethodImplementationsSearch.java
@@ -16,12 +16,14 @@
 package com.intellij.codeInsight.navigation;
 
 import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFunctionalExpression;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.search.SearchScope;
 import com.intellij.psi.search.searches.DefinitionsScopedSearch;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
-import com.intellij.util.QueryExecutor;
 import com.intellij.util.Processor;
+import com.intellij.util.QueryExecutor;
 import com.intellij.util.containers.ContainerUtil;
 import org.jetbrains.annotations.NotNull;
 
@@ -29,21 +31,37 @@
 
 public class MethodImplementationsSearch implements QueryExecutor<PsiElement, DefinitionsScopedSearch.SearchParameters> {
   @Override
-  public boolean execute(@NotNull DefinitionsScopedSearch.SearchParameters queryParameters, @NotNull Processor<PsiElement> consumer) {
+  public boolean execute(final @NotNull DefinitionsScopedSearch.SearchParameters queryParameters, final @NotNull Processor<PsiElement> consumer) {
     final PsiElement sourceElement = queryParameters.getElement();
     if (sourceElement instanceof PsiMethod) {
-      PsiMethod[] implementations = getMethodImplementations((PsiMethod)sourceElement, queryParameters.getScope());
-      return ContainerUtil.process(implementations, consumer);
+      return processImplementations((PsiMethod)sourceElement, consumer, queryParameters.getScope());
     }
     return true;
   }
 
+  public static boolean processImplementations(final PsiMethod psiMethod, final Processor<PsiElement> consumer,
+                                               final SearchScope searchScope) {
+    if (!FunctionalExpressionSearch.search(psiMethod, searchScope).forEach(new Processor<PsiFunctionalExpression>() {
+      @Override
+      public boolean process(PsiFunctionalExpression expression) {
+        return consumer.process(expression);
+      }
+    })) {
+      return false;
+    }
+    final ArrayList<PsiMethod> methods = new ArrayList<PsiMethod>();
+    getOverridingMethods(psiMethod, methods, searchScope);
+    return ContainerUtil.process(methods, consumer);
+  }
+
   public static void getOverridingMethods(PsiMethod method, ArrayList<PsiMethod> list, SearchScope scope) {
     for (PsiMethod psiMethod : OverridingMethodsSearch.search(method, scope, true)) {
       list.add(psiMethod);
     }
   }
 
+  @SuppressWarnings("UnusedDeclaration")
+  @Deprecated
   public static PsiMethod[] getMethodImplementations(final PsiMethod method, SearchScope scope) {
     ArrayList<PsiMethod> result = new ArrayList<PsiMethod>();
 
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java
new file mode 100644
index 0000000..689961e
--- /dev/null
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/java/stubs/index/JavaMethodParameterTypesIndex.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.impl.java.stubs.index;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.impl.search.JavaSourceFilterScope;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StringStubIndexExtension;
+import com.intellij.psi.stubs.StubIndex;
+import com.intellij.psi.stubs.StubIndexKey;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class JavaMethodParameterTypesIndex extends StringStubIndexExtension<PsiMethod> {
+
+  private static final JavaMethodParameterTypesIndex ourInstance = new JavaMethodParameterTypesIndex();
+  public static JavaMethodParameterTypesIndex getInstance() {
+    return ourInstance;
+  }
+
+  @NotNull
+  @Override
+  public StubIndexKey<String, PsiMethod> getKey() {
+    return JavaStubIndexKeys.METHOD_TYPES;
+  }
+
+  @Override
+  public Collection<PsiMethod> get(final String s, final Project project, @NotNull final GlobalSearchScope scope) {
+    return StubIndex.getElements(getKey(), s, project, new JavaSourceFilterScope(scope), PsiMethod.class);
+  }
+}
\ No newline at end of file
diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java
new file mode 100644
index 0000000..2ee2cc2
--- /dev/null
+++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/JavaFunctionalExpressionSearcher.java
@@ -0,0 +1,153 @@
+/*
+ * 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.psi.impl.search;
+
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Computable;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.java.stubs.index.JavaMethodParameterTypesIndex;
+import com.intellij.psi.search.EverythingGlobalScope;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.SearchScope;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
+import com.intellij.psi.search.searches.MethodReferencesSearch;
+import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.Processor;
+import com.intellij.util.QueryExecutor;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class JavaFunctionalExpressionSearcher implements QueryExecutor<PsiFunctionalExpression, FunctionalExpressionSearch.SearchParameters> {
+
+  @Override
+  public boolean execute(final @NotNull FunctionalExpressionSearch.SearchParameters queryParameters,
+                         final @NotNull Processor<PsiFunctionalExpression> consumer) {
+    final PsiClass aClass = queryParameters.getElementToSearch();
+    if (!ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
+      @Override
+      public Boolean compute() {
+        return LambdaUtil.isFunctionalClass(aClass);
+      }
+    }) || !PsiUtil.isLanguageLevel8OrHigher(aClass)) {
+      return true;
+    }
+    return collectFunctionalExpressions(aClass, ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
+      @Override
+      public SearchScope compute() {
+        return queryParameters.getEffectiveSearchScope();
+      }
+    }), consumer);
+  }
+
+  public static boolean collectFunctionalExpressions(final PsiClass aClass,
+                                                     final SearchScope searchScope,
+                                                     final Processor<PsiFunctionalExpression> consumer) {
+    final SearchScope classScope = ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
+      @Override
+      public SearchScope compute() {
+        return aClass.getUseScope();
+      }
+    });
+    final SearchScope useScope = searchScope.intersectWith(classScope);
+    final Project project = aClass.getProject();
+    final GlobalSearchScope scope = useScope instanceof GlobalSearchScope ? (GlobalSearchScope)useScope : new EverythingGlobalScope(project);
+    final Collection<PsiMethod> lambdaCandidates = ApplicationManager.getApplication().runReadAction(new Computable<Collection<PsiMethod>>() {
+      @Override
+      public Collection<PsiMethod> compute() {
+        final String functionalInterfaceName = aClass.getName();
+        final GlobalSearchScope useClassScope = classScope instanceof GlobalSearchScope ? (GlobalSearchScope)classScope : scope;
+        return JavaMethodParameterTypesIndex.getInstance().get(functionalInterfaceName, project, useClassScope);
+      }
+    });
+    for (PsiMethod psiMethod : lambdaCandidates) {
+      for (PsiReference ref : MethodReferencesSearch.search(psiMethod, scope, false)) {
+        final PsiElement refElement = ref.getElement();
+        if (refElement != null) {
+          final PsiElement candidateElement = refElement.getParent();
+          if (candidateElement instanceof PsiCallExpression) {
+            final PsiExpressionList argumentList = ((PsiCallExpression)candidateElement).getArgumentList();
+            if (argumentList != null) {
+              final Boolean accepted = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
+                @Override
+                public Boolean compute() {
+                  final PsiExpression[] args = argumentList.getExpressions();
+                  for (PsiExpression arg : args) {
+                    if (arg instanceof PsiFunctionalExpression) {
+                      final PsiFunctionalExpression functionalExpression = (PsiFunctionalExpression)arg;
+                      final PsiType functionalType = functionalExpression.getFunctionalInterfaceType();
+                      if (PsiUtil.resolveClassInType(functionalType) == aClass) {
+                        if (!consumer.process(functionalExpression)) return false;
+                      }
+                    }
+                  }
+                  return true;
+                }
+              });
+              if (!accepted) return false;
+            }
+          }
+        }
+      }
+    }
+
+    for (PsiReference reference : ReferencesSearch.search(aClass, scope)) {
+      final PsiElement element = reference.getElement();
+      if (element != null) {
+        final PsiElement parent = element.getParent();
+        if (parent instanceof PsiTypeElement) {
+          final PsiElement gParent = parent.getParent();
+          if (gParent instanceof PsiVariable) {
+            final PsiExpression initializer = PsiUtil.skipParenthesizedExprDown(((PsiVariable)gParent).getInitializer());
+            if (initializer instanceof PsiFunctionalExpression) {
+              if (!consumer.process((PsiFunctionalExpression)initializer)) return false;
+            }
+            for (PsiReference varRef : ReferencesSearch.search(parent, scope)) {
+              final PsiElement varElement = varRef.getElement();
+              if (varElement != null) {
+                final PsiElement varElementParent = varElement.getParent();
+                if (varElementParent instanceof PsiAssignmentExpression && 
+                    ((PsiAssignmentExpression)varElementParent).getLExpression() == varElement) {
+                  final PsiExpression rExpression = PsiUtil.skipParenthesizedExprDown(((PsiAssignmentExpression)varElementParent).getRExpression());
+                  if (rExpression instanceof PsiFunctionalExpression) {
+                    if (!consumer.process((PsiFunctionalExpression)rExpression)) return false;
+                  }
+                }
+              }
+            }
+          } else if (gParent instanceof PsiMethod) {
+            final PsiReturnStatement[] returnStatements = ApplicationManager.getApplication().runReadAction(
+              new Computable<PsiReturnStatement[]>() {
+                @Override
+                public PsiReturnStatement[] compute() {
+                  return PsiUtil.findReturnStatements((PsiMethod)gParent);
+                }
+              });
+            for (PsiReturnStatement returnStatement : returnStatements) {
+              final PsiExpression returnValue = returnStatement.getReturnValue();
+              if (returnValue instanceof PsiFunctionalExpression) {
+                if (!consumer.process((PsiFunctionalExpression)returnValue)) return false;
+              }
+            }
+          }
+        }
+      }
+    }
+    return true;
+  }
+}
diff --git a/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java b/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java
index 668390c..192d19c 100644
--- a/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java
+++ b/java/java-psi-api/src/com/intellij/codeInsight/NullableNotNullManager.java
@@ -44,8 +44,12 @@
   public final JDOMExternalizableStringList myNullables = new JDOMExternalizableStringList();
   public final JDOMExternalizableStringList myNotNulls = new JDOMExternalizableStringList();
 
-  public static final String[] DEFAULT_NULLABLES = {AnnotationUtil.NULLABLE, "javax.annotation.Nullable", "edu.umd.cs.findbugs.annotations.Nullable"};
-  public static final String[] DEFAULT_NOT_NULLS = {AnnotationUtil.NOT_NULL, "javax.annotation.Nonnull",  "edu.umd.cs.findbugs.annotations.NonNull"};
+  public static final String[] DEFAULT_NULLABLES = {AnnotationUtil.NULLABLE, "javax.annotation.Nullable",
+    "edu.umd.cs.findbugs.annotations.Nullable", "android.support.annotation.Nullable"
+  };
+  public static final String[] DEFAULT_NOT_NULLS = {AnnotationUtil.NOT_NULL, "javax.annotation.Nonnull",
+    "edu.umd.cs.findbugs.annotations.NonNull", "android.support.annotation.NonNull"
+  };
 
   public NullableNotNullManager() {
     Collections.addAll(myNotNulls, DEFAULT_NOT_NULLS);
diff --git a/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java b/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java
index 248aad7..272edbc 100644
--- a/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java
+++ b/java/java-psi-api/src/com/intellij/codeInsight/TestFrameworks.java
@@ -29,6 +29,7 @@
   }
 
   public abstract boolean isTestClass(PsiClass psiClass);
+  public abstract boolean isPotentialTestClass(PsiClass psiClass);
 
   @Nullable
   public abstract PsiMethod findOrCreateSetUpMethod(PsiClass psiClass);
@@ -40,6 +41,8 @@
   public abstract PsiMethod findTearDownMethod(PsiClass psiClass);
 
   protected abstract boolean hasConfigMethods(PsiClass psiClass);
+  
+  public abstract boolean isTestMethod(PsiMethod method);
 
   public boolean isTestOrConfig(PsiClass psiClass) {
     return isTestClass(psiClass) || hasConfigMethods(psiClass);
diff --git a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
index a77be43..e561140 100644
--- a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
@@ -21,7 +21,7 @@
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.util.*;
-import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -34,7 +34,6 @@
 public class LambdaUtil {
   public static ThreadLocal<Map<PsiElement, PsiType>> ourFunctionTypes = new ThreadLocal<Map<PsiElement, PsiType>>();
   private static final Logger LOG = Logger.getInstance("#" + LambdaUtil.class.getName());
-  @NonNls public static final String JAVA_LANG_FUNCTIONAL_INTERFACE = "java.lang.FunctionalInterface";
 
   @Nullable
   public static PsiType getFunctionalInterfaceReturnType(PsiLambdaExpression expr) {
@@ -72,12 +71,14 @@
 
   @Nullable
   public static PsiMethod getFunctionalInterfaceMethod(PsiClassType.ClassResolveResult result) {
-    final PsiClass psiClass = result.getElement();
-    if (psiClass != null) {
-      final MethodSignature methodSignature = getFunction(psiClass);
-      if (methodSignature != null) {
-        return getMethod(psiClass, methodSignature);
-      }
+    return getFunctionalInterfaceMethod(result.getElement());
+  }
+
+  @Nullable
+  public static PsiMethod getFunctionalInterfaceMethod(PsiClass aClass) {
+    final MethodSignature methodSignature = getFunction(aClass);
+    if (methodSignature != null) {
+      return getMethod(aClass, methodSignature);
     }
     return null;
   }
@@ -106,8 +107,11 @@
         if (isFunctionalType(type1)) return true;
       }
     }
-    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(GenericsUtil.eliminateWildcards(type));
-    final PsiClass aClass = resolveResult.getElement();
+    return isFunctionalClass(PsiUtil.resolveGenericsClassInType(type).getElement());
+  }
+
+  @Contract("null -> false")
+  public static boolean isFunctionalClass(PsiClass aClass) {
     if (aClass != null) {
       if (aClass instanceof PsiTypeParameter) return false;
       final List<MethodSignature> signatures = findFunctionCandidates(aClass);
@@ -115,7 +119,7 @@
     }
     return false;
   }
-  
+
   public static boolean isValidLambdaContext(@Nullable PsiElement context) {
     return context instanceof PsiTypeCastExpression ||
            context instanceof PsiAssignmentExpression ||
@@ -192,9 +196,6 @@
 
   @Nullable
   public static List<MethodSignature> findFunctionCandidates(PsiClass psiClass) {
-    if (psiClass instanceof PsiAnonymousClass) {
-      psiClass = PsiUtil.resolveClassInType(((PsiAnonymousClass)psiClass).getBaseClassType());
-    }
     if (psiClass != null && psiClass.isInterface() && !psiClass.isAnnotationType()) {
       final List<MethodSignature> methods = new ArrayList<MethodSignature>();
       final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
@@ -319,6 +320,13 @@
               return properties.getSubstitutor().substitute(getNormalizedType(parameters[finalLambdaIdx]));
             }
           }
+          final Map<PsiElement, PsiType> map = ourFunctionTypes.get();
+          if (map != null) {
+            final PsiType type = map.get(expression);
+            if (type != null) {
+              return type;
+            }
+          }
           final JavaResolveResult resolveResult = contextCall.resolveMethodGenerics();
             final PsiElement resolve = resolveResult.getElement();
             if (resolve instanceof PsiMethod) {
@@ -326,13 +334,6 @@
               final int finalLambdaIdx = adjustLambdaIdx(lambdaIdx, (PsiMethod)resolve, parameters);
               if (finalLambdaIdx < parameters.length) {
                 if (!tryToSubstitute) return getNormalizedType(parameters[finalLambdaIdx]);
-                final Map<PsiElement, PsiType> map = ourFunctionTypes.get();
-                if (map != null) {
-                  final PsiType type = map.get(expression);
-                  if (type != null) {
-                    return type;
-                  }
-                }
                 return PsiResolveHelper.ourGraphGuard.doPreventingRecursion(expression, true, new Computable<PsiType>() {
                   @Override
                   public PsiType compute() {
@@ -429,7 +430,7 @@
 
   @Nullable
   public static String checkFunctionalInterface(@NotNull PsiAnnotation annotation, @NotNull LanguageLevel languageLevel) {
-    if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && Comparing.strEqual(annotation.getQualifiedName(), JAVA_LANG_FUNCTIONAL_INTERFACE)) {
+    if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8) && Comparing.strEqual(annotation.getQualifiedName(), CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE)) {
       final PsiAnnotationOwner owner = annotation.getOwner();
       if (owner instanceof PsiModifierList) {
         final PsiElement parent = ((PsiModifierList)owner).getParent();
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiFunctionalExpression.java b/java/java-psi-api/src/com/intellij/psi/PsiFunctionalExpression.java
new file mode 100644
index 0000000..e038065
--- /dev/null
+++ b/java/java-psi-api/src/com/intellij/psi/PsiFunctionalExpression.java
@@ -0,0 +1,28 @@
+/*
+ * 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.psi;
+
+import com.intellij.openapi.util.Iconable;
+import org.jetbrains.annotations.Nullable;
+
+public interface PsiFunctionalExpression extends PsiExpression, Iconable {
+  /**
+   * @return SAM type the lambda expression corresponds to
+   *         null when no SAM type could be found
+   */
+  @Nullable
+  PsiType getFunctionalInterfaceType();
+}
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiLambdaExpression.java b/java/java-psi-api/src/com/intellij/psi/PsiLambdaExpression.java
index e8e3dea..a59d1e5 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiLambdaExpression.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiLambdaExpression.java
@@ -21,7 +21,7 @@
 /**
  * Represents a Java lambda expression.
  */
-public interface PsiLambdaExpression extends PsiExpression {
+public interface PsiLambdaExpression extends PsiFunctionalExpression {
   /**
    * Returns this lambda expression's parameter list.
    *
@@ -39,13 +39,6 @@
   @Nullable
   PsiElement getBody();
 
-  /**
-   * @return SAM type the lambda expression corresponds to
-   *         null when no SAM type could be found
-   */
-  @Nullable
-  PsiType getFunctionalInterfaceType();
-
   boolean isVoidCompatible();
   boolean isValueCompatible();
 
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceExpression.java b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceExpression.java
index 1f927d5..2058da0 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceExpression.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceExpression.java
@@ -20,7 +20,7 @@
 /**
  * Represents a method or constructor reference.
  */
-public interface PsiMethodReferenceExpression extends PsiReferenceExpression {
+public interface PsiMethodReferenceExpression extends PsiReferenceExpression, PsiFunctionalExpression {
   /**
    * Returns the type element used as the qualifier of the reference.
    *
@@ -28,13 +28,6 @@
    */
   @Nullable
   PsiTypeElement getQualifierType();
-  
-  /**
-   * @return SAM type the method reference expression corresponds to
-   *         null when no SAM type could be found
-  */
-  @Nullable
-  PsiType getFunctionalInterfaceType();
 
   /**
    * @return if there is only one possible compile-time declaration with only one possible invocation type, 
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
index 133d170..fa891fd 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiMethodReferenceUtil.java
@@ -17,6 +17,7 @@
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.psi.util.*;
+import com.intellij.util.containers.HashMap;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -65,6 +66,37 @@
     return null;
   }
 
+  public static boolean isCorrectAssignment(PsiType[] signatureParameterTypes2,
+                                            PsiType[] parameterTypes,
+                                            PsiSubstitutor substitutor,
+                                            boolean varargs,
+                                            int offset) {
+    final int min = Math.min(signatureParameterTypes2.length, parameterTypes.length - offset);
+    for (int i = 0; i < min; i++) {
+      final PsiType type1 = substitutor.substitute(parameterTypes[i + offset]);
+      final PsiType type2 = signatureParameterTypes2[i];
+      if (varargs && i == signatureParameterTypes2.length - 1) {
+        if (!TypeConversionUtil.isAssignable(type2, type1) && !TypeConversionUtil.isAssignable(((PsiArrayType)type2).getComponentType(), type1)) {
+          return false;
+        }
+      }
+      else if (!TypeConversionUtil.isAssignable(type2, type1)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @NotNull
+  public static Map<PsiMethodReferenceExpression, PsiType> getFunctionalTypeMap() {
+    Map<PsiMethodReferenceExpression, PsiType> map = ourRefs.get();
+    if (map == null) {
+      map = new HashMap<PsiMethodReferenceExpression, PsiType>();
+      ourRefs.set(map);
+    }
+    return map;
+  }
+
   public static class QualifierResolveResult {
     private final PsiClass myContainingClass;
     private final PsiSubstitutor mySubstitutor;
@@ -160,12 +192,12 @@
     if (containingClass != null) {
       receiverType = getExpandedType(receiverType, containingClass);
     }
-    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(GenericsUtil.eliminateWildcards(receiverType));
+    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(receiverType);
     final PsiClass receiverClass = resolveResult.getElement();
     if (receiverClass != null && isReceiverType(receiverClass, containingClass)) {
       LOG.assertTrue(containingClass != null);
       return emptyOrRaw(containingClass, psiSubstitutor) ||
-             TypeConversionUtil.isAssignable(JavaPsiFacade.getElementFactory(containingClass.getProject()).createType(containingClass, psiSubstitutor), GenericsUtil.eliminateWildcards(receiverType));
+             TypeConversionUtil.isAssignable(JavaPsiFacade.getElementFactory(containingClass.getProject()).createType(containingClass, psiSubstitutor), receiverType);
     }
     return false;
   }
@@ -211,6 +243,12 @@
     final PsiElement resolve = methodRef.resolve();
 
     if (resolve == null) return null;
+    return checkMethodReferenceContext(methodRef, resolve, methodRef.getFunctionalInterfaceType());
+  }
+
+  public static String checkMethodReferenceContext(PsiMethodReferenceExpression methodRef,
+                                                   PsiElement resolve,
+                                                   PsiType functionalInterfaceType) {
     final PsiClass containingClass = resolve instanceof PsiMethod ? ((PsiMethod)resolve).getContainingClass() : (PsiClass)resolve;
     final boolean isStaticSelector = isStaticallyReferenced(methodRef);
     final PsiElement qualifier = methodRef.getQualifier();
@@ -224,7 +262,7 @@
 
       isMethodStatic = method.hasModifierProperty(PsiModifier.STATIC);
       isConstructor = method.isConstructor();
-      receiverReferenced = hasReceiver(methodRef, method);
+      receiverReferenced = hasReceiver(methodRef, method, functionalInterfaceType);
       
       if (method.hasModifierProperty(PsiModifier.ABSTRACT) && qualifier instanceof PsiSuperExpression) {
         return "Abstract method '" + method.getName() + "' cannot be accessed directly";
@@ -264,8 +302,15 @@
     return null;
   }
 
-  public static boolean hasReceiver(@NotNull PsiMethodReferenceExpression methodRef, @NotNull PsiMethod method) {
-    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(methodRef.getFunctionalInterfaceType());
+  public static boolean hasReceiver(@NotNull PsiMethodReferenceExpression methodRef,
+                                    @NotNull PsiMethod method) {
+    return hasReceiver(methodRef, method, methodRef.getFunctionalInterfaceType());
+  }
+
+  private static boolean hasReceiver(@NotNull PsiMethodReferenceExpression methodRef,
+                                     @NotNull PsiMethod method,
+                                     PsiType functionalInterfaceType) {
+    final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
     final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
     final MethodSignature signature = interfaceMethod != null ? interfaceMethod.getSignature(LambdaUtil.getSubstitutor(interfaceMethod, resolveResult)) : null;
     LOG.assertTrue(signature != null);
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiNameHelper.java b/java/java-psi-api/src/com/intellij/psi/PsiNameHelper.java
index 9b72527..747f4f8 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiNameHelper.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiNameHelper.java
@@ -27,7 +27,6 @@
 import java.util.List;
 import java.util.regex.Pattern;
 
-import static com.intellij.util.ObjectUtils.assertNotNull;
 import static com.intellij.util.ObjectUtils.notNull;
 
 /**
@@ -279,17 +278,23 @@
   }
 
   public static boolean appendAnnotations(@NotNull StringBuilder sb, @NotNull List<PsiAnnotation> annotations, boolean canonical) {
+    boolean updated = false;
     for (PsiAnnotation annotation : annotations) {
-      sb.append('@');
       if (canonical) {
-        sb.append(annotation.getQualifiedName());
-        sb.append(annotation.getParameterList().getText());
+        String name = annotation.getQualifiedName();
+        if (name != null) {
+          sb.append('@').append(name).append(annotation.getParameterList().getText()).append(' ');
+          updated = true;
+        }
       }
       else {
-        sb.append(assertNotNull(annotation.getNameReferenceElement()).getText());
+        PsiJavaCodeReferenceElement refElement = annotation.getNameReferenceElement();
+        if (refElement != null) {
+          sb.append('@').append(refElement.getText()).append(' ');
+          updated = true;
+        }
       }
-      sb.append(' ');
     }
-    return !annotations.isEmpty();
+    return updated;
   }
 }
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiResolveHelper.java b/java/java-psi-api/src/com/intellij/psi/PsiResolveHelper.java
index 3e4cea4..2e3de88 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiResolveHelper.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiResolveHelper.java
@@ -81,6 +81,18 @@
   CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression call, boolean dummyImplicitConstructor);
 
   /**
+   * Resolves a call expression and returns an array of possible resolve results.
+   *
+   * @param call the call expression to resolve.
+   * @param dummyImplicitConstructor if true, implicit empty constructor which does not actually exist
+   * can be returned as a candidate for the resolve.
+   * @param checkVarargs true if varargs method should lead to 2 candidates in the result array
+   * @return the array of resolve results.
+   */
+  @NotNull
+  CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression call, boolean dummyImplicitConstructor, boolean checkVarargs);
+
+  /**
    * Resolves a reference to a class, given the text of the reference and the context
    * in which it was encountered.
    *
diff --git a/java/java-psi-api/src/com/intellij/psi/PsiWildcardType.java b/java/java-psi-api/src/com/intellij/psi/PsiWildcardType.java
index d651810..71fdd0b 100644
--- a/java/java-psi-api/src/com/intellij/psi/PsiWildcardType.java
+++ b/java/java-psi-api/src/com/intellij/psi/PsiWildcardType.java
@@ -66,12 +66,14 @@
   @NotNull
   public static PsiWildcardType createExtends(@NotNull PsiManager manager, @NotNull PsiType bound) {
     LOG.assertTrue(!(bound instanceof PsiWildcardType));
+    LOG.assertTrue(bound != PsiType.NULL);
     return new PsiWildcardType(manager, true, bound);
   }
 
   @NotNull
   public static PsiWildcardType createSuper(@NotNull PsiManager manager, @NotNull PsiType bound) {
     LOG.assertTrue(!(bound instanceof PsiWildcardType));
+    LOG.assertTrue(bound != PsiType.NULL);
     return new PsiWildcardType(manager, false, bound);
   }
 
diff --git a/java/java-psi-api/src/com/intellij/psi/infos/CandidateInfo.java b/java/java-psi-api/src/com/intellij/psi/infos/CandidateInfo.java
index aff69cd..fb4bbb3 100644
--- a/java/java-psi-api/src/com/intellij/psi/infos/CandidateInfo.java
+++ b/java/java-psi-api/src/com/intellij/psi/infos/CandidateInfo.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.
@@ -18,6 +18,7 @@
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
 import com.intellij.openapi.projectRoots.JavaVersionService;
 import com.intellij.psi.*;
+import com.intellij.psi.util.PsiUtilCore;
 import org.jetbrains.annotations.NotNull;
 
 /**
@@ -28,14 +29,14 @@
 
   private final PsiElement myPlace;
   private final PsiClass myAccessClass;
-  private final PsiElement myCandidate;
+  @NotNull private final PsiElement myCandidate;
   private final boolean myStaticsProblem;
   protected final PsiSubstitutor mySubstitutor;
   private final PsiElement myCurrentFileResolveContext;
   private final boolean myPackagePrefixPackageReference;
   private Boolean myAccessible; // benign datarace
 
-  private CandidateInfo(PsiElement candidate,
+  private CandidateInfo(@NotNull PsiElement candidate,
                         @NotNull PsiSubstitutor substitutor,
                         Boolean accessible,
                         boolean staticsProblem,
@@ -52,15 +53,15 @@
     myPlace = place;
     myPackagePrefixPackageReference = packagePrefixPackageReference;
   }
-  public CandidateInfo(PsiElement candidate, @NotNull PsiSubstitutor substitutor, boolean accessProblem, boolean staticsProblem, PsiElement currFileContext) {
+  public CandidateInfo(@NotNull PsiElement candidate, @NotNull PsiSubstitutor substitutor, boolean accessProblem, boolean staticsProblem, PsiElement currFileContext) {
     this(candidate, substitutor, !accessProblem, staticsProblem, currFileContext, null, null, false);
   }
 
-  public CandidateInfo(PsiElement candidate, @NotNull PsiSubstitutor substitutor, boolean accessProblem, boolean staticsProblem){
+  public CandidateInfo(@NotNull PsiElement candidate, @NotNull PsiSubstitutor substitutor, boolean accessProblem, boolean staticsProblem){
     this(candidate, substitutor, accessProblem, staticsProblem, null);
   }
 
-  public CandidateInfo(PsiElement candidate,
+  public CandidateInfo(@NotNull PsiElement candidate,
                        @NotNull PsiSubstitutor substitutor,
                        PsiElement place,
                        PsiClass accessClass,
@@ -69,15 +70,15 @@
     this(candidate, substitutor, null, staticsProblem, currFileContext, place, accessClass, false);
   }
 
-  public CandidateInfo(PsiElement candidate, @NotNull PsiSubstitutor substitutor, PsiElement place, boolean staticsProblem){
+  public CandidateInfo(@NotNull PsiElement candidate, @NotNull PsiSubstitutor substitutor, PsiElement place, boolean staticsProblem){
     this(candidate, substitutor, place, null, staticsProblem, null);
   }
 
-  public CandidateInfo(PsiElement candidate, @NotNull PsiSubstitutor substitutor){
+  public CandidateInfo(@NotNull PsiElement candidate, @NotNull PsiSubstitutor substitutor){
     this(candidate, substitutor, null, null, false, null);
   }
 
-  public CandidateInfo(CandidateInfo candidate, @NotNull PsiSubstitutor newSubstitutor){
+  public CandidateInfo(@NotNull CandidateInfo candidate, @NotNull PsiSubstitutor newSubstitutor){
     this(candidate.myCandidate, newSubstitutor, candidate.myAccessible, candidate.myStaticsProblem, candidate.myCurrentFileResolveContext, candidate.myPlace,
          null, false);
   }
@@ -93,6 +94,7 @@
   }
 
   @Override
+  @NotNull
   public PsiElement getElement(){
     return myCandidate;
   }
@@ -160,7 +162,7 @@
     if (myStaticsProblem != that.myStaticsProblem) return false;
     if (myAccessClass != null ? !myAccessClass.equals(that.myAccessClass) : that.myAccessClass != null) return false;
     if (isAccessible() != that.isAccessible()) return false;
-    if (myCandidate != null ? !myCandidate.equals(that.myCandidate) : that.myCandidate != null) return false;
+    if (!myCandidate.equals(that.myCandidate)) return false;
     if (myCurrentFileResolveContext != null
         ? !myCurrentFileResolveContext.equals(that.myCurrentFileResolveContext)
         : that.myCurrentFileResolveContext != null) {
@@ -174,7 +176,7 @@
   public int hashCode() {
     int result = myPlace != null ? myPlace.hashCode() : 0;
     result = 31 * result + (myAccessClass != null ? myAccessClass.hashCode() : 0);
-    result = 31 * result + (myCandidate != null ? myCandidate.hashCode() : 0);
+    result = 31 * result + myCandidate.hashCode();
     result = 31 * result + (isAccessible() ? 1 : 0);
     result = 31 * result + (myStaticsProblem ? 1 : 0);
     result = 31 * result + mySubstitutor.hashCode();
@@ -185,5 +187,5 @@
 
   @NotNull
   public static final JavaResolveResult[] RESOLVE_RESULT_FOR_PACKAGE_PREFIX_PACKAGE =
-    {new CandidateInfo(null, PsiSubstitutor.EMPTY, Boolean.TRUE, false, null, null, null, true)};
+    {new CandidateInfo(PsiUtilCore.NULL_PSI_ELEMENT, PsiSubstitutor.EMPTY, Boolean.TRUE, false, null, null, null, true)};
 }
diff --git a/java/java-psi-api/src/com/intellij/psi/infos/ClassCandidateInfo.java b/java/java-psi-api/src/com/intellij/psi/infos/ClassCandidateInfo.java
index 97876b2..110b88d 100644
--- a/java/java-psi-api/src/com/intellij/psi/infos/ClassCandidateInfo.java
+++ b/java/java-psi-api/src/com/intellij/psi/infos/ClassCandidateInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -18,6 +18,7 @@
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiSubstitutor;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * Created by IntelliJ IDEA.
@@ -27,14 +28,15 @@
  * To change this template use Options | File Templates.
  */
 public class ClassCandidateInfo extends CandidateInfo{
-  public ClassCandidateInfo(PsiElement candidate, PsiSubstitutor substitutor, boolean accessProblem, PsiElement currFileContext){
+  public ClassCandidateInfo(@NotNull PsiElement candidate, @NotNull PsiSubstitutor substitutor, boolean accessProblem, PsiElement currFileContext){
     super(candidate, substitutor, accessProblem, false, currFileContext);
   }
 
-  public ClassCandidateInfo(PsiElement candidate, PsiSubstitutor substitutor){
+  public ClassCandidateInfo(@NotNull PsiElement candidate, @NotNull PsiSubstitutor substitutor){
     super(candidate, substitutor, false, false);
   }
 
+  @NotNull
   @Override
   public PsiClass getElement(){
     return (PsiClass)super.getElement();
diff --git a/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java b/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
index 30da36e..917a888 100644
--- a/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.java
+++ b/java/java-psi-api/src/com/intellij/psi/infos/MethodCandidateInfo.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.
@@ -39,15 +39,15 @@
 public class MethodCandidateInfo extends CandidateInfo{
   public static final RecursionGuard ourOverloadGuard = RecursionManager.createGuard("overload.guard");
   public static final ThreadLocal<Map<PsiElement,  CurrentCandidateProperties>> CURRENT_CANDIDATE = new ThreadLocal<Map<PsiElement, CurrentCandidateProperties>>();
-  @ApplicabilityLevelConstant
-  private int myApplicabilityLevel; // benign race
+  @ApplicabilityLevelConstant private int myApplicabilityLevel; // benign race
+  @ApplicabilityLevelConstant private int myPertinentApplicabilityLevel;
   private final PsiElement myArgumentList;
   private final PsiType[] myArgumentTypes;
   private final PsiType[] myTypeArguments;
   private PsiSubstitutor myCalcedSubstitutor; // benign race
   private final LanguageLevel myLanguageLevel;
 
-  public MethodCandidateInfo(PsiElement candidate,
+  public MethodCandidateInfo(@NotNull PsiElement candidate,
                              PsiSubstitutor substitutor,
                              boolean accessProblem,
                              boolean staticsProblem,
@@ -59,8 +59,8 @@
          PsiUtil.getLanguageLevel(argumentList));
   }
 
-  public MethodCandidateInfo(PsiElement candidate,
-                             PsiSubstitutor substitutor,
+  public MethodCandidateInfo(@NotNull PsiElement candidate,
+                             @NotNull PsiSubstitutor substitutor,
                              boolean accessProblem,
                              boolean staticsProblem,
                              PsiElement argumentList,
@@ -105,6 +105,13 @@
 
   @ApplicabilityLevelConstant
   public int getPertinentApplicabilityLevel() {
+    if (myPertinentApplicabilityLevel == 0) {
+      myPertinentApplicabilityLevel = getPertinentApplicabilityLevelInner();
+    }
+    return myPertinentApplicabilityLevel;
+  }
+  
+  public int getPertinentApplicabilityLevelInner() {
     if (myArgumentList == null || !PsiUtil.isLanguageLevel8OrHigher(myArgumentList)) {
       return getApplicabilityLevel();
     }
@@ -143,7 +150,9 @@
       }
 
     });
-    assert boxedLevel != null;
+    if (boxedLevel == null) {
+      return getApplicabilityLevel();
+    }
     level = boxedLevel;
     if (level > ApplicabilityLevel.NOT_APPLICABLE && !isTypeArgumentsApplicable(false)) level = ApplicabilityLevel.NOT_APPLICABLE;
     return level;
@@ -153,11 +162,9 @@
     PsiSubstitutor incompleteSubstitutor = super.getSubstitutor();
     if (myTypeArguments != null) {
       PsiMethod method = getElement();
-      if (method != null) {
-        PsiTypeParameter[] typeParams = method.getTypeParameters();
-        for (int i = 0; i < myTypeArguments.length && i < typeParams.length; i++) {
-          incompleteSubstitutor = incompleteSubstitutor.put(typeParams[i], myTypeArguments[i]);
-        }
+      PsiTypeParameter[] typeParams = method.getTypeParameters();
+      for (int i = 0; i < myTypeArguments.length && i < typeParams.length; i++) {
+        incompleteSubstitutor = incompleteSubstitutor.put(typeParams[i], myTypeArguments[i]);
       }
     }
     return incompleteSubstitutor;
@@ -180,7 +187,10 @@
 
         final PsiSubstitutor inferredSubstitutor = inferTypeArguments(DefaultParameterTypeInferencePolicy.INSTANCE, includeReturnConstraint);
 
-         if (!stackStamp.mayCacheNow() || !ourOverloadGuard.currentStack().isEmpty() || !includeReturnConstraint && myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
+         if (!stackStamp.mayCacheNow() ||
+             !ourOverloadGuard.currentStack().isEmpty() ||
+             !includeReturnConstraint && myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8) ||
+             getMarkerList() != null && PsiResolveHelper.ourGraphGuard.currentStack().contains(getMarkerList().getParent())) {
           return inferredSubstitutor;
         }
 
@@ -214,7 +224,7 @@
   }
 
   protected PsiElement getParent() {
-    return myArgumentList != null ? myArgumentList.getParent() : myArgumentList;
+    return myArgumentList != null ? myArgumentList.getParent() : null;
   }
 
   @Override
@@ -222,6 +232,7 @@
     return super.isValidResult() && isApplicable();
   }
 
+  @NotNull
   @Override
   public PsiMethod getElement(){
     return (PsiMethod)super.getElement();
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java
index 425b46d..4edae81 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PropertyUtil.java
@@ -103,7 +103,7 @@
     return Comparing.equal(PsiUtil.resolveClassInType(TypeConversionUtil.erasure(returnType)), method.getContainingClass());
   }
 
-  @Nullable public static String getPropertyName(PsiMethod method) {
+  @Nullable public static String getPropertyName(@NotNull PsiMethod method) {
     if (isSimplePropertyGetter(method)) {
       return getPropertyNameByGetter(method);
     }
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
index 32a9879..2fd2f9b 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
@@ -101,7 +101,7 @@
 
   @NotNull
   public static JavaResolveResult getAccessObjectClass(@NotNull PsiExpression expression) {
-    if (expression instanceof PsiSuperExpression) return JavaResolveResult.EMPTY;
+    if (expression instanceof PsiSuperExpression && !isLanguageLevel8OrHigher(expression)) return JavaResolveResult.EMPTY;
     PsiType type = expression.getType();
     if (type instanceof PsiClassType) {
       return ((PsiClassType)type).resolveGenerics();
@@ -1092,4 +1092,25 @@
     }
     return false;
   }
+
+  public static PsiReturnStatement[] findReturnStatements(PsiMethod method) {
+    ArrayList<PsiReturnStatement> vector = new ArrayList<PsiReturnStatement>();
+    PsiCodeBlock body = method.getBody();
+    if (body != null) {
+      addReturnStatements(vector, body);
+    }
+    return vector.toArray(new PsiReturnStatement[vector.size()]);
+  }
+
+  private static void addReturnStatements(ArrayList<PsiReturnStatement> vector, PsiElement element) {
+    if (element instanceof PsiReturnStatement) {
+      vector.add((PsiReturnStatement)element);
+    }
+    else if (!(element instanceof PsiClass)) {
+      PsiElement[] children = element.getChildren();
+      for (PsiElement child : children) {
+        addReturnStatements(vector, child);
+      }
+    }
+  }
 }
diff --git a/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java b/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
index 6df6f2a..0fbfa4a 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/RedundantCastUtil.java
@@ -373,7 +373,7 @@
         PsiType castType = typeElement.getType();
         final PsiExpression innerOperand = ((PsiTypeCastExpression)expr).getOperand();
         final PsiType operandType = innerOperand != null ? innerOperand.getType() : null;
-        if (!(castType instanceof PsiPrimitiveType)) {
+        if (!(castType instanceof PsiPrimitiveType) && !(topCastType instanceof PsiPrimitiveType)) {
           if (operandType != null && topCastType != null && TypeConversionUtil.areTypesConvertible(operandType, topCastType)) {
             addToResults((PsiTypeCastExpression)expr);
           }
diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
index e147b40..9ff3475 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
@@ -38,12 +38,12 @@
   protected static boolean provablyDistinct(PsiType type1, PsiType type2, int level) {
     if (type1 instanceof PsiWildcardType) {
       if (type2 instanceof PsiWildcardType) {
-        return provablyDistinct((PsiWildcardType)type1, (PsiWildcardType)type2, true);
+        return provablyDistinct((PsiWildcardType)type1, (PsiWildcardType)type2, true, level);
       }
 
       if (level > 1) return true;
       if (type2 instanceof PsiCapturedWildcardType) {
-        return provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard(), false);
+        return provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard(), false, level);
       }
 
       if (type2 instanceof PsiClassType) {
@@ -150,7 +150,7 @@
     return true;
   }
 
-  public static boolean provablyDistinct(PsiWildcardType type1, PsiWildcardType type2, boolean rejectInconsistentRaw) {
+  public static boolean provablyDistinct(PsiWildcardType type1, PsiWildcardType type2, boolean rejectInconsistentRaw, int level) {
     if (type1.isSuper() && type2.isSuper()) return false;
     if (type1.isExtends() && type2.isExtends()) {
       final PsiType extendsBound1 = type1.getExtendsBound();
@@ -168,7 +168,8 @@
       }
       return provablyDistinct(extendsBound1, extendsBound2, 1);
     }
-    if (type2.isExtends()) return provablyDistinct(type2, type1, rejectInconsistentRaw);
+    if (type2.isExtends()) return provablyDistinct(type2, type1, rejectInconsistentRaw, level);
+    if (type1.isExtends() && !type2.isBounded() && level > 1) return PsiUtil.resolveClassInType(type1.getExtendsBound()) instanceof PsiTypeParameter;
     if (type1.isExtends() && type2.isSuper()) {
       final PsiType extendsBound = type1.getExtendsBound();
       final PsiType superBound = type2.getSuperBound();
diff --git a/java/java-psi-api/src/com/intellij/util/VisibilityUtil.java b/java/java-psi-api/src/com/intellij/util/VisibilityUtil.java
index e1f3093..04aa459 100644
--- a/java/java-psi-api/src/com/intellij/util/VisibilityUtil.java
+++ b/java/java-psi-api/src/com/intellij/util/VisibilityUtil.java
@@ -67,6 +67,12 @@
     }
   }
 
+  public static void escalateVisibility(PsiModifierList modifierList, PsiElement place) throws IncorrectOperationException {
+    final PsiElement parent = modifierList.getParent();
+    if (parent instanceof PsiMember) {
+      escalateVisibility((PsiMember)parent, place);
+    }
+  }
 
   @PsiModifier.ModifierConstant
   public static String getPossibleVisibility(final PsiMember psiMethod, final PsiElement place) {
diff --git a/java/java-psi-impl/java-psi-impl.iml b/java/java-psi-impl/java-psi-impl.iml
index 89e9dba..70b825d 100644
--- a/java/java-psi-impl/java-psi-impl.iml
+++ b/java/java-psi-impl/java-psi-impl.iml
@@ -10,7 +10,7 @@
     <orderEntry type="module" module-name="java-psi-api" exported="" />
     <orderEntry type="module" module-name="core-impl" exported="" />
     <orderEntry type="module" module-name="resources-en" />
-    <orderEntry type="library" name="asm4" level="project" />
+    <orderEntry type="library" name="asm5" level="project" />
   </component>
 </module>
 
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/TestFrameworksImpl.java b/java/java-psi-impl/src/com/intellij/codeInsight/TestFrameworksImpl.java
index 7671eae..15e887c 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/TestFrameworksImpl.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/TestFrameworksImpl.java
@@ -43,6 +43,17 @@
   }
 
   @Override
+  public boolean isPotentialTestClass(PsiClass psiClass) {
+    final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
+    for (TestFramework framework : testFrameworks) {
+      if (framework.isPotentialTestClass(psiClass)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  @Override
   @Nullable
   public PsiMethod findOrCreateSetUpMethod(final PsiClass psiClass) {
     final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
@@ -100,4 +111,13 @@
     }
     return false;
   }
+
+  @Override
+  public boolean isTestMethod(PsiMethod method) {
+    final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
+    for (TestFramework framework : testFrameworks) {
+      if (framework.isTestMethod(method)) return true;
+    }
+    return false;
+  }
 }
\ No newline at end of file
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
index c1875bc..550ffc2 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilderBase.java
@@ -744,7 +744,7 @@
         if (argumentList != null && argumentList.getExpressions().length == 0) {
           final PsiMethod[] methods = anonymousClass.getMethods();
           PsiClass baseClass = anonymousClass.getBaseClassType().resolve();
-          if (hasOnlyOneLambdaMethod(anonymousClass, !quick) && seemsLikeLambda(baseClass)) {
+          if (hasOnlyOneLambdaMethod(anonymousClass, !quick) && seemsLikeLambda(baseClass) && !PsiUtil.isLanguageLevel8OrHigher(anonymousClass)) {
             final PsiMethod method = methods[0];
             final PsiCodeBlock body = method.getBody();
             if (body != null) {
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
index ab07fc2..c30aef7 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
@@ -606,7 +606,7 @@
           String text = o.toString();
           PsiType type = variable.getType();
           if (type.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
-            text = "\"" + StringUtil.trimLog(text, 120) + "\"";
+            text = "\"" + StringUtil.shortenPathWithEllipsis(text, 120) + "\"";
           }
           else if (type.equalsToText("char")) text = "'" + text + "'";
           try {
@@ -1087,7 +1087,9 @@
           generateLinkValue(tag, buffer, false);
         }
         else if (tagName.equals(LITERAL_TAG)) {
-          generateLiteralValue(buffer, ((PsiInlineDocTagImpl)tag).getDataElementsIgnoreWhitespaces());
+          final PsiElement[] dataElements = tag instanceof PsiInlineDocTagImpl ?((PsiInlineDocTagImpl)tag).getDataElementsIgnoreWhitespaces() 
+                                                                               : tag.getDataElements();
+          generateLiteralValue(buffer, dataElements);
         }
         else if (tagName.equals(CODE_TAG)) {
           generateCodeValue(tag, buffer);
diff --git a/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java b/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java
index eef4824..d8dc8ad 100644
--- a/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java
+++ b/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -73,7 +73,7 @@
   }
 
   @Override
-  public String getCharset(@NotNull VirtualFile file, final byte[] content) {
+  public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) {
     return null;
   }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java b/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java
index d92ec8c..49b0b55 100644
--- a/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/PsiDiamondTypeImpl.java
@@ -183,7 +183,7 @@
     final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
     final PsiResolveHelper resolveHelper = facade.getResolveHelper();
     final JavaResolveResult result =
-      resolveHelper.resolveConstructor(facade.getElementFactory().createType(containingClass), argumentList, argumentList);
+      resolveHelper.resolveConstructor(facade.getElementFactory().createType(containingClass, PsiSubstitutor.EMPTY), argumentList, argumentList);
     return (PsiMethod)result.getElement();
   }
 
@@ -278,8 +278,7 @@
     buf.append("{}");
 
     try {
-      final PsiNameIdentifierOwner owner = constructor != null ? constructor : containingClass;
-      return elementFactory.createMethodFromText(buf.toString(), owner instanceof PsiCompiledElement ? ((PsiCompiledElement)owner).getMirror() : owner);
+      return elementFactory.createMethodFromText(buf.toString(), constructor != null ? constructor : containingClass);
     }
     catch (IncorrectOperationException e) {
       return null;
diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
index 1966ae5..0e6ed16 100644
--- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java
@@ -213,6 +213,7 @@
 
   public static List<PsiVariable> getUsedVariables(ControlFlow flow, int start, int end) {
     ArrayList<PsiVariable> array = new ArrayList<PsiVariable>();
+    if (start < 0) return array;
     List<Instruction> instructions = flow.getInstructions();
     for (int i = start; i < end; i++) {
       Instruction instruction = instructions.get(i);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
index 831f7ad..3f4cea4 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiClassImplUtil.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -225,7 +225,7 @@
     FilterScopeProcessor<MethodCandidateInfo> processor = new FilterScopeProcessor<MethodCandidateInfo>(
       new OrFilter(ElementClassFilter.METHOD, ElementClassFilter.FIELD, ElementClassFilter.CLASS)) {
       @Override
-      protected void add(PsiElement element, PsiSubstitutor substitutor) {
+      protected void add(@NotNull PsiElement element, @NotNull PsiSubstitutor substitutor) {
         if (element instanceof PsiMethod) {
           methods.add(Pair.create((PsiMember)element, substitutor));
         }
@@ -385,7 +385,7 @@
   public static boolean isMainOrPremainMethod(@NotNull PsiMethod method) {
     if (!PsiType.VOID.equals(method.getReturnType())) return false;
     String name = method.getName();
-    if (!("main".equals(name) || "premain".equals(name))) return false;
+    if (!("main".equals(name) || "premain".equals(name) || !"agentmain".equals(name))) return false;
 
     PsiElementFactory factory = JavaPsiFacade.getInstance(method.getProject()).getElementFactory();
     MethodSignature signature = method.getSignature(PsiSubstitutor.EMPTY);
@@ -394,6 +394,8 @@
       if (MethodSignatureUtil.areSignaturesEqual(signature, main)) return true;
       MethodSignature premain = createSignatureFromText(factory, "void premain(String args, java.lang.instrument.Instrumentation i);");
       if (MethodSignatureUtil.areSignaturesEqual(signature, premain)) return true;
+      MethodSignature agentmain = createSignatureFromText(factory, "void agentmain(String args, java.lang.instrument.Instrumentation i);");
+      if (MethodSignatureUtil.areSignaturesEqual(signature, agentmain)) return true;
     }
     catch (IncorrectOperationException e) {
       LOG.error(e);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
index 81ada72..2251847 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
@@ -494,13 +494,6 @@
       return PsiUtil.captureToplevelWildcards(type, expression);
     }
 
-    final PsiElement parent = toplevel.getParent();
-    if (parent instanceof PsiExpressionList &&
-        PsiUtil.isLanguageLevel8OrHigher(parent) &&
-        parent.getParent() instanceof PsiCallExpression) {
-      return PsiUtil.captureToplevelWildcards(type, expression);
-    }
-
     final PsiType normalized = doNormalizeWildcardByPosition(type, expression, toplevel);
     LOG.assertTrue(normalized.isValid(), type);
     if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(toplevel)) {
@@ -551,7 +544,8 @@
     PsiClass aClass = member.getContainingClass();
     if (aClass instanceof PsiAnonymousClass) {
       //member from anonymous class can be called from outside the class
-      PsiElement methodCallExpr = PsiTreeUtil.getParentOfType(aClass, PsiMethodCallExpression.class);
+      PsiElement methodCallExpr = PsiUtil.isLanguageLevel8OrHigher(aClass) ? PsiTreeUtil.getTopmostParentOfType(aClass, PsiStatement.class) 
+                                                                           : PsiTreeUtil.getParentOfType(aClass, PsiMethodCallExpression.class);
       return new LocalSearchScope(methodCallExpr != null ? methodCallExpr : aClass);
     }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java
index 57390de..e7e3dd0 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSubstitutorImpl.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.
@@ -394,7 +394,7 @@
       if (erasure != null) {
         final PsiType[] boundTypes = typeParameter.getExtendsListTypes();
         for (PsiType boundType : boundTypes) {
-          if (TypeConversionUtil.isAssignable(boundType, erasure) || TypeConversionUtil.isAssignable(erasure, boundType)) {
+          if (TypeConversionUtil.isAssignable(erasure, boundType)) {
             return boundType;
           }
         }
@@ -511,7 +511,8 @@
         buffer.append(" of ");
         buffer.append(((PsiMethod)owner).getName());
         buffer.append(" in ");
-        buffer.append(((PsiMethod)owner).getContainingClass().getQualifiedName());
+        PsiClass aClass = ((PsiMethod)owner).getContainingClass();
+        buffer.append(aClass != null ? aClass.getQualifiedName() : "<no class>");
       }
       buffer.append(" -> ");
       if (entry.getValue() != null) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java
index a11a285..f4f9e88 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.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.
@@ -16,6 +16,7 @@
 package com.intellij.psi.impl;
 
 import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.ProgressManager;
 import com.intellij.openapi.util.Pair;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.source.HierarchicalMethodSignatureImpl;
@@ -112,6 +113,7 @@
                                                                                         final boolean includePrivates,
                                                                                         final Set<PsiClass> visited,
                                                                                         boolean isInRawContext) {
+    ProgressManager.checkCanceled();
     Map<MethodSignature, HierarchicalMethodSignature> result = new LinkedHashMap<MethodSignature, HierarchicalMethodSignature>();
     final Map<MethodSignature, List<PsiMethod>> sameParameterErasureMethods = new THashMap<MethodSignature, List<PsiMethod>>(MethodSignatureUtil.METHOD_PARAMETERS_ERASURE_EQUALITY);
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/cache/TypeInfo.java b/java/java-psi-impl/src/com/intellij/psi/impl/cache/TypeInfo.java
index 41a6d35..9a078bb 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/cache/TypeInfo.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/cache/TypeInfo.java
@@ -33,7 +33,7 @@
 import com.intellij.psi.stubs.StubInputStream;
 import com.intellij.psi.stubs.StubOutputStream;
 import com.intellij.psi.tree.IElementType;
-import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.SmartList;
 import com.intellij.util.io.StringRef;
 import gnu.trove.TObjectIntHashMap;
 import org.jetbrains.annotations.NotNull;
@@ -81,19 +81,19 @@
   private static final int HAS_ARRAY_COUNT = 0x40;
   private static final int HAS_ELLIPSIS = 0x80;
 
-  private static final TypeInfo NULL = new TypeInfo((StringRef)null, (byte)0, false, ContainerUtil.<PsiAnnotationStub>emptyList());
+  private static final TypeInfo NULL = new TypeInfo((StringRef)null, (byte)0, false, PsiAnnotationStub.EMPTY_ARRAY);
 
   public final StringRef text;
   public final byte arrayCount;
   public final boolean isEllipsis;
 
-  private final List<PsiAnnotationStub> myAnnotationStubs;
+  private final PsiAnnotationStub[] myAnnotationStubs;
 
-  public TypeInfo(String text, byte arrayCount, boolean ellipsis, @NotNull List<PsiAnnotationStub> annotationStubs) {
+  public TypeInfo(String text, byte arrayCount, boolean ellipsis, @NotNull PsiAnnotationStub[] annotationStubs) {
     this(StringRef.fromString(text == null ? null : internFrequentType(text)), arrayCount, ellipsis, annotationStubs);
   }
 
-  private TypeInfo(StringRef text, byte arrayCount, boolean isEllipsis, @NotNull List<PsiAnnotationStub> annotationStubs) {
+  private TypeInfo(StringRef text, byte arrayCount, boolean isEllipsis, @NotNull PsiAnnotationStub[] annotationStubs) {
     this.text = text;
     this.arrayCount = arrayCount;
     this.isEllipsis = isEllipsis;
@@ -105,15 +105,19 @@
     PsiModifierListStub modifierList = (PsiModifierListStub)owner.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
     if (modifierList == null) return this;
 
-    List<PsiAnnotationStub> annotationStubs = ContainerUtil.newArrayList();
+    List<PsiAnnotationStub> annotationStubs = null;
     for (StubElement child : modifierList.getChildrenStubs()) {
       if (!(child instanceof PsiAnnotationStub)) continue;
       PsiAnnotationStub annotationStub = (PsiAnnotationStub)child;
       if (PsiImplUtil.isTypeAnnotation(annotationStub.getPsiElement())) {
+        if (annotationStubs == null) annotationStubs = new SmartList<PsiAnnotationStub>();
         annotationStubs.add(annotationStub);
       }
     }
-    return new TypeInfo(text, arrayCount, isEllipsis, annotationStubs);
+
+    PsiAnnotationStub[] stubArray = PsiAnnotationStub.EMPTY_ARRAY;
+    if (annotationStubs != null) stubArray = annotationStubs.toArray(new PsiAnnotationStub[annotationStubs.size()]);
+    return new TypeInfo(text, arrayCount, isEllipsis, stubArray);
   }
 
   @NotNull
@@ -185,7 +189,7 @@
       text = LightTreeUtil.toFilteredString(tree, typeElement, null);
     }
 
-    return new TypeInfo(text, arrayCount, isEllipsis, ContainerUtil.<PsiAnnotationStub>emptyList());
+    return new TypeInfo(text, arrayCount, isEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
   }
 
   @NotNull
@@ -198,7 +202,7 @@
       typeText = typeText.substring(0, typeText.length() - 2);
     }
 
-    return new TypeInfo(typeText, arrayCount, isEllipsis, ContainerUtil.<PsiAnnotationStub>emptyList());
+    return new TypeInfo(typeText, arrayCount, isEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
   }
 
   @NotNull
@@ -225,7 +229,7 @@
 
     StringRef text = frequentIndex == 0 ? record.readName() : StringRef.fromString(ourIndexFrequentType[frequentIndex]);
 
-    return new TypeInfo(text, arrayCount, hasEllipsis, ContainerUtil.<PsiAnnotationStub>emptyList());
+    return new TypeInfo(text, arrayCount, hasEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
   }
 
   public static void writeTYPE(@NotNull StubOutputStream dataStream, @NotNull TypeInfo typeInfo) throws IOException {
@@ -254,7 +258,7 @@
     if (typeInfo == NULL || typeInfo.text == null) {
       return null;
     }
-    if (typeInfo.arrayCount == 0 && typeInfo.myAnnotationStubs.isEmpty()) {
+    if (typeInfo.arrayCount == 0 && typeInfo.myAnnotationStubs.length == 0) {
       return typeInfo.text.getString();
     }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java
index f2a4b48..4f91aea 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java
@@ -40,7 +40,7 @@
 public class ClassFileStubBuilder implements BinaryFileStubBuilder {
   private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.compiled.ClassFileStubBuilder");
 
-  public static final int STUB_VERSION = 9;
+  public static final int STUB_VERSION = 10;
 
   @Override
   public boolean acceptsFile(@NotNull VirtualFile file) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
index 369ce91..6ab8174 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsFileImpl.java
@@ -16,7 +16,6 @@
 package com.intellij.psi.impl.compiled;
 
 import com.intellij.diagnostic.PluginException;
-import com.intellij.ide.caches.FileContent;
 import com.intellij.ide.highlighter.JavaClassFileType;
 import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.ide.plugins.PluginManagerCore;
@@ -34,6 +33,7 @@
 import com.intellij.openapi.roots.FileIndexFacade;
 import com.intellij.openapi.ui.Queryable;
 import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.ModificationTracker;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.pom.java.LanguageLevel;
@@ -50,6 +50,8 @@
 import com.intellij.psi.impl.source.resolve.FileContextUtil;
 import com.intellij.psi.impl.source.tree.JavaElementType;
 import com.intellij.psi.impl.source.tree.TreeElement;
+import com.intellij.psi.scope.ElementClassHint;
+import com.intellij.psi.scope.PsiScopeProcessor;
 import com.intellij.psi.search.PsiElementProcessor;
 import com.intellij.psi.stubs.*;
 import com.intellij.psi.util.CachedValueProvider;
@@ -62,7 +64,7 @@
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.asm4.ClassReader;
+import org.jetbrains.org.objectweb.asm.ClassReader;
 
 import java.io.IOException;
 import java.util.Collections;
@@ -85,6 +87,7 @@
   private volatile SoftReference<StubTree> myStub;
   private volatile TreeElement myMirrorFileElement;
   private volatile ClsPackageStatementImpl myPackageStatement = null;
+  private volatile LanguageLevel myLanguageLevel = null;
   private boolean myIsPhysical = true;
 
   public ClsFileImpl(@NotNull FileViewProvider viewProvider) {
@@ -234,8 +237,17 @@
   @Override
   @NotNull
   public LanguageLevel getLanguageLevel() {
-    List stubs = getStub().getChildrenStubs();
-    return !stubs.isEmpty() ? ((PsiClassStub<?>)stubs.get(0)).getLanguageLevel() : LanguageLevel.HIGHEST;
+    LanguageLevel level = myLanguageLevel;
+    if (level == null) {
+      List classes = ApplicationManager.getApplication().runReadAction(new Computable<List>() {
+        @Override
+        public List compute() {
+          return getStub().getChildrenStubs();
+        }
+      });
+      myLanguageLevel = level = !classes.isEmpty() ? ((PsiClassStub<?>)classes.get(0)).getLanguageLevel() : LanguageLevel.HIGHEST;
+    }
+    return level;
   }
 
   @Override
@@ -417,6 +429,22 @@
   }
 
   @Override
+  public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
+                                     @NotNull ResolveState state,
+                                     PsiElement lastParent,
+                                     @NotNull PsiElement place) {
+    processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
+    final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
+    if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
+      final PsiClass[] classes = getClasses();
+      for (PsiClass aClass : classes) {
+        if (!processor.execute(aClass, state)) return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
   @NotNull
   public StubTree getStubTree() {
     ApplicationManager.getApplication().assertReadAccessAllowed();
@@ -474,11 +502,8 @@
       myMirrorFileElement = null;
       myPackageStatement = packageStatement;
     }
-  }
 
-  @Override
-  public PsiFile cacheCopy(final FileContent content) {
-    return this;
+    myLanguageLevel = null;
   }
 
   @Override
@@ -525,7 +550,8 @@
 
     try {
       PsiJavaFileStubImpl stub = new PsiJavaFileStubImpl("do.not.know.yet", true);
-      StubBuildingVisitor<VirtualFile> visitor = new StubBuildingVisitor<VirtualFile>(file, STRATEGY, stub, 0, file.getNameWithoutExtension());
+      String className = file.getNameWithoutExtension();
+      StubBuildingVisitor<VirtualFile> visitor = new StubBuildingVisitor<VirtualFile>(file, STRATEGY, stub, 0, className);
       try {
         new ClassReader(bytes).accept(visitor, ClassReader.SKIP_FRAMES);
       }
@@ -554,15 +580,13 @@
       return dir.findChild(baseName + "$" + innerName + ".class");
     }
 
-    @Nullable
     @Override
-    public ClassReader readerForInnerClass(VirtualFile innerClass) {
+    public void accept(VirtualFile innerClass, StubBuildingVisitor<VirtualFile> visitor) {
       try {
-        return new ClassReader(innerClass.contentsToByteArray());
+        byte[] bytes = innerClass.contentsToByteArray();
+        new ClassReader(bytes).accept(visitor, ClassReader.SKIP_FRAMES);
       }
-      catch (IOException e) {
-        return null;
-      }
+      catch (IOException ignored) { }
     }
   };
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java
index 534b4c7..7b44a49 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaCodeReferenceElementImpl.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.
@@ -95,14 +95,14 @@
     @Override
     public JavaResolveResult[] resolve(@NotNull ClsJavaCodeReferenceElementImpl ref, boolean incompleteCode) {
       final JavaResolveResult resolveResult = ref.advancedResolveImpl();
-      return resolveResult.getElement() == null ? JavaResolveResult.EMPTY_ARRAY : new JavaResolveResult[] {resolveResult};
+      return resolveResult == null ? JavaResolveResult.EMPTY_ARRAY : new JavaResolveResult[] {resolveResult};
     }
   }
 
   private JavaResolveResult advancedResolveImpl() {
     PsiTypeElement[] typeElements = myRefParameterList == null ? PsiTypeElement.EMPTY_ARRAY : myRefParameterList.getTypeParameterElements();
     PsiElement resolve = resolveElement();
-
+    if (resolve == null) return null;
     if (resolve instanceof PsiClass) {
       Map<PsiTypeParameter, PsiType> substitutionMap = new HashMap<PsiTypeParameter, PsiType>();
       int index = 0;
@@ -129,7 +129,7 @@
         }
         index++;
       }
-      collectOuterClassTypeArgs(((PsiClass)resolve), myCanonicalText, substitutionMap);
+      collectOuterClassTypeArgs((PsiClass)resolve, myCanonicalText, substitutionMap);
       return new CandidateInfo(resolve, PsiSubstitutorImpl.createSubstitutor(substitutionMap));
     }
     else {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
index cce87f3..13da952 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsParameterImpl.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.
@@ -64,6 +64,7 @@
   @Override
   public String getName() {
     String name = myName;
+
     if (name == null) {
       if (DumbService.getInstance(getProject()).isDumb()) {
         return null;
@@ -73,16 +74,19 @@
       PsiMethod sourceMethod = method.getSourceMirrorMethod();
       if (sourceMethod != null) {
         assert sourceMethod != method : method;
-        myName = name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
+        name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
       }
 
       if (name == null) {
         PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
-        if (!parameterStub.isAutoGeneratedName()) {
-          name = parameterStub.getName();
-        }
+        name = !parameterStub.isAutoGeneratedName() ? parameterStub.getName() : getMirrorName();
+      }
+
+      if (name != null) {
+        myName = name;
       }
     }
+
     return name;
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java
index 9d4e388..cc90673 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsTypeElementImpl.java
@@ -18,6 +18,7 @@
 import com.intellij.openapi.util.AtomicNotNullLazyValue;
 import com.intellij.openapi.util.AtomicNullableLazyValue;
 import com.intellij.openapi.util.NotNullLazyValue;
+import com.intellij.openapi.util.NullableLazyValue;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiImplUtil;
 import com.intellij.psi.impl.PsiJavaParserFacadeImpl;
@@ -39,7 +40,7 @@
   private final PsiElement myParent;
   private final String myTypeText;
   private final char myVariance;
-  private final AtomicNullableLazyValue<ClsElementImpl> myChild;
+  private final NullableLazyValue<ClsElementImpl> myChild;
   private final NotNullLazyValue<PsiType> myCachedType;
 
   public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/InnerClassSourceStrategy.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/InnerClassSourceStrategy.java
index 9362699..a686088 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/InnerClassSourceStrategy.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/InnerClassSourceStrategy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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,19 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-/*
- * @author max
- */
 package com.intellij.psi.impl.compiled;
 
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.asm4.ClassReader;
 
+/**
+ * @author max
+ */
 public interface InnerClassSourceStrategy<T> {
   @Nullable
   T findInnerClass(String name, T outerClass);
 
-  @Nullable
-  ClassReader readerForInnerClass(T innerClass);
+  void accept(T innerClass, StubBuildingVisitor<T> visitor);
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
index 3878101..041e51d 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.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.
@@ -31,13 +31,12 @@
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
-import org.jetbrains.asm4.*;
+import org.jetbrains.org.objectweb.asm.*;
 
 import java.lang.reflect.Array;
 import java.text.CharacterIterator;
 import java.text.StringCharacterIterator;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.regex.Pattern;
 
@@ -57,6 +56,8 @@
   public static final String FLOAT_NEGATIVE_INF = "-1.0f / 0.0";
   public static final String FLOAT_NAN = "0.0f / 0.0";
 
+  private static final int ASM_API = Opcodes.ASM5;
+
   @NonNls private static final String SYNTHETIC_CLASS_INIT_METHOD = "<clinit>";
   @NonNls private static final String SYNTHETIC_INIT_METHOD = "<init>";
 
@@ -69,7 +70,7 @@
   private PsiModifierListStub myModList;
 
   public StubBuildingVisitor(T classSource, InnerClassSourceStrategy<T> innersStrategy, StubElement parent, int access, String shortName) {
-    super(Opcodes.ASM4);
+    super(ASM_API);
     mySource = classSource;
     myInnersStrategy = innersStrategy;
     myParent = parent;
@@ -206,6 +207,9 @@
       case Opcodes.V1_7:
         return LanguageLevel.JDK_1_7;
 
+      case Opcodes.V1_8:
+        return LanguageLevel.JDK_1_8;
+
       default:
         return LanguageLevel.HIGHEST;
     }
@@ -319,14 +323,11 @@
       return;
     }
 
-    final T innerSource = myInnersStrategy.findInnerClass(innerName, mySource);
-    if (innerSource == null) return;
-
-    final ClassReader reader = myInnersStrategy.readerForInnerClass(innerSource);
-    if (reader == null) return;
-
-    final StubBuildingVisitor<T> classVisitor = new StubBuildingVisitor<T>(innerSource, myInnersStrategy, myResult, access, innerName);
-    reader.accept(classVisitor, ClassReader.SKIP_FRAMES);
+    T innerClass = myInnersStrategy.findInnerClass(innerName, mySource);
+    if (innerClass != null) {
+      StubBuildingVisitor<T> visitor = new StubBuildingVisitor<T>(innerClass, myInnersStrategy, myResult, access, innerName);
+      myInnersStrategy.accept(innerClass, visitor);
+    }
   }
 
   private static boolean isCorrectName(String name) {
@@ -387,7 +388,7 @@
     if (dim > 0) {
       type = type.getElementType();
     }
-    return new TypeInfo(getTypeText(type), (byte)dim, false, Collections.<PsiAnnotationStub>emptyList()); //todo read annos from .class file
+    return new TypeInfo(getTypeText(type), (byte)dim, false, PsiAnnotationStub.EMPTY_ARRAY); //todo read annos from .class file
   }
 
   private static final String[] parameterNames = {"p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"};
@@ -544,7 +545,7 @@
     private final String myDesc;
 
     public AnnotationTextCollector(@Nullable String desc, AnnotationResultCallback callback) {
-      super(Opcodes.ASM4);
+      super(ASM_API);
       myCallback = callback;
 
       myDesc = desc;
@@ -616,7 +617,7 @@
     private final PsiModifierListStub myModList;
 
     private AnnotationCollectingVisitor(final PsiModifierListStub modList) {
-      super(Opcodes.ASM4);
+      super(ASM_API);
       myModList = modList;
     }
 
@@ -647,7 +648,7 @@
                                              final int paramIgnoreCount,
                                              final int paramCount,
                                              final PsiParameterStubImpl[] paramStubs) {
-      super(Opcodes.ASM4);
+      super(ASM_API);
       myOwner = owner;
       myModList = modList;
       myIgnoreCount = ignoreCount;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
index 56cb356..c188c3a 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/file/PsiPackageImpl.java
@@ -178,8 +178,11 @@
 
   @NotNull
   private PsiClass[] getCachedClassesByName(String name) {
-    SoftReference<Map<String, PsiClass[]>> ref = myClassCache;
-    Map<String, PsiClass[]> map = SoftReference.dereference(ref);
+    if (DumbService.getInstance(getProject()).isDumb()) {
+      return getCachedClassInDumbMode(name);
+    }
+
+    Map<String, PsiClass[]> map = SoftReference.dereference(myClassCache);
     if (map == null) {
       myClassCache = new SoftReference<Map<String, PsiClass[]>>(map = new ConcurrentSoftValueHashMap<String, PsiClass[]>());
     }
@@ -187,29 +190,30 @@
     if (classes != null) {
       return classes;
     }
-    
-    GlobalSearchScope scope = new EverythingGlobalScope(getProject());
 
-    if (DumbService.getInstance(getProject()).isDumb()) {
-      if (ref == null) {
-        for (PsiClass psiClass : getClasses(scope)) {
-          String psiClassName = psiClass.getName();
-          if (psiClassName != null) {
-            PsiClass[] existing = map.get(psiClassName);
-            map.put(psiClassName, existing == null ? new PsiClass[]{psiClass} : ArrayUtil.append(existing, psiClass));
-          }
-        }
-      }
-      classes = map.get(name);
-      return classes == null ? PsiClass.EMPTY_ARRAY : classes;
-    }
-    
     final String qName = getQualifiedName();
     final String classQName = !qName.isEmpty() ? qName + "." + name : name;
-    map.put(name, classes = getFacade().findClasses(classQName, scope));
+    map.put(name, classes = getFacade().findClasses(classQName, new EverythingGlobalScope(getProject())));
     return classes;
   }
-  
+
+  private PsiClass[] getCachedClassInDumbMode(String name) {
+    Map<String, PsiClass[]> map = SoftReference.dereference(myClassCache);
+    if (map == null) {
+      map = new HashMap<String, PsiClass[]>();
+      for (PsiClass psiClass : getClasses(new EverythingGlobalScope(getProject()))) {
+        String psiClassName = psiClass.getName();
+        if (psiClassName != null) {
+          PsiClass[] existing = map.get(psiClassName);
+          map.put(psiClassName, existing == null ? new PsiClass[]{psiClass} : ArrayUtil.append(existing, psiClass));
+        }
+      }
+      myClassCache = new SoftReference<Map<String, PsiClass[]>>(map);
+    }
+    PsiClass[] classes = map.get(name);
+    return classes == null ? PsiClass.EMPTY_ARRAY : classes;
+  }
+
   @Override
   public boolean containsClassNamed(String name) {
     return getCachedClassesByName(name).length > 0;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaMethodElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaMethodElementType.java
index dc35c3b..368d8b3 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaMethodElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/JavaMethodElementType.java
@@ -146,5 +146,16 @@
         sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
       }
     }
+
+    for (StubElement stubElement : stub.getChildrenStubs()) {
+      if (stubElement instanceof PsiParameterListStub) {
+        for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
+          if (paramStub instanceof PsiParameterStub) {
+            sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, ((PsiParameterStub)paramStub).getType(false).getShortTypeText());
+          }
+        }
+        break;
+      }
+    }
   }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/PsiAnnotationStub.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/PsiAnnotationStub.java
index 424ff04..27e3f0b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/PsiAnnotationStub.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/PsiAnnotationStub.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.
@@ -22,6 +22,8 @@
  * @author max
  */
 public interface PsiAnnotationStub extends StubElement<PsiAnnotation> {
+  PsiAnnotationStub[] EMPTY_ARRAY = new PsiAnnotationStub[0];
+
   String getText();
 
   PsiAnnotation getPsiElement();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStubIndexKeys.java b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStubIndexKeys.java
index 04b476b..a3e247f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStubIndexKeys.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/java/stubs/index/JavaStubIndexKeys.java
@@ -28,8 +28,9 @@
   public static final StubIndexKey<String, PsiMethod> METHODS = StubIndexKey.createIndexKey("java.method.name");
   public static final StubIndexKey<String, PsiMember> JVM_STATIC_MEMBERS_NAMES = StubIndexKey.createIndexKey("jvm.static.member.name");
   public static final StubIndexKey<String, PsiMember> JVM_STATIC_MEMBERS_TYPES = StubIndexKey.createIndexKey("jvm.static.member.type");
-  public static final StubIndexKey<String,PsiAnonymousClass> ANONYMOUS_BASEREF = StubIndexKey.createIndexKey("java.anonymous.baseref");
-  public static final StubIndexKey<String,PsiClass> CLASS_SHORT_NAMES = StubIndexKey.createIndexKey("java.class.shortname");
+  public static final StubIndexKey<String, PsiAnonymousClass> ANONYMOUS_BASEREF = StubIndexKey.createIndexKey("java.anonymous.baseref");
+  public static final StubIndexKey<String, PsiMethod> METHOD_TYPES = StubIndexKey.createIndexKey("java.method.parameter.types");
+  public static final StubIndexKey<String, PsiClass> CLASS_SHORT_NAMES = StubIndexKey.createIndexKey("java.class.shortname");
   public static final StubIndexKey<Integer,PsiClass> CLASS_FQN = StubIndexKey.createIndexKey("java.class.fqn");
 
   private JavaStubIndexKeys() {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightMemberReference.java b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightMemberReference.java
index bc90ac1..0f5d8f5 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightMemberReference.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightMemberReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -24,12 +24,12 @@
 import org.jetbrains.annotations.NotNull;
 
 public class LightMemberReference extends LightElement implements PsiJavaCodeReferenceElement {
-  private final PsiMember myRefMember;
+  @NotNull private final PsiMember myRefMember;
   private final PsiSubstitutor mySubstitutor;
 
   private LightReferenceParameterList myParameterList;
 
-  public LightMemberReference(PsiManager manager, PsiMember refClass, PsiSubstitutor substitutor) {
+  public LightMemberReference(PsiManager manager, @NotNull PsiMember refClass, PsiSubstitutor substitutor) {
     super(manager, JavaLanguage.INSTANCE);
     myRefMember = refClass;
 
@@ -37,6 +37,7 @@
   }
 
   @Override
+  @NotNull
   public PsiElement resolve() {
       return myRefMember;
   }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPackageReference.java b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPackageReference.java
index 7aa6aaa..56916f6 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPackageReference.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/light/LightPackageReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -52,7 +52,8 @@
   @Override
   @NotNull
   public JavaResolveResult advancedResolve(boolean incompleteCode){
-    return new CandidateInfo(resolve(), PsiSubstitutor.EMPTY);
+    PsiElement resolve = resolve();
+    return resolve == null ? JavaResolveResult.EMPTY : new CandidateInfo(resolve, PsiSubstitutor.EMPTY);
   }
 
   @Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java
index d08934a..88f0ce8 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/ClassInnerStuffCache.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,7 +15,7 @@
  */
 package com.intellij.psi.impl.source;
 
-import com.intellij.openapi.util.ModificationTracker;
+import com.intellij.openapi.util.SimpleModificationTracker;
 import com.intellij.psi.ExternallyDefinedPsiElement;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiField;
@@ -38,7 +38,7 @@
 
 public class ClassInnerStuffCache {
   private final PsiExtensibleClass myClass;
-  private final MyModificationTracker myTreeChangeTracker;
+  private final SimpleModificationTracker myTreeChangeTracker;
 
   private CachedValue<PsiMethod[]> myConstructorsCache;
   private CachedValue<PsiField[]> myFieldsCache;
@@ -50,7 +50,7 @@
 
   public ClassInnerStuffCache(final PsiExtensibleClass aClass) {
     myClass = aClass;
-    myTreeChangeTracker = new MyModificationTracker();
+    myTreeChangeTracker = new SimpleModificationTracker();
   }
 
   @NotNull
@@ -261,14 +261,7 @@
   }
 
   public void dropCaches() {
-    myTreeChangeTracker.myCount++;
+    myTreeChangeTracker.incModificationCount();
   }
 
-  private static class MyModificationTracker implements ModificationTracker {
-    private long myCount = 0;
-    @Override
-    public long getModificationCount() {
-      return myCount;
-    }
-  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
index d7ba848..f66f419 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiClassImpl.java
@@ -500,13 +500,15 @@
           final NameHint nameHint = processor.getHint(NameHint.KEY);
           final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
           String nameToSearch = nameHint == null ? null : nameHint.getName(state);
-          if (VALUES_METHOD.equals(nameToSearch) &&
+          if ((nameToSearch == null || VALUES_METHOD.equals(nameToSearch)) &&
               (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD))) {
-            if (!processor.execute(getValuesMethod(), ResolveState.initial())) return false;
+            PsiMethod method = getValuesMethod();
+            if (method != null && !processor.execute(method, ResolveState.initial())) return false;
           }
-          if (VALUE_OF_METHOD.equals(nameToSearch) &&
+          if ((nameToSearch == null || VALUE_OF_METHOD.equals(nameToSearch)) &&
               (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD))) {
-            if (!processor.execute(getValueOfMethod(), ResolveState.initial())) return false;
+            PsiMethod method = getValueOfMethod();
+            if (method != null && !processor.execute(method, ResolveState.initial())) return false;
           }
         }
         catch (IncorrectOperationException e) {
@@ -679,9 +681,8 @@
   @Nullable
   public PsiQualifiedNamedElement getContainer() {
     final PsiFile file = getContainingFile();
-    final PsiDirectory dir;
-    return file == null ? null : (dir = file.getContainingDirectory()) == null
-                                 ? null : JavaDirectoryService.getInstance().getPackage(dir);
+    final PsiDirectory dir = file.getContainingDirectory();
+    return dir == null ? null : JavaDirectoryService.getInstance().getPackage(dir);
   }
 
   @Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
index dd88a17..cbe3e2b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.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.
@@ -242,7 +242,7 @@
     }
 
     @Override
-    public void handleEvent(final Event event, final Object associated) {
+    public void handleEvent(@NotNull final Event event, final Object associated) {
       if (JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT.equals(event) && associated instanceof PsiImportStaticStatement) {
         final PsiImportStaticStatement importStaticStatement = (PsiImportStaticStatement)associated;
         myIsProcessingOnDemand = importStaticStatement.isOnDemand();
@@ -254,7 +254,7 @@
     }
 
     @Override
-    public boolean execute(@NotNull final PsiElement element, final ResolveState state) {
+    public boolean execute(@NotNull final PsiElement element, @NotNull final ResolveState state) {
       if (element instanceof PsiModifierListOwner && ((PsiModifierListOwner)element).hasModifierProperty(PsiModifier.STATIC)) {
         if (element instanceof PsiNamedElement && myIsProcessingOnDemand) {
           final String name = ((PsiNamedElement)element).getName();
@@ -290,7 +290,7 @@
     return processDeclarationsNoGuess(processor, state, lastParent, place);
   }
 
-  private boolean processDeclarationsNoGuess(PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place) {
+  private boolean processDeclarationsNoGuess(PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, PsiElement place) {
     processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
     final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
     final NameHint nameHint = processor.getHint(NameHint.KEY);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
index ae08b6d..e77e7ad 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
@@ -99,7 +99,7 @@
         if (parameterIndex < parameters.length) {
           final PsiType psiType = LambdaUtil.getSubstitutor(method, resolveResult).substitute(parameters[parameterIndex].getType());
           if (!LambdaUtil.dependsOnTypeParams(psiType, conjunct, lambdaExpression)) {
-            return GenericsUtil.eliminateWildcards(psiType);
+            return GenericsUtil.eliminateWildcards(psiType, false);
           }
         }
       }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java
index b0eb406..b109372 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.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.
@@ -83,7 +83,7 @@
   }
 
   @Override
-  public String getName(ResolveState state) {
+  public String getName(@NotNull ResolveState state) {
     return myClassName;
   }
 
@@ -93,7 +93,7 @@
   }
 
   @Override
-  public void handleEvent(PsiScopeProcessor.Event event, Object associated) {
+  public void handleEvent(@NotNull PsiScopeProcessor.Event event, Object associated) {
     if (event == JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT) {
       myCurrentFileContext = (PsiElement)associated;
     }
@@ -207,7 +207,7 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     if (!(element instanceof PsiClass)) return true;
     final PsiClass aClass = (PsiClass)element;
     final String name = aClass.getName();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java
index 2fbfc60..67b06a0 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiOldInferenceHelper.java
@@ -512,7 +512,11 @@
                                                                                     PsiType patternType,
                                                                                     final ConstraintType constraintType,
                                                                                     final int depth) {
-    if (arg instanceof PsiCapturedWildcardType && (depth < 2 || constraintType != ConstraintType.EQUALS)) arg = ((PsiCapturedWildcardType)arg).getWildcard(); //reopen
+    if (arg instanceof PsiCapturedWildcardType && (depth < 2 || 
+                                                   constraintType != ConstraintType.EQUALS || 
+                                                   param instanceof PsiWildcardType)) {
+      arg = ((PsiCapturedWildcardType)arg).getWildcard(); //reopen
+    }
 
     if (patternType.equals(param)) {
       return processArgType(arg, constraintType, depth < 2);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java
index 840d1b4..59c8d7f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/PsiResolveHelperImpl.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.
@@ -101,7 +101,7 @@
   }
 
   @Nullable
-  private PsiVariable resolveVar(final String referenceText, final PsiElement context, final boolean[] problemWithAccess) {
+  private PsiVariable resolveVar(@NotNull String referenceText, final PsiElement context, final boolean[] problemWithAccess) {
     final PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(myManager.getProject()).getParserFacade();
     try {
       final PsiJavaCodeReferenceElement ref = parserFacade.createReferenceFromText(referenceText, context);
@@ -127,11 +127,18 @@
     return JavaResolveUtil.isAccessible(member, containingClass, modifierList, place, accessObjectClass, currentFileResolveScope);
   }
 
-  @Override
   @NotNull
-  public CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression expr, boolean dummyImplicitConstructor) {
+  @Override
+  public CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression expr,
+                                                       boolean dummyImplicitConstructor,
+                                                       final boolean checkVarargs) {
     PsiFile containingFile = expr.getContainingFile();
-    final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(expr, containingFile);
+    final MethodCandidatesProcessor processor = new MethodCandidatesProcessor(expr, containingFile) {
+      @Override
+      protected boolean acceptVarargs() {
+        return checkVarargs;
+      }
+    };
     try {
       PsiScopesUtil.setupAndRunProcessor(processor, expr, dummyImplicitConstructor);
     }
@@ -141,6 +148,12 @@
     return processor.getCandidates();
   }
 
+  @NotNull
+  @Override
+  public CandidateInfo[] getReferencedMethodCandidates(@NotNull PsiCallExpression call, boolean dummyImplicitConstructor) {
+    return getReferencedMethodCandidates(call, dummyImplicitConstructor, false);
+  }
+
   @Override
   public PsiType inferTypeForMethodTypeParameter(@NotNull PsiTypeParameter typeParameter,
                                                  @NotNull PsiParameter[] parameters,
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/StaticImportResolveProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/StaticImportResolveProcessor.java
index 3359699..374ad46 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/StaticImportResolveProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/StaticImportResolveProcessor.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.
@@ -33,13 +33,13 @@
   private final List<JavaResolveResult> myClassResult = new SmartList<JavaResolveResult>();
   private final List<JavaResolveResult> myResults = new SmartList<JavaResolveResult>();
 
-  public StaticImportResolveProcessor(final PsiImportStaticReferenceElement reference) {
+  public StaticImportResolveProcessor(@NotNull PsiImportStaticReferenceElement reference) {
     myReference = reference;
     myName = myReference.getReferenceName();
   }
 
   @Override
-  public boolean execute(@NotNull final PsiElement candidate, final ResolveState state) {
+  public boolean execute(@NotNull final PsiElement candidate, @NotNull final ResolveState state) {
     if (candidate instanceof PsiMember && ((PsiModifierListOwner)candidate).hasModifierProperty(PsiModifier.STATIC)) {
       if (candidate instanceof PsiField) {
         if (checkDomination((PsiMember)candidate, myFieldResults)) return true;
@@ -86,7 +86,7 @@
   }
 
   @Override
-  public String getName(final ResolveState state) {
+  public String getName(@NotNull final ResolveState state) {
     return myName;
   }
 
@@ -124,7 +124,7 @@
   private static class OurResolveResult extends CandidateInfo {
     private final PsiImportStaticReferenceElement myReference;
 
-    public OurResolveResult(final PsiElement candidate, final PsiImportStaticReferenceElement reference) {
+    public OurResolveResult(@NotNull PsiElement candidate, final PsiImportStaticReferenceElement reference) {
       super(candidate, PsiSubstitutor.EMPTY);
       myReference = reference;
     }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java
index c65b6e6..b283b39 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/SymbolCollectingProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -43,14 +43,14 @@
   }
 
   @Override
-  public void handleEvent(PsiScopeProcessor.Event event, Object associated) {
+  public void handleEvent(@NotNull PsiScopeProcessor.Event event, Object associated) {
     if (event == JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT) {
       myCurrentFileContext = (PsiElement)associated;
     }
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     if (element instanceof PsiNamedElement) {
       PsiNamedElement named = (PsiNamedElement)element;
       String name = named.getName();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java
index f72ee4f..ead814a 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/VariableResolverProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -69,7 +69,7 @@
   }
 
   @Override
-  public final void handleEvent(PsiScopeProcessor.Event event, Object associated) {
+  public final void handleEvent(@NotNull PsiScopeProcessor.Event event, Object associated) {
     super.handleEvent(event, associated);
     if(event == JavaScopeProcessorEvent.START_STATIC){
       myStaticScopeFlag = true;
@@ -80,7 +80,7 @@
   }
 
   @Override
-  public void add(PsiElement element, PsiSubstitutor substitutor) {
+  public void add(@NotNull PsiElement element, @NotNull PsiSubstitutor substitutor) {
     final boolean staticProblem = myStaticScopeFlag && !((PsiModifierListOwner)element).hasModifierProperty(PsiModifier.STATIC);
     add(new CandidateInfo(element, substitutor, myPlace, myAccessClass, staticProblem, myCurrentFileContext));
   }
@@ -92,7 +92,7 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     if (!(element instanceof PsiField) && (myName == null || PsiUtil.checkName(element, myName, myPlace))) {
       super.execute(element, state);
       return myResults.isEmpty();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
index b8abab6..3614624 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
@@ -46,6 +46,7 @@
 
   private final Map<PsiTypeParameter, InferenceVariable> myInferenceVariables = new LinkedHashMap<PsiTypeParameter, InferenceVariable>();
   private final List<ConstraintFormula> myConstraints = new ArrayList<ConstraintFormula>();
+  private final Set<ConstraintFormula> myConstraintsCopy = new HashSet<ConstraintFormula>();
 
   private PsiSubstitutor mySiteSubstitutor;
   private PsiManager myManager;
@@ -56,6 +57,8 @@
   private final InferenceIncorporationPhase myIncorporationPhase = new InferenceIncorporationPhase(this);
 
   private final PsiElement myContext;
+  
+  private final PsiTypeParameter[] myParamsToInfer;
 
   public InferenceSession(PsiTypeParameter[] typeParams,
                           PsiType[] leftTypes, 
@@ -68,6 +71,7 @@
     myContext = context;
 
     initBounds(typeParams);
+    myParamsToInfer = typeParams;
 
     LOG.assertTrue(leftTypes.length == rightTypes.length);
     for (int i = 0; i < leftTypes.length; i++) {
@@ -87,6 +91,11 @@
     myContext = context;
 
     initBounds(typeParams);
+    myParamsToInfer = typeParams;
+  }
+
+  public PsiTypeParameter[] getParamsToInfer() {
+    return myParamsToInfer;
   }
 
   public void initExpressionConstraints(PsiParameter[] parameters, PsiExpression[] args, PsiElement parent, PsiMethod method) {
@@ -217,7 +226,7 @@
       if (parameters != null && args != null) {
         final Set<ConstraintFormula> additionalConstraints = new HashSet<ConstraintFormula>();
         if (parameters.length > 0) {
-          collectAdditionalConstraints(parameters, args, properties.getMethod(), PsiSubstitutor.EMPTY, additionalConstraints, properties.isVarargs());
+          collectAdditionalConstraints(parameters, args, properties.getMethod(), PsiSubstitutor.EMPTY, additionalConstraints, properties.isVarargs(), true);
         }
 
         if (!additionalConstraints.isEmpty() && !proceedWithAdditionalConstraints(additionalConstraints)) {
@@ -245,12 +254,12 @@
     return prepareSubstitution();
   }
 
-  private static void collectAdditionalConstraints(PsiParameter[] parameters,
-                                                   PsiExpression[] args,
-                                                   PsiMethod parentMethod,
-                                                   PsiSubstitutor siteSubstitutor,
-                                                   Set<ConstraintFormula> additionalConstraints,
-                                                   boolean varargs) {
+  private void collectAdditionalConstraints(PsiParameter[] parameters,
+                                            PsiExpression[] args,
+                                            PsiMethod parentMethod,
+                                            PsiSubstitutor siteSubstitutor,
+                                            Set<ConstraintFormula> additionalConstraints,
+                                            boolean varargs, boolean toplevel) {
     for (int i = 0; i < args.length; i++) {
       if (args[i] != null) {
         PsiType parameterType = getParameterType(parameters, i, siteSubstitutor, varargs);
@@ -262,17 +271,15 @@
           //If the expression is a poly class instance creation expression (15.9) or a poly method invocation expression (15.12), 
           //the set contains all constraint formulas that would appear in the set C when determining the poly expression's invocation type.
           final PsiCallExpression callExpression = (PsiCallExpression)args[i];
-          final PsiExpressionList argumentList = callExpression.getArgumentList();
-          if (argumentList != null) {
-            final JavaResolveResult result = callExpression.resolveMethodGenerics();
-            if (result instanceof MethodCandidateInfo) {
-              final PsiMethod method = ((MethodCandidateInfo)result).getElement();
-              LOG.assertTrue(method != null);
-              final PsiExpression[] newArgs = argumentList.getExpressions();
-              final PsiParameter[] newParams = method.getParameterList().getParameters();
-              if (newParams.length > 0) {
-                collectAdditionalConstraints(newParams, newArgs, method, ((MethodCandidateInfo)result).getSiteSubstitutor(), 
-                                             additionalConstraints, ((MethodCandidateInfo)result).isVarargs());
+          collectAdditionalConstraints(additionalConstraints, callExpression);
+        } else if (args[i] instanceof PsiLambdaExpression && toplevel) {
+          final PsiType interfaceReturnType = LambdaUtil.getFunctionalInterfaceReturnType(parameterType);
+          if (interfaceReturnType != null) {
+            final List<PsiExpression> returnExpressions = LambdaUtil.getReturnExpressions((PsiLambdaExpression)args[i]);
+            for (PsiExpression returnExpression : returnExpressions) {
+              if (returnExpression instanceof PsiCallExpression) {
+                final PsiCallExpression callExpression = (PsiCallExpression)returnExpression;
+                collectAdditionalConstraints(additionalConstraints, callExpression);
               }
             }
           }
@@ -281,6 +288,25 @@
     }
   }
 
+  private void collectAdditionalConstraints(Set<ConstraintFormula> additionalConstraints,
+                                            PsiCallExpression callExpression) {
+    PsiExpressionList argumentList = callExpression.getArgumentList();
+    if (argumentList != null) {
+      final JavaResolveResult result = callExpression.resolveMethodGenerics();
+      if (result instanceof MethodCandidateInfo) {
+        final PsiMethod method = ((MethodCandidateInfo)result).getElement();
+        //need to get type parameters for 2 level nested expressions (they won't be covered by expression constraints on this level?!) 
+        initBounds(method.getTypeParameters());
+        final PsiExpression[] newArgs = argumentList.getExpressions();
+        final PsiParameter[] newParams = method.getParameterList().getParameters();
+        if (newParams.length > 0) {
+          collectAdditionalConstraints(newParams, newArgs, method, ((MethodCandidateInfo)result).getSiteSubstitutor(), 
+                                       additionalConstraints, ((MethodCandidateInfo)result).isVarargs(), false);
+        }
+      }
+    }
+  }
+
   public PsiSubstitutor retrieveNonPrimitiveEqualsBounds(Collection<InferenceVariable> variables) {
     PsiSubstitutor substitutor = mySiteSubstitutor;
     for (InferenceVariable variable : variables) {
@@ -346,10 +372,7 @@
     if (PsiPolyExpressionUtil.isMethodCallPolyExpression(context, method)) {
       PsiType returnType = method.getReturnType();
       if (!PsiType.VOID.equals(returnType) && returnType != null) {
-        PsiType targetType = PsiTypesUtil.getExpectedTypeByParent(context);
-        if (targetType == null) {
-          targetType = getTargetType(context);
-        }
+        PsiType targetType = getTargetType(context);
         if (targetType != null) {
           registerConstraints(PsiUtil.isRawSubstitutor(method, mySiteSubstitutor) ? returnType : mySiteSubstitutor.substitute(returnType), targetType);
         }
@@ -368,7 +391,10 @@
     final InferenceVariable inferenceVariable = shouldResolveAndInstantiate(returnType, targetType);
     if (inferenceVariable != null) {
       final PsiSubstitutor substitutor = resolveSubset(Collections.singletonList(inferenceVariable), mySiteSubstitutor);
-      myConstraints.add(new TypeCompatibilityConstraint(targetType, PsiUtil.captureToplevelWildcards(substitutor.substitute(inferenceVariable.getParameter()), myContext)));
+      final PsiType substitutedReturnType = substitutor.substitute(inferenceVariable.getParameter());
+      if (substitutedReturnType != null) {
+        myConstraints.add(new TypeCompatibilityConstraint(targetType, PsiUtil.captureToplevelWildcards(substitutedReturnType, myContext)));
+      }
     } 
     else {
       if (FunctionalInterfaceParameterizationUtil.isWildcardParameterized(returnType)) {
@@ -465,7 +491,11 @@
     return false;
   }
   
-  private static PsiType getTargetType(final PsiExpression context) {
+  public static PsiType getTargetType(final PsiExpression context) {
+    PsiType targetType = PsiTypesUtil.getExpectedTypeByParent(context);
+    if (targetType != null) {
+      return targetType;
+    }
     final PsiElement parent = PsiUtil.skipParenthesizedExprUp(context.getParent());
     if (parent instanceof PsiExpressionList) {
       PsiElement gParent = parent.getParent();
@@ -495,11 +525,7 @@
         }
       }
     } else if (parent instanceof PsiConditionalExpression) {
-      PsiType targetType = PsiTypesUtil.getExpectedTypeByParent((PsiExpression)parent);
-      if (targetType == null) {
-        targetType = getTargetType((PsiExpression)parent);
-      }
-      return targetType;
+      return getTargetType((PsiExpression)parent);
     }
     else if (parent instanceof PsiLambdaExpression) {
       if (PsiUtil.skipParenthesizedExprUp(parent.getParent()) instanceof PsiExpressionList) {
@@ -594,13 +620,7 @@
         //inference error occurred
         return false;
       }
-    } while (myConstraintIdx < myConstraints.size()); 
 
-    do {
-      if (!reduceConstraints()) {
-        //inference error occurred
-        return false;
-      }
       if (incorporate) {
         if (!myIncorporationPhase.incorporate()) {
           return false;
@@ -709,7 +729,8 @@
         substitutor = substitutor.put(typeParameter, runtimeException);
       } 
       else {
-        substitutor = substitutor.put(typeParameter, getUpperBound(var, substitutor));
+        if (substitutor.getSubstitutionMap().get(typeParameter) != null) continue;
+        substitutor = substitutor.put(typeParameter, myErased ? null : getUpperBound(var, substitutor));
       }
     }
 
@@ -778,7 +799,7 @@
   }
 
   public void addConstraint(ConstraintFormula constraint) {
-    if (!myConstraints.contains(constraint)) {
+    if (myConstraintsCopy.add(constraint)) {
         myConstraints.add(constraint);
       }
   }
@@ -788,6 +809,25 @@
   }
 
   private boolean proceedWithAdditionalConstraints(Set<ConstraintFormula> additionalConstraints) {
+    final Set<InferenceVariable> mentionedVars = new HashSet<InferenceVariable>();
+    for (ConstraintFormula constraint : additionalConstraints) {
+      if (constraint instanceof InputOutputConstraintFormula) {
+        final Set<InferenceVariable> inputVariables = ((InputOutputConstraintFormula)constraint).getInputVariables(this);
+        if (inputVariables != null) {
+          mentionedVars.addAll(inputVariables);
+        }
+        final Set<InferenceVariable> outputVariables = ((InputOutputConstraintFormula)constraint).getOutputVariables(inputVariables, this);
+        if (outputVariables != null) {
+          mentionedVars.addAll(outputVariables);
+        }
+      }
+    }
+
+    final Set<InferenceVariable> readyVariables = new LinkedHashSet<InferenceVariable>(myInferenceVariables.values());
+    readyVariables.removeAll(mentionedVars);
+
+    final PsiSubstitutor siteSubstitutor = resolveBounds(readyVariables, mySiteSubstitutor);
+
     while (!additionalConstraints.isEmpty()) {
       //extract subset of constraints
       final Set<ConstraintFormula> subset = buildSubset(additionalConstraints);
@@ -804,8 +844,7 @@
       }
 
       //resolve input variables
-      PsiSubstitutor substitutor = resolveSubset(varsToResolve, mySiteSubstitutor);
-
+      PsiSubstitutor substitutor = resolveSubset(varsToResolve, retrieveNonPrimitiveEqualsBounds(getInferenceVariables()).putAll(siteSubstitutor));
       if (substitutor == null) {
         return false;
       }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
index bb8db38..13497e3 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceVariable.java
@@ -65,22 +65,31 @@
 
   public Set<InferenceVariable> getDependencies(InferenceSession session) {
     final Set<InferenceVariable> dependencies = new LinkedHashSet<InferenceVariable>();
-    for (InferenceBound inferenceBound : InferenceBound.values()) {
-      for (PsiType bound : getBounds(inferenceBound)) {
-        session.collectDependencies(bound, dependencies);
+    for (List<PsiType> boundTypes : myBounds.values()) {
+      if (boundTypes != null) {
+        for (PsiType bound : boundTypes) {
+          session.collectDependencies(bound, dependencies);
+        }
       }
     }
 
     next:
     for (InferenceVariable variable : session.getInferenceVariables()) {
       if (!dependencies.contains(variable) && variable != this) {
-        for (InferenceBound inferenceBound : InferenceBound.values()) {
-          for (PsiType bound : getBounds(inferenceBound)) {
-            Set<InferenceVariable> deps = new HashSet<InferenceVariable>();
-            session.collectDependencies(bound, deps);
-            if (deps.contains(this)) {
-              dependencies.add(variable);
-              continue next;
+        nextBound:
+        for (List<PsiType> bounds : myBounds.values()) { //todo
+          if (bounds != null) {
+            for (PsiType bound : bounds) {
+              final Set<InferenceVariable> deps = new HashSet<InferenceVariable>();
+              session.collectDependencies(bound, deps);
+              if (deps.isEmpty()) {
+                continue nextBound;
+              }
+
+              if (deps.contains(this)) {
+                dependencies.add(variable);
+                continue next;
+              }
             }
           }
         }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java
index 86c0dbc..1481238 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java
@@ -16,6 +16,7 @@
 package com.intellij.psi.impl.source.resolve.graphInference;
 
 import com.intellij.psi.*;
+import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
 import org.jetbrains.annotations.Nullable;
@@ -58,7 +59,8 @@
         }
       }
     } else if (expression instanceof PsiMethodCallExpression) {
-      return isMethodCallPolyExpression(expression, ((PsiMethodCallExpression)expression).resolveMethod());
+      final MethodCandidateInfo.CurrentCandidateProperties candidateProperties = MethodCandidateInfo.getCurrentMethod(((PsiMethodCallExpression)expression).getArgumentList());
+      return isMethodCallPolyExpression(expression, candidateProperties != null ? candidateProperties.getMethod() : ((PsiMethodCallExpression)expression).resolveMethod());
     }
     else if (expression instanceof PsiConditionalExpression) {
       final ConditionalKind conditionalKind = isBooleanOrNumeric(expression);
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/ExpressionCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/ExpressionCompatibilityConstraint.java
index ff462ce..6fa5fb4 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/ExpressionCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/ExpressionCompatibilityConstraint.java
@@ -23,6 +23,7 @@
 import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.containers.ContainerUtil;
 import com.intellij.util.containers.HashSet;
 import org.jetbrains.annotations.NotNull;
 
@@ -80,8 +81,9 @@
     if (myExpression instanceof PsiCallExpression) {
       final PsiExpressionList argumentList = ((PsiCallExpression)myExpression).getArgumentList();
       if (argumentList != null) {
-        final JavaResolveResult resolveResult = ((PsiCallExpression)myExpression).resolveMethodGenerics();
-        final PsiMethod method = (PsiMethod)resolveResult.getElement();
+        final MethodCandidateInfo.CurrentCandidateProperties candidateProperties = MethodCandidateInfo.getCurrentMethod(((PsiCallExpression)myExpression).getArgumentList());
+        final JavaResolveResult resolveResult = candidateProperties != null ? null : ((PsiCallExpression)myExpression).resolveMethodGenerics();
+        final PsiMethod method = candidateProperties != null ? candidateProperties.getMethod() : (PsiMethod)resolveResult.getElement();
         PsiType returnType = null;
         PsiTypeParameter[] typeParams = null;
         if (method != null && !method.isConstructor()) {
@@ -102,7 +104,7 @@
 
         if (typeParams != null) {
 
-          final HashSet<PsiTypeParameter> oldBounds = new HashSet<PsiTypeParameter>(session.getTypeParams());
+          final Set<PsiTypeParameter> oldBounds = ContainerUtil.newHashSet(session.getParamsToInfer());
           final boolean sameMethodCall = session.initBounds(typeParams);
           PsiSubstitutor substitutor = PsiSubstitutor.EMPTY;
           final HashSet<InferenceVariable> variables = new HashSet<InferenceVariable>();
@@ -117,8 +119,15 @@
               params[i] = typeParams[i];
             }
           }
-          final PsiSubstitutor siteSubstitutor = resolveResult instanceof MethodCandidateInfo && method != null && !method.isConstructor() 
-                                                 ? ((MethodCandidateInfo)resolveResult).getSiteSubstitutor() : PsiSubstitutor.EMPTY;
+          PsiSubstitutor siteSubstitutor = PsiSubstitutor.EMPTY;
+          if (method != null && !method.isConstructor()) {
+            if (resolveResult instanceof MethodCandidateInfo) {
+              siteSubstitutor = ((MethodCandidateInfo)resolveResult).getSiteSubstitutor();
+            }
+            else if (candidateProperties != null) {
+              siteSubstitutor = candidateProperties.getSubstitutor();
+            }
+          }
           for (PsiTypeParameter typeParameter : siteSubstitutor.getSubstitutionMap().keySet()) {
             substitutor = substitutor.put(typeParameter, substitutor.substitute(siteSubstitutor.substitute(typeParameter)));
           }
@@ -129,11 +138,12 @@
           if (method != null) {
             final PsiExpression[] args = argumentList.getExpressions();
             final PsiParameter[] parameters = method.getParameterList().getParameters();
-            callSession.initExpressionConstraints(parameters, args, myExpression, method, resolveResult instanceof MethodCandidateInfo && ((MethodCandidateInfo)resolveResult).isVarargs());
+            callSession.initExpressionConstraints(parameters, args, myExpression, method, resolveResult instanceof MethodCandidateInfo && ((MethodCandidateInfo)resolveResult).isVarargs() || 
+                                                                                          candidateProperties != null && candidateProperties.isVarargs());
           }
           final boolean accepted = callSession.repeatInferencePhases(true);
           if (!accepted) {
-            //todo return false;
+            return false;
           }
           callSession.registerConstraints(method != null && !PsiUtil.isRawSubstitutor(method, siteSubstitutor) ? siteSubstitutor.substitute(returnType) : returnType, substitutor.substitute(returnType));
           if (callSession.repeatInferencePhases(true)) {
@@ -147,6 +157,8 @@
               }
             }
             session.liftBounds(inferenceVariables);
+          } else {
+            return false;
           }
           final PsiType capturedReturnType = myExpression instanceof PsiMethodCallExpression
                                              ? PsiMethodCallExpressionImpl.captureReturnType((PsiMethodCallExpression)myExpression, method, returnType, substitutor)
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/InputOutputConstraintFormula.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/InputOutputConstraintFormula.java
index fbd04e5..6ff1709 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/InputOutputConstraintFormula.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/InputOutputConstraintFormula.java
@@ -115,4 +115,9 @@
     }
     map.put(getExpression(), getT());
   }
+
+  @Override
+  public String toString() {
+    return getExpression().getText() + " -> " + getT().getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/LambdaExpressionCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/LambdaExpressionCompatibilityConstraint.java
index 12e7bfe..8de976b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/LambdaExpressionCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/LambdaExpressionCompatibilityConstraint.java
@@ -77,4 +77,9 @@
   public void apply(PsiSubstitutor substitutor) {
     myT = substitutor.substitute(myT);
   }
+
+  @Override
+  public String toString() {
+    return myExpression.getText() + " -> " + myT.getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java
index 391eafe..6e56328 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java
@@ -17,7 +17,6 @@
 
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.psi.*;
-import com.intellij.psi.impl.PsiImplUtil;
 import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
 import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
@@ -25,9 +24,9 @@
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.containers.ContainerUtil;
-import com.intellij.util.containers.HashMap;
 
-import java.util.*;
+import java.util.List;
+import java.util.Map;
 
 /**
  * User: anna
@@ -58,10 +57,7 @@
     final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, classResolveResult);
     final PsiParameter[] targetParameters = interfaceMethod.getParameterList().getParameters();
     final PsiType interfaceMethodReturnType = interfaceMethod.getReturnType();
-    PsiType returnType = substitutor.substitute(interfaceMethodReturnType);
-    if (myExpression.getTypeParameters().length == 0 && returnType != null) {
-      returnType = PsiImplUtil.normalizeWildcardTypeByPosition(returnType, myExpression);
-    }
+    final PsiType returnType = substitutor.substitute(interfaceMethodReturnType);
     final PsiType[] typeParameters = myExpression.getTypeParameters();
     if (!myExpression.isExact()) {
       for (PsiParameter parameter : targetParameters) {
@@ -113,11 +109,7 @@
       return true;
     }
 
-    Map<PsiMethodReferenceExpression, PsiType> map = PsiMethodReferenceUtil.ourRefs.get();
-    if (map == null) {
-      map = new HashMap<PsiMethodReferenceExpression, PsiType>();
-      PsiMethodReferenceUtil.ourRefs.set(map);
-    }
+    final Map<PsiMethodReferenceExpression, PsiType> map = PsiMethodReferenceUtil.getFunctionalTypeMap();
     final PsiType added = map.put(myExpression, groundTargetType);
     final PsiElement resolve;
     try {
@@ -156,12 +148,18 @@
         session.initBounds(containingClass.getTypeParameters());
       }
 
+      //if i) the method reference elides NonWildTypeArguments, 
+      //  ii) the compile-time declaration is a generic method, and 
+      // iii) the return type of the compile-time declaration mentions at least one of the method's type parameters;
       if (typeParameters.length == 0 && method.getTypeParameters().length > 0) {
         final PsiClass interfaceClass = classResolveResult.getElement();
         LOG.assertTrue(interfaceClass != null);
         if (PsiPolyExpressionUtil.mentionsTypeParameters(referencedMethodReturnType,
                                                          ContainerUtil.newHashSet(method.getTypeParameters()))) {
-          constraints.add(new TypeCompatibilityConstraint(referencedMethodReturnType, returnType));
+          //the constraint reduces to the bound set B3 which would be used to determine the method reference's invocation type 
+          //when targeting the return type of the function type, as defined in 18.5.2.
+          //as there is no parameters, only constraint for return types is left. Here you are:
+          session.registerConstraints(referencedMethodReturnType, returnType);
           return true;
         }
       }
@@ -198,6 +196,10 @@
     PsiType qualifierType;
     if (qualifierTypeElement != null) {
       qualifierType = qualifierTypeElement.getType();
+      final PsiClass qualifierClass = PsiUtil.resolveClassInType(qualifierType);
+      if (qualifierClass != null) {
+        qualifierType = JavaPsiFacade.getElementFactory(myExpression.getProject()).createType(qualifierClass, PsiSubstitutor.EMPTY);
+      }
     }
     else {
       LOG.assertTrue(qualifierExpression != null);
@@ -225,4 +227,9 @@
   public void apply(PsiSubstitutor substitutor) {
     myT = substitutor.substitute(myT);
   }
+
+  @Override
+  public String toString() {
+    return myExpression.getText() + " -> " + myT.getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java
index db193dd..92745cb 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/StrictSubtypingConstraint.java
@@ -141,4 +141,9 @@
     result = 31 * result + (myT != null ? myT.hashCode() : 0);
     return result;
   }
+
+  @Override
+  public String toString() {
+    return myS.getPresentableText() + " < " + myT.getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/SubtypingConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/SubtypingConstraint.java
index 8b7b7fb..e539e94 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/SubtypingConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/SubtypingConstraint.java
@@ -66,11 +66,15 @@
   @Override
   public boolean reduce(InferenceSession session, List<ConstraintFormula> constraints) {
     if (myT instanceof PsiWildcardType) {
-      final PsiType tBound = ((PsiWildcardType)myT).getBound();
+      PsiType tBound = ((PsiWildcardType)myT).getBound();
       if (tBound == null) {
         return true;
       }
 
+      if (tBound instanceof PsiCapturedWildcardType) {
+        tBound = ((PsiWildcardType)myT).isExtends() ? ((PsiCapturedWildcardType)tBound).getUpperBound() 
+                                                    : ((PsiCapturedWildcardType)tBound).getLowerBound();
+      }
       if (myS instanceof PsiCapturedWildcardType) {
         myS = ((PsiCapturedWildcardType)myS).getWildcard();
       }
@@ -124,4 +128,9 @@
       }
     }
   }
+
+  @Override
+  public String toString() {
+    return myS.getPresentableText() + " <= " + myT.getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java
index d94aa94..4038f9a 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeCompatibilityConstraint.java
@@ -108,4 +108,9 @@
     result = 31 * result + myS.hashCode();
     return result;
   }
+
+  @Override
+  public String toString() {
+    return myS.getPresentableText() + " -> " + myT.getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
index cbb1db8..1f4717d 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/TypeEqualityConstraint.java
@@ -145,4 +145,9 @@
     result = 31 * result + (myS != null ? myS.hashCode() : 0);
     return result;
   }
+
+  @Override
+  public String toString() {
+    return myT.getPresentableText() + " == " + myS.getPresentableText();
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaDocElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaDocElementType.java
index 847d7f3..b046de9 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaDocElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaDocElementType.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.
@@ -33,22 +33,24 @@
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import sun.reflect.ConstructorAccessor;
 
 import java.lang.reflect.Constructor;
 
 public interface JavaDocElementType {
   class JavaDocCompositeElementType extends IJavaDocElementType implements ICompositeElementType {
-    private final Constructor<? extends ASTNode> myConstructor;
+    private final ConstructorAccessor myConstructor;
 
     private JavaDocCompositeElementType(@NonNls final String debugName, final Class<? extends ASTNode> nodeClass) {
       super(debugName);
-      myConstructor = ReflectionUtil.getDefaultConstructor(nodeClass);
+      Constructor<? extends ASTNode> constructor = ReflectionUtil.getDefaultConstructor(nodeClass);
+      myConstructor = ReflectionUtil.getConstructorAccessor(constructor);
     }
 
     @NotNull
     @Override
     public ASTNode createCompositeNode() {
-      return ReflectionUtil.createInstance(myConstructor);
+      return ReflectionUtil.createInstanceViaConstructorAccessor(myConstructor);
     }
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java
index 14bc9b4..4fbbad2 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JavaElementType.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.
@@ -35,12 +35,13 @@
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
+import sun.reflect.ConstructorAccessor;
 
 import java.lang.reflect.Constructor;
 
 public interface JavaElementType {
   class JavaCompositeElementType extends IJavaElementType implements ICompositeElementType {
-    private final Constructor<? extends ASTNode> myConstructor;
+    private final ConstructorAccessor myConstructor;
 
     private JavaCompositeElementType(@NonNls final String debugName, final Class<? extends ASTNode> nodeClass) {
       this(debugName, nodeClass, false);
@@ -48,13 +49,14 @@
 
     private JavaCompositeElementType(@NonNls final String debugName, final Class<? extends ASTNode> nodeClass, final boolean leftBound) {
       super(debugName, leftBound);
-      myConstructor = ReflectionUtil.getDefaultConstructor(nodeClass);
+      Constructor<? extends ASTNode> constructor = ReflectionUtil.getDefaultConstructor(nodeClass);
+      myConstructor = ReflectionUtil.getConstructorAccessor(constructor);
     }
 
     @NotNull
     @Override
     public ASTNode createCompositeNode() {
-      return ReflectionUtil.createInstance(myConstructor);
+      return ReflectionUtil.createInstanceViaConstructorAccessor(myConstructor);
     }
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java
new file mode 100644
index 0000000..cf25710
--- /dev/null
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java
@@ -0,0 +1,404 @@
+/*
+ * 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.psi.impl.source.tree.java;
+
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy;
+import com.intellij.psi.impl.source.resolve.ResolveCache;
+import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
+import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
+import com.intellij.psi.impl.source.resolve.graphInference.constraints.TypeCompatibilityConstraint;
+import com.intellij.psi.infos.CandidateInfo;
+import com.intellij.psi.infos.ClassCandidateInfo;
+import com.intellij.psi.infos.MethodCandidateInfo;
+import com.intellij.psi.scope.JavaScopeProcessorEvent;
+import com.intellij.psi.scope.PsiConflictResolver;
+import com.intellij.psi.scope.conflictResolvers.JavaMethodsConflictResolver;
+import com.intellij.psi.scope.processor.MethodCandidatesProcessor;
+import com.intellij.psi.util.MethodSignature;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.SmartList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+class MethodReferenceResolver implements ResolveCache.PolyVariantResolver<PsiMethodReferenceExpression> {
+  private static final Logger LOG = Logger.getInstance("#" + MethodReferenceResolver.class.getName());
+
+  @NotNull
+  @Override
+  public ResolveResult[] resolve(@NotNull final PsiMethodReferenceExpression reference, boolean incompleteCode) {
+    final PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult = PsiMethodReferenceUtil.getQualifierResolveResult(
+      reference);
+
+    final PsiClass containingClass = qualifierResolveResult.getContainingClass();
+    PsiSubstitutor substitutor = qualifierResolveResult.getSubstitutor();
+
+    if (containingClass != null) {
+      final PsiElement element = reference.getReferenceNameElement();
+      final boolean isConstructor = reference.isConstructor();
+      if (element instanceof PsiIdentifier || isConstructor) {
+        if (isConstructor && (containingClass.isEnum() || containingClass.hasModifierProperty(PsiModifier.ABSTRACT))) {
+          return JavaResolveResult.EMPTY_ARRAY;
+        }
+        final PsiType functionalInterfaceType = getInterfaceType(reference);
+        final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
+        final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
+        final PsiSubstitutor functionalInterfaceSubstitutor = interfaceMethod != null ? LambdaUtil.getSubstitutor(interfaceMethod, resolveResult) : null;
+        final MethodSignature signature = interfaceMethod != null ? interfaceMethod.getSignature(functionalInterfaceSubstitutor) : null;
+        final PsiType interfaceMethodReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
+        if (isConstructor && containingClass.getConstructors().length == 0) {
+          if (interfaceMethod != null) {
+            final PsiClassType returnType = composeReturnType(containingClass, substitutor);
+            final InferenceSession session = new InferenceSession(containingClass.getTypeParameters(), substitutor, reference.getManager(), null);
+            if (!(session.isProperType(returnType) && session.isProperType(interfaceMethodReturnType))) {
+              session.registerConstraints(returnType, interfaceMethodReturnType);
+              substitutor = session.infer();
+            }
+          }
+          ClassCandidateInfo candidateInfo = null;
+          final boolean isArray = containingClass == JavaPsiFacade.getElementFactory(reference.getProject()).getArrayClass(PsiUtil.getLanguageLevel(containingClass));
+          if (signature == null ||
+              !isArray && (containingClass.getContainingClass() == null || !isLocatedInStaticContext(containingClass, reference)) && signature.getParameterTypes().length == 0 ||
+              isArray && arrayCreationSignature(signature)) {
+            candidateInfo = new ClassCandidateInfo(containingClass, substitutor);
+          }
+          return candidateInfo == null ? JavaResolveResult.EMPTY_ARRAY : new JavaResolveResult[]{candidateInfo};
+        }
+
+        final PsiConflictResolver conflictResolver = createResolver(reference, qualifierResolveResult, interfaceMethod, signature);
+        final MethodCandidatesProcessor processor =
+          new MethodCandidatesProcessor(reference, reference.getContainingFile(), new PsiConflictResolver[] {conflictResolver}, new SmartList<CandidateInfo>()) {
+            @Override
+            protected boolean acceptVarargs() {
+              return true;
+            }
+
+            @Override
+            protected MethodCandidateInfo createCandidateInfo(@NotNull final PsiMethod method,
+                                                              @NotNull final PsiSubstitutor substitutor,
+                                                              final boolean staticProblem,
+                                                              final boolean accessible, 
+                                                              final boolean varargs) {
+              final PsiExpressionList argumentList = getArgumentList();
+              final PsiType[] typeParameters = reference.getTypeParameters();
+              return new MethodCandidateInfo(method, substitutor, !accessible, staticProblem, argumentList, myCurrentFileContext,
+                                             argumentList != null ? argumentList.getExpressionTypes() : null, typeParameters.length > 0 ? typeParameters : null,
+                                             getLanguageLevel()) {
+                @Override
+                public boolean isVarargs() {
+                  return varargs;
+                }
+
+                @NotNull
+                @Override
+                public PsiSubstitutor inferTypeArguments(@NotNull ParameterTypeInferencePolicy policy, boolean includeReturnConstraint) {
+                  return inferTypeArguments(varargs);
+                }
+
+                public PsiSubstitutor inferTypeArguments(boolean varargs) {
+                  if (interfaceMethod == null) return substitutor;
+                  final PsiSubstitutor qualifierResultSubstitutor = qualifierResolveResult.getSubstitutor();
+                  final InferenceSession session = new InferenceSession(method.getTypeParameters(), substitutor, reference.getManager(), reference);
+
+                  //lift parameters from outer call
+                  final CurrentCandidateProperties methodSubstitutorPair = MethodCandidateInfo.getCurrentMethod(reference.getParent());
+                  if (methodSubstitutorPair != null) {
+                    session.initBounds(methodSubstitutorPair.getMethod().getTypeParameters());
+                  }
+
+                  final PsiParameter[] functionalMethodParameters = interfaceMethod.getParameterList().getParameters();
+                  final PsiParameter[] parameters = method.getParameterList().getParameters();
+                  final boolean isStatic = method.hasModifierProperty(PsiModifier.STATIC);
+                  if (parameters.length == functionalMethodParameters.length && !varargs || isStatic && varargs) {//static methods
+
+                    if (method.isConstructor() && PsiUtil.isRawSubstitutor(containingClass, qualifierResultSubstitutor)) {
+                      session.initBounds(containingClass.getTypeParameters());
+                    }
+
+                    for (int i = 0; i < functionalMethodParameters.length; i++) {
+                      final PsiType pType = signature.getParameterTypes()[i];
+                      session.addConstraint(new TypeCompatibilityConstraint(getParameterType(parameters, i, varargs), pType));
+                    }
+                  }
+                  else if (parameters.length + 1 == functionalMethodParameters.length && !varargs || !isStatic && varargs && functionalMethodParameters.length > 0) { //instance methods
+                    final PsiClass aClass = qualifierResolveResult.getContainingClass();
+                    session.initBounds(aClass.getTypeParameters());
+
+                    final PsiType pType = signature.getParameterTypes()[0];
+
+                    PsiSubstitutor psiSubstitutor = qualifierResultSubstitutor;
+                    // 15.28.1 If the ReferenceType is a raw type, and there exists a parameterization of this type, T, that is a supertype of P1,
+                    // the type to search is the result of capture conversion (5.1.10) applied to T; 
+                    // otherwise, the type to search is the same as the type of the first search. Again, the type arguments, if any, are given by the method reference.
+                    if (PsiUtil.isRawSubstitutor(containingClass, qualifierResultSubstitutor)) {
+                      final PsiClassType.ClassResolveResult pResult = PsiUtil.resolveGenericsClassInType(pType);
+                      final PsiClass pClass = pResult.getElement();
+                      final PsiSubstitutor receiverSubstitutor = pClass != null ? TypeConversionUtil
+                        .getClassSubstitutor(containingClass, pClass, pResult.getSubstitutor()) : null;
+                      if (receiverSubstitutor != null) {
+                        if (!method.hasTypeParameters() && signature.getParameterTypes().length == 1) return receiverSubstitutor;
+                        psiSubstitutor = receiverSubstitutor;
+                      }
+                    }
+
+                    final PsiType qType = JavaPsiFacade.getElementFactory(reference.getProject()).createType(containingClass, psiSubstitutor);
+
+                    session.addConstraint(new TypeCompatibilityConstraint(qType, pType));
+                    
+                    for (int i = 0; i < signature.getParameterTypes().length - 1; i++) {
+                      final PsiType interfaceParamType = signature.getParameterTypes()[i + 1];
+                      session.addConstraint(new TypeCompatibilityConstraint(getParameterType(parameters, i, varargs), interfaceParamType));
+                    }
+                  }
+
+                  if (!session.repeatInferencePhases(false)) {
+                    return substitutor;
+                  }
+
+                  if (interfaceMethodReturnType != PsiType.VOID) {
+                    final PsiType returnType = method.isConstructor() ? composeReturnType(containingClass, substitutor) : method.getReturnType();
+                    if (returnType != null) {
+                      session.registerConstraints(returnType, interfaceMethodReturnType);
+                    }
+                  }
+                  return session.infer(parameters, null, null);
+                }
+
+                private PsiType getParameterType(PsiParameter[] parameters, int i, boolean varargs) {
+                  if (varargs && i >= parameters.length - 1) {
+                    final PsiType type = parameters[parameters.length - 1].getType();
+                    LOG.assertTrue(type instanceof PsiEllipsisType);
+                    return ((PsiEllipsisType)type).getComponentType();
+                  }
+                  return parameters[i].getType();
+                }
+              };
+            }
+        };
+        processor.setIsConstructor(isConstructor);
+        processor.setName(isConstructor ? containingClass.getName() : element.getText());
+        final PsiExpression expression = reference.getQualifierExpression();
+        if (expression == null || !(expression.getType() instanceof PsiArrayType)) {
+          processor.setAccessClass(containingClass);
+        }
+
+        if (qualifierResolveResult.isReferenceTypeQualified() && isLocatedInStaticContext(containingClass, reference)) {
+           processor.handleEvent(JavaScopeProcessorEvent.START_STATIC, null);
+        }
+        ResolveState state = ResolveState.initial().put(PsiSubstitutor.KEY, substitutor);
+        containingClass.processDeclarations(processor, state, reference, reference);
+        return processor.getResult();
+      }
+    }
+    return JavaResolveResult.EMPTY_ARRAY;
+  }
+
+  private static boolean isLocatedInStaticContext(PsiClass containingClass, PsiMethodReferenceExpression reference) {
+    final PsiClass gContainingClass = containingClass.getContainingClass();
+    if (gContainingClass == null || !containingClass.hasModifierProperty(PsiModifier.STATIC)) {
+      PsiClass aClass = null;
+      if (PsiTreeUtil.isAncestor(gContainingClass != null ? gContainingClass : containingClass, reference, false)) {
+        aClass = gContainingClass != null ? gContainingClass : containingClass;
+      }
+      if (PsiUtil.getEnclosingStaticElement(reference, aClass) != null) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  protected PsiType getInterfaceType(PsiMethodReferenceExpression reference) {
+    PsiType functionalInterfaceType = null;
+    final Map<PsiMethodReferenceExpression,PsiType> map = PsiMethodReferenceUtil.ourRefs.get();
+    if (map != null) {
+      functionalInterfaceType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(map.get(reference));
+    }
+
+    if (functionalInterfaceType == null) {
+      functionalInterfaceType = reference.getFunctionalInterfaceType();
+    }
+
+    return functionalInterfaceType;
+  }
+
+  protected PsiConflictResolver createResolver(PsiMethodReferenceExpression referenceExpression,
+                                               PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
+                                               PsiMethod interfaceMethod,
+                                               MethodSignature signature) {
+    return new MethodReferenceConflictResolver(referenceExpression, qualifierResolveResult, signature,
+                                               interfaceMethod != null && interfaceMethod.isVarArgs());
+  }
+
+  private static PsiClassType composeReturnType(PsiClass containingClass, PsiSubstitutor substitutor) {
+    final boolean isRawSubst = PsiUtil.isRawSubstitutor(containingClass, substitutor);
+    return JavaPsiFacade.getElementFactory(containingClass.getProject())
+      .createType(containingClass, isRawSubst ? PsiSubstitutor.EMPTY : substitutor);
+  }
+
+  private static class MethodReferenceConflictResolver extends JavaMethodsConflictResolver {
+    private final MethodSignature mySignature;
+    private PsiMethodReferenceExpression myReferenceExpression;
+    private final PsiMethodReferenceUtil.QualifierResolveResult myQualifierResolveResult;
+    private final boolean myFunctionalMethodVarArgs;
+
+    private MethodReferenceConflictResolver(PsiMethodReferenceExpression referenceExpression, 
+                                            PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
+                                            @Nullable MethodSignature signature, boolean varArgs) {
+      super(referenceExpression, signature != null ? signature.getParameterTypes() : PsiType.EMPTY_ARRAY, PsiUtil.getLanguageLevel(referenceExpression));
+      myReferenceExpression = referenceExpression;
+      myQualifierResolveResult = qualifierResolveResult;
+      myFunctionalMethodVarArgs = varArgs;
+      mySignature = signature;
+    }
+
+    @Override
+    protected int getPertinentApplicabilityLevel(MethodCandidateInfo conflict) {
+      return conflict.isVarargs() ? MethodCandidateInfo.ApplicabilityLevel.VARARGS : MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY;
+    }
+
+    @Nullable
+    @Override
+    public CandidateInfo resolveConflict(@NotNull List<CandidateInfo> conflicts) {
+      if (mySignature == null) return null;
+
+      checkSameSignatures(conflicts);
+      checkAccessStaticLevels(conflicts, true);
+
+      final PsiType[] parameterTypes = mySignature.getParameterTypes();
+      boolean hasReceiver = PsiMethodReferenceUtil.hasReceiver(parameterTypes, myQualifierResolveResult, myReferenceExpression);
+
+      final List<CandidateInfo> firstCandidates = new ArrayList<CandidateInfo>();
+      final List<CandidateInfo> secondCandidates = new ArrayList<CandidateInfo>();
+
+      for (CandidateInfo conflict : conflicts) {
+        if (!(conflict instanceof MethodCandidateInfo)) continue;
+        final PsiMethod psiMethod = ((MethodCandidateInfo)conflict).getElement();
+
+        final PsiSubstitutor substitutor = conflict.getSubstitutor();
+        final PsiType[] signatureParameterTypes2 = psiMethod.getSignature(substitutor).getParameterTypes();
+
+        final boolean varargs = ((MethodCandidateInfo)conflict).isVarargs();
+        if (varargs && (!psiMethod.isVarArgs() || myFunctionalMethodVarArgs)) continue;
+
+        if ((varargs || parameterTypes.length == signatureParameterTypes2.length) &&
+            PsiMethodReferenceUtil.isCorrectAssignment(signatureParameterTypes2, parameterTypes, substitutor, varargs, 0)) {
+          firstCandidates.add(conflict);
+        }
+
+        if (hasReceiver &&
+            (varargs || parameterTypes.length == signatureParameterTypes2.length + 1) &&
+            PsiMethodReferenceUtil.isCorrectAssignment(signatureParameterTypes2, parameterTypes, substitutor, varargs, 1)) {
+          secondCandidates.add(conflict);
+        }
+      }
+
+      if (myQualifierResolveResult.isReferenceTypeQualified() && myReferenceExpression.getReferenceNameElement() instanceof PsiIdentifier) {
+        //If the first search produces a static method, and no non-static method is applicable for the second search, then the result of the first search is the compile-time declaration.
+        CandidateInfo candidateInfo = filterStaticCorrectCandidates(firstCandidates, secondCandidates, true);
+        if (candidateInfo != null) {
+          return candidateInfo;
+        }
+
+        //If the second search produces a non-static method, and no static method is applicable for the first search, then the result of the second search is the compile-time declaration.
+        candidateInfo = filterStaticCorrectCandidates(secondCandidates, firstCandidates, false);
+        if (candidateInfo != null) {
+          return candidateInfo;
+        }
+      }
+
+      if (resolveConflicts(firstCandidates, secondCandidates, MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY)) {
+        return !firstCandidates.isEmpty() ? firstCandidates.get(0) : secondCandidates.get(0);
+      }
+
+      if (resolveConflicts(firstCandidates, secondCandidates, MethodCandidateInfo.ApplicabilityLevel.VARARGS)) {
+        return !firstCandidates.isEmpty() ? firstCandidates.get(0) : secondCandidates.get(0);
+      }
+
+      conflicts.clear();
+      firstCandidates.addAll(secondCandidates);
+      conflicts.addAll(firstCandidates);
+      return null;
+    }
+
+    private boolean resolveConflicts(List<CandidateInfo> firstCandidates, List<CandidateInfo> secondCandidates, int applicabilityLevel) {
+
+      checkApplicability(firstCandidates);
+      checkSpecifics(firstCandidates, applicabilityLevel, myLanguageLevel);
+
+      checkApplicability(secondCandidates);
+      checkSpecifics(secondCandidates, applicabilityLevel, myLanguageLevel);
+
+      return firstCandidates.size() + secondCandidates.size() == 1;
+    }
+
+    @Override
+    protected boolean nonComparable(CandidateInfo method, CandidateInfo conflict) {
+      if (method == conflict) return true;
+      PsiElement psiElement = method.getElement();
+      PsiElement conflictElement = conflict.getElement();
+      if (psiElement instanceof PsiMethod && conflictElement instanceof PsiMethod) {
+        if (((PsiMethod)psiElement).getParameterList().getParametersCount() !=
+            ((PsiMethod)conflictElement).getParameterList().getParametersCount()) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    /**
+     * 15.13.1
+     */
+    private static CandidateInfo filterStaticCorrectCandidates(List<CandidateInfo> firstCandidates,
+                                                               List<CandidateInfo> secondCandidates,
+                                                               boolean shouldBeStatic) {
+      if (firstCandidates.size() == 1) {
+        final CandidateInfo candidateInfo = firstCandidates.get(0);
+        final PsiElement element = candidateInfo.getElement();
+        if (element instanceof PsiMethod) {
+          final boolean isStatic = ((PsiMethod)element).hasModifierProperty(PsiModifier.STATIC);
+          if (shouldBeStatic && isStatic || !shouldBeStatic && !isStatic) {
+            for (CandidateInfo secondCandidate : secondCandidates) {
+              final PsiElement psiElement = secondCandidate.getElement();
+              if (psiElement instanceof PsiMethod) {
+                final boolean oppositeStatic = ((PsiMethod)psiElement).hasModifierProperty(PsiModifier.STATIC);
+                if (shouldBeStatic && !oppositeStatic || !shouldBeStatic && oppositeStatic) {
+                  return null;
+                }
+              }
+            }
+            return candidateInfo;
+          }
+        }
+      }
+      return null;
+    }
+  }
+
+  private static boolean arrayCreationSignature(MethodSignature signature) {
+    final PsiType[] parameterTypes = signature.getParameterTypes();
+    if (parameterTypes.length == 1 && parameterTypes[0] != null && TypeConversionUtil.isAssignable(PsiType.INT, parameterTypes[0])) {
+      return true;
+    }
+    return false;
+  }
+}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java
index b03e9a4..e530554 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -102,7 +102,7 @@
       final Ref<Boolean> conflict = new Ref<Boolean>(Boolean.FALSE);
       PsiScopesUtil.walkChildrenScopes(this, new BaseScopeProcessor() {
         @Override
-        public boolean execute(@NotNull PsiElement element, ResolveState state) {
+        public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
           if (element instanceof PsiLocalVariable) {
             final PsiLocalVariable variable = (PsiLocalVariable)element;
             final String name = variable.getName();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java
index 27012ff..36a9715 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java
@@ -18,9 +18,12 @@
 import com.intellij.lang.ASTNode;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.psi.*;
+import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
+import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil;
 import com.intellij.psi.impl.source.tree.ChildRole;
 import com.intellij.psi.impl.source.tree.ElementType;
 import com.intellij.psi.impl.source.tree.JavaElementType;
+import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.tree.ChildRoleBase;
 import com.intellij.psi.util.PsiUtil;
 import com.intellij.psi.util.TypeConversionUtil;
@@ -83,6 +86,14 @@
     if (TypeConversionUtil.isNullType(type1) && !(type2 instanceof PsiPrimitiveType)) return type2;
     if (TypeConversionUtil.isNullType(type2) && !(type1 instanceof PsiPrimitiveType)) return type1;
 
+    if (PsiUtil.isLanguageLevel8OrHigher(this) && 
+        PsiPolyExpressionUtil.isPolyExpression(this) && 
+        !MethodCandidateInfo.ourOverloadGuard.currentStack().contains(this.getParent())) {
+      //15.25.3 Reference Conditional Expressions 
+      // The type of a poly reference conditional expression is the same as its target type.
+      return InferenceSession.getTargetType(this);
+    }
+
     if (TypeConversionUtil.isAssignable(type1, type2, false)) return type1;
     if (TypeConversionUtil.isAssignable(type2, type1, false)) return type2;
     if (!PsiUtil.isLanguageLevel5OrHigher(this)) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java
index 7bdd013..069f667 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiLambdaExpressionImpl.java
@@ -15,6 +15,7 @@
  */
 package com.intellij.psi.impl.source.tree.java;
 
+import com.intellij.icons.AllIcons;
 import com.intellij.lang.ASTNode;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.JavaCodeStyleManager;
@@ -33,6 +34,8 @@
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
+import javax.swing.*;
+
 public class PsiLambdaExpressionImpl extends ExpressionPsiElement implements PsiLambdaExpression {
 
   public PsiLambdaExpressionImpl() {
@@ -218,4 +221,10 @@
     }
     return paramType;
   }
+
+  @Nullable
+  @Override
+  public Icon getIcon(int flags) {
+    return AllIcons.Nodes.AnonymousClass;
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
index f48fcb5..7a82b24 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.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.
@@ -15,44 +15,34 @@
  */
 package com.intellij.psi.impl.source.tree.java;
 
+import com.intellij.icons.AllIcons;
 import com.intellij.lang.ASTNode;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.psi.*;
 import com.intellij.psi.impl.PsiManagerEx;
-import com.intellij.psi.impl.source.resolve.ParameterTypeInferencePolicy;
 import com.intellij.psi.impl.source.resolve.ResolveCache;
 import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
 import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession;
-import com.intellij.psi.impl.source.resolve.graphInference.constraints.TypeCompatibilityConstraint;
 import com.intellij.psi.impl.source.tree.ChildRole;
 import com.intellij.psi.impl.source.tree.FileElement;
 import com.intellij.psi.impl.source.tree.JavaElementType;
 import com.intellij.psi.impl.source.tree.SharedImplUtil;
-import com.intellij.psi.infos.CandidateInfo;
-import com.intellij.psi.infos.ClassCandidateInfo;
 import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.scope.ElementClassFilter;
-import com.intellij.psi.scope.JavaScopeProcessorEvent;
 import com.intellij.psi.scope.PsiConflictResolver;
 import com.intellij.psi.scope.PsiScopeProcessor;
 import com.intellij.psi.scope.conflictResolvers.DuplicateConflictResolver;
-import com.intellij.psi.scope.conflictResolvers.JavaMethodsConflictResolver;
 import com.intellij.psi.scope.processor.FilterScopeProcessor;
-import com.intellij.psi.scope.processor.MethodCandidatesProcessor;
 import com.intellij.psi.scope.util.PsiScopesUtil;
 import com.intellij.psi.tree.IElementType;
 import com.intellij.psi.util.*;
-import com.intellij.util.Function;
 import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.SmartList;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import javax.swing.*;
 import java.util.Map;
 
 public class PsiMethodReferenceExpressionImpl extends PsiReferenceExpressionBase implements PsiMethodReferenceExpression {
@@ -62,25 +52,6 @@
     super(JavaElementType.METHOD_REF_EXPRESSION);
   }
 
-  private static boolean arrayCreationSignature(MethodSignature signature) {
-    if (arrayCompatibleSignature(signature.getParameterTypes(), new Function<PsiType[], PsiType>() {
-      @Override
-      public PsiType fun(PsiType[] types) {
-        return types[0];
-      }
-    })) {
-      return true;
-    }
-    return false;
-  }
-
-  public static <T> boolean arrayCompatibleSignature(T[] paramTypes, Function<T[], PsiType> fun) {
-    if (paramTypes.length == 1) {
-      final PsiType paramType = fun.fun(paramTypes);
-      if (paramType != null && TypeConversionUtil.isAssignable(PsiType.INT, paramType)) return true;
-    }
-    return false;
-  }
 
   @Override
   public PsiTypeElement getQualifierType() {
@@ -106,7 +77,8 @@
 
     final MethodReferenceResolver resolver = new MethodReferenceResolver() {
       @Override
-      protected PsiConflictResolver createResolver(PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
+      protected PsiConflictResolver createResolver(PsiMethodReferenceExpression referenceExpression,
+                                                   PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
                                                    PsiMethod interfaceMethod,
                                                    MethodSignature signature) {
         return DuplicateConflictResolver.INSTANCE;
@@ -163,7 +135,7 @@
     if (containingClass != null) {
       PsiMethod[] methods = null;
       if (element instanceof PsiIdentifier) {
-        methods = containingClass.findMethodsByName(element.getText(), true);
+        methods = containingClass.findMethodsByName(element.getText(), !qualifierResolveResult.isReferenceTypeQualified());
       }
       else if (isConstructor()) {
         final PsiElementFactory factory = JavaPsiFacade.getElementFactory(getProject());
@@ -390,371 +362,6 @@
     return "PsiMethodReferenceExpression:" + getText();
   }
 
-  private boolean isLocatedInStaticContext(PsiClass containingClass) {
-    final PsiClass gContainingClass = containingClass.getContainingClass();
-    if (gContainingClass == null || !containingClass.hasModifierProperty(PsiModifier.STATIC)) {
-      PsiClass aClass = null;
-      if (PsiTreeUtil.isAncestor(gContainingClass != null ? gContainingClass : containingClass, this, false)) {
-        aClass = gContainingClass != null ? gContainingClass : containingClass;
-      }
-      if (PsiUtil.getEnclosingStaticElement(this, aClass) != null) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  private class MethodReferenceResolver implements ResolveCache.PolyVariantResolver<PsiMethodReferenceExpression> {
-    @NotNull
-    @Override
-    public ResolveResult[] resolve(@NotNull final PsiMethodReferenceExpression reference, boolean incompleteCode) {
-      final PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult = PsiMethodReferenceUtil.getQualifierResolveResult(reference);
-
-      final PsiClass containingClass = qualifierResolveResult.getContainingClass();
-      PsiSubstitutor substitutor = qualifierResolveResult.getSubstitutor();
-
-      if (containingClass != null) {
-        final PsiElement element = getReferenceNameElement();
-        final boolean isConstructor = isConstructor();
-        if (element instanceof PsiIdentifier || isConstructor) {
-          if (isConstructor && (containingClass.isEnum() || containingClass.hasModifierProperty(PsiModifier.ABSTRACT))) {
-            return JavaResolveResult.EMPTY_ARRAY;
-          }
-          final PsiType functionalInterfaceType = getInterfaceType(reference);
-          final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
-          final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(resolveResult);
-          final PsiSubstitutor functionalInterfaceSubstitutor = interfaceMethod != null ? LambdaUtil.getSubstitutor(interfaceMethod, resolveResult) : null;
-          final MethodSignature signature = interfaceMethod != null ? interfaceMethod.getSignature(functionalInterfaceSubstitutor) : null;
-          final PsiType interfaceMethodReturnType = LambdaUtil.getFunctionalInterfaceReturnType(functionalInterfaceType);
-          if (isConstructor && interfaceMethod != null && containingClass.getConstructors().length == 0) {
-            final PsiClassType returnType = composeReturnType(containingClass, substitutor);
-            final InferenceSession session = new InferenceSession(containingClass.getTypeParameters(), substitutor, getManager(), null);
-            if (!(session.isProperType(returnType) && session.isProperType(interfaceMethodReturnType))) {
-              session.registerConstraints(returnType, interfaceMethodReturnType);
-              substitutor = session.infer();
-            }
-            ClassCandidateInfo candidateInfo = null;
-            final boolean isArray = containingClass == JavaPsiFacade.getElementFactory(getProject()).getArrayClass(PsiUtil.getLanguageLevel(containingClass));
-            if (!isArray && (containingClass.getContainingClass() == null || !isLocatedInStaticContext(containingClass)) && signature.getParameterTypes().length == 0 ||
-                isArray && arrayCreationSignature(signature)) {
-              candidateInfo = new ClassCandidateInfo(containingClass, substitutor);
-            }
-            return candidateInfo == null ? JavaResolveResult.EMPTY_ARRAY : new JavaResolveResult[]{candidateInfo};
-          }
-
-          final PsiConflictResolver conflictResolver = createResolver(qualifierResolveResult, interfaceMethod, signature);
-          final MethodCandidatesProcessor processor =
-            new MethodCandidatesProcessor(reference, getContainingFile(), new PsiConflictResolver[] {conflictResolver}, new SmartList<CandidateInfo>()) {
-              @Override
-              protected boolean acceptVarargs() {
-                return true;
-              }
-
-              @Override
-              protected MethodCandidateInfo createCandidateInfo(final PsiMethod method,
-                                                                final PsiSubstitutor substitutor,
-                                                                final boolean staticProblem,
-                                                                final boolean accessible, 
-                                                                final boolean varargs) {
-                final PsiExpressionList argumentList = getArgumentList();
-                final PsiType[] typeParameters = reference.getTypeParameters();
-                return new MethodCandidateInfo(method, substitutor, !accessible, staticProblem, argumentList, myCurrentFileContext,
-                                               argumentList != null ? argumentList.getExpressionTypes() : null, typeParameters.length > 0 ? typeParameters : null,
-                                               getLanguageLevel()) {
-                  @Override
-                  public boolean isVarargs() {
-                    return varargs;
-                  }
-
-                  @NotNull
-                  @Override
-                  public PsiSubstitutor inferTypeArguments(@NotNull ParameterTypeInferencePolicy policy, boolean includeReturnConstraint) {
-                    return inferTypeArguments(varargs);
-                  }
-
-                  public PsiSubstitutor inferTypeArguments(boolean varargs) {
-                    if (interfaceMethod == null) return substitutor;
-                    final PsiSubstitutor qualifierResultSubstitutor = qualifierResolveResult.getSubstitutor();
-                    final InferenceSession session = new InferenceSession(method.getTypeParameters(), substitutor, getManager(), reference);
-
-                    //lift parameters from outer call
-                    final CurrentCandidateProperties methodSubstitutorPair = MethodCandidateInfo.getCurrentMethod(reference.getParent());
-                    if (methodSubstitutorPair != null) {
-                      session.initBounds(methodSubstitutorPair.getMethod().getTypeParameters());
-                    }
-
-                    final PsiParameter[] functionalMethodParameters = interfaceMethod.getParameterList().getParameters();
-                    final PsiParameter[] parameters = method.getParameterList().getParameters();
-                    final boolean isStatic = method.hasModifierProperty(PsiModifier.STATIC);
-                    if (parameters.length == functionalMethodParameters.length && !varargs || isStatic && varargs) {//static methods
-
-                      if (method.isConstructor() && PsiUtil.isRawSubstitutor(containingClass, qualifierResultSubstitutor)) {
-                        session.initBounds(containingClass.getTypeParameters());
-                      }
-
-                      for (int i = 0; i < functionalMethodParameters.length; i++) {
-                        final PsiType pType = signature.getParameterTypes()[i];
-                        session.addConstraint(new TypeCompatibilityConstraint(getParameterType(parameters, i, varargs), pType));
-                      }
-                    }
-                    else if (parameters.length + 1 == functionalMethodParameters.length && !varargs || !isStatic && varargs && functionalMethodParameters.length > 0) { //instance methods
-                      final PsiClass aClass = qualifierResolveResult.getContainingClass();
-                      session.initBounds(aClass.getTypeParameters());
-
-                      final PsiType pType = signature.getParameterTypes()[0];
-
-                      PsiSubstitutor psiSubstitutor = qualifierResultSubstitutor;
-                      // 15.28.1 If the ReferenceType is a raw type, and there exists a parameterization of this type, T, that is a supertype of P1,
-                      // the type to search is the result of capture conversion (5.1.10) applied to T; 
-                      // otherwise, the type to search is the same as the type of the first search. Again, the type arguments, if any, are given by the method reference.
-                      if (PsiUtil.isRawSubstitutor(containingClass, qualifierResultSubstitutor)) {
-                        final PsiClassType.ClassResolveResult pResult = PsiUtil.resolveGenericsClassInType(pType);
-                        final PsiClass pClass = pResult.getElement();
-                        final PsiSubstitutor receiverSubstitutor = pClass != null ? TypeConversionUtil.getClassSubstitutor(containingClass, pClass, pResult.getSubstitutor()) : null;
-                        if (receiverSubstitutor != null) {
-                          if (!method.hasTypeParameters() && signature.getParameterTypes().length == 1) return receiverSubstitutor;
-                          psiSubstitutor = receiverSubstitutor;
-                        }
-                      }
-
-                      final PsiType qType = JavaPsiFacade.getElementFactory(getProject()).createType(containingClass, psiSubstitutor);
-
-                      session.addConstraint(new TypeCompatibilityConstraint(qType, pType));
-                      
-                      for (int i = 0; i < signature.getParameterTypes().length - 1; i++) {
-                        final PsiType interfaceParamType = signature.getParameterTypes()[i + 1];
-                        session.addConstraint(new TypeCompatibilityConstraint(getParameterType(parameters, i, varargs), interfaceParamType));
-                      }
-                    }
-
-                    if (!session.repeatInferencePhases(false)) {
-                      return substitutor;
-                    }
-
-                    if (interfaceMethodReturnType != PsiType.VOID) {
-                      final PsiType returnType = method.isConstructor() ? composeReturnType(containingClass, substitutor) : method.getReturnType();
-                      if (returnType != null) {
-                        session.registerConstraints(returnType, interfaceMethodReturnType);
-                      }
-                    }
-                    return session.infer(parameters, null, null);
-                  }
-
-                  private PsiType getParameterType(PsiParameter[] parameters, int i, boolean varargs) {
-                    if (varargs && i >= parameters.length - 1) {
-                      final PsiType type = parameters[parameters.length - 1].getType();
-                      LOG.assertTrue(type instanceof PsiEllipsisType);
-                      return ((PsiEllipsisType)type).getComponentType();
-                    }
-                    return parameters[i].getType();
-                  }
-                };
-              }
-          };
-          processor.setIsConstructor(isConstructor);
-          processor.setName(isConstructor ? containingClass.getName() : element.getText());
-          final PsiExpression expression = getQualifierExpression();
-          if (expression == null || !(expression.getType() instanceof PsiArrayType)) {
-            processor.setAccessClass(containingClass);
-          }
-
-          if (qualifierResolveResult.isReferenceTypeQualified() && isLocatedInStaticContext(containingClass)) {
-             processor.handleEvent(JavaScopeProcessorEvent.START_STATIC, null);
-          }
-          ResolveState state = ResolveState.initial().put(PsiSubstitutor.KEY, substitutor);
-          containingClass.processDeclarations(processor, state, reference, reference);
-          return processor.getResult();
-        }
-      }
-      return JavaResolveResult.EMPTY_ARRAY;
-    }
-
-    protected PsiType getInterfaceType(PsiMethodReferenceExpression reference) {
-      PsiType functionalInterfaceType = null;
-      final Map<PsiMethodReferenceExpression,PsiType> map = PsiMethodReferenceUtil.ourRefs.get();
-      if (map != null) {
-        functionalInterfaceType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(map.get(reference));
-      }
-
-      if (functionalInterfaceType == null) {
-        functionalInterfaceType = reference.getFunctionalInterfaceType();
-      }
-
-      return functionalInterfaceType;
-    }
-
-    protected PsiConflictResolver createResolver(PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
-                                                             PsiMethod interfaceMethod,
-                                                             MethodSignature signature) {
-      return new MethodReferenceConflictResolver(qualifierResolveResult, signature, interfaceMethod != null && interfaceMethod.isVarArgs());
-    }
-
-    private PsiClassType composeReturnType(PsiClass containingClass, PsiSubstitutor substitutor) {
-      final boolean isRawSubst = PsiUtil.isRawSubstitutor(containingClass, substitutor);
-      return JavaPsiFacade.getElementFactory(containingClass.getProject())
-        .createType(containingClass, isRawSubst ? PsiSubstitutor.EMPTY : substitutor);
-    }
-
-    private class MethodReferenceConflictResolver extends JavaMethodsConflictResolver {
-      private final MethodSignature mySignature;
-      private final PsiMethodReferenceUtil.QualifierResolveResult myQualifierResolveResult;
-      private final boolean myFunctionalMethodVarArgs;
-
-      private MethodReferenceConflictResolver(PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
-                                              @Nullable MethodSignature signature, boolean varArgs) {
-        super(PsiMethodReferenceExpressionImpl.this, signature != null ? signature.getParameterTypes() : PsiType.EMPTY_ARRAY, PsiUtil.getLanguageLevel(PsiMethodReferenceExpressionImpl.this));
-        myQualifierResolveResult = qualifierResolveResult;
-        myFunctionalMethodVarArgs = varArgs;
-        mySignature = signature;
-      }
-
-      @Override
-      protected int getPertinentApplicabilityLevel(MethodCandidateInfo conflict) {
-        return conflict.isVarargs() ? MethodCandidateInfo.ApplicabilityLevel.VARARGS : MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY;
-      }
-
-      @Nullable
-      @Override
-      public CandidateInfo resolveConflict(@NotNull List<CandidateInfo> conflicts) {
-        if (mySignature == null) return null;
-
-        checkSameSignatures(conflicts);
-        checkAccessStaticLevels(conflicts, true);
-
-        final PsiType[] parameterTypes = mySignature.getParameterTypes();
-        boolean hasReceiver = PsiMethodReferenceUtil.hasReceiver(parameterTypes, myQualifierResolveResult,
-                                                                 PsiMethodReferenceExpressionImpl.this);
-
-        final List<CandidateInfo> firstCandidates = new ArrayList<CandidateInfo>();
-        final List<CandidateInfo> secondCandidates = new ArrayList<CandidateInfo>();
-
-        for (CandidateInfo conflict : conflicts) {
-          if (!(conflict instanceof MethodCandidateInfo)) continue;
-          final PsiMethod psiMethod = ((MethodCandidateInfo)conflict).getElement();
-          if (psiMethod == null) continue;
-
-          final PsiSubstitutor substitutor = conflict.getSubstitutor();
-          final PsiType[] signatureParameterTypes2 = psiMethod.getSignature(substitutor).getParameterTypes();
-
-          final boolean varargs = ((MethodCandidateInfo)conflict).isVarargs();
-          if (varargs && (!psiMethod.isVarArgs() || myFunctionalMethodVarArgs)) continue;
-
-          if ((varargs || parameterTypes.length == signatureParameterTypes2.length) &&
-              isCorrectAssignment(signatureParameterTypes2, parameterTypes, substitutor, varargs, 0)) {
-            firstCandidates.add(conflict);
-          }
-
-          if (hasReceiver &&
-              (varargs || parameterTypes.length == signatureParameterTypes2.length + 1) &&
-              isCorrectAssignment(signatureParameterTypes2, parameterTypes, substitutor, varargs, 1)) {
-            secondCandidates.add(conflict);
-          }
-        }
-
-        if (myQualifierResolveResult.isReferenceTypeQualified() && getReferenceNameElement() instanceof PsiIdentifier) {
-          //If the first search produces a static method, and no non-static method is applicable for the second search, then the result of the first search is the compile-time declaration.
-          CandidateInfo candidateInfo = filterStaticCorrectCandidates(firstCandidates, secondCandidates, true);
-          if (candidateInfo != null) {
-            return candidateInfo;
-          }
-
-          //If the second search produces a non-static method, and no static method is applicable for the first search, then the result of the second search is the compile-time declaration.
-          candidateInfo = filterStaticCorrectCandidates(secondCandidates, firstCandidates, false);
-          if (candidateInfo != null) {
-            return candidateInfo;
-          }
-        }
-
-        if (resolveConflicts(firstCandidates, secondCandidates, MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY)) {
-          return !firstCandidates.isEmpty() ? firstCandidates.get(0) : secondCandidates.get(0);
-        }
-
-        if (resolveConflicts(firstCandidates, secondCandidates, MethodCandidateInfo.ApplicabilityLevel.VARARGS)) {
-          return !firstCandidates.isEmpty() ? firstCandidates.get(0) : secondCandidates.get(0);
-        }
-
-        conflicts.clear();
-        firstCandidates.addAll(secondCandidates);
-        conflicts.addAll(firstCandidates);
-        return null;
-      }
-
-      private boolean resolveConflicts(List<CandidateInfo> firstCandidates, List<CandidateInfo> secondCandidates, int applicabilityLevel) {
-
-        checkApplicability(firstCandidates);
-        checkSpecifics(firstCandidates, applicabilityLevel, myLanguageLevel);
-
-        checkApplicability(secondCandidates);
-        checkSpecifics(secondCandidates, applicabilityLevel, myLanguageLevel);
-
-        return firstCandidates.size() + secondCandidates.size() == 1;
-      }
-
-      @Override
-      protected boolean nonComparable(CandidateInfo method, CandidateInfo conflict) {
-        if (method == conflict) return true;
-        PsiElement psiElement = method.getElement();
-        PsiElement conflictElement = conflict.getElement();
-        if (psiElement instanceof PsiMethod && conflictElement instanceof PsiMethod) {
-          if (((PsiMethod)psiElement).getParameterList().getParametersCount() !=
-              ((PsiMethod)conflictElement).getParameterList().getParametersCount()) {
-            return true;
-          }
-        }
-        return false;
-      }
-
-      /**
-       * 15.13.1
-       */
-      private CandidateInfo filterStaticCorrectCandidates(List<CandidateInfo> firstCandidates,
-                                                 List<CandidateInfo> secondCandidates, 
-                                                 boolean shouldBeStatic) {
-        if (firstCandidates.size() == 1) {
-          final CandidateInfo candidateInfo = firstCandidates.get(0);
-          final PsiElement element = candidateInfo.getElement();
-          if (element instanceof PsiMethod) {
-            final boolean isStatic = ((PsiMethod)element).hasModifierProperty(PsiModifier.STATIC);
-            if (shouldBeStatic && isStatic || !shouldBeStatic && !isStatic) {
-              for (CandidateInfo secondCandidate : secondCandidates) {
-                final PsiElement psiElement = secondCandidate.getElement();
-                if (psiElement instanceof PsiMethod) {
-                  final boolean oppositeStatic = ((PsiMethod)psiElement).hasModifierProperty(PsiModifier.STATIC);
-                  if (shouldBeStatic && !oppositeStatic || !shouldBeStatic && oppositeStatic) {
-                    return null;
-                  }
-                }
-              }
-              return candidateInfo;
-            }
-          }
-        }
-        return null;
-      }
-
-      private boolean isCorrectAssignment(PsiType[] signatureParameterTypes2,
-                                          PsiType[] parameterTypes,
-                                          PsiSubstitutor substitutor,
-                                          boolean varargs,
-                                          int offset) {
-        final int min = Math.min(signatureParameterTypes2.length, parameterTypes.length - offset);
-        for (int i = 0; i < min; i++) {
-          final PsiType type1 = substitutor.substitute(parameterTypes[i + offset]);
-          final PsiType type2 = signatureParameterTypes2[i];
-          if (varargs && i == signatureParameterTypes2.length - 1) {
-            if (!TypeConversionUtil.isAssignable(type2, type1) && !TypeConversionUtil.isAssignable(((PsiArrayType)type2).getComponentType(), type1)) {
-              return false;
-            }
-          }
-          else if (!TypeConversionUtil.isAssignable(type2, type1)) {
-            return false;
-          }
-        }
-        return true;
-      }
-    }
-  }
-
   @Override
   public boolean isAcceptable(PsiType left) {
     if (left instanceof PsiIntersectionType) {
@@ -792,12 +399,7 @@
      //        the result of applying capture conversion (5.1.10) to the return type of the invocation type (15.12.2.6) of the chosen declaration is R', 
      //        where R is the target type that may be used to infer R'; neither R nor R' is void; and R' is compatible with R in an assignment context.
 
-    Map<PsiMethodReferenceExpression, PsiType> map = PsiMethodReferenceUtil.ourRefs.get();
-    if (map == null) {
-      map = new HashMap<PsiMethodReferenceExpression, PsiType>();
-      PsiMethodReferenceUtil.ourRefs.set(map);
-    }
-
+    Map<PsiMethodReferenceExpression, PsiType> map = PsiMethodReferenceUtil.getFunctionalTypeMap();
     final JavaResolveResult result;
     try {
       if (map.put(this, left) != null) {
@@ -869,4 +471,10 @@
     }
     return false;
   }
+
+  @Nullable
+  @Override
+  public Icon getIcon(int flags) {
+    return AllIcons.Nodes.AnonymousClass;
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java
index 7f4a7dd..f91f01c 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiReferenceExpressionImpl.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.
@@ -491,7 +491,7 @@
       private final Set<String> myVarNames = new THashSet<String>();
 
       @Override
-      public boolean execute(@NotNull final PsiElement element, final ResolveState state) {
+      public boolean execute(@NotNull final PsiElement element, @NotNull final ResolveState state) {
         if (element instanceof PsiLocalVariable || element instanceof PsiParameter) {
           myVarNames.add(((PsiVariable) element).getName());
         }
diff --git a/java/java-psi-impl/src/com/intellij/psi/presentation/java/ClassPresentationUtil.java b/java/java-psi-impl/src/com/intellij/psi/presentation/java/ClassPresentationUtil.java
index 2a13a0e..42171ad 100644
--- a/java/java-psi-impl/src/com/intellij/psi/presentation/java/ClassPresentationUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/presentation/java/ClassPresentationUtil.java
@@ -62,7 +62,7 @@
     }
   }
 
-  private static String getContextName(@NotNull PsiElement element, boolean qualified) {
+  public static String getContextName(@NotNull PsiElement element, boolean qualified) {
     PsiElement parent = PsiTreeUtil.getParentOfType(element, PsiMember.class, PsiFile.class);
     while(true){
       if (parent == null) return null;
@@ -72,4 +72,8 @@
       parent = parent.getParent();
     }
   }
+
+  public static String getFunctionalExpressionPresentation(PsiFunctionalExpression functionalExpression, boolean qualified) {
+    return "Functional expression in " + getContextName(functionalExpression, qualified);
+  }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/NameHint.java b/java/java-psi-impl/src/com/intellij/psi/scope/NameHint.java
index be52641..5b1fdfd 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/NameHint.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/NameHint.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -17,11 +17,12 @@
 
 import com.intellij.openapi.util.Key;
 import com.intellij.psi.ResolveState;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 public interface NameHint {
   Key<NameHint> KEY = Key.create("NameHint");
 
   @Nullable
-  String getName(ResolveState state);
+  String getName(@NotNull ResolveState state);
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/DuplicateConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/DuplicateConflictResolver.java
index 46631b7..32ac894 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/DuplicateConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/DuplicateConflictResolver.java
@@ -18,6 +18,7 @@
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.infos.CandidateInfo;
+import com.intellij.psi.infos.MethodCandidateInfo;
 import com.intellij.psi.scope.PsiConflictResolver;
 import com.intellij.psi.util.PsiUtilCore;
 import com.intellij.util.containers.HashMap;
@@ -47,7 +48,7 @@
       final PsiElement element = info.getElement();
       Object key;
       if (element instanceof PsiMethod) {
-        key = ((PsiMethod)element).getSignature(info.getSubstitutor());
+        key = ((PsiMethod)element).getSignature(((MethodCandidateInfo)info).getSubstitutor(false));
       }
       else {
         key = PsiUtilCore.getName(element);
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
index 6c979cf..5f1e2f6 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
@@ -550,15 +550,17 @@
       final PsiSubstitutor methodSubstitutor2 = calculateMethodSubstitutor(typeParameters2, method2, siteSubstitutor2, types2, types1AtSite, languageLevel);
       boolean applicable21 = isApplicableTo(types1AtSite, method2, languageLevel, varargsPosition, methodSubstitutor2, method1, siteSubstitutor2);
 
-      final boolean typeArgsApplicable12 = GenericsUtil.isTypeArgumentsApplicable(typeParameters1, methodSubstitutor1, myArgumentsList, !applicable21);
-      final boolean typeArgsApplicable21 = GenericsUtil.isTypeArgumentsApplicable(typeParameters2, methodSubstitutor2, myArgumentsList, !applicable12);
+      if (!myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
+        final boolean typeArgsApplicable12 = GenericsUtil.isTypeArgumentsApplicable(typeParameters1, methodSubstitutor1, myArgumentsList, !applicable21);
+        final boolean typeArgsApplicable21 = GenericsUtil.isTypeArgumentsApplicable(typeParameters2, methodSubstitutor2, myArgumentsList, !applicable12);
 
-      if (!typeArgsApplicable12) {
-        applicable12 = false;
-      }
+        if (!typeArgsApplicable12) {
+          applicable12 = false;
+        }
 
-      if (!typeArgsApplicable21) {
-        applicable21 = false;
+        if (!typeArgsApplicable21) {
+          applicable21 = false;
+        }
       }
 
       if (applicable12 || applicable21) {
@@ -586,8 +588,8 @@
             //from 15.12.2.5 Choosing the Most Specific Method
             //In addition, a functional interface type S is more specific than a functional interface type T for an expression exp 
             // if T is not a subtype of S and one of the following conditions apply.
-            if (LambdaUtil.isFunctionalType(type1) && !type1.isAssignableFrom(type2) &&
-                LambdaUtil.isFunctionalType(type2) && !type2.isAssignableFrom(type1)) {
+            if (LambdaUtil.isFunctionalType(type1) && !TypeConversionUtil.erasure(type1).isAssignableFrom(type2) &&
+                LambdaUtil.isFunctionalType(type2) && !TypeConversionUtil.erasure(type2).isAssignableFrom(type1)) {
               types1AtSite[Math.min(i, types1.length - 1)] = PsiType.NULL;
               types2AtSite[Math.min(i, types2.length - 1)] = PsiType.NULL;
               toCompareFunctional = true;
@@ -717,8 +719,11 @@
       LOG.assertTrue(typeParameter != null);
       if (!substitutor.getSubstitutionMap().containsKey(typeParameter)) {
         PsiType type = siteSubstitutor.substitute(typeParameter);
-        if (type instanceof PsiClassType && ((PsiClassType)type).resolve() instanceof PsiTypeParameter) {
-          type = TypeConversionUtil.erasure(type, substitutor);
+        if (type instanceof PsiClassType) {
+          final PsiClass aClass = ((PsiClassType)type).resolve();
+          if (aClass instanceof PsiTypeParameter && ((PsiTypeParameter)aClass).getOwner() == typeParameter.getOwner()) {
+            type = TypeConversionUtil.erasure(type, siteSubstitutor);
+          }
         }
         substitutor = substitutor.put(typeParameter, type);
       } else {
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/ConflictFilterProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/ConflictFilterProcessor.java
index f46dd70..0744b3b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/ConflictFilterProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/ConflictFilterProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -34,7 +34,7 @@
  */
 public class ConflictFilterProcessor extends FilterScopeProcessor<CandidateInfo> implements NameHint {
   private final PsiConflictResolver[] myResolvers;
-  private JavaResolveResult[] myCachedResult = null;
+  private JavaResolveResult[] myCachedResult;
   protected String myName;
   protected final PsiElement myPlace;
   protected final PsiFile myPlaceFile;
@@ -53,8 +53,9 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
-    if (myCachedResult != null && myCachedResult.length == 1 && myCachedResult[0].isAccessible()) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
+    JavaResolveResult[] cachedResult = myCachedResult;
+    if (cachedResult != null && cachedResult.length == 1 && cachedResult[0].isAccessible()) {
       return false;
     }
     if (myName == null || PsiUtil.checkName(element, myName, myPlace)) {
@@ -64,7 +65,7 @@
   }
 
   @Override
-  protected void add(PsiElement element, PsiSubstitutor substitutor) {
+  protected void add(@NotNull PsiElement element, @NotNull PsiSubstitutor substitutor) {
     add(new CandidateInfo(element, substitutor));
   }
 
@@ -74,7 +75,7 @@
   }
 
   @Override
-  public void handleEvent(PsiScopeProcessor.Event event, Object associated) {
+  public void handleEvent(@NotNull PsiScopeProcessor.Event event, Object associated) {
     if (event == JavaScopeProcessorEvent.CHANGE_LEVEL && myName != null) {
       getResult();
     }
@@ -82,7 +83,8 @@
 
   @NotNull
   public JavaResolveResult[] getResult() {
-    if (myCachedResult == null) {
+    JavaResolveResult[] cachedResult = myCachedResult;
+    if (cachedResult == null) {
       final List<CandidateInfo> conflicts = getResults();
       for (PsiConflictResolver resolver : myResolvers) {
         CandidateInfo candidate = resolver.resolveConflict(conflicts);
@@ -92,14 +94,14 @@
           break;
         }
       }
-      myCachedResult = conflicts.toArray(new JavaResolveResult[conflicts.size()]);
+      myCachedResult = cachedResult = conflicts.toArray(new JavaResolveResult[conflicts.size()]);
     }
 
-    return myCachedResult;
+    return cachedResult;
   }
 
   @Override
-  public String getName(ResolveState state) {
+  public String getName(@NotNull ResolveState state) {
     return myName;
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/FilterScopeProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/FilterScopeProcessor.java
index 96c8d95..78be684 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/FilterScopeProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/FilterScopeProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -57,7 +57,7 @@
   }
 
   @Override
-  public void handleEvent(PsiScopeProcessor.Event event, Object associated) {
+  public void handleEvent(@NotNull PsiScopeProcessor.Event event, Object associated) {
     if (myProcessor != null) {
       myProcessor.handleEvent(event, associated);
     }
@@ -67,7 +67,7 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     if (myFilter.isAcceptable(element, myCurrentDeclarationHolder)) {
       if (myProcessor != null) {
         return myProcessor.execute(element, state);
@@ -77,13 +77,13 @@
     return true;
   }
 
-  protected void add(PsiElement element, PsiSubstitutor substitutor) {
+  protected void add(@NotNull PsiElement element, @NotNull PsiSubstitutor substitutor) {
     //noinspection unchecked
     myResults.add((T)element);
   }
 
   @Override
-  public <T> T getHint(@NotNull Key<T> hintKey) {
+  public <K> K getHint(@NotNull Key<K> hintKey) {
     if (myProcessor != null) {
       return myProcessor.getHint(hintKey);
     }
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodCandidatesProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodCandidatesProcessor.java
index e44dfc7..7c83f10 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodCandidatesProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodCandidatesProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2011 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.
@@ -43,14 +43,14 @@
   }
 
   @Override
-  public void add(PsiElement element, PsiSubstitutor substitutor) {
+  public void add(@NotNull PsiElement element, @NotNull PsiSubstitutor substitutor) {
     if (element instanceof PsiMethod) {
       final PsiMethod method = (PsiMethod)element;
       addMethod(method, substitutor, isInStaticScope() && !method.hasModifierProperty(PsiModifier.STATIC));
     }
   }
 
-  public void addMethod(final PsiMethod method, final PsiSubstitutor substitutor, final boolean staticProblem) {
+  public void addMethod(@NotNull PsiMethod method, final PsiSubstitutor substitutor, final boolean staticProblem) {
     final boolean isAccessible = JavaResolveUtil.isAccessible(method, method.getContainingClass(), method.getModifierList(),
                                                               myPlace, myAccessClass, myCurrentFileContext, myPlaceFile) &&
                                  !isShadowed(method);
@@ -67,14 +67,24 @@
     return false;
   }
 
-  protected MethodCandidateInfo createCandidateInfo(final PsiMethod method, final PsiSubstitutor substitutor,
+  protected MethodCandidateInfo createCandidateInfo(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor,
                                                     final boolean staticProblem, final boolean accessible, final boolean varargs) {
     final PsiExpressionList argumentList = getArgumentList();
     return new MethodCandidateInfo(method, substitutor, !accessible, staticProblem, argumentList, myCurrentFileContext,
                                    null, getTypeArguments(), getLanguageLevel()) {
+
+      private PsiType[] myExpressionTypes;
+
       @Override
       public PsiType[] getArgumentTypes() {
-        return getExpressionTypes(argumentList);
+        if (myExpressionTypes == null && argumentList != null) {
+          final PsiType[] expressionTypes = getExpressionTypes(argumentList);
+          if (!MethodCandidateInfo.ourOverloadGuard.currentStack().isEmpty()) {
+            return expressionTypes;
+          }
+          myExpressionTypes = expressionTypes;
+        }
+        return myExpressionTypes;
       }
 
       @Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java
index 463e2a1..664b70f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolveProcessor.java
@@ -1,17 +1,17 @@
 /*
- * Copyright 2000-2009 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.
- *  You may obtain a copy of the License at
+ * 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
+ * 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.
+ * 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.psi.scope.processor;
@@ -51,13 +51,15 @@
     return myMethods.toArray(new PsiMethod[myMethods.size()]);
   }
 
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  @Override
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     if (element instanceof PsiMethod) {
       ContainerUtil.addIfNotNull(myMethods, (PsiMethod)element);
     }
     return true;
   }
 
+  @Override
   public <T> T getHint(@NotNull Key<T> hintKey) {
     if (hintKey == ElementClassHint.KEY) {
       return (T)this;
@@ -68,9 +70,11 @@
     return null;
   }
 
-  public void handleEvent(Event event, Object associated) {
+  @Override
+  public void handleEvent(@NotNull Event event, Object associated) {
   }
 
+  @Override
   public boolean shouldProcess(DeclarationKind kind) {
     return kind == DeclarationKind.METHOD;
   }
@@ -90,7 +94,7 @@
 
   @Nullable
   @Override
-  public String getName(ResolveState state) {
+  public String getName(@NotNull ResolveState state) {
     return myNameHint;
   }
 }
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolverProcessor.java
index b73f87b..543143e 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolverProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodResolverProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -52,7 +52,7 @@
   }
 
   @Override
-  public void handleEvent(Event event, Object associated) {
+  public void handleEvent(@NotNull Event event, Object associated) {
     if (event == JavaScopeProcessorEvent.CHANGE_LEVEL) {
       if (myHasAccessibleStaticCorrectCandidate) myStopAcceptingCandidates = true;
     }
@@ -60,7 +60,7 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     return !myStopAcceptingCandidates && super.execute(element, state);
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java
index 47e8b8a..1d89d43 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/MethodsProcessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 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.
@@ -89,7 +89,7 @@
   }
 
   @Override
-  public void handleEvent(Event event, Object associated) {
+  public void handleEvent(@NotNull Event event, Object associated) {
     if (event == JavaScopeProcessorEvent.START_STATIC) {
       myStaticScopeFlag = true;
     }
@@ -110,7 +110,7 @@
     this.myIsConstructor = myIsConstructor;
   }
 
-  public void forceAddResult(PsiMethod method) {
+  public void forceAddResult(@NotNull PsiMethod method) {
     add(new CandidateInfo(method, PsiSubstitutor.EMPTY, false, false, myCurrentFileContext));
   }
 
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.java b/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.java
index 6f9d64c..530a8ad 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/processor/VariablesProcessor.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.
@@ -53,7 +53,7 @@
 
   /** Always return true since we wanna get all vars in scope */
   @Override
-  public boolean execute(@NotNull PsiElement pe, ResolveState state){
+  public boolean execute(@NotNull PsiElement pe, @NotNull ResolveState state){
     if(pe instanceof PsiVariable){
       final PsiVariable pvar = (PsiVariable)pe;
       if(!myStaticSensitiveFlag || !myStaticScopeFlag || pvar.hasModifierProperty(PsiModifier.STATIC)){
@@ -66,7 +66,7 @@
   }
 
   @Override
-  public final void handleEvent(Event event, Object associated){
+  public final void handleEvent(@NotNull Event event, Object associated){
     if(event == JavaScopeProcessorEvent.START_STATIC)
       myStaticScopeFlag = true;
   }
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java b/java/java-psi-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java
index 30f9084..2c3bb5c 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/util/PsiScopesUtil.java
@@ -442,6 +442,12 @@
       if (!(qualifier instanceof PsiSuperExpression)) {
         processor.setAccessClass((PsiClass)PsiUtil.getAccessObjectClass(qualifier).getElement());
       }
+      else if (((PsiSuperExpression)qualifier).getQualifier() != null && PsiUtil.isLanguageLevel8OrHigher(qualifier)) {
+        final PsiClass accessClass = (PsiClass)PsiUtil.getAccessObjectClass(qualifier).getElement();
+        if (accessClass != null && accessClass.isInterface()) {
+          processor.setAccessClass(accessClass);
+        }
+      }
     }
 
     processor.setIsConstructor(false);
diff --git a/java/java-psi-impl/src/com/intellij/refactoring/util/RefactoringChangeUtil.java b/java/java-psi-impl/src/com/intellij/refactoring/util/RefactoringChangeUtil.java
index b23e347..a5b8c31 100644
--- a/java/java-psi-impl/src/com/intellij/refactoring/util/RefactoringChangeUtil.java
+++ b/java/java-psi-impl/src/com/intellij/refactoring/util/RefactoringChangeUtil.java
@@ -20,6 +20,7 @@
 import com.intellij.psi.codeStyle.CodeStyleManager;
 import com.intellij.psi.util.InheritanceUtil;
 import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
 import com.intellij.util.IncorrectOperationException;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -44,6 +45,31 @@
     return PsiKeyword.SUPER.equals(name);
   }
 
+  public static PsiType getTypeByExpression(PsiExpression expr) {
+    PsiType type = expr.getType();
+    if (type == null) {
+      if (expr instanceof PsiArrayInitializerExpression) {
+        PsiExpression[] initializers = ((PsiArrayInitializerExpression)expr).getInitializers();
+        if (initializers.length > 0) {
+          PsiType initType = getTypeByExpression(initializers[0]);
+          if (initType == null) return null;
+          return initType.createArrayType();
+        }
+      }
+
+      if (expr instanceof PsiReferenceExpression && PsiUtil.isOnAssignmentLeftHand(expr)) {
+        return getTypeByExpression(((PsiAssignmentExpression)expr.getParent()).getRExpression());
+      }
+      return null;
+    }
+    PsiClass refClass = PsiUtil.resolveClassInType(type);
+    if (refClass instanceof PsiAnonymousClass) {
+      type = ((PsiAnonymousClass)refClass).getBaseClassType();
+    }
+
+    return GenericsUtil.getVariableTypeByExpressionType(type);
+  }
+  
   public static PsiReferenceExpression qualifyReference(@NotNull PsiReferenceExpression referenceExpression,
                                                         @NotNull PsiMember member,
                                                         @Nullable final PsiClass qualifyingClass) throws IncorrectOperationException {
diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
index d9feb5c..2ae02e9 100644
--- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties
+++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
@@ -220,6 +220,7 @@
 invalid.statement=Invalid statement
 incompatible.types=Incompatible types. Found: ''{1}'', required: ''{0}''
 valid.switch.selector.types=byte, char, short or int
+valid.switch.17.selector.types=char, byte, short, int, Character, Byte, Short, Integer, String, or an enum
 dot.expected.after.super.or.this='.' expected
 unqualified.super.disallowed=Unqualified super reference is not allowed in extension method
 
diff --git a/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java b/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java
index 1319956..3673a93 100644
--- a/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java
+++ b/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java
@@ -33,6 +33,9 @@
   private static final String PROPERTY_PORT_NUMBER = "idea.launcher.port";
   private static final String PROPERTY_BINPATH = "idea.launcher.bin.path";
 
+  private static final String JAVAFX_LAUNCHER = "com.sun.javafx.application.LauncherImpl";
+  private static final String LAUNCH_APPLICATION_METHOD_NAME = "launchApplication";
+
   private static native void triggerControlBreak();
 
   static {
@@ -110,7 +113,18 @@
     for (int j = 1; j < args.length; j++) {
       parms[j - 1] = args[j];
     }
-    Method m = Class.forName(mainClass).getMethod("main", new Class[]{parms.getClass()});
+    final Class appClass = Class.forName(mainClass);
+    Method m;
+    try {
+      m = appClass.getMethod("main", new Class[]{parms.getClass()});
+    }
+    catch (NoSuchMethodException e) {
+      if (!startJavaFXApplication(parms, appClass)) {
+        throw e;
+      }
+      return;
+    }
+
     if (!Modifier.isStatic(m.getModifiers())) {
       System.err.println("main method should be static");
       return;
@@ -123,6 +137,19 @@
     }
   }
 
+  private static boolean startJavaFXApplication(String[] parms, Class appClass) throws NoSuchMethodException {
+    try {
+      //check in launch method for application class in the stack trace leads to this hack here
+      final Method launchApplication = Class.forName(JAVAFX_LAUNCHER).getMethod(LAUNCH_APPLICATION_METHOD_NAME,
+                                                                                new Class[]{appClass.getClass(), parms.getClass()});
+      launchApplication.invoke(null, new Object[] {appClass, parms});
+      return true;
+    }
+    catch (Throwable e) {
+      return false;
+    }
+  }
+
   private static void ensureAccess(Object reflectionObject) {
     // need to call setAccessible here in order to be able to launch package-local classes
     // calling setAccessible() via reflection because the method is missing from java version 1.1.x
diff --git a/java/java-structure-view/src/com/intellij/ide/structureView/impl/AddAllMembersProcessor.java b/java/java-structure-view/src/com/intellij/ide/structureView/impl/AddAllMembersProcessor.java
index f692c8f..3d27bf8 100644
--- a/java/java-structure-view/src/com/intellij/ide/structureView/impl/AddAllMembersProcessor.java
+++ b/java/java-structure-view/src/com/intellij/ide/structureView/impl/AddAllMembersProcessor.java
@@ -43,7 +43,7 @@
   }
 
   @Override
-  public boolean execute(@NotNull PsiElement element, ResolveState state) {
+  public boolean execute(@NotNull PsiElement element, @NotNull ResolveState state) {
     PsiMember member = (PsiMember)element;
     if (!isInteresting(element)) return true;
     if (myPsiClass.isInterface() && isObjectMember(element)) return true;
diff --git a/java/java-tests/java-tests.iml b/java/java-tests/java-tests.iml
index 01e606b..294b5de 100644
--- a/java/java-tests/java-tests.iml
+++ b/java/java-tests/java-tests.iml
@@ -31,6 +31,7 @@
     <orderEntry type="module" module-name="external-system-impl" scope="RUNTIME" />
     <orderEntry type="module" module-name="junit_rt" scope="TEST" />
     <orderEntry type="module" module-name="xml-psi-impl" scope="TEST" />
+    <orderEntry type="module" module-name="properties-psi-api" scope="TEST" />
   </component>
 </module>
 
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType-out.java b/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType-out.java
index c96328d..a99c498 100644
--- a/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType-out.java
+++ b/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType-out.java
@@ -19,7 +19,7 @@
 public class Test {
   public int m() {
     I i = s -> {
-      return s.contains();
+      return s.isEmpty();
     };
     return 0;
   }
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType1-out.java b/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType1-out.java
index 73a03e4..1947277 100644
--- a/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType1-out.java
+++ b/java/java-tests/testData/codeInsight/completion/smartType/ExpectedReturnType1-out.java
@@ -18,7 +18,7 @@
 }
 public class Test {
   public int m() {
-    I i = s -> s.contains();
+    I i = s -> s.isEmpty();
     return 0;
   }
 }
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/FilterAmbiguity.java b/java/java-tests/testData/codeInsight/completion/smartType/FilterAmbiguity.java
new file mode 100644
index 0000000..58eb8c7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/FilterAmbiguity.java
@@ -0,0 +1,14 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class A {
+  {
+    List<A> s = new ArrayList<>();
+    s.stream().filter(A::<caret>);
+  }
+
+  public boolean accept(String s) {
+    return true;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/FilterWrongParamsMethods-out.java b/java/java-tests/testData/codeInsight/completion/smartType/FilterWrongParamsMethods-out.java
new file mode 100644
index 0000000..9f14315
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/FilterWrongParamsMethods-out.java
@@ -0,0 +1,18 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class A {
+  {
+    List<A> s = new ArrayList<>();
+    s.stream().filter(A::accept);
+  }
+
+  static <K> boolean accept(K k) {
+    return false;
+  }
+
+  public boolean accept1(String s) {
+    return true;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/FilterWrongParamsMethods.java b/java/java-tests/testData/codeInsight/completion/smartType/FilterWrongParamsMethods.java
new file mode 100644
index 0000000..25af850
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/FilterWrongParamsMethods.java
@@ -0,0 +1,18 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class A {
+  {
+    List<A> s = new ArrayList<>();
+    s.stream().filter(A::<caret>);
+  }
+
+  static <K> boolean accept(K k) {
+    return false;
+  }
+
+  public boolean accept1(String s) {
+    return true;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/FilteredStaticMethods-out.java b/java/java-tests/testData/codeInsight/completion/smartType/FilteredStaticMethods-out.java
new file mode 100644
index 0000000..c714230
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/FilteredStaticMethods-out.java
@@ -0,0 +1,14 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class A {
+  {
+    List<A> s = new ArrayList<>();
+    s.stream().filter(A::accept);
+  }
+
+  public boolean accept() {
+    return true;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/completion/smartType/FilteredStaticMethods.java b/java/java-tests/testData/codeInsight/completion/smartType/FilteredStaticMethods.java
new file mode 100644
index 0000000..3f9a20a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/smartType/FilteredStaticMethods.java
@@ -0,0 +1,14 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class A {
+  {
+    List<A> s = new ArrayList<>();
+    s.stream().filter(A::<caret>);
+  }
+
+  public boolean accept() {
+    return true;
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/AgentPremain.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/AgentPremain.java
new file mode 100644
index 0000000..2fe9b41
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/AgentPremain.java
@@ -0,0 +1,11 @@
+package java.lang.instrument;
+
+class Instrumentation {} 
+
+class Foo {
+
+  public void agentmain(String args, Instrumentation i) {
+    System.out.println(args);
+    System.out.println(i);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA79251.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA79251.java
new file mode 100644
index 0000000..b26587f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/IDEA79251.java
@@ -0,0 +1,10 @@
+class Main {
+  public static class InnerClass {
+    private String field;
+  }
+  public static class InnerSubClass extends InnerClass {
+    public String getParentField() {
+      return this.<error descr="'field' has private access in 'Main.InnerClass'">field</error>;
+    }
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java
index d0d4dbc..ac3eb04 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting6/UnsupportedFeatures7.java
@@ -45,5 +45,6 @@
 
   interface I {
     <error descr="Extension methods are not supported at this language level">default void m() { }</error>
+    <error descr="Extension methods are not supported at this language level">static void m() { }</error>
   }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/Externalizable.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/Externalizable.java
new file mode 100644
index 0000000..3f81f49
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/Externalizable.java
@@ -0,0 +1,36 @@
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+class SerializationProxy implements Externalizable
+{
+  private static final long serialVersionUID = 1L;
+
+  private Object object;
+
+  public SerializationProxy()
+  {
+    // Empty constructor for Externalizable class
+  }
+
+  private <warning descr="Private constructor 'SerializationProxy(java.lang.Object)' is never used">SerializationProxy</warning>(Object object)
+  {
+    this.object = object;
+  }
+
+  public void writeExternal(ObjectOutput out) throws IOException
+  {
+    out.writeObject(this.object);
+  }
+
+  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+  {
+    this.object = in.readObject();
+  }
+
+  protected Object readResolve()
+  {
+    return this.object;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA122519EnclosingInstance.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA122519EnclosingInstance.java
new file mode 100644
index 0000000..3de0841
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA122519EnclosingInstance.java
@@ -0,0 +1,20 @@
+class ClassA {
+  public abstract class InnerAbstractA {
+  }
+}
+
+class ClassC {
+  static ClassA classA = new ClassA();
+
+  public static ClassA getClassA() {
+    return classA;
+  }
+}
+
+class ClassB {
+  public static class InnerClassA extends ClassA.InnerAbstractA {
+    public InnerClassA() {
+      ClassC.getClassA().super();
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInheritance/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInheritance/pck/AmbiguousMethodCall.java
index 580a30a..5eab22e 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInheritance/pck/AmbiguousMethodCall.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousInheritance/pck/AmbiguousMethodCall.java
@@ -7,7 +7,7 @@
 
 interface B<T> extends A<T[]> { }
 
-class C<T extends A<Object[]> & B<?>>
+class C<T extends A<Object[]> & B<Object>>
 {
     void foo(T x)
     {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA120563.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA120563.java
new file mode 100644
index 0000000..fb60ea5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA120563.java
@@ -0,0 +1,33 @@
+
+import java.util.Set;
+
+public class WrongGenerics {
+
+  @SuppressWarnings("unchecked")
+  <T> Set<Foo<? extends T>> foo(Set<Foo<?>> foo) {
+    return <error descr="Inconvertible types; cannot cast 'java.util.Set<Foo<?>>' to 'java.util.Set<Foo<? extends T>>'">(Set<Foo<?  extends T>>)foo</error>;
+  }
+
+  @SuppressWarnings("unchecked")
+  <T> Set<Foo<? extends T>> bar(Set<Foo<? extends T>> foo) {
+    return <error descr="Inconvertible types; cannot cast 'java.util.Set<Foo<? extends T>>' to 'java.util.Set<Foo<?>>'">(Set<Foo<?>>) foo</error>;
+  }
+
+  @SuppressWarnings("unchecked")
+  <T> Foo<? extends T> bothSucceed(Foo<?> foo) {
+    return (Foo<? extends  T>) foo;
+  }
+
+  @SuppressWarnings("unchecked")
+  <T> Foo<Foo<? extends T>> bothFail(Foo<Foo<?>> foo) {
+    return <error descr="Inconvertible types; cannot cast 'Foo<Foo<?>>' to 'Foo<Foo<? extends T>>'">(Foo<Foo<? extends T>>) foo</error>;
+  }
+
+  @SuppressWarnings("unchecked")
+  <T> Set<Foo<? extends T>> onlyIntelliJSucceeds(Set<Foo<?>> foo) {
+    return <error descr="Inconvertible types; cannot cast 'java.util.Set<Foo<?>>' to 'java.util.Set<Foo<? extends T>>'">(Set<Foo<? extends T>>) foo</error>;
+  }
+}
+
+class Foo<T> {
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA121400.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA121400.java
new file mode 100644
index 0000000..bab56b8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA121400.java
@@ -0,0 +1,13 @@
+import java.util.*;
+
+class Test<K,V> {
+  private final Map<? extends K, ? extends V> m = null;
+
+  {
+    f(m.entrySet());
+  }
+
+  private static <A, B> void f(Set<? extends Map.Entry<? extends A, ? extends B>> s) {}
+
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123316.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123316.java
new file mode 100644
index 0000000..101c8f3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123316.java
@@ -0,0 +1,24 @@
+class Temp {
+
+  interface Future<F> {}
+
+  class Message {
+  }
+
+  interface Client<C extends Client, M> {
+    <T> Future<T> request(M request);
+  }
+
+  interface MessageClient extends Client<MessageClient, Message> {
+    Future<Message> request(Message request);
+  }
+
+  abstract class AbstractClient implements MessageClient {
+  }
+
+  class ConcreteClient extends AbstractClient {
+    public Future<Message> request(Message request) {
+      return null;
+    }
+  }
+} 
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123338.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123338.java
new file mode 100644
index 0000000..fdef475
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123338.java
@@ -0,0 +1,12 @@
+class Aaa<Ta> {
+  class Inner {}
+  void doSmth(final Inner inner) {}
+}
+
+class Bbb<T> extends Aaa<T> {
+  class SubInner extends Aaa<T>.Inner {}
+  void doSmth(final SubInner inner) {}
+  void ambiguousCall() {
+    doSmth (new SubInner());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123352.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123352.java
new file mode 100644
index 0000000..1c49b58
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123352.java
@@ -0,0 +1,17 @@
+import java.util.*;
+
+class Test {
+  class Predicate<T> {
+    <S extends T> boolean test(final Collection<T> src) {
+      return true;
+    }
+    <S extends T> boolean test(final Iterable<T> iterable) {
+      return false;
+    }
+  }
+
+  public void testPredicate() {
+    final Predicate<Integer> predicate = new Predicate<>();
+    predicate.test(new ArrayList<Integer>());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123518.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123518.java
new file mode 100644
index 0000000..0440475
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA123518.java
@@ -0,0 +1,21 @@
+import java.util.*;
+
+class sTest {
+
+  public void shouldCallListConstructor(){
+    List<String>stringList=new ArrayList<String>();
+    ClassUnderTest<Date> cut=new ClassUnderTest<>(stringList);
+  }
+
+  private class ClassUnderTest<T extends Date> {
+
+    public String constructorString;
+    private ClassUnderTest(List<T>stringList) {
+      constructorString="Using List Constructor";
+    }
+
+    private ClassUnderTest(Iterable<String> iterables) {
+      constructorString="Using Iterables Constructor";
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57311.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57311.java
index 9ed409c..2be9a4f 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57311.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57311.java
@@ -4,7 +4,7 @@
     }
 
     void bar(A<?> x){
-        baz<error descr="'baz(A<A<? extends S>>)' in 'A' cannot be applied to '(A<A<capture<?>>>)'">(x.foo())</error>;
+        baz<error descr="'baz(A<A<?>>)' in 'A' cannot be applied to '(A<A<capture<?>>>)'">(x.foo())</error>;
     }
 
     <S> void baz(A<A<? extends S>> x){}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57439.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57439.java
index 544d6c1..2ca8dee 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57439.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57439.java
@@ -17,14 +17,14 @@
         foo2(sb);
         foo2(s);
     
-        foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
-        foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
-        foo3<error descr="'foo3(A<A<? extends T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
+        foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
+        foo3<error descr="'foo3(A<A<? extends java.lang.String>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
+        foo3<error descr="'foo3(A<A<?>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
         foo3<error descr="'foo3(A<A<? extends java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
 
-        foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
-        foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
-        foo4<error descr="'foo4(A<A<? super T>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
+        foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<?>>)'">(b)</error>;
+        foo4<error descr="'foo4(A<A<? super java.lang.Object>>)' in 'B' cannot be applied to '(B<capture<? extends java.lang.String>>)'">(eb)</error>;
+        foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<capture<? super java.lang.String>>)'">(sb)</error>;
         foo4<error descr="'foo4(A<A<? super java.lang.String>>)' in 'B' cannot be applied to '(B<java.lang.String>)'">(s)</error>;
 
         foo5(b);
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA64103.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA64103.java
new file mode 100644
index 0000000..fd85609
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA64103.java
@@ -0,0 +1,37 @@
+import java.util.*;
+
+class Test {
+
+  public static <R, E, RC extends Collection<R>, C extends Collection<E>> RC collectionGenericTest(C collection, Lambda<R, E> lambda) {
+    return (RC) new Vector<R>();
+  }
+
+  public static <R, E, RC extends List<R>, C extends List<E>> RC listGenericTest(C list, Lambda<R, E> lambda) {
+    return (RC) new Vector<R>();
+  }
+
+  public static void testGeneric() {
+    Collection<String> testCollection = collectionGenericTest(new Vector<Integer>(), new Lambda<String, Integer>() {
+      @Override
+      public String lambda(Integer l) {
+        return null;
+      }
+    });
+
+    List<String> testList = listGenericTest(new Vector<Integer>(), new Lambda<String, Integer>() {
+      @Override
+      public String lambda(Integer l) {
+        return null;
+      }
+    });
+  }
+
+  private interface Lambda<R, A> {
+    public R lambda(A l);
+  }
+
+  <error descr="Class 'Vector' must either be declared abstract or implement abstract method 'get(int)' in 'AbstractList'">private static class Vector<A> extends AbstractList<A> implements List<A></error> {
+    public Vector() {
+    }
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams.java
index 2adff2f..180b755 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams.java
@@ -18,7 +18,7 @@
 interface IB2<T> extends IA2<T[]> {}
 
 class A2 {
-    <T extends IA2<Object[]> & IB2<?>> void foo(){}
+    <T extends IA2<Object[]> & IB2<Object>> void foo(){}
 }
 
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams1.java
new file mode 100644
index 0000000..f7fda29
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/InheritedWithDifferentArgsInTypeParams1.java
@@ -0,0 +1,10 @@
+import java.util.List;
+
+interface Base<T> {
+}
+
+interface Middle<T> extends Base<List<? super T>> {
+}
+
+<error descr="'Base' cannot be inherited with different type arguments: 'java.util.List<? super T>' and 'java.util.List<T>'">interface Child<T> extends Middle<T>, Base<List<T>></error> {
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/CaptureInsideNestedCalls.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/CaptureInsideNestedCalls.java
new file mode 100644
index 0000000..38b6998
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/CaptureInsideNestedCalls.java
@@ -0,0 +1,15 @@
+import java.util.Iterator;
+
+class Test<K, V> {
+
+  private final Iterator<? extends Foo<? extends K, ? extends V>> i = null;
+
+  public Foo<K, V> next() {
+    return new Bar<>(i.next());
+  }
+
+  interface Foo<T, K> {}
+  private static class Bar<K, V> implements Foo<K, V> {
+    Bar(Foo<? extends K, ? extends V> e) {}
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Erasure.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Erasure.java
new file mode 100644
index 0000000..0d38ade
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Erasure.java
@@ -0,0 +1,9 @@
+import java.util.Collection;
+
+abstract class NCollections {
+  public <T> void foo(Collection<? extends T> coll) {
+    bar((Collection)coll);
+  }
+
+  public abstract <T2 extends Object & Comparable<? super T2>> T2 bar(Collection<? extends T2> coll);
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA122401.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA122401.java
new file mode 100644
index 0000000..95b8efc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/IDEA122401.java
@@ -0,0 +1,26 @@
+import java.util.Comparator;
+
+class NullComparator<T> {
+  private final Comparator<T> real = null;
+  private Comparator<? super T> other;
+  private Comparator<T> another;
+
+  NullComparator(Comparator<? super T> real) {
+  }
+
+  public NullComparator<T> thenComparing() {
+    return new NullComparator<>(real == null ? other : another);
+  }
+
+  Comparator<T> a() {
+    return null;
+  }
+
+  Comparator<? super T> b() {
+    return null;
+  }
+
+  public NullComparator<T> thenComparing1() {
+    return new NullComparator<>(real == null ? a() : b());
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/InheritedWithDifferentArgsInTypeParams.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/InheritedWithDifferentArgsInTypeParams.java
index 2adff2f..a1c0d83 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/InheritedWithDifferentArgsInTypeParams.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/InheritedWithDifferentArgsInTypeParams.java
@@ -18,7 +18,7 @@
 interface IB2<T> extends IA2<T[]> {}
 
 class A2 {
-    <T extends IA2<Object[]> & IB2<?>> void foo(){}
+    <<error descr="'IA2' cannot be inherited with different type arguments: 'java.lang.Object[]' and 'capture<?>[]'"></error>T extends IA2<Object[]> & IB2<?>> void foo(){}
 }
 
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SOEInLeastUpperClass.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SOEInLeastUpperClass.java
index 70ad266..20d377a 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SOEInLeastUpperClass.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SOEInLeastUpperClass.java
@@ -7,6 +7,6 @@
     }
 
     void bar (boolean a, A a1, B b1){
-        <error descr="Incompatible types. Found: 'java.lang.Object', required: 'T'">T t = a ? a1 : b1;</error>
+        T t = a ? <error descr="Incompatible types. Found: 'A', required: 'T'">a1</error> : <error descr="Incompatible types. Found: 'B', required: 'T'">b1</error>;
     }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SuperWildcardWithBoundPromotion.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SuperWildcardWithBoundPromotion.java
similarity index 76%
rename from java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SuperWildcardWithBoundPromotion.java
rename to java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SuperWildcardWithBoundPromotion.java
index cfdc2a5..f1a5330 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/SuperWildcardWithBoundPromotion.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/SuperWildcardWithBoundPromotion.java
@@ -20,7 +20,7 @@
   }
 
   void bug1(Parametrized<? super T> param) {
-    foo(param);
+    <error descr="Inferred type 'capture<? super T>' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
   }
 
 
@@ -47,7 +47,7 @@
     }
 
     void bug1(Parametrized<? super T> param) {
-      <error descr="Inferred type 'java.io.Serializable' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
+      <error descr="Inferred type 'capture<? super T>' for type parameter 'I' is not within its bound; should extend 'java.lang.Number'">foo(param)</error>;
     }
 
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Variance.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Variance.java
index 298a33d..7556292 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Variance.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/Variance.java
@@ -142,7 +142,7 @@
     }
 
     void bar(List<? extends S1> k) {
-        f<error descr="'f(java.util.List<capture<? extends S1>>, capture<? extends S1>)' in 'S1' cannot be applied to '(java.util.List<capture<? extends S1>>, capture<? extends S1>)'">(k,  k.get(0))</error>;
+        f<error descr="'f(java.util.List<capture<? extends S1>>, capture<? extends S1>)' in 'S1' cannot be applied to '(java.util.List<capture<? extends S1>>, S1)'">(k,  k.get(0))</error>;
     }
 }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardBoundsCombination.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardBoundsCombination.java
new file mode 100644
index 0000000..d621979
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardBoundsCombination.java
@@ -0,0 +1,16 @@
+import java.util.*;
+import java.util.function.Consumer;
+
+class NachCollections<K,V> {
+  <K1, V1> Consumer<Map.Entry<K1, V1>> consumer(Consumer<Map.Entry<K1, V1>> c) {
+    return null;
+  }
+
+  public void forEach(Collection<? extends Map.Entry<K,V>> c1,
+                      Collection<? super Map.Entry<K,V>> c2,
+                      Consumer<Map.Entry<K, V>> a) {
+    c1.forEach(consumer(a));
+    c2.forEach(consumer<error descr="'consumer(java.util.function.Consumer<java.util.Map.Entry<K1,V1>>)' in 'NachCollections' cannot be applied to '(java.util.function.Consumer<java.util.Map.Entry<K,V>>)'">(a)</error>);
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardsBoundsIntersection.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardsBoundsIntersection.java
index cf8ad1c..6385fe5 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardsBoundsIntersection.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/WildcardsBoundsIntersection.java
@@ -10,6 +10,6 @@
 
 class Main {
     public static void main(NodeProperty<NumberExpression, Integer> nval,  Node<? extends NodeType> expr) {
-        int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,java.lang.Object>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
+        int val = expr.get<error descr="'get(NodeProperty<? super capture<? extends NodeType>,java.lang.Integer>)' in 'Node' cannot be applied to '(NodeProperty<NumberExpression,java.lang.Integer>)'">(nval)</error>;
     }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/DefaultMethodTouched.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/DefaultMethodTouched.java
new file mode 100644
index 0000000..3edf10d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/DefaultMethodTouched.java
@@ -0,0 +1,12 @@
+interface SAM {
+  default void <caret>foo(){}
+  void bar();
+}
+
+class Test {
+  {
+    bar(() -> {});
+  }
+  
+  void bar(SAM sam){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/DefaultMethodTouched_after.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/DefaultMethodTouched_after.java
new file mode 100644
index 0000000..b833d50
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/DefaultMethodTouched_after.java
@@ -0,0 +1,12 @@
+interface SAM {
+  default void foo(boolean b){}
+  void bar();
+}
+
+class Test {
+  {
+    bar(() -> {});
+  }
+  
+  void bar(SAM sam){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/MethodArgument.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/MethodArgument.java
new file mode 100644
index 0000000..2a28ea7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/MethodArgument.java
@@ -0,0 +1,11 @@
+interface SAM {
+  void <caret>foo();
+}
+
+class Test {
+  {
+    bar(() -> {});
+  }
+  
+  void bar(SAM sam){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/VariableDeclaration.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/VariableDeclaration.java
new file mode 100644
index 0000000..b28339f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/VariableDeclaration.java
@@ -0,0 +1,9 @@
+interface SAM {
+  void <caret>foo();
+}
+
+class Test {
+  {
+    SAM sam = () -> {};
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/FieldFromAnonymousClassScope.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/FieldFromAnonymousClassScope.java
new file mode 100644
index 0000000..db563c0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/FieldFromAnonymousClassScope.java
@@ -0,0 +1,21 @@
+import java.util.Collection;
+import java.util.Map;
+
+class Test{
+
+  public static void main(String[] args) {
+    Map<String, Collection<Integer>> myMap = null;
+
+    myMap.entrySet().stream()
+      .flatMap(entry -> entry.getValue().stream()
+        .map(val -> new Object() {
+          String key = entry.getKey();
+          Integer va<caret>lue = val;
+        }))
+      .forEachOrdered(o -> {
+        final String key = o.key;
+        final Integer value = o.value;
+        System.out.println("key: " + key + " value: " + value);
+      });
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/MethodArgument.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/MethodArgument.java
new file mode 100644
index 0000000..2fe6964
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/findUsages/MethodArgument.java
@@ -0,0 +1,11 @@
+interface SA<caret>M {
+  void foo();
+}
+
+class Test {
+  {
+    bar(() -> {});
+  }
+
+  void bar(SAM sam){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguitySpecificReturn.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguitySpecificReturn.java
index 5ecd4f5..5b9d5d7 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguitySpecificReturn.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/AmbiguitySpecificReturn.java
@@ -1,8 +1,8 @@
 class IntStream {
   private void foo(IntStream s) {
-    s.map(i -> <error descr="Operator '<<' cannot be applied to 'int', '<lambda parameter>'">1 << i</error>);
+    s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Integer>)' match">(i -> 1 << i)</error>;
     s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Integer>)' match">(i -> 1)</error>;
-    s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<T>)' match">(i -> i)</error>;
+    s.map<error descr="Ambiguous method call: both 'IntStream.map(IntUnaryOperator)' and 'IntStream.map(ObjIntFunction<Integer>)' match">(i -> i)</error>;
   }
 
   public static void main(String[] args) {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/IDEA123308.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/IDEA123308.java
new file mode 100644
index 0000000..b650fd9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/IDEA123308.java
@@ -0,0 +1,14 @@
+class Test {
+  private final int a;
+
+  public Test() {
+    a = 1;
+    run(() -> {
+      <error descr="Cannot assign a value to final variable 'a'">a</error> = 2;
+    });
+  }
+
+  public void run(Runnable r) {
+    r.run();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ReturnTypeCompatibility.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ReturnTypeCompatibility.java
index 0f7aa70..10cd3ff 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ReturnTypeCompatibility.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ReturnTypeCompatibility.java
@@ -25,7 +25,7 @@
     }
 
     public static void main(String[] args) {
-        call<error descr="Ambiguous method call: both 'ReturnTypeIncompatibility.call(I1<P>)' and 'ReturnTypeIncompatibility.call(I2<P>)' match">(i-> {return i;})</error>;
+        call<error descr="Ambiguous method call: both 'ReturnTypeIncompatibility.call(I1<Integer>)' and 'ReturnTypeIncompatibility.call(I2<P>)' match">(i-> {return i;})</error>;
     }
 }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/TypeArgsConsistency.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/TypeArgsConsistency.java
index 0c79d84..911f35c 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/TypeArgsConsistency.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/TypeArgsConsistency.java
@@ -12,7 +12,7 @@
       I<Integer> i1 = (i, j) -> i + j;
       foo((i, j) -> i + j);
       I<Integer> i2 = bar((i, j) -> i + j);
-      I<Integer> i3 = bar(<error descr="Cyclic inference">(i, j) -> "" + i + j</error>);
+      I<Integer> i3 = bar(<error descr="Incompatible return type String in lambda expression">(i, j) -> "" + i + j</error>);
     }
 }
 
@@ -43,7 +43,7 @@
         I<Integer> i1 = bar(x -> x);
         I1<Integer> i2 = bar1(x -> 1);
         I2<String> aI2 = bar2(x -> "");
-        I2<Integer> aI28 = bar2( <error descr="Cyclic inference">x-> ""</error>);
+        I2<Integer> aI28 = bar2( <error descr="Incompatible return type String in lambda expression">x-> ""</error>);
         I2<Integer> i3 = bar2(x -> x);
         I2<Integer> i4 = bar2(x -> foooI());
         System.out.println(i4.foo(2));
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA120498.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA120498.java
new file mode 100644
index 0000000..8316f9e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA120498.java
@@ -0,0 +1,11 @@
+
+interface X<T> { void m(T arg); }
+interface Y<T> { void m(T arg); }
+interface Z<T> extends X<T>, Y<T> {}
+
+class App {
+  public static void main(String[] args) {
+    Z<String> z = (String s) -> System.out.println(s);
+    z.m("Hello, world");
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA122720.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA122720.java
new file mode 100644
index 0000000..84fcdcd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA122720.java
@@ -0,0 +1,21 @@
+interface I {
+  default void f() {}
+}
+
+class P {
+  public void f() {}
+}
+
+class AP extends P implements I {
+  @Override
+  public void f() {
+    I.super.f();
+  }
+}
+
+class AC implements Cloneable {
+
+  public Object clone() throws CloneNotSupportedException {
+    return Cloneable.super.<error descr="'clone()' has protected access in 'java.lang.Object'">clone</error>();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA123839.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA123839.java
new file mode 100644
index 0000000..d79effb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/IDEA123839.java
@@ -0,0 +1,13 @@
+import java.util.Iterator;
+
+interface A4 {
+  default Iterator iterator() {
+    return null;
+  }
+}
+
+interface A5 {
+  Iterator  iterator();
+}
+
+abstract class <error descr="B inherits unrelated defaults for iterator() from types A5 and A4">B</error> implements A5, A4 {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/NotInheritFromUnrelatedDefault.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/NotInheritFromUnrelatedDefault.java
index 79f310b..9cea478 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/NotInheritFromUnrelatedDefault.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/NotInheritFromUnrelatedDefault.java
@@ -12,7 +12,7 @@
 
 class <error descr="Class 'SecondParent' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">FirstSon</error> implements FirstParent, SecondParent {}
 
-<error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class SecondSon implements SecondParent, FirstParent</error> {}
+<error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class <error descr="SecondSon inherits unrelated defaults for doSomething() from types SecondParent and FirstParent">SecondSon</error> implements SecondParent, FirstParent</error> {}
 
 interface A {
   default int foo() {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/SuperProtectedCalls.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/SuperProtectedCalls.java
new file mode 100644
index 0000000..feaf0d4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods/SuperProtectedCalls.java
@@ -0,0 +1,9 @@
+package p2;
+
+import p.*;
+
+class Test extends Foo {
+  {
+    Test.super.foo();
+  }
+} 
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/AccessModifiers.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/AccessModifiers.java
index bc235b2..cb76d74 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/AccessModifiers.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/AccessModifiers.java
@@ -25,9 +25,9 @@
     }
 
     static {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IInt'">IInt i1 = MyTest::abracadabra;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IInt'">IInt i2 = MyTest::foo;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IInt'">IInt i3 = MyTest::bar;</error>
+        IInt i1 = MyTest::<error descr="Cannot resolve method 'abracadabra'">abracadabra</error>;
+        IInt i2 = MyTest::<error descr="Cannot resolve method 'foo'">foo</error>;
+        IInt i3 = MyTest::<error descr="Cannot resolve method 'bar'">bar</error>;
         <error descr="Incompatible types. Found: '<method reference>', required: 'AlienTest.IIntInt'">IIntInt i4 = MyTest::bar;</error>
         IInt i5 = <error descr="Non-static method cannot be referenced from a static context">MyTest::baz</error>;
         IInt i6 = <error descr="'foo(int)' is not public in 'MyTest.Foo'. Cannot be accessed from outside package">MyTest.foo::foo</error>;
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Ambiguity.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Ambiguity.java
index c7f2194..475ae43 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Ambiguity.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Ambiguity.java
@@ -54,7 +54,7 @@
     }
 
     {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'todelete.MyTest1.Bar1'">Bar1 b1 = MyTest2 :: foo;</error>
+        Bar1 b1 = MyTest2 :: <error descr="Cannot resolve method 'foo'">foo</error>;
         bar(MyTest1 :: foo);
     }
 }
@@ -80,7 +80,7 @@
     }*/
 
     {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'todelete.MyTest2.Bar1'">Bar1 b1 = MyTest2 :: foo;</error>
+        Bar1 b1 = MyTest2 :: <error descr="Cannot resolve method 'foo'">foo</error>;
         bar(MyTest2 :: foo);
     }
 }
@@ -106,8 +106,8 @@
     }
 
     {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'todelete.MyTest3.Bar1'">Bar1 b1 = MyTest2 :: foo;</error>
-        bar<error descr="'bar(todelete.MyTest3.Bar2)' in 'todelete.MyTest3' cannot be applied to '(<method reference>)'">(MyTest3 :: foo)</error>;
+        Bar1 b1 = MyTest2 :: <error descr="Cannot resolve method 'foo'">foo</error>;
+        bar(MyTest3 :: <error descr="Cannot resolve method 'foo'">foo</error>);
     }
 }
 
@@ -129,7 +129,7 @@
     }
 
     {
-         bar<error descr="'bar(todelete.MyTest4.Bar1)' in 'todelete.MyTest4' cannot be applied to '(<method reference>)'">(MyTest4:: foo)</error>;
+         bar(MyTest4:: <error descr="Cannot resolve method 'foo'">foo</error>);
     }
 }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Assignability.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Assignability.java
index 6b8d1fb..a5dbcd0 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Assignability.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Assignability.java
@@ -1,8 +1,8 @@
 class Test {
   {
-      <error descr="Incompatible types. Found: '<method reference>', required: 'java.lang.Runnable'">Runnable b = Test :: length;</error>
+      Runnable b = Test :: <error descr="Cannot resolve method 'length'">length</error>;
       Comparable<String> c = Test :: length;
-      <error descr="Incompatible types. Found: '<method reference>', required: 'java.lang.Comparable<java.lang.Integer>'">Comparable<Integer> c1 =  Test :: length;</error>
+      Comparable<Integer> c1 =  Test :: <error descr="Cannot resolve method 'length'">length</error>;
   }
 
   public static Integer length(String s) {
@@ -16,7 +16,7 @@
 
 class Test1 {
     {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'java.lang.Runnable'">Runnable b = Test1 :: length;</error>
+        Runnable b = Test1 :: <error descr="Cannot resolve method 'length'">length</error>;
         Comparable<String> c = Test1 :: length;
         Comparable<Integer> c1 =  Test1 :: length;
     }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefInnerFromSuper.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefInnerFromSuper.java
index 7c3bff9..145823f 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefInnerFromSuper.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefInnerFromSuper.java
@@ -13,7 +13,7 @@
         }
 
         void test() {
-            <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.Child.I'">I var = Child.Inner::new;</error>
+            I var = Child.Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
         }
     }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefs.java
index c9cb53a..1b0893c 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefs.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefs.java
@@ -70,8 +70,8 @@
     static void test(I<Integer> s) {   }
 
     public static void main(String[] args) {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest3.I<java.lang.Integer>'">I<Integer> s = MyTest3<String>::new;</error>
-        test<error descr="'test(MyTest3.I<java.lang.Integer>)' in 'MyTest3' cannot be applied to '(<method reference>)'">(MyTest3<String>::new)</error>;
+        I<Integer> s = MyTest3<String>::<error descr="Cannot resolve constructor 'MyTest3'">new</error>;
+        test(MyTest3<String>::<error descr="Cannot resolve constructor 'MyTest3'">new</error>);
     }
 }
 
@@ -99,6 +99,6 @@
     interface I {
       A foo();
     }
-    <error descr="Incompatible types. Found: '<method reference>', required: 'MyTestInvalidQ.A.I'">I i = A :: new;</error>
+    I i = <error descr="'A' is abstract; cannot be instantiated">A :: new</error>;
   }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefsInnerClasses.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefsInnerClasses.java
index 99337ff..887a776 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefsInnerClasses.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ConstructorRefsInnerClasses.java
@@ -88,11 +88,11 @@
 
 
   static {
-     <error descr="Incompatible types. Found: '<method reference>', required: 'StaticInner2.I1'">I1 i1 = StaticInner2.Inner :: new;</error>
+     I1 i1 = StaticInner2.Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
   }
 
   {
-     <error descr="Incompatible types. Found: '<method reference>', required: 'StaticInner2.I1'">I1 i1 = StaticInner2.Inner :: new;</error>
+     I1 i1 = StaticInner2.Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
   }
 }
 
@@ -109,11 +109,11 @@
 
 
   static {
-     <error descr="Incompatible types. Found: '<method reference>', required: 'NonStaticInner2.I1'">I1 i1 = NonStaticInner2.Inner :: new;</error>
+     I1 i1 = NonStaticInner2.Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
   }
 
   {
-     <error descr="Incompatible types. Found: '<method reference>', required: 'NonStaticInner2.I1'">I1 i1 = NonStaticInner2.Inner :: new;</error>
+     I1 i1 = NonStaticInner2.Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
   }
 }
 
@@ -145,7 +145,7 @@
     }
 
     {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'NonStaticInner3.I3<NonStaticInner3.Foo>'">I3<Foo> b1 = Foo::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'NonStaticInner3.I4<NonStaticInner3.Foo>'">I4<Foo> b2 = Foo::new;</error>
+        I3<Foo> b1 = Foo::<error descr="Cannot resolve constructor 'Foo'">new</error>;
+        I4<Foo> b2 = Foo::<error descr="Cannot resolve constructor 'Foo'">new</error>;
     }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/DefaultConstructor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/DefaultConstructor.java
index 2534997..53cd638 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/DefaultConstructor.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/DefaultConstructor.java
@@ -13,25 +13,25 @@
         }
         
         static void test1() {
-            <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,DefaultConstructor.Outer>'">I2<Inner, Outer> i2 = Inner :: new;</error>
-            <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,java.lang.String>'">I2<Inner, String> i2str = Inner :: new;</error>
+            I2<Inner, Outer> i2 = Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
+            I2<Inner, String> i2str = Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
         }
         
         void test2() {
             I1<Inner> i1 = Inner :: new;
             <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I1<java.lang.Integer>'">I1<Integer> i1Int = Inner :: new;</error>
-            <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,DefaultConstructor.Outer>'">I2<Inner, Outer> i2 =  Inner :: new;</error>
+            I2<Inner, Outer> i2 =  Inner :: <error descr="Cannot resolve constructor 'Inner'">new</error>;
         }
     }
     
     static void test1() {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,DefaultConstructor.Outer>'">I2<Outer.Inner, Outer> i2 = Outer.Inner::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,java.lang.String>'">I2<Outer.Inner, String> i2str = Outer.Inner::new;</error>
+        I2<Outer.Inner, Outer> i2 = Outer.Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
+        I2<Outer.Inner, String> i2str = Outer.Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
     }
     
     void test2() {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,DefaultConstructor.Outer>'">I2<Outer.Inner, Outer> i2 = Outer.Inner::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor.I2<DefaultConstructor.Outer.Inner,java.lang.String>'">I2<Outer.Inner, String> i2str = Outer.Inner::new;</error>
+        I2<Outer.Inner, Outer> i2 = Outer.Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
+        I2<Outer.Inner, String> i2str = Outer.Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
     }
 }
 
@@ -52,7 +52,7 @@
 
 
     void f() {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor2.I'">I i1 = DefaultConstructor2 :: new;</error>
+        I i1 = DefaultConstructor2 :: <error descr="Cannot resolve constructor 'DefaultConstructor2'">new</error>;
         I i2 = <error descr="Cannot find class this">this</error>::new;
     }
 }
@@ -61,7 +61,7 @@
    public class Inner {}
    public static class StaticInner {}
    
-   static <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor3.I'">I i = Inner::new;</error>
+   static I i = Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
    static I1 i1 = StaticInner::new;
    interface I {
      Inner foo();
@@ -76,8 +76,8 @@
    public class Inner {}
    public static class StaticInner {}
    
-   static <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor4.I'">I i = Inner::new;</error>
-   static <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor4.I1'">I1 i1 = StaticInner::new;</error>
+   static I i = Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
+   static I1 i1 = StaticInner::<error descr="Cannot resolve constructor 'StaticInner'">new</error>;
    interface I {
      Inner foo(DefaultConstructor4 receiver);
    }
@@ -91,7 +91,7 @@
     public class Inner {}
 
     static void test() {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'DefaultConstructor5.I'">I i = Inner::new;</error>
+        I i = Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;
     }
 
     void test1() {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ExprReceiver.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ExprReceiver.java
index f3bc8d4..632f83b 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ExprReceiver.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/ExprReceiver.java
@@ -5,7 +5,7 @@
     }
     {
         A a = new A();
-        <error descr="Incompatible types. Found: '<method reference>', required: 'ThreadExample.Function<? super ThreadExample.A,? extends java.lang.String>'">Function<? super A,? extends String> foo = a::foo;</error>
+        Function<? super A,? extends String> foo = a::<error descr="Cannot resolve method 'foo'">foo</error>;
     }
 
     static class A {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefAcceptance.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefAcceptance.java
index 315a8e0..75f049f 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefAcceptance.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefAcceptance.java
@@ -22,20 +22,20 @@
     void foo(IFactory cf) { }
 
     void testAssign() {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'Test.IFactory'">IFactory c1 = Anno::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'Test.IFactory'">IFactory c2 = E::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'Test.IFactory'">IFactory c3 = I::new;</error>
+        IFactory c1 = <error descr="'Anno' is abstract; cannot be instantiated">Anno::new</error>;
+        IFactory c2 = <error descr="Enum types cannot be instantiated">E::new</error>;
+        IFactory c3 = <error descr="'I' is abstract; cannot be instantiated">I::new</error>;
         IFactory c4 = <error descr="Unexpected wildcard">Foo<?></error>::new;
         IFactory c5 = <error descr="Cannot find class 1">1</error>::new;
-        <error descr="Incompatible types. Found: '<method reference>', required: 'Test.IFactory'">IFactory c6 = ABar::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'Test.IFactory'">IFactory c7 = ABaz::new;</error>
+        IFactory c6 = <error descr="'ABar' is abstract; cannot be instantiated">ABar::new</error>;
+        IFactory c7 = <error descr="'ABaz' is abstract; cannot be instantiated">ABaz::new</error>;
 
-        foo<error descr="'foo(Test.IFactory)' in 'Test' cannot be applied to '(<method reference>)'">(Anno::new)</error>;
-        foo<error descr="'foo(Test.IFactory)' in 'Test' cannot be applied to '(<method reference>)'">(E::new)</error>;
-        foo<error descr="'foo(Test.IFactory)' in 'Test' cannot be applied to '(<method reference>)'">(I::new)</error>;
+        foo(<error descr="'Anno' is abstract; cannot be instantiated">Anno::new</error>);
+        foo(<error descr="Enum types cannot be instantiated">E::new</error>);
+        foo(<error descr="'I' is abstract; cannot be instantiated">I::new</error>);
         foo(<error descr="Unexpected wildcard">Foo<?></error>::new);
         foo(<error descr="Cannot find class 1">1</error>::new);
-        foo<error descr="'foo(Test.IFactory)' in 'Test' cannot be applied to '(<method reference>)'">(ABar::new)</error>;
-        foo<error descr="'foo(Test.IFactory)' in 'Test' cannot be applied to '(<method reference>)'">(ABaz::new)</error>;
+        foo(<error descr="'ABar' is abstract; cannot be instantiated">ABar::new</error>);
+        foo(<error descr="'ABaz' is abstract; cannot be instantiated">ABaz::new</error>);
     }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefMisc1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefMisc1.java
index bd9c9ca..14b9a2b 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefMisc1.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/MethodRefMisc1.java
@@ -144,10 +144,10 @@
     enum E { }
     
     void test() {
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest7.I'">I s1 = A::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest7.I'">I s2 = I::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest7.I'">I s3 = AC::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest7.I'">I s4 = E::new;</error>
+        I s1 = <error descr="'A' is abstract; cannot be instantiated">A::new</error>;
+        I s2 = <error descr="'I' is abstract; cannot be instantiated">I::new</error>;
+        I s3 = <error descr="'AC' is abstract; cannot be instantiated">AC::new</error>;
+        I s4 = <error descr="Enum types cannot be instantiated">E::new</error>;
     }
 }
 
@@ -165,7 +165,7 @@
         }
 
         void test() {
-            <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest8.Sub.I'">I var = Sub.Inner::new;</error>;
+            I var = Sub.Inner::<error descr="Cannot resolve constructor 'Inner'">new</error>;;
         }
     }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/QualifierTypeArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/QualifierTypeArgs.java
index 7c1e04f..f88c5bf 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/QualifierTypeArgs.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/QualifierTypeArgs.java
@@ -12,7 +12,7 @@
 
     {
       I i = Foo<String> :: foo;
-      <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I'">I i1 = Foo<Integer> :: foo;</error>
+      I i1 = Foo<Integer> :: <error descr="Cannot resolve method 'foo'">foo</error>;
     }
   }
 }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/RefOnArrayDeclaration.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/RefOnArrayDeclaration.java
index ed1efe8..f11a6de 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/RefOnArrayDeclaration.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/RefOnArrayDeclaration.java
@@ -34,7 +34,7 @@
         Cln s =  int[]::clone;
         IA a =  int[]::new;
         <error descr="Incompatible types. Found: '<method reference>', required: 'OnArrayTest.I'">I i = int[]::new;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'OnArrayTest.Len<java.lang.String>'">Len<String> strLen = String[]::length;</error>
+        Len<String> strLen = String[]::<error descr="Cannot resolve method 'length'">length</error>;
         ToStr<Integer> toStr = Integer[]::toString;
 
         ArrayReturnType<String[]> a1 = String[]::new;
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Varargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Varargs.java
index e521df2..db0dd15 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Varargs.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/Varargs.java
@@ -48,27 +48,27 @@
 
     static {
         I1 i1 = MyTest::static_1;
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i2 = MyTest::static_2;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i3 = MyTest::static_3;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i4 = MyTest::static_4;</error>
+        I1 i2 = MyTest::<error descr="Cannot resolve method 'static_2'">static_2</error>;
+        I1 i3 = MyTest::<error descr="Cannot resolve method 'static_3'">static_3</error>;
+        I1 i4 = MyTest::<error descr="Cannot resolve method 'static_4'">static_4</error>;
     }
 
 
     {
         I1 i_1 = <error descr="Non-static method cannot be referenced from a static context">MyTest::_1</error>;
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i_2 = MyTest::_2;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i_3 = MyTest::_3;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i_4 = MyTest::_4;</error>
+        I1 i_2 = MyTest::<error descr="Cannot resolve method '_2'">_2</error>;
+        I1 i_3 = MyTest::<error descr="Cannot resolve method '_3'">_3</error>;
+        I1 i_4 = MyTest::<error descr="Cannot resolve method '_4'">_4</error>;
 
         I1 i1 = this::_1;
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i2 = this::_2;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i3 = this::_3;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I1'">I1 i4 = this::_4;</error>
+        I1 i2 = this::<error descr="Cannot resolve method '_2'">_2</error>;
+        I1 i3 = this::<error descr="Cannot resolve method '_3'">_3</error>;
+        I1 i4 = this::<error descr="Cannot resolve method '_4'">_4</error>;
 
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I2'">I2 i21 = MyTest::m1;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I2'">I2 i22 = MyTest::m2;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I2'">I2 i23 = MyTest::m3;</error>
-        <error descr="Incompatible types. Found: '<method reference>', required: 'MyTest.I2'">I2 i24 = MyTest::m4;</error>
+        I2 i21 = MyTest::<error descr="Cannot resolve method 'm1'">m1</error>;
+        I2 i22 = MyTest::<error descr="Cannot resolve method 'm2'">m2</error>;
+        I2 i23 = MyTest::<error descr="Cannot resolve method 'm3'">m3</error>;
+        I2 i24 = MyTest::<error descr="Cannot resolve method 'm4'">m4</error>;
     }
 }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/VarargsInReceiverPosition.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/VarargsInReceiverPosition.java
index cf2151d..b34634c 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/VarargsInReceiverPosition.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/methodRef/VarargsInReceiverPosition.java
@@ -4,7 +4,7 @@
     void test() {
         Comparator<Test> r2 = Test::yyy;
         Comparator1<Test> c1 = <error descr="Non-static method cannot be referenced from a static context">Test::yyy</error>;
-        <error descr="Incompatible types. Found: '<method reference>', required: 'Comparator1<Test>'">Comparator1<Test> c2 = Test::xxx;</error>
+        Comparator1<Test> c2 = Test::<error descr="Cannot resolve method 'xxx'">xxx</error>;
     }
     int yyy(Test... p) { return 1; }
     int xxx(Test t) {return 42;}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA123352.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA123352.java
new file mode 100644
index 0000000..77f04cb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/IDEA123352.java
@@ -0,0 +1,19 @@
+import java.util.*;
+
+class Test {
+  class Predicate<T> {
+    private <<warning descr="Type parameter 'S' is never used">S</warning> extends T> boolean test(final Collection<T> src) {
+      System.out.println(src);
+      return true;
+    }
+    private <<warning descr="Type parameter 'S' is never used">S</warning> extends T> boolean <warning descr="Private method 'test(java.lang.Iterable<T>)' is never used">test</warning>(final Iterable<T> iterable) {
+      System.out.println(iterable);
+      return false;
+    }
+  }
+
+  public void testPredicate() {
+    final Predicate<Integer> predicate = new Predicate<>();
+    predicate.test(new ArrayList<Integer>());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/JDK8034223.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/JDK8034223.java
new file mode 100644
index 0000000..e5469ab
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/JDK8034223.java
@@ -0,0 +1,18 @@
+class MS {
+  interface GetInt { int get(); }
+  interface GetInteger { Integer get(); }
+
+  private void m(GetInt getter) {
+    System.out.println(getter);
+  }
+
+  private void m(GetInteger getter) {
+    System.out.println(getter);
+  }
+
+  void test(boolean cond) {
+    m(cond ? () -> 26 : () -> 24);
+    m<error descr="Cannot resolve method 'm(?)'">(cond ? () -> 26 : () -> new Integer(42))</error>;
+    m(cond ? () -> new Integer(26) : () -> new Integer(42));
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/RelatedSAMErasures.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/RelatedSAMErasures.java
new file mode 100644
index 0000000..e2ac37c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/mostSpecific/RelatedSAMErasures.java
@@ -0,0 +1,53 @@
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+
+class Test {
+  interface RunnableX extends Callable<String> {
+    void run() throws Exception;
+
+    default String call() throws Exception
+    {
+      run();
+      return null;
+    }
+  }
+
+  static void foo(RunnableX r){
+    System.out.println(r);
+  }
+  static void foo(Callable<List<?>> c){
+    System.out.println(c);
+  }
+
+  public void test() {
+    foo<error descr="Ambiguous method call: both 'Test.foo(RunnableX)' and 'Test.foo(Callable<List<?>>)' match">(()->  new ArrayList<Void>() )</error>;
+  }
+
+}
+
+class Test1 {
+  interface RunnableX extends Callable<List<?>> {
+    void run() throws Exception;
+
+    default List<?> call() throws Exception
+    {
+      run();
+      return null;
+    }
+  }
+
+  static void foo(RunnableX r){
+    System.out.println(r);
+  }
+  static void foo(Callable<List<?>> c){
+    System.out.println(c);
+  }
+
+  public void test() {
+    foo(()->  new ArrayList<Void>() );
+  }
+
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/AdditionalConstraintDependsOnNonMentionedVars.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/AdditionalConstraintDependsOnNonMentionedVars.java
new file mode 100644
index 0000000..9bf687c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/AdditionalConstraintDependsOnNonMentionedVars.java
@@ -0,0 +1,13 @@
+import java.util.function.Function;
+
+abstract class Test {
+  abstract <T, A, R> Collector<T, A, R> create(Foo<A> foo, Function<A,R> fun);
+  abstract <Ts> Foo<Ts[]> toArray(Ts identity);
+
+  <Tf> Collector<Tf, ?, Tf> foo(Tf t) {
+    return create(toArray(t), a -> a[0]);
+  }
+
+  interface Collector<T1, A1, R1> {}
+  class Foo<D> {}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119003.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119003.java
new file mode 100644
index 0000000..f56af02
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119003.java
@@ -0,0 +1,84 @@
+package problems;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+
+import static java.util.stream.Collectors.*;
+
+class Test {
+
+  enum CaloricLevel { DIET, NORMAL, FAT }
+
+  public static void main(String[] args) {
+    List<Dish> menu = Arrays.asList(
+      new Dish("pork", false, 800, Dish.Type.MEAT),
+      new Dish("beef", false, 700, Dish.Type.MEAT),
+      new Dish("chicken", false, 400, Dish.Type.MEAT),
+      new Dish("french fries", true, 530, Dish.Type.OTHER),
+      new Dish("rice", true, 350, Dish.Type.OTHER),
+      new Dish("season fruit", true, 120, Dish.Type.OTHER),
+      new Dish("pizza", true, 550, Dish.Type.OTHER),
+      new Dish("prawns", false, 400, Dish.Type.FISH),
+      new Dish("salmon", false, 450, Dish.Type.FISH)
+    );
+
+    System.out.println(
+      menu.stream().collect(reducing(0, Dish::getCalories, (Integer i, Integer j) -> i + j))
+    );
+
+    System.out.println(
+      menu.stream().collect(
+        groupingBy(Dish::getType, mapping(
+          dish -> { if (dish.getCalories() <= 400) return CaloricLevel.DIET;
+          else if (dish.getCalories() <= 700) return CaloricLevel.NORMAL;
+          else return CaloricLevel.FAT; },
+          toSet())))
+    );
+
+    System.out.println(
+      menu.stream().collect(
+        groupingBy(Dish::getType,
+                   collectingAndThen(
+                     reducing((d1, d2) -> d1.getCalories() > d2.getCalories() ? d1 : d2),
+                     Optional::get)))
+    );
+  }
+}
+
+class Dish {
+  private final String name;
+  private final boolean vegetarian;
+  private final int calories;
+  private final Type type;
+
+  public Dish(String name, boolean vegetarian, int calories, Type type) {
+    this.name = name;
+    this.vegetarian = vegetarian;
+    this.calories = calories;
+    this.type = type;
+  }
+
+  public String getName() {
+    return name;
+  }
+
+  public boolean isVegetarian() {
+    return vegetarian;
+  }
+
+  public int getCalories() {
+    return calories;
+  }
+
+  public Type getType() {
+    return type;
+  }
+
+  public enum Type { MEAT, FISH, OTHER }
+
+  @Override
+  public String toString() {
+    return name;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119535.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119535.java
index 9c88330..414b2bd 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119535.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA119535.java
@@ -1,3 +1,4 @@
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -5,6 +6,8 @@
 import java.util.function.Function;
 import java.util.stream.Collector;
 
+import static java.util.stream.Collectors.*;
+
 class Stuff {
   public enum Type { A }
   private final int value;
@@ -41,4 +44,31 @@
                                         Collector<? super T, A, D> downstream) {
     return null;
   }
+}
+
+class FakeErrorsComplete {
+  public static List<Stuff> elems(){
+    return Arrays.asList(
+      new Stuff(800, Stuff.Type.A));
+  }
+
+  public static void main(String ... args){
+
+    Map<Stuff.Type, Optional<Stuff>> bar =
+      elems()
+        .stream()
+        .collect(groupingBy(Stuff::getType,
+                            reducing((d1, d2) -> d1.getValue() > d2.getValue() ? d1 : d2)));
+
+    System.out.println(bar);
+
+    Map<Stuff.Type, Stuff> baz =
+      elems()
+        .stream()
+        .collect(groupingBy(Stuff::getType,
+                            collectingAndThen(reducing((Stuff d1, Stuff d2) -> d1.getValue() > d2.getValue() ? d1 : d2),
+                                              Optional::get)));
+
+    System.out.println(baz);
+  }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122074.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122074.java
new file mode 100644
index 0000000..02cdd6c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122074.java
@@ -0,0 +1,15 @@
+class CyclicInferenceBug {
+  interface Func1<T1, R> {
+    R apply(T1 v1);
+    void other();
+  }
+  interface F1<T1, R> extends Func1<T1, R> {
+    default void other() {}
+  }
+
+  <T1, R> Func1<T1, R> func(F1<T1, R> f1) { return f1; }
+
+  void test() {
+    Func1<String, String> f1 = func(s -> s);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122084.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122084.java
new file mode 100644
index 0000000..1995793
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122084.java
@@ -0,0 +1,18 @@
+class InferenceFailBug {
+  interface Func1<T1, R> {
+    R apply(T1 v1);
+    void other();
+  }
+  interface F1<T1, R> extends Func1<T1, R> {
+    default void other() {}
+  }
+
+  <T1, R> Func1<T1, R> func(F1<T1, R> f1) { return f1; }
+
+  interface Future<T> {
+    <R> Future<R> map(Func1<T, R> f1);
+  }
+  private Future<Integer> futureExample(Future<String> future) {
+    return future.map(func(s -> s.toUpperCase())).map(func(s -> s.length()));
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122406.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122406.java
new file mode 100644
index 0000000..2d350a8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122406.java
@@ -0,0 +1,41 @@
+import java.util.*;
+import java.util.function.Predicate;
+
+abstract class Test {
+  public long countTweetsLongerThan(int numberOfChars, final List<String> tweetList) {
+    //numberOfChars = 100; //TODO uncomment to show it must be effectively final
+
+    long totalByFor = 0;
+    for (String tweet : tweetList) {
+      if (tweet.length() > numberOfChars) {
+        totalByFor++;
+      }
+    }
+
+    final ArrayList<String> guavaList = newArrayList(filter(tweetList, new Predicate<String>() {
+      @Override
+      public boolean test(String tweet) {
+        return false;
+      }
+    }));
+    final long totalFromGuava = guavaList.size();
+
+
+    final long totalFromLambda = tweetList.stream()
+      .filter(t -> t.length() > numberOfChars)
+      .count();
+
+    if (totalByFor != totalFromLambda | totalByFor != totalFromGuava) {
+      throw new RuntimeException("");
+    }
+    return totalFromLambda;
+  }
+
+  abstract <E> ArrayList<E> newArrayList(Iterable<? extends E> elements);
+  abstract <E> ArrayList<E> newArrayList();
+  abstract <E> ArrayList<E> newArrayList(E... elements);
+
+  abstract <T> Iterable<T> filter(Iterable<T> unfiltered, Predicate<? super T> predicate);
+  abstract <T> Iterable<T> filter(Iterable<?> unfiltered, Class<T> type);
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122616.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122616.java
new file mode 100644
index 0000000..5963ad3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122616.java
@@ -0,0 +1,18 @@
+import java.util.function.Function;
+
+class ChoiceBox<T> {
+  static {
+    ChoiceBox<Item> confParamField1 = new ChoiceBox<>("", p -> p.getName());
+    ChoiceBox<Item> confParamField2 = new ChoiceBox<Item>("", p -> p.getName());
+  }
+
+  public ChoiceBox(T... options) {}
+
+  public ChoiceBox(String caption, Function<T, String> itemCaption) {}
+
+  public static class Item {
+    public String getName() {
+      return null;
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122700.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122700.java
new file mode 100644
index 0000000..03b0dec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA122700.java
@@ -0,0 +1,26 @@
+class Test {
+  class Event {}
+  class KeyEvent extends Event {
+    int getCode() {
+      return 0;
+    }
+  }
+  interface EventListener<T extends Event> {
+    void handle(T event);
+  }
+
+  class EventType<T extends Event>{}
+  static final EventType<KeyEvent> KEY_PRESSED = null;
+
+  {
+    addEventHandler(KEY_PRESSED, keyEvent -> {
+      int i = keyEvent.getCode();
+    });
+
+  }
+
+
+
+  public final <T extends Event> void addEventHandler(final EventType<T> eventType, final EventListener<? super T> listener) {}
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123731.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123731.java
new file mode 100644
index 0000000..f5a0b63
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123731.java
@@ -0,0 +1,21 @@
+import java.util.Collection;
+import java.util.Map;
+
+class Test{
+
+  public static void main(String[] args) {
+    Map<String, Collection<Integer>> myMap = null;
+
+    myMap.entrySet().stream()
+      .flatMap(entry -> entry.getValue().stream()
+        .map(val -> new Object() {
+          String key = entry.getKey();
+          Integer value = val;
+        }))
+      .forEachOrdered(o -> {
+        final String key = o.key;
+        final Integer value = o.value;
+        System.out.println("key: " + key + " value: " + value);
+      });
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123848.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123848.java
new file mode 100644
index 0000000..0d1cec6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123848.java
@@ -0,0 +1,27 @@
+import java.util.*;
+
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.mapping;
+import static java.util.stream.Collectors.toList;
+
+class Test {
+
+  private static void run() {
+    List<R> list = Arrays.asList(new R());
+
+    System.out.println(
+      list.stream()
+        .collect(groupingBy(r -> r.get(String.class), mapping(r -> r.get(String.class),toList())
+        ))
+    );
+  }
+
+  static class R {
+    <T> T get(Class<T> clazz) {
+      if (clazz == String.class)
+        return (T) "string";
+
+      throw new IllegalArgumentException();
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123869.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123869.java
new file mode 100644
index 0000000..14318d3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA123869.java
@@ -0,0 +1,19 @@
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Set;
+
+class Test {
+
+  {
+    Map<String, ? extends Set<Integer>> myMap = null;
+
+    myMap.entrySet().parallelStream()
+      .map(it -> {
+        final ArrayList<Integer> myList = newArrayList(it.getValue());
+        return myList.size();
+      })
+      .forEach(System.out::println);
+  }
+  
+  public static <E> ArrayList<E> newArrayList(Iterable<? extends E> elements) { return null; }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedCallsInsideLambdaReturnExpression.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedCallsInsideLambdaReturnExpression.java
new file mode 100644
index 0000000..b8db3c4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/NestedCallsInsideLambdaReturnExpression.java
@@ -0,0 +1,59 @@
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+abstract class Play {
+  public void main(Stream<String> stream, Stream<String> anotherStream) {
+    Stream<String> stringStream = stream.map(o -> foo(i -> "")).flatMap(l -> l);
+  }
+
+  abstract <RF > Stream<RF> foo(Function<Integer, ? extends RF> mapper);
+
+  static int foo() {
+    return 6;
+  }
+}
+
+
+
+class SimplePlay {
+  {
+    foo(y -> bar(x ->  "")).substring(0);
+  }
+
+  interface Res<R> {
+    R apply(String s);
+  }
+
+  <T> T foo(Res<T> f) {return null;}
+  <K> K bar(Res<K> f) {return null;}
+}
+
+class Test19 {
+  interface Seq<E> extends Iterable<E> {
+    static <E> Seq<E> of(Iterable<? extends E> source) {
+      return null;
+    }
+
+    <R> Seq<R> map(Function<? super E, ? extends R> mapper);
+    <R, V> Seq<R> zip(BiFunction<? super E, ? super V, ? extends R> zipper, Seq<V> other);
+  }
+
+  interface S extends Seq<String> {
+    static S copyOf(Iterable<String> source) {
+      return null;
+    }
+  }
+
+  interface D extends S {
+
+  }
+
+  void test(Seq<D> dseq) {
+    BiFunction<D, List<Integer>, Seq<S>> f =
+      (d, nums) -> dseq.map(s -> s.zip((text, num) -> text + num, Seq.of(nums)))
+        .map(s -> S.copyOf(s));
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AfterDistinctOps.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AfterDistinctOps.java
index c2ee24b..ee24b8c 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AfterDistinctOps.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AfterDistinctOps.java
@@ -77,7 +77,7 @@
     public boolean add(E e) {
         return true;
     }
-    public boolean addAll(Collection<? extends E> <warning descr="Parameter 'c' is never used">c</warning>) {
+    public boolean addAll(Collection<? extends E> c) {
         boolean modified = false;
         return modified;
     }
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AssertNumberOfParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AssertNumberOfParameters.java
index 77c6700..9449054 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AssertNumberOfParameters.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/AssertNumberOfParameters.java
@@ -10,6 +10,6 @@
     <T> void bar(I i) {}
 
     void test() {
-        bar<error descr="'bar(Test.I)' in 'Test' cannot be applied to '(<method reference>)'">(Foo::foo)</error>;
+        bar(Foo::<error descr="Cannot resolve method 'foo'">foo</error>);
     }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/FromReferenceWithTypeArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/FromReferenceWithTypeArgs.java
new file mode 100644
index 0000000..df39491
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/FromReferenceWithTypeArgs.java
@@ -0,0 +1,17 @@
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class Box<T>
+{
+  public T getValue()
+  {
+    return null;
+  }
+
+  void f(Stream<Box<String>> stream) {
+    List<String> l3 = stream
+      .map(Box<String>::getValue)
+      .collect(Collectors.toList());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/GenericArrayCreation.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/GenericArrayCreation.java
index f985da2..ad3ed71 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/GenericArrayCreation.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/GenericArrayCreation.java
@@ -6,11 +6,11 @@
         Test m(List<Integer> l1, List<Integer> l2);
     }
 
-    static Test meth(List<Integer>... <warning descr="Parameter 'lli' is never used">lli</warning>) {
+    static Test meth(List<Integer>... lli) {
         return null;
     }
 
-    Test(List<Integer>... <warning descr="Parameter 'lli' is never used">lli</warning>) {}
+    Test(List<Integer>... lli) {}
 
     {
         I <warning descr="Variable 'i1' is never used">i1</warning> = <warning descr="Unchecked generics array creation for varargs parameter">Test::meth</warning>;
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA112191.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA112191.java
new file mode 100644
index 0000000..273107e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA112191.java
@@ -0,0 +1,15 @@
+import java.util.function.ToIntFunction;
+class Test {
+  {
+    fooBar(String::length);
+  }
+
+  class Foo<K> {
+    Foo<K> then() {
+      return null;
+    }
+  }
+  static <T> Foo<T> fooBar(ToIntFunction<? super T> keyExtractor) {
+    return null;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122018comment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122018comment.java
new file mode 100644
index 0000000..ca9bf69
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122018comment.java
@@ -0,0 +1,20 @@
+import java.util.List;
+import java.util.function.Function;
+class Base {
+
+  interface Seq<Eq> extends Iterable<Eq> {
+    static <E> Seq<E> of(Iterable<? extends E> source) {
+      return null;
+    }
+
+    <R> Seq<R> map(Function<? super Eq, ? extends R> mapper);
+  }
+
+}
+
+class Test3 extends Base {
+
+  void test4(Seq<List<String>> map) {
+    Seq<Seq<String>> mapped = map.map(Seq::of);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122100.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122100.java
new file mode 100644
index 0000000..e6b44e4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122100.java
@@ -0,0 +1,20 @@
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+
+class InferenceExample<E> {
+  public <Output> List<Output> convertAll(Function<E, Output> converter) {
+    return invoke (MyArrayList::convertAll, converter);
+  }
+
+  protected <A, R> R invoke(BiFunction<MyArrayList<E>, A, R> action, A arg) {
+    return null;
+  }
+
+  public class MyArrayList<T> extends ArrayList<T> {
+    public <Output1> List<Output1> convertAll(Function<T,  Output1> converter) {
+      return null;
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122509.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122509.java
new file mode 100644
index 0000000..7ed7987
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122509.java
@@ -0,0 +1,19 @@
+import java.util.Arrays;
+import java.util.List;
+
+class ListComprehensionSample {
+  public static void main(String[] args) {
+    new ListComprehensionSample().run();
+  }
+
+  interface Function1<ResultType, ParameterType1> {
+    ResultType invoke(ParameterType1 parameter1);
+  }
+
+  private void run() {
+    Function1<Integer, String> stringToInt = Integer::parseInt;
+    Function1<Double, Integer> intToPercent = i -> i / 100.0;
+    List<String> values = Arrays.asList("12", "23", "34", "45", "56", "67", "78", "89");
+    values.stream().map(stringToInt::invoke).map(intToPercent::invoke).forEach(System.out::println);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122681.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122681.java
new file mode 100644
index 0000000..562f03d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA122681.java
@@ -0,0 +1,21 @@
+import java.util.Set;
+import java.util.function.Supplier;
+
+class IDEA122681 {
+  private static <E> Set<E> getSet(E element) {
+    return null;
+  }
+
+  private static <T> T getObject(Supplier<T> supplier) {
+    return null;
+  }
+
+  private static Object getObjectFromString(String string) {
+    return null;
+  }
+
+  private static void callGetSet() {
+    getSet(getObjectFromString(getObject(String ::new)));
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123223.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123223.java
new file mode 100644
index 0000000..becb426
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123223.java
@@ -0,0 +1,31 @@
+import java.util.List;
+import java.util.function.Function;
+
+class FluTr<K> {
+
+  class Group {
+    List<Authority> getAuthorities() {
+      return null;
+    }
+  }
+
+  class Authority {
+    String getPermission() {
+      return null;
+    }
+  }
+
+  public void filterForPermission(final String permission) {
+    transformAndConcat(Group::getAuthorities)
+      .transform(Authority::getPermission)
+      .contains(permission);
+  }
+
+  boolean contains(String f) {
+    return false;
+  }
+
+  public final <T> FluTr<T> transform(Function<? super K,T> function) { return null; }
+  public <T> FluTr<T> transformAndConcat(Function<? super Group,? extends Iterable<? extends T>> function) { return null; }
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123248.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123248.java
new file mode 100644
index 0000000..bedd4e2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123248.java
@@ -0,0 +1,11 @@
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+
+class App {
+
+  void foo(Stream<Integer> boxed) {
+    final Map<Integer, Integer> count = boxed.collect(HashMap::new, null, HashMap::putAll);
+  }
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123366.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123366.java
new file mode 100644
index 0000000..b54dc8f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123366.java
@@ -0,0 +1,18 @@
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class MyClass {
+  private static void test() {
+    List<String> collect = Arrays.asList("foo", "bar")
+      .stream()
+      .flatMap(MyClass::mapper)
+      .filter(s -> s.startsWith("foo"))
+      .collect(Collectors.toList());
+  }
+
+  private static Stream<String> mapper(String s) {
+    return Stream.of(s);
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123366comment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123366comment.java
new file mode 100644
index 0000000..f360a9c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newMethodRef/IDEA123366comment.java
@@ -0,0 +1,49 @@
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class MethodReferenceTest {
+
+  private final List<String> strings = Arrays.asList("One,Two", "Three,Four,Five");
+
+  public static Stream<String> split(String csv) {
+    return Arrays.asList(csv.split(",")).stream();
+  }
+
+  public void testMethodReference() {
+    List<String> list = strings.stream()
+      .flatMap(MethodReferenceTest::split)
+      .collect(Collectors.toList());
+
+  }
+
+  public void testLambda() {
+    List<String> list = strings.stream()
+      .flatMap((t) -> MethodReferenceTest.split(t))
+      .collect(Collectors.toList());
+  }
+
+  public void testMethodReferenceWithCast() {
+    List<String> list = strings.stream()
+      .flatMap((Function<String,Stream<String>>)MethodReferenceTest::split)
+      .collect(Collectors.toList());
+
+  }
+
+  public void testAnonymousInnerClass() {
+    List<String> strings = Arrays.asList("One,Two", "Three,Four,Five");
+
+    List<String> list = strings.stream()
+      .flatMap(new Function<String, Stream<String>>() {
+        @Override
+        public Stream<String> apply(String s) {
+          return Arrays.asList(s.split(",")).stream();
+        }
+      })
+      .collect(Collectors.toList());
+
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/IDEA122406.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/IDEA122406.java
new file mode 100644
index 0000000..b40ccbc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/resolve/IDEA122406.java
@@ -0,0 +1,41 @@
+import java.util.*;
+import java.util.function.Predicate;
+
+abstract class Test {
+  public long countTweetsLongerThan(int numberOfChars, final List<String> tweetList) {
+    //numberOfChars = 100; //TODO uncomment to show it must be effectively final
+
+    long totalByFor = 0;
+    for (String tweet : tweetList) {
+      if (tweet.length() > numberOfChars) {
+        totalByFor++;
+      }
+    }
+
+    final ArrayList<String> guavaList = newArrayList(fil<ref>ter(tweetList, new Predicate<String>() {
+      @Override
+      public boolean test(String tweet) {
+        return false;
+      }
+    }));
+    final long totalFromGuava = guavaList.size();
+
+
+    final long totalFromLambda = tweetList.stream()
+      .filter(t -> t.length() > numberOfChars)
+      .count();
+
+    if (totalByFor != totalFromLambda | totalByFor != totalFromGuava) {
+      throw new RuntimeException("");
+    }
+    return totalFromLambda;
+  }
+
+  abstract <E> ArrayList<E> newArrayList(Iterable<? extends E> elements);
+  abstract <E> ArrayList<E> newArrayList();
+  abstract <E> ArrayList<E> newArrayList(E... elements);
+
+  abstract <T> Iterable<T> filter(Iterable<T> unfiltered, Predicate<? super T> predicate);
+  abstract <T> Iterable<T> filter(Iterable<?> unfiltered, Class<T> type);
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterLambda.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterLambda.java
new file mode 100644
index 0000000..6f1a450
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/afterLambda.java
@@ -0,0 +1,10 @@
+// "Assert 'container != null'" "true"
+class A{
+  void test(){
+    Object container = null;
+    Runnable r = () -> {
+        assert container != null;
+        container == null ? container.toString() : "";
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeLambda.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeLambda.java
new file mode 100644
index 0000000..47ec64c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addAssert/beforeLambda.java
@@ -0,0 +1,7 @@
+// "Assert 'container != null'" "true"
+class A{
+  void test(){
+    Object container = null;
+    Runnable r = () -> container == null ? conta<caret>iner.toString() : "";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/afterFQN.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/afterFQN.java
new file mode 100644
index 0000000..a69afc2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/afterFQN.java
@@ -0,0 +1,14 @@
+// "Add explicit type arguments" "true"
+import java.util.Date;
+import java.util.List;
+import java.util.Collections;
+
+class Bar {
+  public static void main(String[] args) {
+    new Foo().foo(Collections.<Date>emptyList());
+  }
+}
+
+class Foo {
+  void foo(List<java.util.Date> dates) { }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/afterPrimitives.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/afterPrimitives.java
new file mode 100644
index 0000000..0884158
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/afterPrimitives.java
@@ -0,0 +1,14 @@
+// "Add explicit type arguments to 2nd argument" "true"
+import java.util.Collections;
+import java.util.List;
+
+class Foo {
+
+  public static void main(String[] args) {
+    new Foo(1, Collections.<String>emptyList());
+  }
+
+  public Foo(Integer i, List<String> list) {
+
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/beforeFQN.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/beforeFQN.java
new file mode 100644
index 0000000..64b582f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/beforeFQN.java
@@ -0,0 +1,13 @@
+// "Add explicit type arguments" "true"
+import java.util.List;
+import java.util.Collections;
+
+class Bar {
+  public static void main(String[] args) {
+    new Foo().fo<caret>o(Collections.emptyList());
+  }
+}
+
+class Foo {
+  void foo(List<java.util.Date> dates) { }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/beforePrimitives.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/beforePrimitives.java
new file mode 100644
index 0000000..52a2dff
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeArguments/beforePrimitives.java
@@ -0,0 +1,14 @@
+// "Add explicit type arguments to 2nd argument" "true"
+import java.util.Collections;
+import java.util.List;
+
+class Foo {
+
+  public static void main(String[] args) {
+    new Foo(1, Collections.empt<caret>yList());
+  }
+
+  public Foo(Integer i, List<String> list) {
+
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTernary.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTernary.java
index 1ed19b5..e9c1922 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTernary.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/afterTernary.java
@@ -1,7 +1,7 @@
 // "Cast to 'B'" "true"
 class A {
  void f(B b) {
-   B s = <caret>b == null ? (B) this : b;
+   B s = b == null ? <caret>(B) this : b;
  }
 }
 class B extends A {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTernary.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTernary.java
index 3c07995..c19e116 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTernary.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/addTypeCast/beforeTernary.java
@@ -1,7 +1,7 @@
 // "Cast to 'B'" "true"
 class A {
  void f(B b) {
-   B s = <caret>b == null ? this : b;
+   B s = b == null ? <caret>this : b;
  }
 }
 class B extends A {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterCallToDefaultFromFunctionalInterfaceInsideInheritor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterCallToDefaultFromFunctionalInterfaceInsideInheritor.java
new file mode 100644
index 0000000..234ad18
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterCallToDefaultFromFunctionalInterfaceInsideInheritor.java
@@ -0,0 +1,13 @@
+// "Replace with lambda" "true"
+class Test {
+  interface InOut {
+    void run() throws IOException;
+    default void foo(){}
+  }
+
+  interface InOutEx extends InOut {
+    InOut bind() {
+      return () -> foo();
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterCallToStaticFromFunctionalInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterCallToStaticFromFunctionalInterface.java
new file mode 100644
index 0000000..5004921
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterCallToStaticFromFunctionalInterface.java
@@ -0,0 +1,11 @@
+// "Replace with lambda" "true"
+class Test {
+  interface InOut {
+    void run() throws IOException;
+    static void foo(){}
+  }
+
+  InOut bind() {
+    return () -> InOut.foo();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterConflictingLocal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterConflictingLocal.java
new file mode 100644
index 0000000..2d931e5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterConflictingLocal.java
@@ -0,0 +1,9 @@
+// "Replace with lambda" "true"
+class X1 {
+  Runnable m() {
+    String s;
+    return () -> {
+      String s1;
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterFinalFieldInitializedBeforeAnonymInConstructor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterFinalFieldInitializedBeforeAnonymInConstructor.java
index e481f9b..c6dec3d 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterFinalFieldInitializedBeforeAnonymInConstructor.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterFinalFieldInitializedBeforeAnonymInConstructor.java
@@ -4,10 +4,7 @@
 
   HelloLambda() {
     x = 1;
-    Runnable r = () -> {
-      System.out.println(x);
-
-    };
+    Runnable r = () -> System.out.println(x);
 
   }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterForwardStaticFieldReference.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterForwardStaticFieldReference.java
index 16ed145..813d851 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterForwardStaticFieldReference.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterForwardStaticFieldReference.java
@@ -1,7 +1,5 @@
 // "Replace with lambda" "true"
 class HelloLambda {
-  private final Runnable r = () -> {
-    System.out.println(x);
-  };
+  private final Runnable r = () -> System.out.println(x);
   private static int x = 0;
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnable.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnable.java
index 8860a7c..c92f237 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnable.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnable.java
@@ -1,8 +1,6 @@
 // "Replace with lambda" "true"
 class Test {
   {
-    Runnable r = () -> {
-      System.out.println("");
-    };
+    Runnable r = () -> System.out.println("");
   }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnableInArrayInitializer.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnableInArrayInitializer.java
index 0688e8b..83ad2f6 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnableInArrayInitializer.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/afterRunnableInArrayInitializer.java
@@ -1,8 +1,6 @@
 // "Replace with lambda" "true"
 class Test {
   {
-    Runnable[] r = new Runnable[] {() -> {
-      System.out.println("");
-    }};
+    Runnable[] r = new Runnable[] {() -> System.out.println("")};
   }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToDefaultFromFunctionalInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToDefaultFromFunctionalInterface.java
new file mode 100644
index 0000000..0a91eea
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToDefaultFromFunctionalInterface.java
@@ -0,0 +1,16 @@
+// "Replace with lambda" "false"
+class Test {
+  interface InOut {
+    void run() throws IOException;
+    default void foo(){}
+  }
+
+  InOut bind() {
+    return new In<caret>Out() {
+      @Override
+      public void run() throws IOException {
+        foo();
+      }
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToDefaultFromFunctionalInterfaceInsideInheritor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToDefaultFromFunctionalInterfaceInsideInheritor.java
new file mode 100644
index 0000000..5432bb9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToDefaultFromFunctionalInterfaceInsideInheritor.java
@@ -0,0 +1,18 @@
+// "Replace with lambda" "true"
+class Test {
+  interface InOut {
+    void run() throws IOException;
+    default void foo(){}
+  }
+
+  interface InOutEx extends InOut {
+    InOut bind() {
+      return new In<caret>Out() {
+        @Override
+        public void run() throws IOException {
+          foo();
+        }
+      };
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToStaticFromFunctionalInterface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToStaticFromFunctionalInterface.java
new file mode 100644
index 0000000..acfb975
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeCallToStaticFromFunctionalInterface.java
@@ -0,0 +1,16 @@
+// "Replace with lambda" "true"
+class Test {
+  interface InOut {
+    void run() throws IOException;
+    static void foo(){}
+  }
+
+  InOut bind() {
+    return new In<caret>Out() {
+      @Override
+      public void run() throws IOException {
+        foo();
+      }
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeConflictingLocal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeConflictingLocal.java
new file mode 100644
index 0000000..5b1035b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2lambda/beforeConflictingLocal.java
@@ -0,0 +1,12 @@
+// "Replace with lambda" "true"
+class X1 {
+  Runnable m() {
+    String s;
+    return new Run<caret>nable() {
+      @Override
+      public void run() {
+        String s;
+      }
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference/beforeCallToDefault.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference/beforeCallToDefault.java
new file mode 100644
index 0000000..34c118c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/anonymous2methodReference/beforeCallToDefault.java
@@ -0,0 +1,16 @@
+// "Replace with method reference" "false"
+class Test {
+  interface InOut {
+    void run() throws IOException;
+    default void foo(){}
+  }
+
+  InOut bind() {
+    return new In<caret>Out() {
+      @Override
+      public void run() throws IOException {
+        foo();
+      }
+    };
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterBlocksInSameMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterBlocksInSameMethod.java
new file mode 100644
index 0000000..9f5a157
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/afterBlocksInSameMethod.java
@@ -0,0 +1,21 @@
+// "Convert to local" "true"
+import java.util.ArrayList;
+
+class ITest {
+
+    public IntelliJBugConvertToLocal(int x, int z) {
+
+        ArrayList<String> mayBeLocal = new ArrayList<String>();
+        if (x == 5) {
+      mayBeLocal.add("jjj");
+    }
+
+    if (x > z) {
+      useIt(mayBeLocal);
+    }
+  }
+  @SuppressWarnings("UnusedParameters")
+  private void useIt(Object data) {
+    System.out.println(data);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeBlocksInSameMethod.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeBlocksInSameMethod.java
new file mode 100644
index 0000000..b4e42ef
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/convert2Local/beforeBlocksInSameMethod.java
@@ -0,0 +1,22 @@
+// "Convert to local" "true"
+import java.util.ArrayList;
+
+class ITest {
+
+  private ArrayList<String> may<caret>BeLocal = new ArrayList<String>();
+
+  public IntelliJBugConvertToLocal(int x, int z) {
+
+    if (x == 5) {
+      mayBeLocal.add("jjj");
+    }
+
+    if (x > z) {
+      useIt(mayBeLocal);
+    }
+  }
+  @SuppressWarnings("UnusedParameters")
+  private void useIt(Object data) {
+    System.out.println(data);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/afterStaticImport.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/afterStaticImport.java
new file mode 100644
index 0000000..27470ff
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/afterStaticImport.java
@@ -0,0 +1,21 @@
+// "Create Enum Constant 'CRIME'" "true"
+import java.util.Arrays;
+import java.util.List;
+
+import static AutomaticTypeInference.E.*;
+
+class AutomaticTypeInference {
+
+  AutomaticTypeInference(List<E> gs) {
+  }
+
+  public static void main(String[] args) {
+
+    new AutomaticTypeInference(Arrays.asList(ACTION, CRIME));
+
+  }
+
+  enum E {
+    ACTION, CRIME;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/afterVarargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/afterVarargs.java
new file mode 100644
index 0000000..3c48ba6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/afterVarargs.java
@@ -0,0 +1,18 @@
+// "Create Enum Constant 'CRIME'" "true"
+import java.util.*;
+
+class AutomaticTypeInference {
+
+  AutomaticTypeInference(List<E> gs) {
+  }
+
+  public static void main(String[] args) {
+
+    new AutomaticTypeInference(Arrays.asList(E.ACTION, E.CRIME));
+
+  }
+
+  enum E {
+    ACTION, CRIME;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/beforeStaticImport.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/beforeStaticImport.java
new file mode 100644
index 0000000..e34874c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/beforeStaticImport.java
@@ -0,0 +1,21 @@
+// "Create Enum Constant 'CRIME'" "true"
+import java.util.Arrays;
+import java.util.List;
+
+import static AutomaticTypeInference.E.*;
+
+class AutomaticTypeInference {
+
+  AutomaticTypeInference(List<E> gs) {
+  }
+
+  public static void main(String[] args) {
+
+    new AutomaticTypeInference(Arrays.asList(ACTION, CRI<caret>ME));
+
+  }
+
+  enum E {
+    ACTION;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/beforeVarargs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/beforeVarargs.java
new file mode 100644
index 0000000..3ce84a9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createEnumConstantFromUsage/beforeVarargs.java
@@ -0,0 +1,18 @@
+// "Create Enum Constant 'CRIME'" "true"
+import java.util.*;
+
+class AutomaticTypeInference {
+
+  AutomaticTypeInference(List<E> gs) {
+  }
+
+  public static void main(String[] args) {
+
+    new AutomaticTypeInference(Arrays.asList(E.ACTION, E.CRI<caret>ME));
+
+  }
+
+  enum E {
+    ACTION;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/afterNull.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/afterNull.java
new file mode 100644
index 0000000..a7ffa69
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/afterNull.java
@@ -0,0 +1,9 @@
+// "Create Local Variable 'str'" "true"
+public class A {
+    void foo() {
+        String str;
+        String s = str;
+        str = null;
+    }
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/beforeNull.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/beforeNull.java
new file mode 100644
index 0000000..7589950
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalFromUsage/beforeNull.java
@@ -0,0 +1,8 @@
+// "Create Local Variable 'str'" "true"
+public class A {
+    void foo() {
+        String s = s<caret>tr;
+        str = null;
+    }
+
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalVarFromInstanceof/afterFormatting.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalVarFromInstanceof/afterFormatting.java
new file mode 100644
index 0000000..f96cba4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalVarFromInstanceof/afterFormatting.java
@@ -0,0 +1,13 @@
+// "Insert '(IOException)o' declaration" "true"
+import java.io.IOException;
+
+class C {
+  void f(Object o) {
+    if (o instanceof IOException) {
+        IOException ioException = (IOException) o;
+        
+
+    }
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalVarFromInstanceof/beforeFormatting.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalVarFromInstanceof/beforeFormatting.java
new file mode 100644
index 0000000..8303c6d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createLocalVarFromInstanceof/beforeFormatting.java
@@ -0,0 +1,11 @@
+// "Insert '(IOException)o' declaration" "true"
+import java.io.IOException;
+
+class C {
+  void f(Object o) {
+    if (o instanceof IOException) {
+      <caret>
+    }
+  }
+}
+
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterConstructor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterConstructor.java
new file mode 100644
index 0000000..4c5e012
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterConstructor.java
@@ -0,0 +1,13 @@
+// "Create Constructor" "true"
+class FooBar {
+  FooBar(int i) {
+  }
+
+  {
+    Runnable r = FooBar::new;
+  }
+
+    public FooBar() {
+        
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterReferenceType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterReferenceType.java
new file mode 100644
index 0000000..7c81889
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterReferenceType.java
@@ -0,0 +1,10 @@
+// "Create Method 'fooBar'" "true"
+class FooBar {
+  {
+    Runnable r = FooBar::fooBar;
+  }
+
+    private static void fooBar() {
+        
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterThisType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterThisType.java
new file mode 100644
index 0000000..f1d2b64
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/afterThisType.java
@@ -0,0 +1,10 @@
+// "Create Method 'fooBar'" "true"
+class FooBar {
+  {
+    Runnable r = this::fooBar;
+  }
+
+    private void fooBar() {
+        
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeConstructor.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeConstructor.java
new file mode 100644
index 0000000..5660b9f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeConstructor.java
@@ -0,0 +1,9 @@
+// "Create Constructor" "true"
+class FooBar {
+  FooBar(int i) {
+  }
+
+  {
+    Runnable r = FooBar::ne<caret>w;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeReferenceType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeReferenceType.java
new file mode 100644
index 0000000..6430bdb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeReferenceType.java
@@ -0,0 +1,6 @@
+// "Create Method 'fooBar'" "true"
+class FooBar {
+  {
+    Runnable r = FooBar::foo<caret>Bar;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeThisType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeThisType.java
new file mode 100644
index 0000000..9f3e0d8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef/beforeThisType.java
@@ -0,0 +1,6 @@
+// "Create Method 'fooBar'" "true"
+class FooBar {
+  {
+    Runnable r = this::foo<caret>Bar;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterParameterNameFirstSuggestion.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterParameterNameFirstSuggestion.java
new file mode 100644
index 0000000..62e163e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/afterParameterNameFirstSuggestion.java
@@ -0,0 +1,9 @@
+// "Create Method 'test2'" "true"
+class Foo {
+  static String FOO_BAR = "Bar"; 
+  void test1() { test2(FOO_BAR); }
+
+    private void test2(String fooBar) {
+        
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeParameterNameFirstSuggestion.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeParameterNameFirstSuggestion.java
new file mode 100644
index 0000000..2275135
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromUsage/beforeParameterNameFirstSuggestion.java
@@ -0,0 +1,5 @@
+// "Create Method 'test2'" "true"
+class Foo {
+  static String FOO_BAR = "Bar"; 
+  void test1() { tes<caret>t2(FOO_BAR); } 
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createParameterFromUsage/afterDefaultValueAtCallPlace.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createParameterFromUsage/afterDefaultValueAtCallPlace.java
new file mode 100644
index 0000000..8bc0f57
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createParameterFromUsage/afterDefaultValueAtCallPlace.java
@@ -0,0 +1,10 @@
+// "Create Parameter 'popop'" "true"
+class Calculator {
+    public void printError(int popop) {
+        int i = popop;
+    }
+
+    {
+        printError(popop);
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createParameterFromUsage/beforeDefaultValueAtCallPlace.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createParameterFromUsage/beforeDefaultValueAtCallPlace.java
new file mode 100644
index 0000000..4ab4d2a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/createParameterFromUsage/beforeDefaultValueAtCallPlace.java
@@ -0,0 +1,10 @@
+// "Create Parameter 'popop'" "true"
+class Calculator {
+    public void printError() {
+        int i = <caret>popop;
+    }
+
+    {
+        printError();
+    }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterEq.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterEq.java
new file mode 100644
index 0000000..485bc37
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterEq.java
@@ -0,0 +1,6 @@
+// "Join declaration and assignment" "true"
+class Test {
+  {
+    String ss = "hello";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterMultiDeclr.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterMultiDeclr.java
new file mode 100644
index 0000000..8109062
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterMultiDeclr.java
@@ -0,0 +1,6 @@
+// "Join declaration and assignment" "true"
+class Test {
+  {
+    String ss = "hello", a = "";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterPlusEq.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterPlusEq.java
new file mode 100644
index 0000000..c8e9c3d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/afterPlusEq.java
@@ -0,0 +1,6 @@
+// "Join declaration and assignment" "true"
+class Test {
+  {
+    String ss = "hello" + "world";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeEq.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeEq.java
new file mode 100644
index 0000000..b44568a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeEq.java
@@ -0,0 +1,7 @@
+// "Join declaration and assignment" "true"
+class Test {
+  {
+    String s<caret>s = "";
+    ss = "hello";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeForeignExprBetween.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeForeignExprBetween.java
new file mode 100644
index 0000000..9756619
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeForeignExprBetween.java
@@ -0,0 +1,8 @@
+// "Join declaration and assignment" "false"
+class Test {
+  {
+    String s<caret>s = "";
+    System.out.println(ss);
+    ss = "hello";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeMultiDeclr.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeMultiDeclr.java
new file mode 100644
index 0000000..b488a53
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeMultiDeclr.java
@@ -0,0 +1,7 @@
+// "Join declaration and assignment" "true"
+class Test {
+  {
+    String s<caret>s = "", a = "";
+    ss = "hello";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforePlusEq.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforePlusEq.java
new file mode 100644
index 0000000..5932445
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforePlusEq.java
@@ -0,0 +1,7 @@
+// "Join declaration and assignment" "true"
+class Test {
+  {
+    String ss = "hello";
+    ss +<caret>= "world";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeUsedInRightPart.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeUsedInRightPart.java
new file mode 100644
index 0000000..9b84b9c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration/beforeUsedInRightPart.java
@@ -0,0 +1,7 @@
+// "Join declaration and assignment" "false"
+class Test {
+  {
+    String ss = "hello";
+    ss +<caret>= ss;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterCollapseToBeInferredTypeArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterCollapseToBeInferredTypeArgs.java
new file mode 100644
index 0000000..e3e2ad0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterCollapseToBeInferredTypeArgs.java
@@ -0,0 +1,29 @@
+// "Replace lambda with method reference" "true"
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+class Box<T>
+{
+  public Box(T value)
+  {
+    this._value = value;
+  }
+
+  private final T _value;
+
+  public T getValue()
+  {
+    return this._value;
+  }
+
+  {
+    List<Box<String>> l1 = new ArrayList<>();
+    l1.add(new Box<>("Foo"));
+    l1.add(new Box<>("Bar"));
+
+    List<String> l3 = l1.stream()
+      .map(Box::getValue)
+      .collect(Collectors.toList());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterNoCollapseTypeArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterNoCollapseTypeArgs.java
new file mode 100644
index 0000000..6502965
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/afterNoCollapseTypeArgs.java
@@ -0,0 +1,23 @@
+// "Replace lambda with method reference" "true"
+import java.util.function.Function;
+
+class Box<T>
+{
+  public Box(T value)
+  {
+    this._value = value;
+  }
+
+  private final T _value;
+
+  public T getValue()
+  {
+    return this._value;
+  }
+
+  {
+    foo(Box<String>::getValue);
+  }
+  
+  <K> void foo(Function<Box<K>, K> f){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeCollapseToBeInferredTypeArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeCollapseToBeInferredTypeArgs.java
new file mode 100644
index 0000000..f147127
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeCollapseToBeInferredTypeArgs.java
@@ -0,0 +1,29 @@
+// "Replace lambda with method reference" "true"
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+class Box<T>
+{
+  public Box(T value)
+  {
+    this._value = value;
+  }
+
+  private final T _value;
+
+  public T getValue()
+  {
+    return this._value;
+  }
+
+  {
+    List<Box<String>> l1 = new ArrayList<>();
+    l1.add(new Box<>("Foo"));
+    l1.add(new Box<>("Bar"));
+
+    List<String> l3 = l1.stream()
+      .map((t) -> t.get<caret>Value())
+      .collect(Collectors.toList());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeNoCollapseTypeArgs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeNoCollapseTypeArgs.java
new file mode 100644
index 0000000..13b324d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference/beforeNoCollapseTypeArgs.java
@@ -0,0 +1,23 @@
+// "Replace lambda with method reference" "true"
+import java.util.function.Function;
+
+class Box<T>
+{
+  public Box(T value)
+  {
+    this._value = value;
+  }
+
+  private final T _value;
+
+  public T getValue()
+  {
+    return this._value;
+  }
+
+  {
+    foo((Box<String> t) -> t.get<caret>Value());
+  }
+  
+  <K> void foo(Function<Box<K>, K> f){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/afterReturnTypeInExpressionStatement.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/afterReturnTypeInExpressionStatement.java
new file mode 100644
index 0000000..159cd79
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/afterReturnTypeInExpressionStatement.java
@@ -0,0 +1,8 @@
+// "Replace with expression lambda" "true"
+class Test {
+  {
+    Runnable c = () -> foo();
+  }
+  
+  int foo() {return 1;}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/beforeReturnTypeInExpressionStatement.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/beforeReturnTypeInExpressionStatement.java
index e5be2cd..4e73771 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/beforeReturnTypeInExpressionStatement.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/lambdaCodeBlock2Expr/beforeReturnTypeInExpressionStatement.java
@@ -1,4 +1,4 @@
-// "Replace with expression lambda" "false"
+// "Replace with expression lambda" "true"
 class Test {
   {
     Runnable c = () -> <caret>{foo();};
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/methodReturn/afterIncorrectInHierarchy.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/methodReturn/afterIncorrectInHierarchy.java
new file mode 100644
index 0000000..b1b6566
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/methodReturn/afterIncorrectInHierarchy.java
@@ -0,0 +1,18 @@
+// "Make 'get' return 'Callable<java.lang.Integer>'" "true"
+interface Gettable<T> {
+  Callable<Integer> get();
+}
+
+public class Issue<T> implements Gettable<T> {
+  public Callable<Integer> get() {
+
+    return new Callable<Integer>() {
+      public Integer call() {
+        return 0;
+      }
+    };
+
+  }
+}
+
+class Callable<T> {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/methodReturn/beforeIncorrectInHierarchy.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/methodReturn/beforeIncorrectInHierarchy.java
new file mode 100644
index 0000000..53d46b6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/methodReturn/beforeIncorrectInHierarchy.java
@@ -0,0 +1,18 @@
+// "Make 'get' return 'Callable<java.lang.Integer>'" "true"
+interface Gettable<T> {
+  Callable<Integer> get();
+}
+
+public class Issue<T> implements Gettable<T> {
+  public void get() {
+
+    return new Call<caret>able<Integer>() {
+      public Integer call() {
+        return 0;
+      }
+    };
+
+  }
+}
+
+class Callable<T> {}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs/afterMethodReference.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs/afterMethodReference.java
new file mode 100644
index 0000000..84b4cc2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs/afterMethodReference.java
@@ -0,0 +1,18 @@
+// "Remove explicit type arguments" "true"
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class Box<T>
+{
+  public T getValue()
+  {
+    return null;
+  }
+
+  void f(Stream<Box<String>> stream) {
+    List<String> l3 = stream
+      .map(Box::getValue)
+      .collect(Collectors.toList());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs/beforeMethodReference.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs/beforeMethodReference.java
new file mode 100644
index 0000000..6f812c0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs/beforeMethodReference.java
@@ -0,0 +1,18 @@
+// "Remove explicit type arguments" "true"
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+class Box<T>
+{
+  public T getValue()
+  {
+    return null;
+  }
+
+  void f(Stream<Box<String>> stream) {
+    List<String> l3 = stream
+      .map(Box<Stri<caret>ng>::getValue)
+      .collect(Collectors.toList());
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant/afterStaticNotFinal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant/afterStaticNotFinal.java
new file mode 100644
index 0000000..17546ac
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant/afterStaticNotFinal.java
@@ -0,0 +1,10 @@
+// "Replace with 'A.RADIUS'" "true"
+
+class A {
+  public static String RADIUS = "radius";
+
+  public void myMethod(String propertyName) {
+    if (RADIUS.equals(propertyName)) {
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant/beforeStaticNotFinal.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant/beforeStaticNotFinal.java
new file mode 100644
index 0000000..30b6308
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant/beforeStaticNotFinal.java
@@ -0,0 +1,10 @@
+// "Replace with 'A.RADIUS'" "true"
+
+class A {
+  public static String RADIUS = "radius";
+
+  public void myMethod(String propertyName) {
+    if ("rad<caret>ius".equals(propertyName)) {
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCastInIterValue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCastInIterValue.java
new file mode 100644
index 0000000..e6a5527
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCastInIterValue.java
@@ -0,0 +1,11 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  List<String> foo = new ArrayList<>();
+  String foo(){
+      ((List<String>) foo).stream().filter(s -> s == null).forEach(System.out::println);
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectIdentityMap.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectIdentityMap.java
new file mode 100644
index 0000000..ea95020
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectIdentityMap.java
@@ -0,0 +1,11 @@
+// "Replace with collect" "true"
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class Collect {
+  class Person {}
+
+  void collectNames(List<Person> persons){
+    List<Person> names = persons.stream().collect(Collectors.toList());
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter.java
new file mode 100644
index 0000000..8686570
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  public static void main(List<String> testTags) {
+    final List<String> resultJava7 = new ArrayList<>(testTags.size());
+      testTags.stream().filter(tag -> !resultJava7.contains(tag.trim())).forEach(tag -> {
+          resultJava7.add(tag.trim());
+      });
+
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter1.java
new file mode 100644
index 0000000..c081b1b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter1.java
@@ -0,0 +1,11 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+abstract class Sample implements List<String> {
+  void main() {
+      this.stream().filter(tag -> !contains(tag.trim())).forEach(tag -> {
+          add(tag.trim());
+      });
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter2.java
new file mode 100644
index 0000000..c0a135f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter2.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+abstract class Sample implements List<String> {
+  void main() {
+      this.stream().filter(tag -> !foo(this)).forEach(tag -> {
+          add(tag.trim());
+      });
+  }
+  
+  static boolean foo(List<String> a){ return false;}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter3.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter3.java
new file mode 100644
index 0000000..2813cdf
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter3.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample extends ArrayList<String> {
+  void main() {
+      this.stream().filter(tag -> !super.contains(tag)).forEach(tag -> {
+          add(tag.trim());
+      });
+  }
+  
+  static boolean foo(List<String> a){ return false;}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter4.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter4.java
new file mode 100644
index 0000000..8488d78
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterCollectionDependencyInFilter4.java
@@ -0,0 +1,17 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  public static void main(List<String> testTags) {
+    final List<String> resultJava7 = new ArrayList<>(testTags.size());
+      testTags.stream().filter(tag -> !foo(resultJava7)).forEach(tag -> {
+          resultJava7.add(tag.trim());
+      });
+
+  }
+  
+  static boolean foo(List<String> l) {
+    return false;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterMissedBraces.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterMissedBraces.java
new file mode 100644
index 0000000..6cfe43a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/afterMissedBraces.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  List<String> foo = new ArrayList<>();
+  String foo(){
+      foo.stream().filter(s -> s == null).forEach(s -> {
+          int i = 0;
+      });
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCastInIterValue.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCastInIterValue.java
new file mode 100644
index 0000000..12a4d0e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCastInIterValue.java
@@ -0,0 +1,15 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  List<String> foo = new ArrayList<>();
+  String foo(){
+    for (String s : (List<String>)fo<caret>o) {
+      if (s == null) {
+        System.out.println(s);
+      }
+    }
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectIdentityMap.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectIdentityMap.java
new file mode 100644
index 0000000..9f708f6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectIdentityMap.java
@@ -0,0 +1,13 @@
+// "Replace with collect" "true"
+import java.util.*;
+
+public class Collect {
+  class Person {}
+
+  void collectNames(List<Person> persons){
+    List<Person> names = new ArrayList<>();
+    for (Person person : pers<caret>ons) {
+      names.add(person);
+    }
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter.java
new file mode 100644
index 0000000..b0844f2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter.java
@@ -0,0 +1,15 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  public static void main(List<String> testTags) {
+    final List<String> resultJava7 = new ArrayList<>(testTags.size());
+    for (final String tag : tes<caret>tTags) {
+      if (!resultJava7.contains(tag.trim())) {
+        resultJava7.add(tag.trim());
+      }
+    }
+
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter1.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter1.java
new file mode 100644
index 0000000..0cfc956
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter1.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+abstract class Sample implements List<String> {
+  void main() {
+    for (final String tag : t<caret>his) {
+      if (!contains(tag.trim())) {
+        add(tag.trim());
+      }
+    }
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter2.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter2.java
new file mode 100644
index 0000000..aae55cf
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter2.java
@@ -0,0 +1,15 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+abstract class Sample implements List<String> {
+  void main() {
+    for (final String tag : t<caret>his) {
+      if (!foo(this)) {
+        add(tag.trim());
+      }
+    }
+  }
+  
+  static boolean foo(List<String> a){ return false;}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter3.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter3.java
new file mode 100644
index 0000000..16f612a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter3.java
@@ -0,0 +1,15 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample extends ArrayList<String> {
+  void main() {
+    for (final String tag : t<caret>his) {
+      if (!super.contains(tag)) {
+        add(tag.trim());
+      }
+    }
+  }
+  
+  static boolean foo(List<String> a){ return false;}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter4.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter4.java
new file mode 100644
index 0000000..92831a2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeCollectionDependencyInFilter4.java
@@ -0,0 +1,19 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  public static void main(List<String> testTags) {
+    final List<String> resultJava7 = new ArrayList<>(testTags.size());
+    for (final String tag : tes<caret>tTags) {
+      if (!foo(resultJava7)) {
+        resultJava7.add(tag.trim());
+      }
+    }
+
+  }
+  
+  static boolean foo(List<String> l) {
+    return false;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeMissedBraces.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeMissedBraces.java
new file mode 100644
index 0000000..f366f2f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/beforeMissedBraces.java
@@ -0,0 +1,13 @@
+// "Replace with forEach" "true"
+import java.util.ArrayList;
+import java.util.List;
+
+class Sample {
+  List<String> foo = new ArrayList<>();
+  String foo(){
+    for (String s : fo<caret>o) {
+      if (s == null) int i = 0;
+    }
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterInsideExpression.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterInsideExpression.java
new file mode 100644
index 0000000..8fe63b4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterInsideExpression.java
@@ -0,0 +1,7 @@
+// "Remove redundant assignment" "true"
+class A {
+  public static void main(String[] args) {
+    int x = 3 * 4;
+    System.out.println(x);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterNoSideEffect.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterNoSideEffect.java
new file mode 100644
index 0000000..6819587
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterNoSideEffect.java
@@ -0,0 +1,8 @@
+// "Remove redundant assignment" "true"
+class A {
+    void m() {
+        int i;
+        i = 0;
+        System.out.println(i);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterParameterAssignment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterParameterAssignment.java
new file mode 100644
index 0000000..6d20a3f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterParameterAssignment.java
@@ -0,0 +1,7 @@
+// "Remove redundant assignment" "true"
+class A {
+    void m(int i) {
+        i = 0;
+        System.out.println(i);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterSideEffect.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterSideEffect.java
new file mode 100644
index 0000000..acbbf18
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/afterSideEffect.java
@@ -0,0 +1,15 @@
+// "Remove redundant assignment" "true"
+class A {
+  A a = null;
+  String m(String str) {
+    return str;
+  }
+
+  {
+    String ss = "";
+
+    System.out.println();
+
+      a.m(ss);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeInsideExpression.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeInsideExpression.java
new file mode 100644
index 0000000..4449c9c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeInsideExpression.java
@@ -0,0 +1,7 @@
+// "Remove redundant assignment" "true"
+class A {
+  public static void main(String[] args) {
+    int x = (<caret>x = 3) * 4;
+    System.out.println(x);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeNoSideEffect.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeNoSideEffect.java
new file mode 100644
index 0000000..1c8b767
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeNoSideEffect.java
@@ -0,0 +1,9 @@
+// "Remove redundant assignment" "true"
+class A {
+    void m() {
+        int i;
+        <caret>i = 9;
+        i = 0;
+        System.out.println(i);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeParameterAssignment.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeParameterAssignment.java
new file mode 100644
index 0000000..d65c371
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeParameterAssignment.java
@@ -0,0 +1,8 @@
+// "Remove redundant assignment" "true"
+class A {
+    void m(int i) {
+        <caret>i = 9;
+        i = 0;
+        System.out.println(i);
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeSideEffect.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeSideEffect.java
new file mode 100644
index 0000000..014f3fc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment/beforeSideEffect.java
@@ -0,0 +1,15 @@
+// "Remove redundant assignment" "true"
+class A {
+  A a = null;
+  String m(String str) {
+    return str;
+  }
+
+  {
+    String ss = "";
+
+    System.out.println();
+
+    s<caret>s = a.m(ss);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enter.java b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enter.java
new file mode 100644
index 0000000..7294483
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enter.java
@@ -0,0 +1,5 @@
+public class Shakespeare {
+  void quote() {
+    String theQuote = "A fool thinks himself to be wise, <caret>but a wise man knows himself to be a fool.";
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enterOpSignOnNextLine.java b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enterOpSignOnNextLine.java
new file mode 100644
index 0000000..7294483
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enterOpSignOnNextLine.java
@@ -0,0 +1,5 @@
+public class Shakespeare {
+  void quote() {
+    String theQuote = "A fool thinks himself to be wise, <caret>but a wise man knows himself to be a fool.";
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enterOpSignOnNextLine_after.java b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enterOpSignOnNextLine_after.java
new file mode 100644
index 0000000..b557643
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enterOpSignOnNextLine_after.java
@@ -0,0 +1,6 @@
+public class Shakespeare {
+  void quote() {
+    String theQuote = "A fool thinks himself to be wise, " 
+            + "<caret>but a wise man knows himself to be a fool.";
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enter_after.java b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enter_after.java
new file mode 100644
index 0000000..d920597
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/editorActions/stringLiteral/enter_after.java
@@ -0,0 +1,6 @@
+public class Shakespeare {
+  void quote() {
+    String theQuote = "A fool thinks himself to be wise, " +
+            "<caret>but a wise man knows himself to be a fool.";
+  }
+}
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterAbstractClass.java b/java/java-tests/testData/codeInsight/generateConstructor/afterAbstractClass.java
index 6e850b1..bbf363c 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterAbstractClass.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterAbstractClass.java
@@ -1,4 +1,4 @@
 public abstract class Test {
-    protected Test() {<caret>
+    public Test() {<caret>
     }
 }
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence.java b/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence.java
index 9ae5a0b..d783ba3 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence.java
@@ -1,7 +1,7 @@
 class Parent {
     Object menu;
 
-    Parent(Object menu) {
+    public Parent(Object menu) {
         this.menu = menu;
     }
 }
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence1.java b/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence1.java
index 29be0de..3b3c4ac 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence1.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterFieldPrefixCoincidence1.java
@@ -1,7 +1,7 @@
 class Test {
   private int _foo;
 
-    Test(int foo) {
+    public Test(int foo) {
         _foo = foo;
     }
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterFinalFieldPreselection.java b/java/java-tests/testData/codeInsight/generateConstructor/afterFinalFieldPreselection.java
index bd402a9..afac816 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterFinalFieldPreselection.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterFinalFieldPreselection.java
@@ -4,7 +4,7 @@
     private int c;
     private final int d;
 
-    Test(int b, int d) {
+    public Test(int b, int d) {
         this.b = b;
         this.d = d;
     }
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterImmediatelyAfterRBrace.java b/java/java-tests/testData/codeInsight/generateConstructor/afterImmediatelyAfterRBrace.java
index f5b9858..84e94c5 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterImmediatelyAfterRBrace.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterImmediatelyAfterRBrace.java
@@ -1,5 +1,5 @@
 class A
 {
-    A() {
+    public A() {<caret>
     }
 }
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterPackageLocalClass.java b/java/java-tests/testData/codeInsight/generateConstructor/afterPackageLocalClass.java
index 0d9b0ad..8a88580 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterPackageLocalClass.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterPackageLocalClass.java
@@ -1,4 +1,4 @@
 class Test {
-    Test() {<caret>
+    public Test() {<caret>
     }
 }
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterPrivateClass.java b/java/java-tests/testData/codeInsight/generateConstructor/afterPrivateClass.java
index 1990616..e0f4177 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterPrivateClass.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterPrivateClass.java
@@ -1,6 +1,6 @@
 class Test {
   private class Foo {
-      private Foo() {<caret>
+      public Foo() {<caret>
       }
   }
 }
diff --git a/java/java-tests/testData/codeInsight/generateConstructor/afterSubstitution.java b/java/java-tests/testData/codeInsight/generateConstructor/afterSubstitution.java
index f457956..696adcc 100644
--- a/java/java-tests/testData/codeInsight/generateConstructor/afterSubstitution.java
+++ b/java/java-tests/testData/codeInsight/generateConstructor/afterSubstitution.java
@@ -7,7 +7,7 @@
 }
 
 class Child<Integer> extends Parent<Integer> {
-    Child(Integer field) {
+    public Child(Integer field) {
         super(field);
     }
 }
diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIf.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIf.java
new file mode 100644
index 0000000..9fab2d2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIf.java
@@ -0,0 +1,11 @@
+class Test {
+  boolean foo() {
+    return true;
+  }
+  
+  void bar() {
+    if (true) {
+    }
+    else <selection>foo()</selection>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIfElse.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIfElse.java
new file mode 100644
index 0000000..9fab2d2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIfElse.java
@@ -0,0 +1,11 @@
+class Test {
+  boolean foo() {
+    return true;
+  }
+  
+  void bar() {
+    if (true) {
+    }
+    else <selection>foo()</selection>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIfElse_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIfElse_after.java
new file mode 100644
index 0000000..1735bec
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIfElse_after.java
@@ -0,0 +1,14 @@
+class Test {
+  boolean foo() {
+    return true;
+  }
+  
+  void bar() {
+    if (true) {
+    }
+    else if (foo()) {
+        <caret>
+    } else {
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIf_after.java b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIf_after.java
new file mode 100644
index 0000000..f410dc4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/generation/surroundWith/java/SurroundExpressionWithElseIf_after.java
@@ -0,0 +1,13 @@
+class Test {
+  boolean foo() {
+    return true;
+  }
+  
+  void bar() {
+    if (true) {
+    }
+    else if (foo()) {
+        <caret>
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/javadocIG/classTypeParamsPresentation.html b/java/java-tests/testData/codeInsight/javadocIG/classTypeParamsPresentation.html
index 789ba10..ea45f5f 100644
--- a/java/java-tests/testData/codeInsight/javadocIG/classTypeParamsPresentation.html
+++ b/java/java-tests/testData/codeInsight/javadocIG/classTypeParamsPresentation.html
@@ -1,3 +1,3 @@
 [&lt; java 1.7 &gt;] java.util
- public class java.util.ArrayList&lt;E&gt; extends java.util.AbstractList&lt;E&gt;
+ public class ArrayList&lt;E&gt; extends java.util.AbstractList&lt;E&gt;
  implements java.util.List&lt;E&gt;, java.util.RandomAccess, java.lang.Cloneable, java.io.Serializable
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotCompleteTemplateInMultiCaretMode.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotCompleteTemplateInMultiCaretMode.java
new file mode 100644
index 0000000..31f0bd6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotCompleteTemplateInMultiCaretMode.java
@@ -0,0 +1,8 @@
+import java.lang.Object;
+
+public class Foo {
+  void m() {
+    new Object().inst<caret>
+    new Object().inst<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotCompleteTemplateInMultiCaretMode_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotCompleteTemplateInMultiCaretMode_after.java
new file mode 100644
index 0000000..31f0bd6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotCompleteTemplateInMultiCaretMode_after.java
@@ -0,0 +1,8 @@
+import java.lang.Object;
+
+public class Foo {
+  void m() {
+    new Object().inst<caret>
+    new Object().inst<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateInMultiCaretMode.java b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateInMultiCaretMode.java
new file mode 100644
index 0000000..8cedb76
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/doNotShowTemplateInMultiCaretMode.java
@@ -0,0 +1,8 @@
+import java.lang.Object;
+
+public class Foo {
+    void m() {
+        new Object().<caret>
+        new Object().<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/shouldNotExpandInMultiCaretMode.java b/java/java-tests/testData/codeInsight/template/postfix/completion/shouldNotExpandInMultiCaretMode.java
new file mode 100644
index 0000000..7a4651f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/shouldNotExpandInMultiCaretMode.java
@@ -0,0 +1,9 @@
+class A {
+  Object foo;
+  Object bar;
+
+  public static void main(String[] args) {
+    foo == null<caret>
+    bar == null<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/completion/shouldNotExpandInMultiCaretMode_after.java b/java/java-tests/testData/codeInsight/template/postfix/completion/shouldNotExpandInMultiCaretMode_after.java
new file mode 100644
index 0000000..076ce16
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/completion/shouldNotExpandInMultiCaretMode_after.java
@@ -0,0 +1,9 @@
+class A {
+  Object foo;
+  Object bar;
+
+  public static void main(String[] args) {
+    foo == null.if  <caret>
+    bar == null.if  <caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/format/notString.java b/java/java-tests/testData/codeInsight/template/postfix/templates/format/notString.java
new file mode 100644
index 0000000..f95b6df
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/format/notString.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+    b.format<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/format/notString_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/format/notString_after.java
new file mode 100644
index 0000000..e828f4d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/format/notString_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+    b.format    <caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/format/string.java b/java/java-tests/testData/codeInsight/template/postfix/templates/format/string.java
new file mode 100644
index 0000000..0cd8302
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/format/string.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+      "m()".format<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/format/string_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/format/string_after.java
new file mode 100644
index 0000000..a0b3172
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/format/string_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+      String.format("m()", <caret>);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/notnull/elseStatement.java b/java/java-tests/testData/codeInsight/template/postfix/templates/notnull/elseStatement.java
new file mode 100644
index 0000000..477a154
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/notnull/elseStatement.java
@@ -0,0 +1,8 @@
+public class Foo {
+    void m(Object o) {
+        if (true) {
+          
+        }
+        else o.notnull<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/notnull/elseStatement_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/notnull/elseStatement_after.java
new file mode 100644
index 0000000..97da48f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/notnull/elseStatement_after.java
@@ -0,0 +1,10 @@
+public class Foo {
+    void m(Object o) {
+        if (true) {
+
+        }
+        else if (o != null) {
+            <caret>
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/sout/simple.java b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/simple.java
new file mode 100644
index 0000000..80da2b8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/simple.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+    b.sout<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/sout/simple_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/simple_after.java
new file mode 100644
index 0000000..3b0a8dd
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/simple_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+      System.out.println(b);<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/sout/void.java b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/void.java
new file mode 100644
index 0000000..b99a577
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/void.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+    m().sout<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/sout/void_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/void_after.java
new file mode 100644
index 0000000..4e08abc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/sout/void_after.java
@@ -0,0 +1,7 @@
+package templates;
+
+public class Foo {
+  void m(boolean b, int value) {
+    m().sout    <caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/multiStatement.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/multiStatement.java
new file mode 100644
index 0000000..6b64472
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/multiStatement.java
@@ -0,0 +1,7 @@
+public class Foo {
+    void m() {
+        somevalue.try<caret>
+        int i=0;
+
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/multiStatement_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/multiStatement_after.java
new file mode 100644
index 0000000..cf2395d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/multiStatement_after.java
@@ -0,0 +1,11 @@
+public class Foo {
+    void m() {
+        try {
+            somevalue<caret>
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        int i=0;
+
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/notStatement.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/notStatement.java
new file mode 100644
index 0000000..bec0827
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/notStatement.java
@@ -0,0 +1,3 @@
+public class Foo.try<caret> {
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/notStatement_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/notStatement_after.java
new file mode 100644
index 0000000..59c9b04
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/notStatement_after.java
@@ -0,0 +1,3 @@
+public class Foo.try    <caret> {
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/simple.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/simple.java
new file mode 100644
index 0000000..d77e002
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/simple.java
@@ -0,0 +1,5 @@
+public class Foo {
+    void m() {
+        somevalue.try<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/simple_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/simple_after.java
new file mode 100644
index 0000000..bf0347a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/simple_after.java
@@ -0,0 +1,9 @@
+public class Foo {
+    void m() {
+        try {
+            somevalue<caret>
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/statement.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/statement.java
new file mode 100644
index 0000000..e68cb69
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/statement.java
@@ -0,0 +1,5 @@
+public class Foo {
+    void m() {
+        Object o = new Object().try<caret>
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/template/postfix/templates/try/statement_after.java b/java/java-tests/testData/codeInsight/template/postfix/templates/try/statement_after.java
new file mode 100644
index 0000000..41f8cc1
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/template/postfix/templates/try/statement_after.java
@@ -0,0 +1,9 @@
+public class Foo {
+    void m() {
+        try {
+            Object o = new Object()<caret>
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretIndentLBrace_after.java b/java/java-tests/testData/codeInsight/typing/multicaretIndentLBrace_after.java
new file mode 100644
index 0000000..31d1689
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretIndentLBrace_after.java
@@ -0,0 +1,8 @@
+class Foo {
+  void m() {
+    if (true)
+    {<caret>
+    if (true)
+    {<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretIndentLBrace_before.java b/java/java-tests/testData/codeInsight/typing/multicaretIndentLBrace_before.java
new file mode 100644
index 0000000..cc7542d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretIndentLBrace_before.java
@@ -0,0 +1,8 @@
+class Foo {
+  void m() {
+    if (true)
+      <caret>
+    if (true)
+      <caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretIndentRBrace_after.java b/java/java-tests/testData/codeInsight/typing/multicaretIndentRBrace_after.java
new file mode 100644
index 0000000..dd2d47d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretIndentRBrace_after.java
@@ -0,0 +1,10 @@
+class Foo {
+  void m() {
+    if (true) {
+        System.out.println();
+    }<caret>
+    if (true) {
+        System.out.println();
+    }<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretIndentRBrace_before.java b/java/java-tests/testData/codeInsight/typing/multicaretIndentRBrace_before.java
new file mode 100644
index 0000000..386e2e2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretIndentRBrace_before.java
@@ -0,0 +1,10 @@
+class Foo {
+  void m() {
+    if (true) {
+    System.out.println();
+    <caret>
+    if (true) {
+    System.out.println();
+    <caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretInsertGt_after.java b/java/java-tests/testData/codeInsight/typing/multicaretInsertGt_after.java
new file mode 100644
index 0000000..5779f88
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretInsertGt_after.java
@@ -0,0 +1,10 @@
+class Foo {
+  void m() {
+    if (true) {
+      List<<caret>>
+    }
+    if (true) {
+      List<<caret>>
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretInsertGt_before.java b/java/java-tests/testData/codeInsight/typing/multicaretInsertGt_before.java
new file mode 100644
index 0000000..fa17fc8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretInsertGt_before.java
@@ -0,0 +1,10 @@
+class Foo {
+  void m() {
+    if (true) {
+      List<caret>
+    }
+    if (true) {
+      List<caret>
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretInsertQuote_after.java b/java/java-tests/testData/codeInsight/typing/multicaretInsertQuote_after.java
new file mode 100644
index 0000000..bef6962
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretInsertQuote_after.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.out.println("<caret>");
+    System.out.println("<caret>");
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretInsertQuote_before.java b/java/java-tests/testData/codeInsight/typing/multicaretInsertQuote_before.java
new file mode 100644
index 0000000..c0716b5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretInsertQuote_before.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.out.println(<caret>);
+    System.out.println(<caret>);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretInsertRParen_after.java b/java/java-tests/testData/codeInsight/typing/multicaretInsertRParen_after.java
new file mode 100644
index 0000000..ec85a67
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretInsertRParen_after.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.exit(<caret>)
+    System.exit(<caret>)
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretInsertRParen_before.java b/java/java-tests/testData/codeInsight/typing/multicaretInsertRParen_before.java
new file mode 100644
index 0000000..594fa91
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretInsertRParen_before.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.exit<caret>
+    System.exit<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipGt_after.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipGt_after.java
new file mode 100644
index 0000000..432129e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipGt_after.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    java.util.List<String> l1 = new java.util.ArrayList<><caret>();
+    java.util.List<String> l2 = new java.util.ArrayList<><caret>();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipGt_before.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipGt_before.java
new file mode 100644
index 0000000..7fe0a60
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipGt_before.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    java.util.List<String> l1 = new java.util.ArrayList<<caret>>();
+    java.util.List<String> l2 = new java.util.ArrayList<<caret>>();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipQuote_after.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipQuote_after.java
new file mode 100644
index 0000000..a2ce5c5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipQuote_after.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.out.println(""<caret>);
+    System.out.println(""<caret>);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipQuote_before.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipQuote_before.java
new file mode 100644
index 0000000..bef6962
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipQuote_before.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.out.println("<caret>");
+    System.out.println("<caret>");
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipRParen_after.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipRParen_after.java
new file mode 100644
index 0000000..45324ed
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipRParen_after.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.exit()<caret>
+    System.exit()<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipRParen_before.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipRParen_before.java
new file mode 100644
index 0000000..ec85a67
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipRParen_before.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.exit(<caret>)
+    System.exit(<caret>)
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipSemicolon_after.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipSemicolon_after.java
new file mode 100644
index 0000000..0e0ddba
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipSemicolon_after.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.out.println();<caret>
+    System.out.println();<caret>
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/typing/multicaretSkipSemicolon_before.java b/java/java-tests/testData/codeInsight/typing/multicaretSkipSemicolon_before.java
new file mode 100644
index 0000000..cadfb33
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/typing/multicaretSkipSemicolon_before.java
@@ -0,0 +1,6 @@
+class Foo {
+  void m() {
+    System.out.println()<caret>;
+    System.out.println()<caret>;
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput.log b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput.log
new file mode 100644
index 0000000..1f87c34
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput.log
@@ -0,0 +1,15 @@
+Compiling files:
+moduleA/src/com/ppp/Inner.java
+End of files
+Cleaning output files:
+out/com/ppp/B.class
+End of files
+Compiling files:
+moduleB/src/com/ppp/B.java
+End of files
+Cleaning output files:
+out/com/ppp/B.class
+End of files
+Compiling files:
+moduleB/src/com/ppp/B.java
+End of files
diff --git a/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleA/src/com/ppp/Inner.java.new b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleA/src/com/ppp/Inner.java.new
new file mode 100644
index 0000000..b274897
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleA/src/com/ppp/Inner.java.new
@@ -0,0 +1,4 @@
+package com.ppp;
+
+class Inner {
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/B.java b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/B.java
new file mode 100644
index 0000000..da7cb3f
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/B.java
@@ -0,0 +1,6 @@
+package com.ppp;
+
+public class B {
+  private Inner inner;
+}
+
diff --git a/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/Inner.java b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/Inner.java
new file mode 100644
index 0000000..5ffa576
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/Inner.java
@@ -0,0 +1,5 @@
+package com.ppp;
+
+class Inner {
+}
+
diff --git a/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/Inner.java.remove b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/Inner.java.remove
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/java/java-tests/testData/compileServer/incremental/common/moveClassToDependentModuleWithSameOutput/moduleB/src/com/ppp/Inner.java.remove
diff --git a/java/java-tests/testData/inspection/dataFlow/boxingBoolean/expected.xml b/java/java-tests/testData/inspection/dataFlow/boxingBoolean/expected.xml
index d04ea28..e04ae9d 100644
--- a/java/java-tests/testData/inspection/dataFlow/boxingBoolean/expected.xml
+++ b/java/java-tests/testData/inspection/dataFlow/boxingBoolean/expected.xml
@@ -33,7 +33,7 @@
   <problem>
     <file>Test.java</file>
     <line>51</line>
-    <description>Condition &lt;code&gt;o&lt;/code&gt; at the left side of assignment expression is always &lt;code&gt;false&lt;/code&gt;. Can be simplified to normal assignment.</description>
+    <description>Condition &lt;code&gt;o&lt;/code&gt; at the left side of assignment expression is always &lt;code&gt;false&lt;/code&gt;. Can be simplified.</description>
   </problem>
 
 </problems>
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNotNullShouldNotAffectNullity.java b/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNotNullShouldNotAffectNullity.java
index fed3d1b..98c26df 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNotNullShouldNotAffectNullity.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ComparingToNotNullShouldNotAffectNullity.java
@@ -18,6 +18,27 @@
       if (first == getObj() || collection.size() > 0) {
         System.out.println(first.hashCode());
       }
+      if (<warning descr="Condition 'first == null' is always 'false'">first == null</warning>) {
+        System.out.println(first.hashCode());
+      }
+    }
+  }
+
+  void foo2(Collection<Object> collection) {
+    if (!collection.isEmpty()) {
+      Object first = collection.iterator().next();
+      if (first != getObj() || collection.size() > 0) {
+        first.hashCode();
+      }
+    }
+  }
+
+  void foo3(Collection<Object> collection) {
+    if (!collection.isEmpty()) {
+      Object first = collection.iterator().next();
+      if (first == getObj() || collection.size() > 2) {
+        System.out.println(first.hashCode());
+      }
       if (first == null) {
         System.out.println(<warning descr="Method invocation 'first.hashCode()' may produce 'java.lang.NullPointerException'">first.hashCode()</warning>);
       }
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java b/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java
new file mode 100644
index 0000000..e65bc87
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ContractVarargs.java
@@ -0,0 +1,39 @@
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+class Contracts {
+
+  public void simpleFail(@Nullable String message) {
+    notBlank(message);
+    log(message);
+  }
+
+  @Contract("_->fail")
+  private void notBlank(@Nullable Object message) {
+
+  }
+
+  @Contract("_,_,_->fail")
+  private void notBlank(@Nullable Object o, String message, Object... args) {
+
+  }
+
+  public void varargFail(@Nullable String message) {
+    notBlank(message, "Message should not be blank");
+    log(message);
+  }
+
+  public void vararg1(@Nullable String message) {
+    notBlank(message, "Message should not be blank", new Object());
+    log(message);
+  }
+  public void vararg2(@Nullable String message) {
+    notBlank(message, "Message should not be blank", new Object(), new Object());
+    log(message);
+  }
+
+  public void log(@NotNull String message) {
+    System.out.println(message);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/NotNullAfterDereference.java b/java/java-tests/testData/inspection/dataFlow/fixture/NotNullAfterDereference.java
new file mode 100644
index 0000000..5c6dc81
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/NotNullAfterDereference.java
@@ -0,0 +1,9 @@
+class Foo {
+
+  private void someMethod(String someArg) {
+    someArg.getClass();
+    if (<warning descr="Condition 'someArg == null' is always 'false'">someArg == null</warning>) {
+      System.err.println("Wrong argument");
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/NullableBoolean.java b/java/java-tests/testData/inspection/dataFlow/fixture/NullableBoolean.java
new file mode 100644
index 0000000..3675633
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/NullableBoolean.java
@@ -0,0 +1,23 @@
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+class Foo {
+
+  public static void main(@Nullable Boolean hasMissingGems, List<String> missing) {
+    if (hasMissingGems != null && hasMissingGems) {
+      return;
+    }
+
+    if (hasMissingGems == null && missing.size() > 0) {
+
+    }
+
+  }
+  public static void main2(@Nullable Boolean hasMissingGems, List<String> missing) {
+    if ((hasMissingGems != null && hasMissingGems) || (hasMissingGems == null && missing.size() > 0)) {
+
+    }
+
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java
index 7f727f9..d81b467 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences.java
@@ -16,4 +16,10 @@
     return foo;
   }
 
+  public void testDontReplaceQualifierWithNull(Object bar) {
+    if (bar == null) {
+      <warning descr="Method invocation 'bar.hashCode()' may produce 'java.lang.NullPointerException'">bar.hashCode()</warning>;
+    }
+  }
+
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java
index feb147c..0d18739 100644
--- a/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/ReportConstantReferences_after.java
@@ -16,4 +16,10 @@
     return foo;
   }
 
+  public void testDontReplaceQualifierWithNull(Object bar) {
+    if (bar == null) {
+      bar.hashCode();
+    }
+  }
+
 }
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/TrueOrEqualsSomething.java b/java/java-tests/testData/inspection/dataFlow/fixture/TrueOrEqualsSomething.java
new file mode 100644
index 0000000..a41172b
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/TrueOrEqualsSomething.java
@@ -0,0 +1,9 @@
+class Contracts {
+
+  private boolean method(boolean a) {
+      boolean b = true;
+      <warning descr="Condition 'b' at the left side of assignment expression is always 'true'. Can be simplified"><caret>b</warning> |= a;
+      return b;
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/TrueOrEqualsSomething_after.java b/java/java-tests/testData/inspection/dataFlow/fixture/TrueOrEqualsSomething_after.java
new file mode 100644
index 0000000..8e7695f
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/TrueOrEqualsSomething_after.java
@@ -0,0 +1,8 @@
+class Contracts {
+
+  private boolean method(boolean a) {
+      boolean b = true;
+      return b;
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/redundantCast/generics/BoxingTopCast/expected.xml b/java/java-tests/testData/inspection/redundantCast/generics/BoxingTopCast/expected.xml
new file mode 100644
index 0000000..4704d91
--- /dev/null
+++ b/java/java-tests/testData/inspection/redundantCast/generics/BoxingTopCast/expected.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems/>
\ No newline at end of file
diff --git a/java/java-tests/testData/inspection/redundantCast/generics/BoxingTopCast/src/BoxingTopCast.java b/java/java-tests/testData/inspection/redundantCast/generics/BoxingTopCast/src/BoxingTopCast.java
new file mode 100644
index 0000000..148422b
--- /dev/null
+++ b/java/java-tests/testData/inspection/redundantCast/generics/BoxingTopCast/src/BoxingTopCast.java
@@ -0,0 +1,20 @@
+class TestCasting
+{
+  public void testRedundantCast() throws Exception
+  {
+    Object o = getObject();
+    double d = 0.0;
+
+    if( o instanceof Integer )
+    {
+      d = (double) (Integer)o;
+    }
+
+    System.out.println( "d = " + d );
+  }
+
+  private Object getObject()
+  {
+    return new Integer(42);
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/moduleRootManager/rootsChanged/emptyModule/a.iml b/java/java-tests/testData/moduleRootManager/rootsChanged/emptyModule/a.iml
new file mode 100644
index 0000000..ddf828e
--- /dev/null
+++ b/java/java-tests/testData/moduleRootManager/rootsChanged/emptyModule/a.iml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
+
diff --git a/java/java-tests/testData/psi/cls/mirror/Class.txt b/java/java-tests/testData/psi/cls/mirror/Class.txt
new file mode 100644
index 0000000..59d7e4d
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/Class.txt
@@ -0,0 +1,385 @@
+
+  // IntelliJ API Decompiler stub source generated from a class file
+  // Implementation of methods is not available
+
+package java.lang;
+
+public final class Class <T> implements java.io.Serializable, java.lang.reflect.GenericDeclaration, java.lang.reflect.Type, java.lang.reflect.AnnotatedElement {
+    private static final int ANNOTATION = 8192;
+    private static final int ENUM = 16384;
+    private static final int SYNTHETIC = 4096;
+    private transient volatile java.lang.reflect.Constructor<T> cachedConstructor;
+    private transient volatile java.lang.Class<?> newInstanceCallerCache;
+    private transient java.lang.String name;
+    private static java.security.ProtectionDomain allPermDomain;
+    private static boolean useCaches;
+    private transient volatile java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> reflectionData;
+    private transient volatile int classRedefinedCount;
+    private transient volatile sun.reflect.generics.repository.ClassRepository genericInfo;
+    private static final long serialVersionUID = 3206093459760846163L;
+    private static final java.io.ObjectStreamField[] serialPersistentFields;
+    private static sun.reflect.ReflectionFactory reflectionFactory;
+    private static boolean initted;
+    private transient volatile T[] enumConstants;
+    private transient volatile java.util.Map<java.lang.String,T> enumConstantDirectory;
+    private transient volatile java.lang.Class.AnnotationData annotationData;
+    private transient volatile sun.reflect.annotation.AnnotationType annotationType;
+    transient java.lang.ClassValue.ClassValueMap classValueMap;
+
+    private static native void registerNatives();
+
+    private Class() { /* compiled code */ }
+
+    public java.lang.String toString() { /* compiled code */ }
+
+    public java.lang.String toGenericString() { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public static java.lang.Class<?> forName(java.lang.String s) throws java.lang.ClassNotFoundException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public static java.lang.Class<?> forName(java.lang.String s, boolean b, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException { /* compiled code */ }
+
+    private static native java.lang.Class<?> forName0(java.lang.String s, boolean b, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException;
+
+    @sun.reflect.CallerSensitive
+    public T newInstance() throws java.lang.InstantiationException, java.lang.IllegalAccessException { /* compiled code */ }
+
+    public native boolean isInstance(java.lang.Object o);
+
+    public native boolean isAssignableFrom(java.lang.Class<?> aClass);
+
+    public native boolean isInterface();
+
+    public native boolean isArray();
+
+    public native boolean isPrimitive();
+
+    public boolean isAnnotation() { /* compiled code */ }
+
+    public boolean isSynthetic() { /* compiled code */ }
+
+    public java.lang.String getName() { /* compiled code */ }
+
+    private native java.lang.String getName0();
+
+    @sun.reflect.CallerSensitive
+    public java.lang.ClassLoader getClassLoader() { /* compiled code */ }
+
+    native java.lang.ClassLoader getClassLoader0();
+
+    public java.lang.reflect.TypeVariable<java.lang.Class<T>>[] getTypeParameters() { /* compiled code */ }
+
+    public native java.lang.Class<? super T> getSuperclass();
+
+    public java.lang.reflect.Type getGenericSuperclass() { /* compiled code */ }
+
+    public java.lang.Package getPackage() { /* compiled code */ }
+
+    public java.lang.Class<?>[] getInterfaces() { /* compiled code */ }
+
+    private native java.lang.Class<?>[] getInterfaces0();
+
+    public java.lang.reflect.Type[] getGenericInterfaces() { /* compiled code */ }
+
+    public native java.lang.Class<?> getComponentType();
+
+    public native int getModifiers();
+
+    public native java.lang.Object[] getSigners();
+
+    native void setSigners(java.lang.Object[] objects);
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Method getEnclosingMethod() throws java.lang.SecurityException { /* compiled code */ }
+
+    private native java.lang.Object[] getEnclosingMethod0();
+
+    private java.lang.Class.EnclosingMethodInfo getEnclosingMethodInfo() { /* compiled code */ }
+
+    private static java.lang.Class<?> toClass(java.lang.reflect.Type type) { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Constructor<?> getEnclosingConstructor() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.Class<?> getDeclaringClass() throws java.lang.SecurityException { /* compiled code */ }
+
+    private native java.lang.Class<?> getDeclaringClass0();
+
+    @sun.reflect.CallerSensitive
+    public java.lang.Class<?> getEnclosingClass() throws java.lang.SecurityException { /* compiled code */ }
+
+    public java.lang.String getSimpleName() { /* compiled code */ }
+
+    public java.lang.String getTypeName() { /* compiled code */ }
+
+    private static boolean isAsciiDigit(char c) { /* compiled code */ }
+
+    public java.lang.String getCanonicalName() { /* compiled code */ }
+
+    public boolean isAnonymousClass() { /* compiled code */ }
+
+    public boolean isLocalClass() { /* compiled code */ }
+
+    public boolean isMemberClass() { /* compiled code */ }
+
+    private java.lang.String getSimpleBinaryName() { /* compiled code */ }
+
+    private boolean isLocalOrAnonymousClass() { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.Class<?>[] getClasses() { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Field[] getFields() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Method[] getMethods() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Constructor<?>[] getConstructors() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Field getField(java.lang.String s) throws java.lang.NoSuchFieldException, java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Method getMethod(java.lang.String s, java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Constructor<T> getConstructor(java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.Class<?>[] getDeclaredClasses() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Field[] getDeclaredFields() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Method[] getDeclaredMethods() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Constructor<?>[] getDeclaredConstructors() throws java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Field getDeclaredField(java.lang.String s) throws java.lang.NoSuchFieldException, java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Method getDeclaredMethod(java.lang.String s, java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
+
+    @sun.reflect.CallerSensitive
+    public java.lang.reflect.Constructor<T> getDeclaredConstructor(java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
+
+    public java.io.InputStream getResourceAsStream(java.lang.String s) { /* compiled code */ }
+
+    public java.net.URL getResource(java.lang.String s) { /* compiled code */ }
+
+    public java.security.ProtectionDomain getProtectionDomain() { /* compiled code */ }
+
+    private native java.security.ProtectionDomain getProtectionDomain0();
+
+    static native java.lang.Class<?> getPrimitiveClass(java.lang.String s);
+
+    private void checkMemberAccess(int i, java.lang.Class<?> aClass, boolean b) { /* compiled code */ }
+
+    private void checkPackageAccess(java.lang.ClassLoader classLoader, boolean b) { /* compiled code */ }
+
+    private java.lang.String resolveName(java.lang.String s) { /* compiled code */ }
+
+    private java.lang.Class.ReflectionData<T> reflectionData() { /* compiled code */ }
+
+    private java.lang.Class.ReflectionData<T> newReflectionData(java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> softReference, int i) { /* compiled code */ }
+
+    private native java.lang.String getGenericSignature0();
+
+    private sun.reflect.generics.factory.GenericsFactory getFactory() { /* compiled code */ }
+
+    private sun.reflect.generics.repository.ClassRepository getGenericInfo() { /* compiled code */ }
+
+    native byte[] getRawAnnotations();
+
+    native byte[] getRawTypeAnnotations();
+
+    static byte[] getExecutableTypeAnnotationBytes(java.lang.reflect.Executable executable) { /* compiled code */ }
+
+    native sun.reflect.ConstantPool getConstantPool();
+
+    private java.lang.reflect.Field[] privateGetDeclaredFields(boolean b) { /* compiled code */ }
+
+    private java.lang.reflect.Field[] privateGetPublicFields(java.util.Set<java.lang.Class<?>> set) { /* compiled code */ }
+
+    private static void addAll(java.util.Collection<java.lang.reflect.Field> collection, java.lang.reflect.Field[] fields) { /* compiled code */ }
+
+    private java.lang.reflect.Constructor<T>[] privateGetDeclaredConstructors(boolean b) { /* compiled code */ }
+
+    private java.lang.reflect.Method[] privateGetDeclaredMethods(boolean b) { /* compiled code */ }
+
+    private java.lang.reflect.Method[] privateGetPublicMethods() { /* compiled code */ }
+
+    private static java.lang.reflect.Field searchFields(java.lang.reflect.Field[] fields, java.lang.String s) { /* compiled code */ }
+
+    private java.lang.reflect.Field getField0(java.lang.String s) throws java.lang.NoSuchFieldException { /* compiled code */ }
+
+    private static java.lang.reflect.Method searchMethods(java.lang.reflect.Method[] methods, java.lang.String s, java.lang.Class<?>[] classes) { /* compiled code */ }
+
+    private java.lang.reflect.Method getMethod0(java.lang.String s, java.lang.Class<?>[] classes, boolean b) { /* compiled code */ }
+
+    private java.lang.reflect.Constructor<T> getConstructor0(java.lang.Class<?>[] classes, int i) throws java.lang.NoSuchMethodException { /* compiled code */ }
+
+    private static boolean arrayContentsEq(java.lang.Object[] objects, java.lang.Object[] objects1) { /* compiled code */ }
+
+    private static java.lang.reflect.Field[] copyFields(java.lang.reflect.Field[] fields) { /* compiled code */ }
+
+    private static java.lang.reflect.Method[] copyMethods(java.lang.reflect.Method[] methods) { /* compiled code */ }
+
+    private static <U> java.lang.reflect.Constructor<U>[] copyConstructors(java.lang.reflect.Constructor<U>[] constructors) { /* compiled code */ }
+
+    private native java.lang.reflect.Field[] getDeclaredFields0(boolean b);
+
+    private native java.lang.reflect.Method[] getDeclaredMethods0(boolean b);
+
+    private native java.lang.reflect.Constructor<T>[] getDeclaredConstructors0(boolean b);
+
+    private native java.lang.Class<?>[] getDeclaredClasses0();
+
+    private static java.lang.String argumentTypesToString(java.lang.Class<?>[] classes) { /* compiled code */ }
+
+    public boolean desiredAssertionStatus() { /* compiled code */ }
+
+    private static native boolean desiredAssertionStatus0(java.lang.Class<?> aClass);
+
+    public boolean isEnum() { /* compiled code */ }
+
+    private static sun.reflect.ReflectionFactory getReflectionFactory() { /* compiled code */ }
+
+    private static void checkInitted() { /* compiled code */ }
+
+    public T[] getEnumConstants() { /* compiled code */ }
+
+    T[] getEnumConstantsShared() { /* compiled code */ }
+
+    java.util.Map<java.lang.String,T> enumConstantDirectory() { /* compiled code */ }
+
+    public T cast(java.lang.Object o) { /* compiled code */ }
+
+    private java.lang.String cannotCastMsg(java.lang.Object o) { /* compiled code */ }
+
+    public <U> java.lang.Class<? extends U> asSubclass(java.lang.Class<U> aClass) { /* compiled code */ }
+
+    public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> aClass) { /* compiled code */ }
+
+    public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> aClass) { /* compiled code */ }
+
+    public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(java.lang.Class<A> aClass) { /* compiled code */ }
+
+    public java.lang.annotation.Annotation[] getAnnotations() { /* compiled code */ }
+
+    public <A extends java.lang.annotation.Annotation> A getDeclaredAnnotation(java.lang.Class<A> aClass) { /* compiled code */ }
+
+    public <A extends java.lang.annotation.Annotation> A[] getDeclaredAnnotationsByType(java.lang.Class<A> aClass) { /* compiled code */ }
+
+    public java.lang.annotation.Annotation[] getDeclaredAnnotations() { /* compiled code */ }
+
+    private java.lang.Class.AnnotationData annotationData() { /* compiled code */ }
+
+    private java.lang.Class.AnnotationData createAnnotationData(int i) { /* compiled code */ }
+
+    boolean casAnnotationType(sun.reflect.annotation.AnnotationType annotationType, sun.reflect.annotation.AnnotationType annotationType1) { /* compiled code */ }
+
+    sun.reflect.annotation.AnnotationType getAnnotationType() { /* compiled code */ }
+
+    java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> getDeclaredAnnotationMap() { /* compiled code */ }
+
+    public java.lang.reflect.AnnotatedType getAnnotatedSuperclass() { /* compiled code */ }
+
+    public java.lang.reflect.AnnotatedType[] getAnnotatedInterfaces() { /* compiled code */ }
+
+    private static class AnnotationData {
+        final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> annotations;
+        final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> declaredAnnotations;
+        final int redefinedCount;
+
+        AnnotationData(java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> map, java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> map1, int i) { /* compiled code */ }
+    }
+
+    private static class Atomic {
+        private static final sun.misc.Unsafe unsafe;
+        private static final long reflectionDataOffset;
+        private static final long annotationTypeOffset;
+        private static final long annotationDataOffset;
+
+        private Atomic() { /* compiled code */ }
+
+        private static long objectFieldOffset(java.lang.reflect.Field[] fields, java.lang.String s) { /* compiled code */ }
+
+        static <T> boolean casReflectionData(java.lang.Class<?> aClass, java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> softReference, java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> softReference1) { /* compiled code */ }
+
+        static <T> boolean casAnnotationType(java.lang.Class<?> aClass, sun.reflect.annotation.AnnotationType annotationType, sun.reflect.annotation.AnnotationType annotationType1) { /* compiled code */ }
+
+        static <T> boolean casAnnotationData(java.lang.Class<?> aClass, java.lang.Class.AnnotationData annotationData, java.lang.Class.AnnotationData annotationData1) { /* compiled code */ }
+    }
+
+    private static final class EnclosingMethodInfo {
+        private java.lang.Class<?> enclosingClass;
+        private java.lang.String name;
+        private java.lang.String descriptor;
+
+        private EnclosingMethodInfo(java.lang.Object[] objects) { /* compiled code */ }
+
+        boolean isPartial() { /* compiled code */ }
+
+        boolean isConstructor() { /* compiled code */ }
+
+        boolean isMethod() { /* compiled code */ }
+
+        java.lang.Class<?> getEnclosingClass() { /* compiled code */ }
+
+        java.lang.String getName() { /* compiled code */ }
+
+        java.lang.String getDescriptor() { /* compiled code */ }
+    }
+
+    static class MethodArray {
+        private java.lang.reflect.Method[] methods;
+        private int length;
+
+        MethodArray() { /* compiled code */ }
+
+        void add(java.lang.reflect.Method method) { /* compiled code */ }
+
+        void addAll(java.lang.reflect.Method[] methods) { /* compiled code */ }
+
+        void addAll(java.lang.Class.MethodArray methodArray) { /* compiled code */ }
+
+        void addIfNotPresent(java.lang.reflect.Method method) { /* compiled code */ }
+
+        void addAllIfNotPresent(java.lang.Class.MethodArray methodArray) { /* compiled code */ }
+
+        void addAllNonStatic(java.lang.reflect.Method[] methods) { /* compiled code */ }
+
+        int length() { /* compiled code */ }
+
+        java.lang.reflect.Method get(int i) { /* compiled code */ }
+
+        void removeByNameAndSignature(java.lang.reflect.Method method) { /* compiled code */ }
+
+        void compactAndTrim() { /* compiled code */ }
+
+        java.lang.reflect.Method[] getArray() { /* compiled code */ }
+    }
+
+    private static class ReflectionData <T> {
+        volatile java.lang.reflect.Field[] declaredFields;
+        volatile java.lang.reflect.Field[] publicFields;
+        volatile java.lang.reflect.Method[] declaredMethods;
+        volatile java.lang.reflect.Method[] publicMethods;
+        volatile java.lang.reflect.Constructor<T>[] declaredConstructors;
+        volatile java.lang.reflect.Constructor<T>[] publicConstructors;
+        volatile java.lang.reflect.Field[] declaredPublicFields;
+        volatile java.lang.reflect.Method[] declaredPublicMethods;
+        volatile java.lang.Class<?>[] interfaces;
+        final int redefinedCount;
+
+        ReflectionData(int i) { /* compiled code */ }
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/changeSignature/TypeAnnotationsAllAround.java b/java/java-tests/testData/refactoring/changeSignature/TypeAnnotationsAllAround.java
new file mode 100644
index 0000000..c9387c2
--- /dev/null
+++ b/java/java-tests/testData/refactoring/changeSignature/TypeAnnotationsAllAround.java
@@ -0,0 +1,14 @@
+import java.lang.annotation.*;
+import java.util.List;
+
+@Target({ElementType.TYPE_USE})
+@interface TA { int value() default 0; }
+
+class C {
+  class Inner { }
+
+  //public @TA(0) List<@TA(1) C.@TA(1) Inner> m(@TA(2) int @TA(3) [] p1, @TA(4) List<@TA(5) Class<@TA(6) ?>> p2, @TA(7) String @TA(8) ... p3) throws @TA(42) IllegalArgumentException, @TA(43) IllegalStateException {
+  public List<Inner> m<caret>() {
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/refactoring/changeSignature/TypeAnnotationsAllAround_after.java b/java/java-tests/testData/refactoring/changeSignature/TypeAnnotationsAllAround_after.java
new file mode 100644
index 0000000..7b21bd1
--- /dev/null
+++ b/java/java-tests/testData/refactoring/changeSignature/TypeAnnotationsAllAround_after.java
@@ -0,0 +1,14 @@
+import java.lang.annotation.*;
+import java.util.List;
+
+@Target({ElementType.TYPE_USE})
+@interface TA { int value() default 0; }
+
+class C {
+  class Inner { }
+
+  //public @TA(0) List<@TA(1) C.@TA(1) Inner> m(@TA(2) int @TA(3) [] p1, @TA(4) List<@TA(5) Class<@TA(6) ?>> p2, @TA(7) String @TA(8) ... p3) throws @TA(42) IllegalArgumentException, @TA(43) IllegalStateException {
+  public @TA(0) List<@TA(1) Inner> m(@TA(2) int @TA(3) [] p1, @TA(4) List<@TA(5) Class<@TA(6) ?>> p2, @TA(7) String @TA(8) ... p3) {
+    return null;
+  }
+}
diff --git a/java/java-tests/testData/refactoring/inlineMethod/MethodInsideChangeIfStatement.java b/java/java-tests/testData/refactoring/inlineMethod/MethodInsideChangeIfStatement.java
new file mode 100644
index 0000000..1df5d47
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineMethod/MethodInsideChangeIfStatement.java
@@ -0,0 +1,26 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class Test {
+  List<String> foo(String[] strs)
+  {
+    final List<String> result = new ArrayList<String>();
+    int start = -1;
+    for (int i = 0; i < strs.length; i++)
+    {
+      if (idx(i) == 42 && start == -1)
+      {
+        start = i;
+      } else if (idx(i) != 24 && start != -1)
+      {
+        result.add("".substring(id<caret>x(start)));
+      }
+    }
+    return result;
+  }
+
+  private static int idx(int i) {
+    return i;
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inlineMethod/MethodInsideChangeIfStatement.java.after b/java/java-tests/testData/refactoring/inlineMethod/MethodInsideChangeIfStatement.java.after
new file mode 100644
index 0000000..e43e7e8
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineMethod/MethodInsideChangeIfStatement.java.after
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+class Test {
+  List<String> foo(String[] strs)
+  {
+    final List<String> result = new ArrayList<String>();
+    int start = -1;
+    for (int i = 0; i < strs.length; i++)
+    {
+        if (i == 42 && start == -1)
+      {
+        start = i;
+      } else if (i != 24 && start != -1)
+      {
+          result.add("".substring(start));
+      }
+    }
+    return result;
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/inplaceIntroduceConstant/replaceAllInsideParenthesized.java b/java/java-tests/testData/refactoring/inplaceIntroduceConstant/replaceAllInsideParenthesized.java
new file mode 100644
index 0000000..671fc5a
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inplaceIntroduceConstant/replaceAllInsideParenthesized.java
@@ -0,0 +1,13 @@
+class Test {
+
+  Test foo(long l) {
+    return this;
+  }
+
+  {
+    Test t = new Test()
+      .foo(-(5<caret>L))
+      .foo(7L)
+      .foo(-(5L));
+  }
+}
diff --git a/java/java-tests/testData/refactoring/inplaceIntroduceConstant/replaceAllInsideParenthesized_after.java b/java/java-tests/testData/refactoring/inplaceIntroduceConstant/replaceAllInsideParenthesized_after.java
new file mode 100644
index 0000000..a67368d
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inplaceIntroduceConstant/replaceAllInsideParenthesized_after.java
@@ -0,0 +1,15 @@
+class Test {
+
+  Test foo(long l) {
+    return this;
+  }
+
+    public static final long LONG = 5L;
+
+    {
+    Test t = new Test()
+      .foo(-LONG)
+      .foo(7L)
+      .foo(-LONG);
+  }
+}
diff --git a/java/java-tests/testData/refactoring/inplaceIntroduceParameter/localInsideAnonymous.java b/java/java-tests/testData/refactoring/inplaceIntroduceParameter/localInsideAnonymous.java
new file mode 100644
index 0000000..932201e
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inplaceIntroduceParameter/localInsideAnonymous.java
@@ -0,0 +1,18 @@
+class Abc {
+  void foo() {
+    final String name = "name";
+
+    new Runnable(){
+      @Override
+      public void run() {
+        foo();
+
+      }
+
+      private void foo() {
+        System.out.println(na<caret>me);
+      }
+    };
+  }
+}
+
diff --git a/java/java-tests/testData/refactoring/inplaceIntroduceParameter/localInsideAnonymous_after.java b/java/java-tests/testData/refactoring/inplaceIntroduceParameter/localInsideAnonymous_after.java
new file mode 100644
index 0000000..172bbd1
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inplaceIntroduceParameter/localInsideAnonymous_after.java
@@ -0,0 +1,18 @@
+class Abc {
+  void foo() {
+    final String name = "name";
+
+    new Runnable(){
+      @Override
+      public void run() {
+        foo(name);
+
+      }
+
+      private void foo(String name1) {
+        System.out.println(name1);
+      }
+    };
+  }
+}
+
diff --git a/java/java-tests/testData/refactoring/introduceVariable/LambdaExprNotAccepted.after.java b/java/java-tests/testData/refactoring/introduceVariable/LambdaExprNotAccepted.after.java
index a4b5330..6e02ab0 100644
--- a/java/java-tests/testData/refactoring/introduceVariable/LambdaExprNotAccepted.after.java
+++ b/java/java-tests/testData/refactoring/introduceVariable/LambdaExprNotAccepted.after.java
@@ -4,7 +4,7 @@
 
 class Foo {  
     void test() {
-        SAM<X> c = (i, j) -> "" + i + j;
+        SAM<Integer> c = (i, j) -> "" + i + j;
         SAM<Integer> s3 = m(c);
     }
     <X> SAM<X> m(SAM<X> s) { return null; }
diff --git a/java/java-tests/testData/refactoring/invertBoolean/BooleanFieldWithoutInitializer.java b/java/java-tests/testData/refactoring/invertBoolean/BooleanFieldWithoutInitializer.java
new file mode 100644
index 0000000..01d5a1d
--- /dev/null
+++ b/java/java-tests/testData/refactoring/invertBoolean/BooleanFieldWithoutInitializer.java
@@ -0,0 +1,10 @@
+class Test {
+  private boolean notInitial<caret>ized;
+
+  public void foo() {
+    if (notInitialized) {
+      notInitialized = false;
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/invertBoolean/BooleanFieldWithoutInitializer_after.java b/java/java-tests/testData/refactoring/invertBoolean/BooleanFieldWithoutInitializer_after.java
new file mode 100644
index 0000000..20b31fa
--- /dev/null
+++ b/java/java-tests/testData/refactoring/invertBoolean/BooleanFieldWithoutInitializer_after.java
@@ -0,0 +1,10 @@
+class Test {
+  private boolean notInitializedInverted = true;
+
+  public void foo() {
+    if (!notInitializedInverted) {
+      notInitializedInverted = true;
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/methodDuplicates/SkipNonRelatedCalls.java b/java/java-tests/testData/refactoring/methodDuplicates/SkipNonRelatedCalls.java
new file mode 100644
index 0000000..fbda8f3
--- /dev/null
+++ b/java/java-tests/testData/refactoring/methodDuplicates/SkipNonRelatedCalls.java
@@ -0,0 +1,16 @@
+class CommonParent {
+  void foo() {}
+}
+
+public class A extends CommonParent {
+
+  private void <caret>f() {
+    foo();
+  }
+
+  private class B extends CommonParent {
+    void g() {
+      foo();
+    }
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/after/p/A.java b/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/after/p/A.java
new file mode 100644
index 0000000..077abf4
--- /dev/null
+++ b/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/after/p/A.java
@@ -0,0 +1,8 @@
+package p;
+
+class A {
+    public void test() {
+        B.foo();
+    }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/after/p/B.java b/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/after/p/B.java
new file mode 100644
index 0000000..218cf83
--- /dev/null
+++ b/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/after/p/B.java
@@ -0,0 +1,9 @@
+package p;
+
+class B {
+    private B() {
+        System.out.println("Constructor");
+    }
+
+    static void foo(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/before/p/A.java b/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/before/p/A.java
new file mode 100644
index 0000000..8597534
--- /dev/null
+++ b/java/java-tests/testData/refactoring/moveInner/constructorUtilClassVisibility/before/p/A.java
@@ -0,0 +1,15 @@
+package p;
+
+class A {
+    public void test() {
+        B.foo();
+    }
+
+    private class B {
+        private B() {
+            System.out.println("Constructor");
+        }
+
+        static void foo(){}
+    }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pullUp/NotFunctionalAnymore.java b/java/java-tests/testData/refactoring/pullUp/NotFunctionalAnymore.java
new file mode 100644
index 0000000..df7683e
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pullUp/NotFunctionalAnymore.java
@@ -0,0 +1,12 @@
+interface I {
+  void foo();
+}
+
+class IImpl implements I {
+  public void foo(){}
+  public void g<caret>et() {}
+
+  {
+    I i = () -> {};
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pullUp/StillFunctional.java b/java/java-tests/testData/refactoring/pullUp/StillFunctional.java
new file mode 100644
index 0000000..657a296
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pullUp/StillFunctional.java
@@ -0,0 +1,9 @@
+@FunctionalInterface
+interface I {
+  void foo();
+}
+
+class IImpl implements I {
+  public void foo(){}
+  public void g<caret>et() {}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pullUp/StillFunctional_after.java b/java/java-tests/testData/refactoring/pullUp/StillFunctional_after.java
new file mode 100644
index 0000000..d4380a3
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pullUp/StillFunctional_after.java
@@ -0,0 +1,10 @@
+@FunctionalInterface
+interface I {
+  void foo();
+
+    default void get() {}
+}
+
+class IImpl implements I {
+  public void foo(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pushDown/FunctionalExpression.java b/java/java-tests/testData/refactoring/pushDown/FunctionalExpression.java
new file mode 100644
index 0000000..36975cf
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/FunctionalExpression.java
@@ -0,0 +1,12 @@
+interface Base {
+    default void foo() {
+        System.out.println("Hi there.");
+    }
+    void ba<caret>r();
+}
+
+class Test {
+  {
+    Base base = () -> {};
+  }
+}
diff --git a/java/java-tests/testData/refactoring/pushDown/FunctionalExpressionDefaultMethod.java b/java/java-tests/testData/refactoring/pushDown/FunctionalExpressionDefaultMethod.java
new file mode 100644
index 0000000..f3a6b82
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/FunctionalExpressionDefaultMethod.java
@@ -0,0 +1,14 @@
+interface Base {
+    default void foo<caret>() {
+        System.out.println("Hi there.");
+    }
+    void bar();
+}
+
+class Test {
+  {
+    Base base = () -> {};
+  }
+}
+
+class Child implements Base {}
diff --git a/java/java-tests/testData/refactoring/pushDown/FunctionalExpressionDefaultMethod_after.java b/java/java-tests/testData/refactoring/pushDown/FunctionalExpressionDefaultMethod_after.java
new file mode 100644
index 0000000..50fd08d
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/FunctionalExpressionDefaultMethod_after.java
@@ -0,0 +1,15 @@
+interface Base {
+    void bar();
+}
+
+class Test {
+  {
+    Base base = () -> {};
+  }
+}
+
+class Child implements Base {
+    public void foo() {
+    System.out.println("Hi there.");
+}
+}
diff --git a/java/java-tests/testData/refactoring/pushDown/FunctionalExpression_after.java b/java/java-tests/testData/refactoring/pushDown/FunctionalExpression_after.java
new file mode 100644
index 0000000..1ddc1ab
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/FunctionalExpression_after.java
@@ -0,0 +1,11 @@
+interface Base {
+    default void foo() {
+        System.out.println("Hi there.");
+    }
+}
+
+class Test {
+  {
+    Base base = () -> {};
+  }
+}
diff --git a/java/java-tests/testData/refactoring/pushDown/FunctionalInterface.java b/java/java-tests/testData/refactoring/pushDown/FunctionalInterface.java
new file mode 100644
index 0000000..331ac89
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/FunctionalInterface.java
@@ -0,0 +1,10 @@
+@FunctionalInterface
+interface Base {
+    default void foo() {
+        System.out.println("Hi there.");
+    }
+    void ba<caret>r();
+}
+
+class Child implements Base {
+}
diff --git a/java/java-tests/testData/refactoring/pushDown/FunctionalInterface_after.java b/java/java-tests/testData/refactoring/pushDown/FunctionalInterface_after.java
new file mode 100644
index 0000000..e834360
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/FunctionalInterface_after.java
@@ -0,0 +1,10 @@
+@FunctionalInterface
+interface Base {
+    default void foo() {
+        System.out.println("Hi there.");
+    }
+}
+
+class Child implements Base {
+    public abstract void bar();
+}
diff --git a/java/java-tests/testData/refactoring/pushDown/InterfaceConstants.java b/java/java-tests/testData/refactoring/pushDown/InterfaceConstants.java
new file mode 100644
index 0000000..d510a84
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/InterfaceConstants.java
@@ -0,0 +1,7 @@
+interface SimpleDialogPresenter {
+  int BUT<caret>TON_POSITIVE = 1;
+  int BUTTON_NEGATIVE = 2;
+  int BUTTON_NEUTRAL = 3;
+}
+
+class SimpleDialogPresenterImpl implements SimpleDialogPresenter {}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/pushDown/InterfaceConstants_after.java b/java/java-tests/testData/refactoring/pushDown/InterfaceConstants_after.java
new file mode 100644
index 0000000..4a7044e
--- /dev/null
+++ b/java/java-tests/testData/refactoring/pushDown/InterfaceConstants_after.java
@@ -0,0 +1,8 @@
+interface SimpleDialogPresenter {
+    int BUTTON_NEGATIVE = 2;
+  int BUTTON_NEUTRAL = 3;
+}
+
+class SimpleDialogPresenterImpl implements SimpleDialogPresenter {
+    public static final int BUTTON_POSITIVE = 1;
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceDefaultMethod.java b/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceDefaultMethod.java
new file mode 100644
index 0000000..e9c4a91
--- /dev/null
+++ b/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceDefaultMethod.java
@@ -0,0 +1,12 @@
+interface SAM {
+  default void fo<caret>o(int i){}
+  void bar(int i);
+}
+
+class Test {
+
+  {
+    SAM sam = (i) -> {};
+  }
+
+}
diff --git a/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceDefaultMethod_after.java b/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceDefaultMethod_after.java
new file mode 100644
index 0000000..2530d0f
--- /dev/null
+++ b/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceDefaultMethod_after.java
@@ -0,0 +1,11 @@
+interface SAM {
+    void bar(int i);
+}
+
+class Test {
+
+  {
+    SAM sam = (i) -> {};
+  }
+
+}
diff --git a/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceMethod.java b/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceMethod.java
new file mode 100644
index 0000000..2f1c097
--- /dev/null
+++ b/java/java-tests/testData/refactoring/safeDelete/FunctionalInterfaceMethod.java
@@ -0,0 +1,11 @@
+interface SAM {
+  void fo<caret>o(int i);
+}
+
+class Test {
+
+  {
+    SAM sam = (i) -> {};
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/safeDelete/ParameterFromFunctionalInterface.java b/java/java-tests/testData/refactoring/safeDelete/ParameterFromFunctionalInterface.java
new file mode 100644
index 0000000..61f666d
--- /dev/null
+++ b/java/java-tests/testData/refactoring/safeDelete/ParameterFromFunctionalInterface.java
@@ -0,0 +1,11 @@
+interface SAM {
+  void foo(int <caret>i);
+}
+
+class Test {
+
+  {
+    SAM sam = (i) -> {};
+  }
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/vfs/maven-toolchain-1.0.jar b/java/java-tests/testData/vfs/maven-toolchain-1.0.jar
new file mode 100644
index 0000000..ace00cf
--- /dev/null
+++ b/java/java-tests/testData/vfs/maven-toolchain-1.0.jar
Binary files differ
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java
new file mode 100644
index 0000000..8c3837f
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/JavaTypingTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.testFramework.PlatformTestUtil;
+import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
+
+import java.io.File;
+
+public class JavaTypingTest extends LightPlatformCodeInsightFixtureTestCase {
+  public void testMulticaretIndentLBrace() {
+    doTest('{');
+  }
+
+  public void testMulticaretIndentRBrace() {
+    doTest('}');
+  }
+
+  public void testMulticaretSkipSemicolon() {
+    doTest(';');
+  }
+
+  public void testMulticaretSkipGt() {
+    doTest('>');
+  }
+
+  public void testMulticaretInsertGt() {
+    doTest('<');
+  }
+
+  public void testMulticaretSkipRParen() {
+    doTest(')');
+  }
+
+  public void testMulticaretInsertRParen() {
+    doTest('(');
+  }
+
+  public void testMulticaretSkipQuote() {
+    doTest('"');
+  }
+
+  public void testMulticaretInsertQuote() {
+    doTest('"');
+  }
+
+  private void doTest(char c) {
+    myFixture.configureByFile(getTestName(true) + "_before.java");
+    myFixture.type(c);
+    myFixture.checkResultByFile(getTestName(true) + "_after.java");
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/java/java-tests/testData/codeInsight/typing";
+  }
+}
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 e626fd4..d789ce2 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
@@ -812,7 +812,7 @@
     }
     def l = lookup
     edt {
-      assert lookup.calculating
+      if (!lookup.calculating) println "testRestartWithVisibleLookup couldn't be faster than LongContributor"
       myFixture.type 'c'
     }
     joinCommit {
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 a981198..66051a9 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/SmartType18CompletionTest.java
@@ -37,7 +37,7 @@
   @NotNull
   @Override
   protected LightProjectDescriptor getProjectDescriptor() {
-    return JAVA_LATEST;
+    return JAVA_8;
   }
 
 
@@ -82,7 +82,21 @@
   }
 
   public void testFilteredMethodReference() throws Exception {
-    doTest();
+    doTest(false);
+  }
+
+  public void testFilteredStaticMethods() throws Exception {
+    doTest(false);
+  }
+
+  public void testFilterWrongParamsMethods() throws Exception {
+    doTest(false);
+  }
+
+  public void testFilterAmbiguity() throws Exception {
+    configureByFile("/" + getTestName(false) + ".java");
+    assertNotNull(myItems);
+    assertTrue(myItems.length == 0);
   }
 
   public void testNotAvailableInLambdaPositionAfterQualifier() throws Exception {
@@ -105,17 +119,22 @@
   }
 
   public void testDiamondsInsideMethodCall() throws Exception {
-    configureByFile("/" + getTestName(false) + ".java");
-    checkResultByFile("/" + getTestName(false) + "-out.java");
+    doTest(false);
   }
 
   private void doTest() {
+    doTest(true);
+  }
+
+  private void doTest(boolean checkItems) {
     configureByFile("/" + getTestName(false) + ".java");
-    assertNotNull(myItems);
-    assertTrue(myItems.length > 0);
-    final Lookup lookup = getLookup();
-    if (lookup != null) {
-      selectItem(lookup.getCurrentItem(), Lookup.NORMAL_SELECT_CHAR);
+    if (checkItems) {
+      assertNotNull(myItems);
+      assertTrue(myItems.length > 0);
+      final Lookup lookup = getLookup();
+      if (lookup != null) {
+        selectItem(lookup.getCurrentItem(), Lookup.NORMAL_SELECT_CHAR);
+      }
     }
     checkResultByFile("/" + getTestName(false) + "-out.java");
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
index 2ed84c6..f4e40bd 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
@@ -238,6 +238,7 @@
   public void testIDEA106964() throws Exception { doTest5(false);}
   public void testIDEA107782() throws Exception { doTest5(false);}
   public void testInheritedWithDifferentArgsInTypeParams() throws Exception { doTest5(false);}
+  public void testInheritedWithDifferentArgsInTypeParams1() throws Exception { doTest5(false);}
   public void testIllegalForwardReferenceInTypeParameterDefinition() throws Exception { doTest5(false);}
 
   public void testIDEA57877() throws Exception { doTest5(false);}
@@ -337,8 +338,13 @@
   public void testIDEA119546() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
   public void testIDEA118527() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
   public void testIDEA120153() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
-
-  public void testSuperWildcardWithBoundPromotion() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);}
+  public void testIDEA120563() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA121400() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA123316() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA123352() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA123518() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA64103() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+  public void testIDEA123338() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
 
   public void testJavaUtilCollections_NoVerify() throws Exception {
     PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImplementationsViewTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImplementationsViewTest.java
index 6e3b0cc..d12e720 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImplementationsViewTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/ImplementationsViewTest.java
@@ -2,12 +2,14 @@
 
 import com.intellij.codeInsight.TargetElementUtilBase;
 import com.intellij.codeInsight.hint.ImplementationViewComponent;
+import com.intellij.codeInsight.navigation.ClassImplementationsSearch;
+import com.intellij.codeInsight.navigation.MethodImplementationsSearch;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
-import com.intellij.psi.search.searches.ClassInheritorsSearch;
 import com.intellij.psi.search.searches.OverridingMethodsSearch;
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import com.intellij.util.CommonProcessors;
 import org.junit.Assert;
 
 import java.util.*;
@@ -80,6 +82,20 @@
                  "    }", newText);
   }
 
+  private static Collection<PsiElement> getClassImplementations(final PsiClass psiClass) {
+    CommonProcessors.CollectProcessor<PsiElement> processor = new CommonProcessors.CollectProcessor<PsiElement>();
+    ClassImplementationsSearch.processImplementations(psiClass, processor, psiClass.getUseScope());
+
+    return processor.getResults();
+  }
+
+  private static Collection<PsiElement> getMethodImplementations(final PsiMethod psiMethod) {
+    CommonProcessors.CollectProcessor<PsiElement> processor = new CommonProcessors.CollectProcessor<PsiElement>();
+    MethodImplementationsSearch.processImplementations( psiMethod, processor, psiMethod.getUseScope());
+
+    return processor.getResults();
+  }
+
   public void testInnerClasses() {
     myFixture.configureByText("a.java", "abstract class AF<caret>oo{\n" +
                                         "    abstract boolean aaa();\n" +
@@ -107,14 +123,17 @@
       (PsiClass)TargetElementUtilBase.findTargetElement(myFixture.getEditor(), TargetElementUtilBase.getInstance().getAllAccepted());
 
     assert psiClass != null;
-    final Collection<PsiClass> classes = ClassInheritorsSearch.search(psiClass).findAll();
-    List<PsiClass> all = new ArrayList<PsiClass>();
+    final Collection<PsiElement> classes = getClassImplementations(psiClass);
+    List<PsiElement> all = new ArrayList<PsiElement>();
     all.add(psiClass);
     all.addAll(classes);
     final ImplementationViewComponent component =
       new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
     try {
       final String[] visibleFiles = component.getVisibleFiles();
+      assertTrue(visibleFiles.length > 0);
+      assertEquals(visibleFiles[0], "a.java (AFoo)");
+      Arrays.sort(visibleFiles);
       Assert.assertArrayEquals(Arrays.toString(visibleFiles),
                                new String[]{"a.java (AFoo)", "a.java (AFoo1 in AFoo)", "a.java (AFoo2 in AFoo)", "a.java (AFoo3 in AFoo)"}, visibleFiles);
     }
@@ -123,6 +142,70 @@
     }
   }
 
+  public void testFunctionalInterface() {
+    myFixture.configureByText("a.java", "interface AF<caret>oo{\n" +
+                                        "    boolean aaa();\n" +
+                                        "}\n" +
+                                        "class AFooImpl {\n" +
+                                        "        {\n" +
+                                        "             AFoo a = () -> {return false;};\n" +            
+                                        "        }\n" +
+                                        "}");
+    PsiClass psiClass =
+      (PsiClass)TargetElementUtilBase.findTargetElement(myFixture.getEditor(), TargetElementUtilBase.getInstance().getAllAccepted());
+
+    assert psiClass != null;
+    final Collection<PsiElement> classes = getClassImplementations(psiClass);
+    List<PsiElement> all = new ArrayList<PsiElement>();
+    all.add(psiClass);
+    all.addAll(classes);
+    final ImplementationViewComponent component = new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
+    assertContent(component, new String[]{"a.java (AFoo)", "a.java"});
+  }
+
+  public void testInterfaceMethodOfFunctionalInterface() {
+    myFixture.configureByText("a.java", "interface AFoo{\n" +
+                                        "    boolean a<caret>aa();\n" +
+                                        "}\n" +
+                                        "class AFooImpl {\n" +
+                                        "        {\n" +
+                                        "             AFoo a = () -> {return false;};\n" +            
+                                        "        }\n" +
+                                        "}");
+    PsiMethod psiMethod =
+      (PsiMethod)TargetElementUtilBase.findTargetElement(myFixture.getEditor(), TargetElementUtilBase.getInstance().getAllAccepted());
+
+    assert psiMethod != null;
+    final Collection<PsiElement> methods = getMethodImplementations(psiMethod);
+    List<PsiElement> all = new ArrayList<PsiElement>();
+    all.add(psiMethod);
+    all.addAll(methods);
+    final ImplementationViewComponent component = new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
+    assertContent(component, new String[]{"a.java (AFoo)", "a.java"});
+  }
+
+  public void testDefaultMethodOfFunctionalInterface() {
+    myFixture.configureByText("a.java", "interface AFoo{\n" +
+                                        "    default boolean a<caret>aa(){}\n" +
+                                        "    boolean bbb();" +
+                                        "}\n" +
+                                        "class AFooImpl {\n" +
+                                        "        {\n" +
+                                        "             AFoo a = () -> {return false;};\n" +            
+                                        "        }\n" +
+                                        "}");
+    PsiMethod psiMethod =
+      (PsiMethod)TargetElementUtilBase.findTargetElement(myFixture.getEditor(), TargetElementUtilBase.getInstance().getAllAccepted());
+
+    assert psiMethod != null;
+    final Collection<PsiElement> methods = getMethodImplementations(psiMethod);
+    List<PsiElement> all = new ArrayList<PsiElement>();
+    all.add(psiMethod);
+    all.addAll(methods);
+    final ImplementationViewComponent component = new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
+    assertContent(component, new String[]{"a.java (AFoo)"});
+  }
+
   public void testMethodsInInnerClasses() {
       myFixture.configureByText("a.java", "abstract class AFoo{\n" +
                                           "    abstract boolean a<caret>aa();\n" +
@@ -165,10 +248,13 @@
     });
     final ImplementationViewComponent component =
       new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
+    assertContent(component, new String[]{"a.java (AFoo)", "a.java (AFoo1 in AFoo)", "a.java (AFoo2 in AFoo)", "a.java (AFoo3 in AFoo)"});
+  }
+
+  public static void assertContent(ImplementationViewComponent component, String[] expects) {
     try {
       final String[] visibleFiles = component.getVisibleFiles();
-      Assert.assertArrayEquals(Arrays.toString(visibleFiles),
-                               new String[]{"a.java (AFoo)", "a.java (AFoo1 in AFoo)", "a.java (AFoo2 in AFoo)", "a.java (AFoo3 in AFoo)"}, visibleFiles);
+      Assert.assertArrayEquals(Arrays.toString(visibleFiles), expects, visibleFiles);
     }
     finally {
       component.removeNotify();
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java
index 7ebb887..8d2c815 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk6Test.java
@@ -62,4 +62,8 @@
   public void testUnhandledExceptionsValueOf() { doTest(true, false); }
   public void testUnsupportedFeatures7() { doTest(false, false); }
   public void testEnumInitializers() { doTest(false, false); }
+  public void testIDEA79251() { doTest(false, false); }
+  public void testAgentPremain() {
+    doTest(false, false); 
+  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
index ec16061..9f14615 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
@@ -165,6 +165,7 @@
   public void testUncheckedWarningIDEA26738() { doTest(true, false); }
   public void testUncheckedWarningIDEA99536() { doTest(true, false); }
   public void testEnclosingInstance() { doTest(false, false); }
+  public void testIDEA122519EnclosingInstance() { doTest(false, false); }
   public void testWrongArgsAndUnknownTypeParams() { doTest(false, false); }
   public void testAmbiguousMethodCallIDEA97983() { doTest(false, false); }
   public void testAmbiguousMethodCallIDEA100314() { doTest(false, false); }
@@ -180,4 +181,5 @@
   public void testIDEA78916() { doTest(false, false); }
   public void testIDEA111420() { doTest(false, false); }
   public void testIDEA111450() { doTest(true, false); }
+  public void testExternalizable() { doTest(true, false); }
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/ChangeSignatureTouchLambdaTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/ChangeSignatureTouchLambdaTest.java
new file mode 100644
index 0000000..e7c19bf
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/ChangeSignatureTouchLambdaTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.daemon.lambda;
+
+import com.intellij.psi.PsiType;
+import com.intellij.refactoring.BaseRefactoringProcessor;
+import com.intellij.refactoring.ChangeSignatureBaseTest;
+import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
+import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
+
+public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
+ 
+  public void testVariableDeclaration() {
+    doTestConflict();
+  }
+
+  public void testMethodArgument() throws Exception {
+    doTestConflict();
+  }
+
+  public void testDefaultMethodTouched() throws Exception {
+    doTest(null, null, null, new ParameterInfoImpl[] {new ParameterInfoImpl(-1, "b", PsiType.BOOLEAN)}, new ThrownExceptionInfo[0], false);
+  }
+
+  private void doTestConflict() {
+    try {
+      doTest(null, null, null, new ParameterInfoImpl[] {new ParameterInfoImpl(-1, "b", PsiType.BOOLEAN)}, new ThrownExceptionInfo[0], false);
+      fail("Conflict expected");
+    }
+    catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) { }
+  }
+
+  @Override
+  protected String getRelativePath() {
+    return "/codeInsight/daemonCodeAnalyzer/lambda/changeSignature/";
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.java
new file mode 100644
index 0000000..a6a75b7
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/FindFunctionalInterfaceTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.daemon.lambda;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.search.searches.FunctionalExpressionSearch;
+import com.intellij.psi.search.searches.ReferencesSearch;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.testFramework.LightProjectDescriptor;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class FindFunctionalInterfaceTest extends LightCodeInsightFixtureTestCase {
+  public void testMethodArgument() throws Exception {
+    myFixture.configureByFile(getTestName(false) + ".java");
+    final PsiElement elementAtCaret = myFixture.getElementAtCaret();
+    assertNotNull(elementAtCaret);
+    final PsiClass psiClass = PsiTreeUtil.getParentOfType(elementAtCaret, PsiClass.class, false);
+    assertTrue(psiClass != null && psiClass.isInterface());
+    final Collection<PsiFunctionalExpression> expressions = FunctionalExpressionSearch.search(psiClass).findAll();
+    assertTrue(expressions.size() == 1);
+    final PsiFunctionalExpression next = expressions.iterator().next();
+    assertNotNull(next);
+    assertEquals("() -> {}", next.getText());
+  }
+
+  public void testFieldFromAnonymousClassScope() throws Exception {
+    myFixture.configureByFile(getTestName(false) + ".java");
+    final PsiElement elementAtCaret = myFixture.getElementAtCaret();
+    assertNotNull(elementAtCaret);
+    final PsiField field = PsiTreeUtil.getParentOfType(elementAtCaret, PsiField.class, false);
+    assertNotNull(field);
+    final PsiClass aClass = field.getContainingClass();
+    assertTrue(aClass instanceof PsiAnonymousClass);
+    final Collection<PsiReference> references = ReferencesSearch.search(field).findAll();
+    assertFalse(references.isEmpty());
+    assertEquals(1, references.size());
+  }
+
+  @Override
+  protected String getBasePath() {
+    return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/daemonCodeAnalyzer/lambda/findUsages/";
+  }
+
+  @NotNull
+  @Override
+  protected LightProjectDescriptor getProjectDescriptor() {
+    return JAVA_8;
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
index 161d864..8f9167d 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
@@ -743,6 +743,22 @@
     doTest();
   }
 
+  public void testIDEA122401() throws Exception {
+    doTest();
+  }
+
+  public void testCaptureInsideNestedCalls() throws Exception {
+    doTest();
+  }
+
+  public void testSuperWildcardWithBoundPromotion() { doTest();}
+
+  public void testErasure() throws Exception { doTest(); }
+
+  public void testWildcardBoundsCombination() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Interface8MethodsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Interface8MethodsHighlightingTest.java
index f43c937..dfc6a73 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Interface8MethodsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/Interface8MethodsHighlightingTest.java
@@ -15,10 +15,13 @@
  */
 package com.intellij.codeInsight.daemon.lambda;
 
-import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
+import com.intellij.JavaTestUtil;
+import com.intellij.testFramework.LightProjectDescriptor;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
 import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
 
-public class Interface8MethodsHighlightingTest extends LightDaemonAnalyzerTestCase {
+public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTestCase {
   @NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods";
 
   public void testStaticMethod() { doTest(); }
@@ -34,15 +37,39 @@
   public void testDefaultMethodOverrideEquivalentObject() { doTest(false, false); }
   public void testStaticMethods() { doTest(false, false); }
   public void testFinalStaticDefaultMethods() { doTest(false, false); }
+  public void testIDEA122720() { doTest(false, false); }
+  public void testIDEA123839() { doTest(false, false); }
   public void testDefaultSupersInStaticContext() {
     doTest(false, false);
   }
 
+  public void testSuperProtectedCalls() throws Exception {
+    myFixture.addClass("package p; public class Foo {" +
+                       "  protected void foo(){}" +
+                       "}");
+    doTest();
+  }
+
+  public void testIDEA120498() { doTest(false, false); }
+
   private void doTest() {
     doTest(false, false);
   }
 
   private void doTest(boolean checkWarnings, boolean checkInfos) {
-    doTestNewInference(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
+    String filePath = BASE_PATH + "/" + getTestName(false) + ".java";
+    myFixture.configureByFile(filePath);
+    myFixture.checkHighlighting(checkWarnings, checkInfos, false);
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath();
+  }
+
+  @NotNull
+  @Override
+  protected LightProjectDescriptor getProjectDescriptor() {
+    return JAVA_8;
   }
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaHighlightingTest.java
index cf8f43b..aa18173 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/LambdaHighlightingTest.java
@@ -99,6 +99,7 @@
   public void testFinalInitializer() {doTest();}
   public void testBreakContinueInside() {doTest();}
   public void testSameLambdaParamNames() {doTest();}
+  public void testIDEA123308() {doTest();}
 
   private void doTest() {
     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 5f4d01e..a46036c 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
@@ -63,6 +63,18 @@
     doTest();
   }
 
+  public void testRelatedSAMErasures() throws Exception {
+    doTest();
+  }
+
+  public void testJDK8034223() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123352() 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 a3c2b12..5e21a82 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
@@ -130,6 +130,10 @@
     doTest();
   }
 
+  public void testIDEA119003() throws Exception {
+    doTest();
+  }
+
   public void testIDEA117124() throws Exception {
     doTest();
   }
@@ -154,6 +158,46 @@
     doTest();
   }
 
+  public void testIDEA122074() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122084() throws Exception {
+    doTest();
+  }
+
+  public void testAdditionalConstraintDependsOnNonMentionedVars() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122616() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122700() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122406() throws Exception {
+    doTest();
+  }
+
+  public void testNestedCallsInsideLambdaReturnExpression() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123731() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123869() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123848() 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 f18ae82..54ee87c 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
@@ -197,6 +197,46 @@
     doTest();
   }
 
+  public void testIDEA122100() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122509() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122681() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA112191() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA122018comment() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123223() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123248() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123366() throws Exception {
+    doTest();
+  }
+
+  public void testIDEA123366comment() throws Exception {
+    doTest();
+  }
+
+  public void testFromReferenceWithTypeArgs() throws Exception {
+    doTest();
+  }
+
   private void doTest() {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/TypeInference18Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/TypeInference18Test.java
new file mode 100644
index 0000000..8a9a451
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/TypeInference18Test.java
@@ -0,0 +1,64 @@
+/*
+ * 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.daemon.lambda;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.roots.LanguageLevelProjectExtension;
+import com.intellij.pom.java.LanguageLevel;
+import com.intellij.psi.*;
+import com.intellij.testFramework.IdeaTestUtil;
+import com.intellij.testFramework.ResolveTestCase;
+
+public class TypeInference18Test extends ResolveTestCase {
+
+  public void testIDEA122406() throws Exception {
+    doTest();
+  }
+
+  private LanguageLevel myOldLanguageLevel;
+
+  @Override
+  protected void setUp() throws Exception {
+    super.setUp();
+    myOldLanguageLevel = LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).getLanguageLevel();
+    LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
+    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
+  }
+
+  @Override
+  protected void tearDown() throws Exception {
+    LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(myOldLanguageLevel);
+    super.tearDown();
+  }
+
+  private void doTest() throws Exception {
+    PsiReference ref = configureByFile("/codeInsight/daemonCodeAnalyzer/lambda/resolve/" + getTestName(false) + ".java");
+    assertNotNull(ref);
+    assertNotNull(ref.resolve());
+  }
+
+  @Override
+  protected Sdk getTestProjectJdk() {
+    return IdeaTestUtil.getMockJdk18();
+  }
+
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath();
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromMethodReferenceFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromMethodReferenceFixTest.java
new file mode 100644
index 0000000..6182f87
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/CreateMethodFromMethodReferenceFixTest.java
@@ -0,0 +1,25 @@
+/*
+ * 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.daemon.quickFix;
+
+public class CreateMethodFromMethodReferenceFixTest extends LightQuickFixParameterizedTestCase {
+  public void test() throws Exception { doAllTests(); }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/createMethodFromMethodRef";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java
index 579081a..50258fd 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/EmptyIntentionInspectionQuickFixTest.java
@@ -5,6 +5,7 @@
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.ProblemsHolder;
 import com.intellij.codeInspection.defUse.DefUseInspection;
+import com.intellij.codeInspection.ex.EditInspectionToolsSettingsAction;
 import com.intellij.psi.JavaElementVisitor;
 import com.intellij.psi.PsiElementVisitor;
 import com.intellij.psi.PsiLiteralExpression;
@@ -88,7 +89,7 @@
     }
     assertTrue(i < emptyActions.size());
     for (; i < emptyActions.size(); i++) {
-      if (emptyActions.get(i) instanceof EmptyIntentionAction) {
+      if (emptyActions.get(i) instanceof EditInspectionToolsSettingsAction) {
         return;
       }
     }
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Lambda2MethodReferenceInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Lambda2MethodReferenceInspectionTest.java
index 2bbe041..125aaf4 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Lambda2MethodReferenceInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/Lambda2MethodReferenceInspectionTest.java
@@ -17,6 +17,8 @@
 
 import com.intellij.codeInspection.LambdaCanBeMethodReferenceInspection;
 import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.testFramework.IdeaTestUtil;
 import org.jetbrains.annotations.NotNull;
 
 
@@ -36,4 +38,8 @@
     return "/codeInsight/daemonCodeAnalyzer/quickFix/lambda2methodReference";
   }
 
+  @Override
+  protected Sdk getProjectJDK() {
+    return IdeaTestUtil.getMockJdk18();
+  }
 }
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RedundantTypeArgsInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RedundantTypeArgsInspectionTest.java
new file mode 100644
index 0000000..67659c1
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RedundantTypeArgsInspectionTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.daemon.quickFix;
+
+import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.codeInspection.miscGenerics.RedundantTypeArgsInspection;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.testFramework.IdeaTestUtil;
+import org.jetbrains.annotations.NotNull;
+
+
+public class RedundantTypeArgsInspectionTest extends LightQuickFixParameterizedTestCase {
+  @NotNull
+  @Override
+  protected LocalInspectionTool[] configureLocalInspectionTools() {
+    return new LocalInspectionTool[]{ new RedundantTypeArgsInspection()};
+  }
+
+  public void test() throws Exception { doAllTests(); }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/redundantTypeArgs";
+  }
+
+  @Override
+  protected Sdk getProjectJDK() {
+    return IdeaTestUtil.getMockJdk18();
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java
new file mode 100644
index 0000000..a8816f8
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/RemoveUnusedAssignmentTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.daemon.quickFix;
+
+import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.codeInspection.defUse.DefUseInspection;
+import com.intellij.pom.java.LanguageLevel;
+import org.jetbrains.annotations.NotNull;
+
+public class RemoveUnusedAssignmentTest extends LightQuickFixTestCase {
+  public void test() throws Exception { doAllTests(); }
+
+  @NotNull
+  @Override
+  protected LocalInspectionTool[] configureLocalInspectionTools() {
+    return new LocalInspectionTool[] {new DefUseInspection()};
+  }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/unusedAssignment";
+  }
+
+  @Override
+  protected LanguageLevel getLanguageLevel() {
+    return LanguageLevel.JDK_1_5;
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithConstantFixTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithConstantFixTest.java
new file mode 100644
index 0000000..f0b6201
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithConstantFixTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.daemon.quickFix;
+
+import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.codeInspection.duplicateStringLiteral.DuplicateStringLiteralInspection;
+import org.jetbrains.annotations.NotNull;
+
+public class ReplaceWithConstantFixTest extends LightQuickFixParameterizedTestCase {
+  @NotNull
+  @Override
+  protected LocalInspectionTool[] configureLocalInspectionTools() {
+    return new LocalInspectionTool[]{new DuplicateStringLiteralInspection()};
+  }
+
+  public void test() throws Exception {
+     doAllTests();
+   }
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithConstant";
+  }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/editorActions/JavaEnterInStringLiteralTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/editorActions/JavaEnterInStringLiteralTest.java
new file mode 100644
index 0000000..f8feec3
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/editorActions/JavaEnterInStringLiteralTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.editorActions;
+
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
+import com.intellij.testFramework.EditorTestUtil;
+import com.intellij.testFramework.LightCodeInsightTestCase;
+
+/**
+ * @author Rustam Vishnyakov
+ */
+public class JavaEnterInStringLiteralTest extends LightCodeInsightTestCase {
+  private static final String BASE_PATH = "/codeInsight/editorActions/stringLiteral/";
+
+  public void testEnter() {
+    doTest();
+  }
+
+  public void testEnterOpSignOnNextLine() {
+    CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
+    boolean opSignOnNextLine = settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE;
+    try {
+      settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE =  true;
+      doTest();
+    }
+    finally {
+      settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE = opSignOnNextLine;
+    }
+  }
+
+  private void doTest() {
+    String testName = getTestName(true);
+    configureByFile(BASE_PATH + testName + ".java");
+    EditorTestUtil.performTypingAction(getEditor(), '\n');
+    checkResultByFile(BASE_PATH + testName + "_after.java");
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
index b462263..ffe09fd 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
@@ -29,6 +29,7 @@
 import com.intellij.psi.PsiClass
 import com.intellij.psi.PsiMethod
 import com.intellij.psi.search.GlobalSearchScope
+import com.intellij.testFramework.LightProjectDescriptor
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 
 /**
@@ -41,6 +42,11 @@
   def JavaCodeFoldingSettingsImpl myFoldingStateToRestore
 
   @Override
+  protected LightProjectDescriptor getProjectDescriptor() {
+    return JAVA_1_7
+  }
+
+  @Override
   public void setUp() {
     super.setUp()
     myFoldingSettings = JavaCodeFoldingSettings.instance as JavaCodeFoldingSettingsImpl
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java
index 6f31786..60be917 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/generation/surroundWith/JavaSurroundWithTest.java
@@ -145,6 +145,16 @@
     TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
     doTest(getTestName(false), new JavaWithNotSurrounder());
   }
+  
+  public void testSurroundExpressionWithElseIf() {
+    TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+    doTest(getTestName(false), new JavaWithIfExpressionSurrounder());
+  }
+  
+  public void testSurroundExpressionWithElseIfElse() {
+    TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
+    doTest(getTestName(false), new JavaWithIfElseExpressionSurrounder());
+  }
 
   private void doTest(@NotNull String fileName, final Surrounder surrounder) {
     configureByFile(BASE_PATH + fileName + ".java");
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy
index 02d52a5..6237f9c 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/highlighting/HighlightUsagesHandlerTest.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.
@@ -14,11 +14,10 @@
  * limitations under the License.
  */
 package com.intellij.codeInsight.highlighting
-
 import com.intellij.JavaTestUtil
+import com.intellij.codeInsight.daemon.impl.HighlightInfoType
 import com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPassFactory
 import com.intellij.codeInspection.sillyAssignment.SillyAssignmentInspection
-import com.intellij.lang.annotation.HighlightSeverity
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 import org.jetbrains.annotations.NonNls
 /**
@@ -233,7 +232,7 @@
     try {
       def infos = myFixture.doHighlighting()
       //import highlighted twice: for each overloaded usage target
-      assert infos.findAll { it.severity == HighlightSeverity.INFORMATION && myFixture.file.text.substring(it.startOffset, it.endOffset) == 'foo' }.size() == 3
+      assert infos.findAll { it.severity == HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY && myFixture.file.text.substring(it.startOffset, it.endOffset) == 'foo' }.size() == 3
     }
     finally {
       IdentifierHighlighterPassFactory.ourTestingIdentifierHighlighting = false
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/JoinDeclarationTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/JoinDeclarationTest.java
new file mode 100644
index 0000000..d0e1d9f
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/JoinDeclarationTest.java
@@ -0,0 +1,26 @@
+/*
+ * 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.intention;
+
+import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
+
+public class JoinDeclarationTest extends LightQuickFixParameterizedTestCase {
+
+  @Override
+  protected String getBasePath() {
+    return "/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration";
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitDeclarationTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitDeclarationTest.java
index 50e46ab..9d7693a 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitDeclarationTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/intention/SplitDeclarationTest.java
@@ -16,9 +16,6 @@
 package com.intellij.codeInsight.intention;
 
 import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
-import com.intellij.codeInsight.intention.impl.SplitIfAction;
-import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
-import com.intellij.testFramework.LightCodeInsightTestCase;
 
 public class SplitDeclarationTest extends LightQuickFixParameterizedTestCase {
 
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 cef42e9..8f7efee 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/LiveTemplateTest.groovy
@@ -35,6 +35,7 @@
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings
 import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
 import com.intellij.util.containers.ContainerUtil
+import com.intellij.util.ui.UIUtil
 import org.jetbrains.annotations.NotNull
 
 import static com.intellij.codeInsight.template.Template.Property.USE_STATIC_IMPORT_IF_POSSIBLE
@@ -80,6 +81,7 @@
     addTemplate(template, testRootDisposable)
 
     manager.startTemplate(editor, (char)'\t');
+    UIUtil.dispatchAllInvocationEvents()
     checkResultByText(expected);
   }
   
@@ -110,6 +112,7 @@
     addTemplate(template, testRootDisposable)
 
     startTemplate(templateName, templateGroup)
+    UIUtil.dispatchAllInvocationEvents()
     if (firstDefaultValue.empty) myFixture.type("TestValue1")
     myFixture.type("\t")
     if (secondDefaultValue.empty) myFixture.type("TestValue2")
@@ -137,9 +140,8 @@
     final TemplateManager manager = TemplateManager.getInstance(getProject());
     final Template template = manager.createTemplate("empty", "user", '$VAR$');
     template.addVariable("VAR", "", "", false);
-    final Editor editor = getEditor();
 
-    manager.startTemplate(editor, template);
+    startTemplate(template);
     checkResultByText("");
 
   }
@@ -150,9 +152,8 @@
     final Template template = manager.createTemplate("empty", "user", '$VAR$$END$');
     template.addVariable("VAR", "bar", "bar", true);
     template.setToReformat(true);
-    final Editor editor = getEditor();
 
-    manager.startTemplate(editor, template);
+    startTemplate(template);
     myFixture.type("foo");
     checkResultByText("foo");
   }
@@ -168,7 +169,7 @@
                                                                 '  $END$\n' +
                                                                 'foo()');
     template.setToReformat(true);
-    manager.startTemplate(getEditor(), template);
+    startTemplate(template);
     checkResultByText("class C {\n" +
                       "  bar() {\n" +
                       "      foo()\n" +
@@ -196,7 +197,7 @@
                                                                     "frame.pack();");
     template.setToShortenLongNames(false);
     template.setToReformat(true);
-    manager.startTemplate(getEditor(), template);
+    startTemplate(template);
     checkResult();
   }
 
@@ -210,7 +211,7 @@
     final TemplateManager manager = TemplateManager.getInstance(getProject());
     final Template template = manager.createTemplate("frm", "user", '$VAR$');
     template.addVariable('VAR', new MacroCallNode(new CompleteMacro()), new EmptyNode(), true)
-    manager.startTemplate(getEditor(), template);
+    startTemplate(template);
     myFixture.type('fo\n')
     myFixture.checkResult '''
 class Foo {
@@ -231,7 +232,7 @@
     final TemplateManager manager = TemplateManager.getInstance(getProject());
     final Template template = manager.createTemplate("frm", "user", '$VAR$');
     template.addVariable('VAR', new MacroCallNode(new CompleteMacro()), new EmptyNode(), true)
-    manager.startTemplate(getEditor(), template);
+    startTemplate(template);
     myFixture.type('fo\n')
     myFixture.checkResult '''
 class Foo {
@@ -253,7 +254,7 @@
     final TemplateManager manager = TemplateManager.getInstance(getProject());
     final Template template = manager.createTemplate("frm", "user", '$VAR$');
     template.addVariable('VAR', new MacroCallNode(new ClassNameCompleteMacro()), new EmptyNode(), true)
-    manager.startTemplate(getEditor(), template);
+    startTemplate(template);
     assert !state.finished
     assert 'Bar' in myFixture.lookupElementStrings
   }
@@ -278,7 +279,12 @@
   }
 
   def startTemplate(String name, String group) {
-    TemplateManager.getInstance(getProject()).startTemplate(getEditor(), TemplateSettings.getInstance().getTemplate(name, group));
+    startTemplate(TemplateSettings.getInstance().getTemplate(name, group));
+  }
+
+  def startTemplate(Template template) {
+    TemplateManager.getInstance(getProject()).startTemplate(getEditor(), template)
+    UIUtil.dispatchAllInvocationEvents()
   }
 
   private static <T extends TemplateContextType> T contextType(Class<T> clazz) {
@@ -533,7 +539,7 @@
     template.addVariable("V3", "", "", true);
     final Editor editor = getEditor();
 
-    writeCommand { manager.startTemplate(editor, template) }
+    writeCommand { startTemplate(template) }
 
     final TemplateState state = getState();
 
@@ -575,7 +581,7 @@
     template.addVariable("V1", "", "", true);
     template.addVariable("V2", "", '"239"', true);
 
-    writeCommand { manager.startTemplate(editor, template) }
+    writeCommand { startTemplate(template) }
 
     myFixture.checkResult '<caret> var = 239;'
 
@@ -596,7 +602,7 @@
 
     addTemplate(template, testRootDisposable)
     myFixture.type '\t'
-    myFixture.checkResult 'class A { void f() { Stri    "; } }'
+    myFixture.checkResult 'class A { void f() { Stri   "; } }'
   }
 
   static void addTemplate(Template template, Disposable parentDisposable) {
@@ -659,7 +665,7 @@
     template.addVariable('T', new MacroCallNode(new MethodReturnTypeMacro()), new EmptyNode(), false)
     template.toReformat = true
     
-    manager.startTemplate(getEditor(), template);
+    startTemplate(template);
     assert myFixture.editor.document.text.contains('List<Map.Entry<String, Integer>> result;')
   }
 
@@ -705,7 +711,7 @@
     final Template template = manager.createTemplate("xxx", "user", 'foo $ARG$ bar $END$ goo $SELECTION$ after');
     template.addVariable("ARG", "", "", true);
     
-    manager.startTemplate(editor, template);
+    startTemplate(template);
     myFixture.type('arg')
     state.nextTab()
     assert !state
@@ -731,7 +737,7 @@
     final Template template = manager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)');
     template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true);
 
-    manager.startTemplate(editor, template);
+    startTemplate(template);
     myFixture.checkResult """
 import static foo.Bar.someMethod;
 
@@ -754,7 +760,7 @@
     template.addVariable('B', macroCallNode, false)
 
     myFixture.configureByText "a.txt", "<caret>"
-    manager.startTemplate(editor, template);
+    startTemplate(template);
     myFixture.type('-foo-bar_goo-')
     state.nextTab()
     assert !state
@@ -779,7 +785,7 @@
     final Template template = manager.createTemplate("xxx", "user", 'foo.Bar.someMethod($END$)');
     template.setValue(USE_STATIC_IMPORT_IF_POSSIBLE, true);
 
-    manager.startTemplate(editor, template);
+    startTemplate(template);
     myFixture.checkResult """import static foo.Bar.someMethod;
 
 class Foo {
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java
index 39fd2fb..9fa0063 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/completion/TemplatesCompletionTest.java
@@ -17,6 +17,7 @@
 
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.completion.CompletionAutoPopupTestCase;
+import com.intellij.codeInsight.completion.CompletionType;
 import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.codeInsight.lookup.impl.LookupImpl;
 import com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor;
@@ -27,10 +28,18 @@
 import org.jetbrains.annotations.Nullable;
 
 public class TemplatesCompletionTest extends CompletionAutoPopupTestCase {
+  private boolean shotTemplatesInTestsOldValue;
+
+  @Override
+  public void setUp() {
+    super.setUp();
+    shotTemplatesInTestsOldValue = LiveTemplateCompletionContributor.ourShowTemplatesInTests;
+    LiveTemplateCompletionContributor.ourShowTemplatesInTests = false;
+  }
 
   @Override
   public void tearDown() throws Exception {
-    LiveTemplateCompletionContributor.ourShowTemplatesInTests = false;
+    LiveTemplateCompletionContributor.ourShowTemplatesInTests = shotTemplatesInTestsOldValue;
 
     PostfixTemplatesSettings settings = PostfixTemplatesSettings.getInstance();
     assertNotNull(settings);
@@ -95,6 +104,17 @@
     doAutoPopupTest("instanceof", null);
   }
 
+  public void testDoNotShowTemplateInMultiCaretMode() {
+    doAutoPopupTest("instanceof", null);
+  }
+
+  public void testDoNotCompleteTemplateInMultiCaretMode() {
+    LiveTemplateCompletionContributor.ourShowTemplatesInTests = true;
+    configureByFile();
+    assertEmpty(myFixture.complete(CompletionType.BASIC));
+    checkResultByFile();
+  }
+
   public void testShowTemplateOnDoubleLiteral() {
     doAutoPopupTest("switch", SwitchStatementPostfixTemplate.class);
   }
@@ -146,7 +166,7 @@
   
   public void testTabCompletionWithTemplatesInAutopopup() {
     LiveTemplateCompletionContributor.ourShowTemplatesInTests = true;
-    
+
     configureByFile();
     type(".");
     myFixture.assertPreferredCompletionItems(0, "parents");
@@ -156,6 +176,12 @@
     checkResultByFile();
   }
 
+  public void testShouldNotExpandInMultiCaretMode() {
+    configureByFile();
+    type(".if\t");
+    checkResultByFile();
+  }
+  
   @Override
   protected String getBasePath() {
     return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/template/postfix/completion";
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplateTest.java
new file mode 100644
index 0000000..fc336e0
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/FormatPostfixTemplateTest.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.template.postfix.templates;
+
+import org.jetbrains.annotations.NotNull;
+
+public class FormatPostfixTemplateTest extends PostfixTemplateTestCase {
+  @NotNull
+  @Override
+  protected String getSuffix() { return "format"; }
+
+  public void testString()      { doTest(); }
+  public void testNotString()   { doTest(); }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/NotNullPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/NotNullPostfixTemplateTest.java
index ca08b68..bbac7ff 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/NotNullPostfixTemplateTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/NotNullPostfixTemplateTest.java
@@ -17,9 +17,6 @@
 
 import org.jetbrains.annotations.NotNull;
 
-/**
- * @author ignatov
- */
 public class NotNullPostfixTemplateTest extends PostfixTemplateTestCase {
   @NotNull
   @Override
@@ -29,4 +26,5 @@
   public void testPrimitive()         { doTest(); }
   public void testNn()                { doTest(); }
   public void testSecondStatement()   { doTest(); }
+  public void testElseStatement()     { doTest(); }
 }
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplateTest.java
new file mode 100644
index 0000000..d3bcc74
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/SoutPostfixTemplateTest.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.template.postfix.templates;
+
+import org.jetbrains.annotations.NotNull;
+
+public class SoutPostfixTemplateTest extends PostfixTemplateTestCase {
+  @NotNull
+  @Override
+  protected String getSuffix() { return "sout"; }
+
+  public void testSimple() { doTest(); }
+  public void testVoid()   { doTest(); }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/TryPostfixTemplateTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/TryPostfixTemplateTest.java
new file mode 100644
index 0000000..7183883
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/template/postfix/templates/TryPostfixTemplateTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+
+public class TryPostfixTemplateTest extends PostfixTemplateTestCase {
+
+  @NotNull
+  @Override
+  protected String getSuffix() {
+    return "try";
+  }
+
+  public void testSimple() {
+    doTest();
+  }
+
+  public void testStatement() {
+    doTest();
+  }
+
+  public void testMultiStatement() {
+    doTest();
+  }
+
+  public void testNotStatement() {
+    doTest();
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
index f636c11..af69793 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/DataFlowInspectionTest.java
@@ -274,6 +274,7 @@
   public void testContractWithNullable() { doTest(); }
   public void testContractPreservesUnknownNullability() { doTest(); }
   public void testContractSeveralClauses() { doTest(); }
+  public void testContractVarargs() { doTest(); }
 
   public void testBoxingImpliesNotNull() { doTest(); }
   public void testLargeIntegersAreNotEqualWhenBoxed() { doTest(); }
@@ -308,6 +309,10 @@
 
   public void testUnusedCallDoesNotMakeUnknown() { doTest(); }
   public void testGettersAndPureNoFlushing() { doTest(); }
+  
+  public void testNotNullAfterDereference() { doTest(); }
+
+  public void testNullableBoolean() { doTest(); }
 
   public void testSameComparisonTwice() { doTest(); }
 
@@ -320,6 +325,12 @@
     
     doTest(); 
   }
+
+  public void testTrueOrEqualsSomething() {
+    doTest();
+    myFixture.launchAction(myFixture.findSingleIntention("Remove redundant assignment"));
+    myFixture.checkResultByFile(getTestName(false) + "_after.java");
+  }
   
   public void _testNullCheckBeforeInstanceof() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEA-113220
 }
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/JavaAPIUsagesInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/JavaAPIUsagesInspectionTest.java
index 8414b7f..18b9656 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/JavaAPIUsagesInspectionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/JavaAPIUsagesInspectionTest.java
@@ -23,17 +23,7 @@
 import com.intellij.JavaTestUtil;
 import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
 import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
-import com.intellij.openapi.roots.ContentIterator;
-import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.vfs.JarFileSystem;
-import com.intellij.openapi.vfs.VfsUtilCore;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileFilter;
 import com.intellij.pom.java.LanguageLevel;
-import com.intellij.psi.*;
-import com.intellij.psi.javadoc.PsiDocComment;
-import com.intellij.psi.javadoc.PsiDocTag;
-import com.intellij.psi.javadoc.PsiDocTagValue;
 import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.testFramework.InspectionTestCase;
 
@@ -70,9 +60,10 @@
     });
   }
 
-  @SuppressWarnings("UnusedDeclaration")
-  public void _testCollectSinceApiUsages() {
-    final String version = "1.7";
+  //generate apiXXX.txt
+  /*
+  public void testCollectSinceApiUsages() {
+    final String version = "1.8";
     final ContentIterator contentIterator = new ContentIterator() {
       @Override
       public boolean processFile(VirtualFile fileOrDir) {
@@ -102,15 +93,15 @@
         return true;
       }
     };
-    final VirtualFile srcFile = JarFileSystem.getInstance().findFileByPath("c:/program files/java/jdk1.6.0_12/src.zip!/");
+    final VirtualFile srcFile = JarFileSystem.getInstance().findFileByPath("c:/tools/jdk8/src.zip!/");
     assert srcFile != null;
     VfsUtilCore.iterateChildrenRecursively(srcFile, VirtualFileFilter.ALL, contentIterator);
   }
-/*
+
   @Override
   protected void setUpJdk() {
     Module[] modules = ModuleManager.getInstance(myProject).getModules();
-    final Sdk sdk = JavaSdk.getInstance().createJdk("1.7", "c:/program files (x86)/java/jdk1.7.0_09/", false);
+    final Sdk sdk = JavaSdk.getInstance().createJdk("1.8", "c:/tools/jdk8/", false);
     for (Module module : modules) {
       ModuleRootModificationUtil.setModuleSdk(module, sdk);
     }
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast15Test.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast15Test.java
index ca3065d..4dd2964 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast15Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast15Test.java
@@ -57,6 +57,11 @@
     doTest();
   }
 
+  public void testBoxingTopCast() throws Exception {
+    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), getTestRootDisposable());
+    doTest();
+  }
+
   public void testIgnore() throws Exception {
     final RedundantCastInspection castInspection = new RedundantCastInspection();
     castInspection.IGNORE_ANNOTATED_METHODS = true;
diff --git a/java/java-tests/testSrc/com/intellij/execution/BaseConfigurationTestCase.java b/java/java-tests/testSrc/com/intellij/execution/BaseConfigurationTestCase.java
index 9092e25..9a88daa 100644
--- a/java/java-tests/testSrc/com/intellij/execution/BaseConfigurationTestCase.java
+++ b/java/java-tests/testSrc/com/intellij/execution/BaseConfigurationTestCase.java
@@ -32,6 +32,7 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.ModuleRootModificationUtil;
+import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.JavaPsiFacade;
@@ -96,20 +97,21 @@
     return module;
   }
 
-  private Module createTempModule() throws IOException {
+  private Module createTempModule() {
     return createTempModule(myTempFiles, myProject);
   }
 
+  @NotNull
   public static Module createTempModule(TempFiles tempFiles, final Project project) {
     final String tempPath = tempFiles.createTempPath();
-    final Module[] module = new Module[1];
-    ApplicationManager.getApplication().runWriteAction(new Runnable() {
+    return ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
       @Override
-      public void run() {
-        module[0] = ModuleManager.getInstance(project).newModule(tempPath, StdModuleTypes.JAVA.getId());
+      public Module compute() {
+        Module result = ModuleManager.getInstance(project).newModule(tempPath, StdModuleTypes.JAVA.getId());
+        project.save();
+        return result;
       }
     });
-    return module[0];
   }
 
   protected static VirtualFile findFile(String path) {
diff --git a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
index b0bc587..86d79fb 100644
--- a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
+++ b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
@@ -28,7 +28,7 @@
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.fileTypes.FileTypes;
-import com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl;
+import com.intellij.openapi.fileTypes.PlainTextFileType;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.util.ProperTextRange;
 import com.intellij.openapi.util.io.FileUtil;
@@ -302,8 +302,7 @@
     }.execute().getResultObject();
     
     assertNull(FileDocumentManager.getInstance().getCachedDocument(custom));
-    assertEquals(FileTypes.UNKNOWN, custom.getFileType());
-    assertFalse(FileTypeManagerImpl.isFileTypeDetectedFromContent(custom));
+    assertEquals(PlainTextFileType.INSTANCE, custom.getFileType());
 
     FindModel findModel = new FindModel();
     findModel.setWholeWordsOnly(true);
@@ -318,7 +317,6 @@
     // and we should get the same with text loaded
     assertNotNull(FileDocumentManager.getInstance().getDocument(custom));
     assertEquals(FileTypes.PLAIN_TEXT, custom.getFileType());
-    assertTrue(FileTypeManagerImpl.isFileTypeDetectedFromContent(custom));
 
     assertSize(2, findUsages(findModel));
   }
@@ -539,6 +537,22 @@
     }
   }
 
+  public void testFindInDirectoryOutsideProject() throws Exception {
+    final TempDirTestFixture tempDirFixture = new TempDirTestFixtureImpl();
+    tempDirFixture.setUp();
+    try {
+      tempDirFixture.createFile("a.txt", "foo bar foo");
+      FindModel findModel = FindManagerTestUtils.configureFindModel("foo");
+      findModel.setWholeWordsOnly(true);
+      findModel.setProjectScope(false);
+      findModel.setDirectoryName(tempDirFixture.getFile("").getPath());
+      assertSize(2, findUsages(findModel));
+    }
+    finally {
+      tempDirFixture.tearDown();
+    }
+  }
+
   public void testFindInJavaDocs() {
     FindModel findModel = FindManagerTestUtils.configureFindModel("done");
     String text = "/** done done done */";
diff --git a/java/java-tests/testSrc/com/intellij/ide/fileTemplates/SimpleTemplatesTest.java b/java/java-tests/testSrc/com/intellij/ide/fileTemplates/SimpleTemplatesTest.java
new file mode 100644
index 0000000..193dd7d
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/ide/fileTemplates/SimpleTemplatesTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.ide.fileTemplates;
+
+import com.intellij.ide.fileTemplates.impl.CustomFileTemplate;
+import com.intellij.testFramework.IdeaTestCase;
+import com.intellij.testFramework.LightPlatformTestCase;
+
+import java.util.Properties;
+
+/**
+ * @author Dmitry Avdeev
+ */
+public class SimpleTemplatesTest extends LightPlatformTestCase {
+
+  @SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
+  public SimpleTemplatesTest() {
+    IdeaTestCase.initPlatformPrefix();
+  }
+
+  public void testConditional() throws Exception {
+    CustomFileTemplate template = new CustomFileTemplate("foo", "bar");
+    template.setText("#set($flag = \"$!IJ_BASE_PACKAGE\" != \"\")\n" +
+                     "<option name=\"MAIN_CLASS_NAME\" value=\"$IJ_BASE_PACKAGE#if($flag).#{end}Main\" />"
+    );
+    Properties attributes = new Properties();
+    attributes.setProperty("IJ_BASE_PACKAGE", "");
+    assertEquals("<option name=\"MAIN_CLASS_NAME\" value=\"Main\" />", template.getText(attributes));
+    attributes.setProperty("IJ_BASE_PACKAGE", "foo.bar");
+    assertEquals("<option name=\"MAIN_CLASS_NAME\" value=\"foo.bar.Main\" />", template.getText(attributes));
+  }
+
+  public void testInline() throws Exception {
+    CustomFileTemplate template = new CustomFileTemplate("foo", "bar");
+    template.setText("$IJ_BASE_PACKAGE.replace(\".\", \"/\")");
+    Properties attributes = new Properties();
+    attributes.setProperty("IJ_BASE_PACKAGE", "foo.bar");
+    assertEquals("foo/bar", template.getText(attributes));
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/index/IndexTest.java b/java/java-tests/testSrc/com/intellij/index/IndexTest.java
index 7770c5e..4fcb402 100644
--- a/java/java-tests/testSrc/com/intellij/index/IndexTest.java
+++ b/java/java-tests/testSrc/com/intellij/index/IndexTest.java
@@ -18,7 +18,7 @@
 import com.intellij.openapi.command.WriteCommandAction;
 import com.intellij.openapi.editor.Document;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.fileTypes.UnknownFileType;
+import com.intellij.openapi.fileTypes.PlainTextFileType;
 import com.intellij.openapi.util.Factory;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.VfsUtil;
@@ -276,8 +276,8 @@
 
     final VirtualFile vFile = createChildData(dir, "Foo.test");
     VfsUtil.saveText(vFile, "Foo");
-    assertEquals(UnknownFileType.INSTANCE, vFile.getFileType());
-    assertEmpty(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
+    assertEquals(PlainTextFileType.INSTANCE, vFile.getFileType());
+    assertOneElement(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
 
     final Document document = FileDocumentManager.getInstance().getDocument(vFile);
     //todo should file type be changed silently without events?
@@ -287,22 +287,22 @@
     assertInstanceOf(file, PsiPlainTextFile.class);
     assertEquals("Foo", file.getText());
 
-    assertEmpty(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
+    assertOneElement(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
 
     WriteCommandAction.runWriteCommandAction(myProject, new Runnable() {
       @Override
       public void run() {
         document.insertString(0, " ");
         assertEquals("Foo", file.getText());
-        assertEmpty(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
+        assertOneElement(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
 
         FileDocumentManager.getInstance().saveDocument(document);
         assertEquals("Foo", file.getText());
-        assertEmpty(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
+        assertOneElement(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
 
         PsiDocumentManager.getInstance(myProject).commitAllDocuments();
         assertEquals(" Foo", file.getText());
-        assertEmpty(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
+        assertOneElement(PsiSearchHelper.SERVICE.getInstance(myProject).findFilesWithPlainTextWords("Foo"));
 
       }
     });
diff --git a/java/java-tests/testSrc/com/intellij/index/StringIndex.java b/java/java-tests/testSrc/com/intellij/index/StringIndex.java
index 7d2dd10..0b5d48d 100644
--- a/java/java-tests/testSrc/com/intellij/index/StringIndex.java
+++ b/java/java-tests/testSrc/com/intellij/index/StringIndex.java
@@ -59,7 +59,7 @@
   private static class Indexer implements DataIndexer<String, String, PathContentPair> {
     @Override
     @NotNull
-    public Map<String,String> map(final PathContentPair inputData) {
+    public Map<String,String> map(@NotNull final PathContentPair inputData) {
       final Map<String,String> _map = new HashMap<String, String>();
       final StringBuilder builder = new StringBuilder();
       final String content = inputData.content;
diff --git a/java/java-tests/testSrc/com/intellij/navigation/GotoImplementationTest.java b/java/java-tests/testSrc/com/intellij/navigation/GotoImplementationTest.java
index da1de92..cba853e 100644
--- a/java/java-tests/testSrc/com/intellij/navigation/GotoImplementationTest.java
+++ b/java/java-tests/testSrc/com/intellij/navigation/GotoImplementationTest.java
@@ -12,6 +12,7 @@
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
 import com.intellij.psi.PsiMethod;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.util.CommonProcessors;
@@ -26,8 +27,8 @@
  */
 public class GotoImplementationTest extends CodeInsightTestCase {
 
-  private static Collection<PsiClass> getClassImplementations(final PsiClass psiClass) {
-    CommonProcessors.CollectProcessor<PsiClass> processor = new CommonProcessors.CollectProcessor<PsiClass>();
+  private static Collection<PsiElement> getClassImplementations(final PsiClass psiClass) {
+    CommonProcessors.CollectProcessor<PsiElement> processor = new CommonProcessors.CollectProcessor<PsiElement>();
     ClassImplementationsSearch.processImplementations(psiClass, processor, psiClass.getUseScope());
 
     return processor.getResults();
@@ -64,29 +65,31 @@
     PsiClass test1 = myJavaFacade.findClass("com.test.TestI", moduleScope);
     PsiClass test2 = myJavaFacade.findClass("com.test.TestI", GlobalSearchScope.moduleScope(module2));
     PsiClass test3 = myJavaFacade.findClass("com.test.TestI", GlobalSearchScope.moduleScope(module3));
-    HashSet<PsiClass> expectedImpls1 = new HashSet<PsiClass>(Arrays.asList(
+    HashSet<PsiElement> expectedImpls1 = new HashSet<PsiElement>(Arrays.asList(
       myJavaFacade.findClass("com.test.TestIImpl1", moduleScope),
       myJavaFacade.findClass("com.test.TestIImpl2", moduleScope)
     ));
-    assertEquals(expectedImpls1, new HashSet<PsiClass>(getClassImplementations(test1)));
+    assertEquals(expectedImpls1, new HashSet<PsiElement>(getClassImplementations(test1)));
 
     PsiMethod psiMethod = test1.findMethodsByName("test", false)[0];
-    Set<PsiMethod> expectedMethodImpl1 = new HashSet<PsiMethod>(Arrays.asList(
+    Set<PsiElement> expectedMethodImpl1 = new HashSet<PsiElement>(Arrays.asList(
       myJavaFacade.findClass("com.test.TestIImpl1", moduleScope).findMethodsByName("test",false)[0],
       myJavaFacade.findClass("com.test.TestIImpl2", moduleScope).findMethodsByName("test",false)[0]
     ));
-    assertEquals(expectedMethodImpl1, new HashSet<PsiMethod>(Arrays.asList(MethodImplementationsSearch.getMethodImplementations(psiMethod, moduleScope))));
+    CommonProcessors.CollectProcessor<PsiElement> processor = new CommonProcessors.CollectProcessor<PsiElement>();
+    MethodImplementationsSearch.processImplementations(psiMethod, processor, moduleScope);
+    assertEquals(expectedMethodImpl1, new HashSet<PsiElement>(processor.getResults()));
 
-    HashSet<PsiClass> expectedImpls2 = new HashSet<PsiClass>(Arrays.asList(
+    HashSet<PsiElement> expectedImpls2 = new HashSet<PsiElement>(Arrays.asList(
       myJavaFacade.findClass("com.test.TestIImpl1", GlobalSearchScope.moduleScope(module2)),
       myJavaFacade.findClass("com.test.TestIImpl3", GlobalSearchScope.moduleScope(module2))
     ));
-    assertEquals(expectedImpls2, new HashSet<PsiClass>(getClassImplementations(test2)));
+    assertEquals(expectedImpls2, new HashSet<PsiElement>(getClassImplementations(test2)));
 
-    HashSet<PsiClass> expectedImpls3 = new HashSet<PsiClass>(Arrays.asList(
+    HashSet<PsiElement> expectedImpls3 = new HashSet<PsiElement>(Arrays.asList(
       myJavaFacade.findClass("com.test.TestIImpl1", GlobalSearchScope.moduleScope(module3))
     ));
-    assertEquals(expectedImpls3, new HashSet<PsiClass>(getClassImplementations(test3)));
+    assertEquals(expectedImpls3, new HashSet<PsiElement>(getClassImplementations(test3)));
 
   }
 
diff --git a/java/java-tests/testSrc/com/intellij/openapi/editor/impl/JavaFileEditorManagerTest.java b/java/java-tests/testSrc/com/intellij/openapi/editor/impl/JavaFileEditorManagerTest.java
index 2a985b8..4773532 100644
--- a/java/java-tests/testSrc/com/intellij/openapi/editor/impl/JavaFileEditorManagerTest.java
+++ b/java/java-tests/testSrc/com/intellij/openapi/editor/impl/JavaFileEditorManagerTest.java
@@ -15,7 +15,7 @@
  */
 package com.intellij.openapi.editor.impl;
 
-import com.intellij.openapi.fileEditor.FileEditorManagerTestCase;
+import com.intellij.testFramework.FileEditorManagerTestCase;
 import com.intellij.testFramework.PlatformTestUtil;
 import org.jdom.JDOMException;
 
diff --git a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java
index 23334b6..cf6f11e 100644
--- a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java
+++ b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java
@@ -20,6 +20,7 @@
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
+import com.intellij.openapi.module.ModifiableModuleModel;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.module.StdModuleTypes;
@@ -31,6 +32,7 @@
 import com.intellij.testFramework.IdeaTestCase;
 import com.intellij.testFramework.PlatformTestCase;
 import com.intellij.testFramework.PsiTestUtil;
+import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.jps.model.java.JavaResourceRootType;
@@ -39,10 +41,7 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 import static java.util.Collections.singletonList;
 
@@ -330,9 +329,10 @@
   }
 
   public void testChangeIgnoreList() throws Exception {
-    myModule1Dir.createChildDirectory(this, "newDir");
-
+    VirtualFile newDir = myModule1Dir.createChildDirectory(this, "newDir");
+    
     myIndex.checkConsistency();
+    checkInfoNotNull(newDir);
 
     final FileTypeManagerEx fileTypeManager = (FileTypeManagerEx)FileTypeManager.getInstance();
     final String list = fileTypeManager.getIgnoredFilesList();
@@ -344,8 +344,8 @@
           fileTypeManager.setIgnoredFilesList(list1);
         }
       });
-
       myIndex.checkConsistency();
+      checkInfoNull(newDir);
     }
     finally {
       ApplicationManager.getApplication().runWriteAction(new Runnable() {
@@ -354,6 +354,7 @@
           fileTypeManager.setIgnoredFilesList(list);
         }
       });
+      checkInfoNotNull(newDir);
     }
   }
 
@@ -375,6 +376,45 @@
     myIndex.checkConsistency();
   }
 
+  public void testModuleUnderIgnoredDir() throws IOException {
+    final VirtualFile ignored = myRootVFile.createChildDirectory(this, "RCS");
+    assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
+    final VirtualFile module4 = ignored.createChildDirectory(this, "module4");
+    assertFalse(FileTypeManager.getInstance().isFileIgnored(module4));
+    
+    new WriteCommandAction.Simple(getProject()) {
+      @Override
+      protected void run() throws Throwable {
+        ModuleManager moduleManager = ModuleManager.getInstance(myProject);
+        Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
+        PsiTestUtil.addContentRoot(module, module4);
+        checkInfoNull(ignored);
+        checkInfo(module4, module, false, false, null, null);
+      }
+    }.execute().throwException();
+
+  }
+
+  public void testModuleInIgnoredDir() throws IOException {
+    final VirtualFile ignored = myRootVFile.createChildDirectory(this, "RCS");
+    assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
+    
+    new WriteCommandAction.Simple(getProject()) {
+      @Override
+      protected void run() throws Throwable {
+        ModuleManager moduleManager = ModuleManager.getInstance(myProject);
+        ModifiableModuleModel model = moduleManager.getModifiableModel();
+        model.disposeModule(myModule);
+        model.disposeModule(myModule2);
+        model.disposeModule(myModule3);
+        model.commit();
+        Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA.getId());
+        PsiTestUtil.addContentRoot(module, ignored);
+        checkInfo(ignored, module, false, false, null, null);
+      }
+    }.execute().throwException();
+  }
+
   public void testExcludedDirsInLibraries() {
     ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
     assertFalse(index.isInLibraryClasses(myExcludedLibClsDir));
@@ -678,6 +718,203 @@
     assertFalse(myIndex.isProjectExcludeRoot(projectOutputUnderContent));
   }
 
+  public void testFileContentAndSourceRoots() throws IOException {
+    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
+
+    VirtualFile fileRoot = myRootVFile.createChildData(this, "fileRoot.txt");
+    VirtualFile fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
+    VirtualFile fileTestSourceRoot = myRootVFile.createChildData(this, "fileTestSourceRoot.txt");
+
+    checkInfoNull(fileRoot);
+    assertFalse(fileIndex.isInContent(fileRoot));
+    assertIteratedContent(fileIndex, null, Arrays.asList(fileRoot, fileSourceRoot, fileTestSourceRoot));
+
+    ContentEntry contentEntry = PsiTestUtil.addContentRoot(myModule, fileRoot);
+    assertSame(fileRoot, contentEntry.getFile());
+    checkInfo(fileRoot, myModule, false, false, "", null);
+    assertTrue(fileIndex.isInContent(fileRoot));
+    assertFalse(fileIndex.isInSource(fileRoot));
+ 
+    PsiTestUtil.addContentRoot(myModule, fileSourceRoot);
+    PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+ 
+    PsiTestUtil.addContentRoot(myModule, fileTestSourceRoot);
+    PsiTestUtil.addSourceRoot(myModule, fileTestSourceRoot, true);
+    checkInfo(fileTestSourceRoot, myModule, false, false, "", JavaSourceRootType.TEST_SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileTestSourceRoot));
+    assertTrue(fileIndex.isInSource(fileTestSourceRoot));
+
+    assertIteratedContent(fileIndex, Arrays.asList(fileRoot, fileSourceRoot, fileTestSourceRoot), null);
+
+    // removing file source root
+    PsiTestUtil.removeSourceRoot(myModule, fileTestSourceRoot);
+    checkInfo(fileTestSourceRoot, myModule, false, false, "", null);
+    assertTrue(fileIndex.isInContent(fileTestSourceRoot));
+    assertFalse(fileIndex.isInSource(fileTestSourceRoot));
+    assertIteratedContent(fileIndex, Arrays.asList(fileRoot, fileSourceRoot, fileTestSourceRoot), null);
+ 
+    // removing file content root
+    PsiTestUtil.removeContentEntry(myModule, contentEntry);
+    checkInfoNull(fileRoot);
+    assertFalse(fileIndex.isInContent(fileRoot));
+    assertFalse(fileIndex.isInSource(fileRoot));
+    assertIteratedContent(fileIndex, Arrays.asList(fileSourceRoot, fileTestSourceRoot), Arrays.asList(fileRoot));
+  }
+
+  private void assertIteratedContent(ProjectFileIndex fileIndex,
+                                     @Nullable List<VirtualFile> contains,
+                                     @Nullable List<VirtualFile> doesntContain) {
+    final Set<VirtualFile> collected = new THashSet<VirtualFile>();
+    fileIndex.iterateContent(new ContentIterator() {
+      @Override
+      public boolean processFile(VirtualFile fileOrDir) {
+        collected.add(fileOrDir);
+        return true;
+      }
+    });
+    if (contains != null) assertContainsElements(collected, contains);
+    if (doesntContain != null) assertDoesntContain(collected, doesntContain);
+  }
+
+  public void testFileSourceRootsUnderDirContentRoot() throws IOException {
+    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
+
+    VirtualFile fileSourceRoot = myModule1Dir.createChildData(this, "fileSourceRoot.txt");
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertFalse(fileIndex.isInSource(fileSourceRoot));
+    checkInfoNull(fileSourceRoot);
+
+    PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+
+    // removing file source root
+    PsiTestUtil.removeSourceRoot(myModule, fileSourceRoot);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertFalse(fileIndex.isInSource(fileSourceRoot));
+    checkInfoNull(fileSourceRoot);
+  }
+
+  public void testFileModuleExcludeRootUnderDirectoryRoot() throws IOException {
+    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
+
+    VirtualFile fileExcludeRoot = mySrcDir1.createChildData(this, "fileExcludeRoot.txt");
+    assertTrue(fileIndex.isInContent(fileExcludeRoot));
+    assertTrue(fileIndex.isInSource(fileExcludeRoot));
+    checkInfoNull(fileExcludeRoot);
+    assertIteratedContent(fileIndex, Arrays.asList(fileExcludeRoot), null);
+
+    PsiTestUtil.addExcludedRoot(myModule, fileExcludeRoot);
+    assertFalse(fileIndex.isInContent(fileExcludeRoot));
+    assertFalse(fileIndex.isInSource(fileExcludeRoot));
+    checkInfoNull(fileExcludeRoot);
+    assertIteratedContent(fileIndex, null, Arrays.asList(fileExcludeRoot));
+
+    // removing file exclude root
+    PsiTestUtil.removeExcludedRoot(myModule, fileExcludeRoot);
+    assertTrue(fileIndex.isInContent(fileExcludeRoot));
+    assertTrue(fileIndex.isInSource(fileExcludeRoot));
+    checkInfoNull(fileExcludeRoot);
+    assertIteratedContent(fileIndex, Arrays.asList(fileExcludeRoot), null);
+  }
+
+  public void testFileModuleExcludeRootUnderFileRoot() throws IOException {
+    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
+
+    VirtualFile fileRoot = myRootVFile.createChildData(this, "fileRoot.txt");
+    PsiTestUtil.addContentRoot(myModule, fileRoot);
+    checkInfo(fileRoot, myModule, false, false, "", null);
+    assertTrue(fileIndex.isInContent(fileRoot));
+    assertIteratedContent(fileIndex, Arrays.asList(fileRoot), null);
+    
+    PsiTestUtil.addExcludedRoot(myModule, fileRoot);
+    assertFalse(fileIndex.isInContent(fileRoot));
+    checkInfoNull(fileRoot);
+    assertIteratedContent(fileIndex, null, Arrays.asList(fileRoot));
+ 
+    // removing file exclude root
+    PsiTestUtil.removeExcludedRoot(myModule, fileRoot);
+    checkInfo(fileRoot, myModule, false, false, "", null);
+    assertTrue(fileIndex.isInContent(fileRoot));
+    assertIteratedContent(fileIndex, Arrays.asList(fileRoot), null);
+  }
+
+  public void testFileLibraryInsideFolderLibrary() throws IOException {
+    VirtualFile file = myLibSrcDir.createChildData(this, "empty.txt");
+    ModuleRootModificationUtil.addModuleLibrary(myModule2, "lib2",
+                                                Collections.<String>emptyList(), singletonList(file.getUrl()),
+                                                Collections.<String>emptyList(), DependencyScope.COMPILE, true);
+
+    // same for the dir and for the file
+    checkInfo(file, myModule, false, true, "", null, myModule2, myModule3);
+    checkInfo(myLibSrcDir, myModule, false, true, "", null, myModule2, myModule3);
+  }
+
+  public void testFileContentRootsModifications() throws IOException {
+    ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
+
+    VirtualFile temp = myRootVFile.createChildDirectory(this, "temp");
+
+    VirtualFile fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
+    checkInfoNull(fileSourceRoot);
+
+    PsiTestUtil.addContentRoot(myModule, fileSourceRoot);
+    PsiTestUtil.addSourceRoot(myModule, fileSourceRoot);
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+
+    // delete and recreate
+    fileSourceRoot.delete(this);
+    checkInfoNull(fileSourceRoot);
+    assertFalse(fileIndex.isInContent(fileSourceRoot));
+    assertFalse(fileIndex.isInSource(fileSourceRoot));
+    fileSourceRoot = myRootVFile.createChildData(this, "fileSourceRoot.txt");
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+
+    // delete and move from another dir 
+    fileSourceRoot.delete(this);
+    checkInfoNull(fileSourceRoot);
+    assertFalse(fileIndex.isInContent(fileSourceRoot));
+    assertFalse(fileIndex.isInSource(fileSourceRoot));
+    fileSourceRoot = temp.createChildData(this, "fileSourceRoot.txt");
+    checkInfoNull(fileSourceRoot);
+    fileSourceRoot.move(this, myRootVFile);
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+
+    // delete and copy from another dir 
+    fileSourceRoot.delete(this);
+    checkInfoNull(fileSourceRoot);
+    assertFalse(fileIndex.isInContent(fileSourceRoot));
+    assertFalse(fileIndex.isInSource(fileSourceRoot));
+    fileSourceRoot = temp.createChildData(this, "fileSourceRoot.txt");
+    checkInfoNull(fileSourceRoot);
+    fileSourceRoot = fileSourceRoot.copy(this, myRootVFile, "fileSourceRoot.txt");
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+    
+    // delete and rename from another file
+    fileSourceRoot.delete(this);
+    checkInfoNull(fileSourceRoot);
+    assertFalse(fileIndex.isInContent(fileSourceRoot));
+    assertFalse(fileIndex.isInSource(fileSourceRoot));
+    fileSourceRoot = myRootVFile.createChildData(this, "temp_file.txt");
+    checkInfoNull(fileSourceRoot);
+    fileSourceRoot.rename(this, "fileSourceRoot.txt");
+    checkInfo(fileSourceRoot, myModule, false, false, "", JavaSourceRootType.SOURCE, myModule);
+    assertTrue(fileIndex.isInContent(fileSourceRoot));
+    assertTrue(fileIndex.isInSource(fileSourceRoot));
+  }
+
   private void checkInfo(VirtualFile dir,
                          @Nullable Module module,
                          boolean isInLibrary,
@@ -688,11 +925,11 @@
     DirectoryInfo info = checkInfoNotNull(dir);
     assertEquals(module, info.getModule());
     if (moduleSourceRootType != null) {
-      assertTrue(info.isInModuleSource());
+      assertTrue("isInModuleSource", info.isInModuleSource());
       assertEquals(moduleSourceRootType, myIndex.getSourceRootType(info));
     }
     else {
-      assertFalse(info.isInModuleSource());
+      assertFalse("isInModuleSource", info.isInModuleSource());
     }
     assertEquals(isInLibrary, info.hasLibraryClassRoot());
     assertEquals(isInLibrarySource, info.isInLibrarySource());
@@ -725,12 +962,4 @@
     assertOrderedEquals(actualDirs, expectedDirs);
   }
 
-  public void testFileLibraryInsideFolderLibrary() throws IOException {
-    VirtualFile file = myLibSrcDir.createChildData(this, "empty.txt");
-    ModuleRootModificationUtil.addModuleLibrary(myModule2, "lib2",
-                                                Collections.<String>emptyList(), singletonList(file.getUrl()),
-                                                Collections.<String>emptyList(), DependencyScope.COMPILE, true);
-    checkInfo(file, null, false, true, "", null, myModule2, myModule3);
-
-  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/openapi/vfs/JarFileSystemTest.java b/java/java-tests/testSrc/com/intellij/openapi/vfs/JarFileSystemTest.java
deleted file mode 100644
index d1154ef..0000000
--- a/java/java-tests/testSrc/com/intellij/openapi/vfs/JarFileSystemTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2000-2013 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.openapi.vfs;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.ModuleRootManager;
-import com.intellij.openapi.util.Ref;
-import com.intellij.openapi.util.io.IoTestUtil;
-import com.intellij.openapi.vfs.newvfs.BulkFileListener;
-import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent;
-import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
-import com.intellij.testFramework.IdeaTestCase;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import static com.intellij.testFramework.PlatformTestUtil.assertPathsEqual;
-
-public class JarFileSystemTest extends IdeaTestCase {
-  public void testFindFile() throws IOException {
-    String rtJarPath = getJdkRtPath("src.zip");
-
-    VirtualFile jarRoot = findByPath(rtJarPath + JarFileSystem.JAR_SEPARATOR);
-    assertTrue(jarRoot.isDirectory());
-
-    VirtualFile file2 = findByPath(rtJarPath + JarFileSystem.JAR_SEPARATOR + "java");
-    assertTrue(file2.isDirectory());
-
-    VirtualFile file3 = jarRoot.findChild("java");
-    assertEquals(file2, file3);
-
-    VirtualFile file4 = findByPath(rtJarPath + JarFileSystem.JAR_SEPARATOR + "java/lang/Object.java");
-    assertTrue(!file4.isDirectory());
-
-    byte[] bytes = file4.contentsToByteArray();
-    assertNotNull(bytes);
-    assertTrue(bytes.length > 10);
-  }
-
-  public void testMetaInf() {
-    String rtJarPath = getJdkRtPath("jre/lib/rt.jar");
-
-    VirtualFile jarRoot = findByPath(rtJarPath + JarFileSystem.JAR_SEPARATOR);
-    assertTrue(jarRoot.isDirectory());
-
-    VirtualFile metaInf = jarRoot.findChild("META-INF");
-    assertNotNull(metaInf);
-
-    VirtualFile[] children = metaInf.getChildren();
-    assertEquals(1, children.length);
-  }
-
-  public void testJarRefresh() throws IOException {
-    File jar = IoTestUtil.createTestJar();
-    assertTrue(jar.setLastModified(jar.lastModified() - 1000));
-    VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(jar);
-    assertNotNull(vFile);
-
-    final VirtualFile entry = findByPath(jar.getPath() + JarFileSystem.JAR_SEPARATOR + "entry.txt");
-    assertContent(entry, "test");
-
-    final Ref<Boolean> updated = Ref.create(false);
-    ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(
-      VirtualFileManager.VFS_CHANGES,
-      new BulkFileListener.Adapter() {
-        @Override
-        public void before(@NotNull List<? extends VFileEvent> events) {
-          for (VFileEvent event : events) {
-            if (event instanceof VFileContentChangeEvent && entry.equals(event.getFile())) {
-              updated.set(true);
-              break;
-            }
-          }
-        }
-      }
-    );
-
-    IoTestUtil.writeEntry(jar, "entry.txt", "update");
-    vFile.refresh(false, false);
-
-    assertTrue(updated.get());
-    assertTrue(entry.isValid());
-    assertContent(entry, "update");
-  }
-
-  private String getJdkRtPath(String relativePath) {
-    Sdk jdk = ModuleRootManager.getInstance(myModule).getSdk();
-    assertNotNull(jdk);
-    VirtualFile jdkHome = jdk.getHomeDirectory();
-    assertNotNull(jdkHome);
-    return jdkHome.getPath() + "/" + relativePath;
-  }
-
-  private static VirtualFile findByPath(String path) {
-    VirtualFile file = JarFileSystem.getInstance().findFileByPath(path);
-    assertNotNull(file);
-    assertPathsEqual(path, file.getPath());
-    return file;
-  }
-
-  private static void assertContent(VirtualFile file, String expected) throws IOException {
-    String content = new String(file.contentsToByteArray());
-    assertEquals(expected, content);
-  }
-}
diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
index 7523e5b..4ac4bfb 100644
--- a/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
@@ -18,8 +18,10 @@
 import com.intellij.JavaTestUtil;
 import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileSystem;
 import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
 import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
 import com.intellij.psi.impl.compiled.ClsFileImpl;
@@ -52,7 +54,7 @@
   public void testLocalClass() { doTest(); }
   public void testBounds() { doTest(); }
 
-  public void testTextPsiMismatch() throws Exception {
+  public void testTextPsiMismatch() {
     CommonCodeStyleSettings.IndentOptions options =
       CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings().getIndentOptions(JavaFileType.INSTANCE);
     int indent = options.INDENT_SIZE;
@@ -65,22 +67,31 @@
     }
   }
 
+  public void testJdk8Class() {
+    String testDir = JavaTestUtil.getJavaTestDataPath();
+    String clsPath = testDir + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/lang/Class.class";
+    String txtPath = testDir + "/psi/cls/mirror/" + "Class.txt";
+    doTest(clsPath, txtPath);
+  }
+
   private void doTest() {
     doTest(getTestName(false));
   }
 
   private static void doTest(String name) {
     String testDir = JavaTestUtil.getJavaTestDataPath() + "/psi/cls/mirror/";
+    doTest(testDir + "pkg/" + name + ".class", testDir + name + ".txt");
+  }
 
-    String clsPath = testDir + "pkg/" + name + ".class";
-    VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(clsPath);
+  private static void doTest(String clsPath, String txtPath) {
+    VirtualFileSystem fs = clsPath.contains("!/") ? JarFileSystem.getInstance() : LocalFileSystem.getInstance();
+    VirtualFile vFile = fs.findFileByPath(clsPath);
     assertNotNull(clsPath, vFile);
     PsiFile clsFile = getPsiManager().findFile(vFile);
     assertNotNull(vFile.getPath(), clsFile);
 
     String expected;
     try {
-      String txtPath = testDir + name + ".txt";
       expected = StringUtil.trimTrailing(PlatformTestUtil.loadFileText(txtPath));
     }
     catch (IOException e) {
diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java
index 504838c..709eb88 100644
--- a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.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.
@@ -18,7 +18,6 @@
 import com.intellij.ide.highlighter.JavaFileType;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ex.PathManagerEx;
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.roots.ModuleRootModificationUtil;
 import com.intellij.openapi.roots.OrderRootType;
 import com.intellij.openapi.util.io.FileUtil;
@@ -37,9 +36,8 @@
 
 @PlatformTestCase.WrapInCommand
 public class ClsRepositoryUseTest extends PsiTestCase {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.psi.ClsRepositoryUseTest");
-
   private static final String TEST_ROOT = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/cls";
+
   private GlobalSearchScope RESOLVE_SCOPE;
 
   @Override
@@ -50,15 +48,9 @@
       new Runnable() {
         @Override
         public void run() {
-          try {
-            VirtualFile vDir = getRootFile();
-            PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
-            addLibraryToRoots(vDir, OrderRootType.CLASSES);
-//            PsiTestUtil.addSourceContentToRoots(myProject, vDir);
-          }
-          catch (Exception e) {
-            LOG.error(e);
-          }
+          VirtualFile vDir = getRootFile();
+          PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
+          addLibraryToRoots(vDir, OrderRootType.CLASSES);
         }
       }
     );
@@ -76,28 +68,21 @@
     final File classes = createTempDir("classes", false);
 
     final File com = new File(classes, "com");
-    //noinspection ResultOfMethodCallIgnored
-    com.mkdir();
+    FileUtil.ensureExists(com);
 
     File dataPath = new File(PathManagerEx.getTestDataPath() + "/psi/cls");
 
     final File target = new File(com, "TestClass.class");
     FileUtil.copy(new File(dataPath, "1/TestClass.class"), target);
-    //noinspection ResultOfMethodCallIgnored
-    target.setLastModified(System.currentTimeMillis());
+    assertTrue(target.setLastModified(System.currentTimeMillis()));
 
     ApplicationManager.getApplication().runWriteAction(
       new Runnable() {
         @Override
         public void run() {
-          try {
-            VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(classes);
-            assertNotNull(vDir);
-            addLibraryToRoots(vDir, OrderRootType.CLASSES);
-          }
-          catch (Exception e) {
-            LOG.error(e);
-          }
+          VirtualFile vDir = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(classes);
+          assertNotNull(vDir);
+          addLibraryToRoots(vDir, OrderRootType.CLASSES);
         }
       }
     );
@@ -123,20 +108,14 @@
     assertEquals("method1", psiClass.getMethods()[1].getName());
 
     FileUtil.copy(new File(dataPath, "2/TestClass.class"), target);
-    //noinspection ResultOfMethodCallIgnored
-    target.setLastModified(System.currentTimeMillis() + 5000);
+    assertTrue(target.setLastModified(System.currentTimeMillis() + 5000));
 
     assert vFile != null;
     ApplicationManager.getApplication().runWriteAction(
       new Runnable() {
         @Override
         public void run() {
-          try {
-            vFile.refresh(false, false);
-          }
-          catch (Exception e) {
-            LOG.error(e);
-          }
+          vFile.refresh(false, false);
         }
       }
     );
@@ -375,7 +354,6 @@
 
     assertEquals("void", type1.getText());
     assertTrue(type1.getType() instanceof PsiPrimitiveType);
-    assertTrue(!(type1.getType() instanceof PsiArrayType));
 
     PsiMethod method3 = aClass.getMethods()[2];
     assertNull(method3.getReturnType());
@@ -400,7 +378,7 @@
 
     PsiField field = aClass.getFields()[1];
     PsiType type = field.getType();
-    LOG.assertTrue(type instanceof PsiArrayType);
+    assertTrue(type instanceof PsiArrayType);
     PsiType componentType = ((PsiArrayType)type).getComponentType();
 
     assertTrue(componentType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT));
@@ -497,7 +475,6 @@
     assertEquals("java.io.IOException", refs[1].getCanonicalText());
   }
 
-
   public void testParameters() throws Exception {
     PsiClass aClass = myJavaFacade.findClass("pack.MyClass", GlobalSearchScope.allScope(myProject));
     assert aClass != null;
@@ -524,7 +501,11 @@
     PsiClass objectClass = myJavaFacade.findClasses(CommonClassNames.JAVA_LANG_OBJECT, RESOLVE_SCOPE)[1];
     assertEquals(objectClass, target2);
 
-    parameters[0].getModifierList();
+    assertNotNull(parameters[0].getModifierList());
+    assertNotNull(parameters[1].getModifierList());
+
+    assertEquals("ints", parameters[0].getName());
+    assertEquals("o", parameters[1].getName());
   }
 
   public void testGenericClass() throws Exception {
@@ -706,10 +687,6 @@
     final PsiType returnType = methodsWithReturnType.getReturnType();
     assert returnType != null : methodsWithReturnType;
     assertEquals("pack.Parametrized<? extends T>", returnType.getCanonicalText());
-
-    //TODO[ven, max]: After fix for loading decompiled stuff the result had been change. Need to discuss whether this is important
-    //enough to try to conform old output.
-    //assertEquals("public Parametrized<? extends T> method() { /* compiled code */ }", methodsWithReturnType.getText());
     assertEquals("public pack.Parametrized<? extends T> method() { /* compiled code */ }", methodsWithReturnType.getText());
   }
 
diff --git a/java/java-tests/testSrc/com/intellij/psi/ConstantValuesTest.java b/java/java-tests/testSrc/com/intellij/psi/ConstantValuesTest.java
index 5c3b631..af68ad6 100644
--- a/java/java-tests/testSrc/com/intellij/psi/ConstantValuesTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/ConstantValuesTest.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.
@@ -25,6 +25,7 @@
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.testFramework.PsiTestCase;
 import com.intellij.testFramework.PsiTestUtil;
+import org.jetbrains.annotations.NotNull;
 
 import java.io.IOException;
 
@@ -57,7 +58,7 @@
   }
 
   @Override
-  protected void invokeTestRunnable(Runnable runnable) throws Exception {
+  protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception {
     super.invokeTestRunnable(runnable);
     final PsiJavaFile file = (PsiJavaFile)myClass.getContainingFile();
 
diff --git a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java
index 9250602..8316fe7 100644
--- a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java
@@ -33,6 +33,7 @@
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.testFramework.*;
 import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
@@ -193,7 +194,7 @@
   }
 
   @Override
-  protected void invokeTestRunnable(final Runnable runnable) throws Exception {
+  protected void invokeTestRunnable(@NotNull final Runnable runnable) throws Exception {
     runnable.run();
   }
 }
diff --git a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerSpecialRuleTest.groovy b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerSpecialRuleTest.groovy
index 024f0cd..71959e5 100644
--- a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerSpecialRuleTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerSpecialRuleTest.groovy
@@ -15,6 +15,7 @@
  */
 package com.intellij.psi.codeStyle.arrangement
 
+import static com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens.EntryType.*
 import static com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens.Modifier.*
 import static com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens.Order.BY_NAME
 
@@ -112,4 +113,23 @@
       rules: [ruleWithOrder(BY_NAME, rule(PUBLIC)), ruleWithOrder(BY_NAME, rule(PUBLIC, STATIC))]
     )
   }
+
+  void "test different entries type with modifier conditions"() {
+    doTest(
+      initial: '''\
+class Test {
+  public static void b() {}
+  public void a() {}
+}
+''',
+      expected: '''\
+class Test {
+  public void a() {}
+  public static void b() {}
+}
+''',
+      rules: [rule(FIELD, PUBLIC), rule(FIELD), rule(METHOD, PUBLIC), rule(METHOD), rule(METHOD, PUBLIC, ABSTRACT), rule(METHOD, ABSTRACT),
+              rule(FIELD, PUBLIC, STATIC), rule(FIELD, STATIC), rule(METHOD, PUBLIC, STATIC), rule(METHOD, STATIC)]
+    )
+  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java b/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java
index 185ec30..d6e5e9d 100644
--- a/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java
@@ -89,7 +89,7 @@
   public void testLibraryClassUsageFromDecompiledSource() {
     PsiElement decompiled =
       ((PsiCompiledElement)myJavaFacade.findClass("javax.swing.JLabel", GlobalSearchScope.allScope(myProject))).getMirror();
-    assertEquals(2, ReferencesSearch.search(decompiled).findAll().size());
+    assertEquals(2, ReferencesSearch.search(decompiled, GlobalSearchScope.projectScope(myProject)).findAll().size());
   }
 
   public void testImplicitConstructorUsage() throws Throwable {
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java b/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java
index 5c760ce..82b047c 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java
@@ -42,7 +42,7 @@
   }
 
   @Nullable
-  protected static PsiExpression getExpressionFromEditor() {
+  protected PsiExpression getExpressionFromEditor() {
     final PsiExpression expression = PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiExpression.class);
     if (expression instanceof PsiReferenceExpression && expression.getParent() instanceof PsiMethodCallExpression) {
       return (PsiExpression)expression.getParent();
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureBaseTest.java b/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureBaseTest.java
new file mode 100644
index 0000000..69b5cc0
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureBaseTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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.refactoring;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.codeInsight.TargetElementUtilBase;
+import com.intellij.psi.*;
+import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
+import com.intellij.refactoring.changeSignature.JavaThrownExceptionInfo;
+import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
+import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class ChangeSignatureBaseTest extends LightRefactoringTestCase {
+  protected PsiElementFactory myFactory;
+
+  @NotNull
+  @Override
+  protected String getTestDataPath() {
+    return JavaTestUtil.getJavaTestDataPath();
+  }
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    myFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
+  }
+
+  protected void doTest(@Nullable String returnType,
+                        @Nullable final String[] parameters,
+                        @Nullable final String[] exceptions,
+                        boolean delegate) {
+    GenParams genParams = parameters == null ? new SimpleParameterGen() : new GenParams() {
+      @Override
+      public ParameterInfoImpl[] genParams(PsiMethod method) throws IncorrectOperationException {
+        ParameterInfoImpl[] parameterInfos = new ParameterInfoImpl[parameters.length];
+        for (int i = 0; i < parameters.length; i++) {
+          PsiType type = myFactory.createTypeFromText(parameters[i], method);
+          parameterInfos[i] = new ParameterInfoImpl(-1, "p" + (i + 1), type);
+        }
+        return parameterInfos;
+      }
+    };
+
+    GenExceptions genExceptions = exceptions == null ? new SimpleExceptionsGen() : new GenExceptions() {
+      @Override
+      public ThrownExceptionInfo[] genExceptions(PsiMethod method) throws IncorrectOperationException {
+        ThrownExceptionInfo[] exceptionInfos = new ThrownExceptionInfo[exceptions.length];
+        for (int i = 0; i < exceptions.length; i++) {
+          PsiType type = myFactory.createTypeFromText(exceptions[i], method);
+          exceptionInfos[i] = new JavaThrownExceptionInfo(-1, (PsiClassType)type);
+        }
+        return exceptionInfos;
+      }
+    };
+
+    doTest(null, null, returnType, genParams, genExceptions, delegate);
+  }
+
+  protected void doTest(@Nullable String newReturnType, ParameterInfoImpl[] parameterInfos, boolean generateDelegate) {
+    doTest(null, null, newReturnType, parameterInfos, new ThrownExceptionInfo[0], generateDelegate);
+  }
+
+  protected void doTest(@PsiModifier.ModifierConstant @Nullable String newVisibility,
+                        @Nullable String newName,
+                        @Nullable String newReturnType,
+                        ParameterInfoImpl[] parameterInfo,
+                        ThrownExceptionInfo[] exceptionInfo,
+                        boolean generateDelegate) {
+    SimpleParameterGen params = new SimpleParameterGen(parameterInfo);
+    SimpleExceptionsGen exceptions = new SimpleExceptionsGen(exceptionInfo);
+    doTest(newVisibility, newName, newReturnType, params, exceptions, generateDelegate);
+  }
+
+  protected void doTest(@PsiModifier.ModifierConstant @Nullable String newVisibility,
+                        @Nullable String newName,
+                        @Nullable @NonNls String newReturnType,
+                        GenParams genParams,
+                        boolean generateDelegate) {
+    doTest(newVisibility, newName, newReturnType, genParams, new SimpleExceptionsGen(), generateDelegate);
+  }
+
+  protected void doTest(@PsiModifier.ModifierConstant @Nullable String newVisibility,
+                        @Nullable String newName,
+                        @Nullable String newReturnType,
+                        GenParams genParams,
+                        GenExceptions genExceptions,
+                        boolean generateDelegate) {
+    String basePath = getRelativePath() + getTestName(false);
+    configureByFile(basePath + ".java");
+    PsiElement targetElement = TargetElementUtilBase.findTargetElement(getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
+    assertTrue("<caret> is not on method name", targetElement instanceof PsiMethod);
+    PsiMethod method = (PsiMethod)targetElement;
+    PsiType newType = newReturnType != null ? myFactory.createTypeFromText(newReturnType, method) : method.getReturnType();
+    new ChangeSignatureProcessor(getProject(), method, generateDelegate, newVisibility,
+                                 newName != null ? newName : method.getName(),
+                                 newType, genParams.genParams(method), genExceptions.genExceptions(method)).run();
+    checkResultByFile(basePath + "_after.java");
+  }
+
+  protected String getRelativePath() {
+    return "/refactoring/changeSignature/";
+  }
+
+  protected interface GenParams {
+    ParameterInfoImpl[] genParams(PsiMethod method) throws IncorrectOperationException;
+  }
+
+  protected interface GenExceptions {
+    ThrownExceptionInfo[] genExceptions(PsiMethod method) throws IncorrectOperationException;
+  }
+
+  protected static class SimpleParameterGen implements GenParams {
+    private ParameterInfoImpl[] myInfos;
+
+    public SimpleParameterGen() { }
+
+    public SimpleParameterGen(ParameterInfoImpl[] infos) {
+      myInfos = infos;
+    }
+
+    @Override
+    public ParameterInfoImpl[] genParams(PsiMethod method) {
+      if (myInfos == null) {
+        myInfos = new ParameterInfoImpl[method.getParameterList().getParametersCount()];
+        for (int i = 0; i < myInfos.length; i++) {
+          myInfos[i] = new ParameterInfoImpl(i);
+        }
+      }
+      for (ParameterInfoImpl info : myInfos) {
+        info.updateFromMethod(method);
+      }
+      return myInfos;
+    }
+  }
+
+  protected static class SimpleExceptionsGen implements GenExceptions {
+    private final ThrownExceptionInfo[] myInfos;
+
+    public SimpleExceptionsGen() {
+      myInfos = new ThrownExceptionInfo[0];
+    }
+
+    public SimpleExceptionsGen(ThrownExceptionInfo[] infos) {
+      myInfos = infos;
+    }
+
+    @Override
+    public ThrownExceptionInfo[] genExceptions(PsiMethod method) {
+      for (ThrownExceptionInfo info : myInfos) {
+        info.updateFromMethod(method);
+      }
+      return myInfos;
+    }
+  }
+}
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java b/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java
index 4f6c448..4cd9936 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/ChangeSignatureTest.java
@@ -15,7 +15,6 @@
  */
 package com.intellij.refactoring;
 
-import com.intellij.JavaTestUtil;
 import com.intellij.codeInsight.TargetElementUtilBase;
 import com.intellij.psi.*;
 import com.intellij.refactoring.changeSignature.ChangeSignatureProcessor;
@@ -24,22 +23,13 @@
 import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
 import com.intellij.refactoring.util.CanonicalTypes;
 import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
 
 import java.util.HashSet;
 
 /**
  * @author dsl
  */
-public class ChangeSignatureTest extends LightRefactoringTestCase {
-  private PsiElementFactory myFactory;
-
-  public void setUp() throws Exception {
-    super.setUp();
-    myFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
-  }
+public class ChangeSignatureTest extends ChangeSignatureBaseTest {
 
   public void testSimple() {
     doTest(null, null, null, new ParameterInfoImpl[0], new ThrownExceptionInfo[0], false);
@@ -392,7 +382,7 @@
   }
 
   public void testPropagateParameter() {
-    String basePath = "/refactoring/changeSignature/" + getTestName(false);
+    String basePath = getRelativePath() + getTestName(false);
     configureByFile(basePath + ".java");
     final PsiElement targetElement = TargetElementUtilBase.findTargetElement(getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
     assertTrue("<caret> is not on method name", targetElement instanceof PsiMethod);
@@ -413,102 +403,14 @@
     checkResultByFile(basePath + "_after.java");
   }
 
+  public void testTypeAnnotationsAllAround() {
+    //String[] ps = {"@TA(1) int @TA(2) []", "java.util.@TA(4) List<@TA(5) Class<@TA(6) ?>>", "@TA(7) String @TA(8) ..."};
+    //String[] ex = {"@TA(42) IllegalArgumentException", "java.lang.@TA(43) IllegalStateException"};
+    //doTest("java.util.@TA(0) List<@TA(1) C.@TA(1) Inner>", ps, ex, false);
+    String[] ps = {"@TA(2) int @TA(3) []", "@TA(4) List<@TA(5) Class<@TA(6) ?>>", "@TA(7) String @TA(8) ..."};
+    String[] ex = {};
+    doTest("@TA(0) List<@TA(1) Inner>", ps, ex, false);
+  }
+
   /* workers */
-
-  private void doTest(@Nullable String newReturnType, ParameterInfoImpl[] parameterInfos, boolean generateDelegate) {
-    doTest(null, null, newReturnType, parameterInfos, new ThrownExceptionInfo[0], generateDelegate);
-  }
-
-  private void doTest(@PsiModifier.ModifierConstant @Nullable String newVisibility,
-                      @Nullable String newName,
-                      @Nullable String newReturnType,
-                      ParameterInfoImpl[] parameterInfo,
-                      ThrownExceptionInfo[] exceptionInfo,
-                      boolean generateDelegate) {
-    doTest(newVisibility, newName, newReturnType, new SimpleParameterGen(parameterInfo), new SimpleExceptionsGen(exceptionInfo), generateDelegate);
-  }
-
-  private void doTest(@PsiModifier.ModifierConstant @Nullable String newVisibility,
-                      @Nullable String newName,
-                      @Nullable @NonNls String newReturnType,
-                      GenParams gen,
-                      boolean generateDelegate) {
-    doTest(newVisibility, newName, newReturnType, gen, new SimpleExceptionsGen(), generateDelegate);
-  }
-
-  private void doTest(@PsiModifier.ModifierConstant @Nullable String newVisibility,
-                      @Nullable String newName,
-                      @Nullable String newReturnType,
-                      GenParams genParams,
-                      GenExceptions genExceptions,
-                      boolean generateDelegate) {
-    String basePath = "/refactoring/changeSignature/" + getTestName(false);
-    configureByFile(basePath + ".java");
-    PsiElement targetElement = TargetElementUtilBase.findTargetElement(getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
-    assertTrue("<caret> is not on method name", targetElement instanceof PsiMethod);
-    PsiMethod method = (PsiMethod)targetElement;
-    PsiType newType = newReturnType != null ? myFactory.createTypeFromText(newReturnType, method) : method.getReturnType();
-    new ChangeSignatureProcessor(getProject(), method, generateDelegate, newVisibility,
-                                 newName != null ? newName : method.getName(),
-                                 newType, genParams.genParams(method), genExceptions.genExceptions(method)).run();
-    checkResultByFile(basePath + "_after.java");
-  }
-
-  private interface GenParams {
-    ParameterInfoImpl[] genParams(PsiMethod method) throws IncorrectOperationException;
-  }
-
-  private static class SimpleParameterGen implements GenParams {
-    private ParameterInfoImpl[] myInfos;
-
-    private SimpleParameterGen() { }
-
-    private SimpleParameterGen(ParameterInfoImpl[] infos) {
-      myInfos = infos;
-    }
-
-    @Override
-    public ParameterInfoImpl[] genParams(PsiMethod method) {
-      if (myInfos == null) {
-        myInfos = new ParameterInfoImpl[method.getParameterList().getParametersCount()];
-        for (int i = 0; i < myInfos.length; i++) {
-          myInfos[i] = new ParameterInfoImpl(i);
-        }
-      }
-      for (ParameterInfoImpl info : myInfos) {
-        info.updateFromMethod(method);
-      }
-      return myInfos;
-    }
-  }
-
-  private interface GenExceptions {
-    ThrownExceptionInfo[] genExceptions(PsiMethod method) throws IncorrectOperationException;
-  }
-
-  private static class SimpleExceptionsGen implements GenExceptions {
-    private final ThrownExceptionInfo[] myInfos;
-
-    public SimpleExceptionsGen() {
-      myInfos = new ThrownExceptionInfo[0];
-    }
-
-    private SimpleExceptionsGen(ThrownExceptionInfo[] infos) {
-      myInfos = infos;
-    }
-
-    @Override
-    public ThrownExceptionInfo[] genExceptions(PsiMethod method) {
-      for (ThrownExceptionInfo info : myInfos) {
-        info.updateFromMethod(method);
-      }
-      return myInfos;
-    }
-  }
-
-  @NotNull
-  @Override
-  protected String getTestDataPath() {
-    return JavaTestUtil.getJavaTestDataPath();
-  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/FindMethodDuplicatesTest.java b/java/java-tests/testSrc/com/intellij/refactoring/FindMethodDuplicatesTest.java
index ecabfb0..b841cb7 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/FindMethodDuplicatesTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/FindMethodDuplicatesTest.java
@@ -51,6 +51,10 @@
     doTest();
   }
 
+  public void testSkipNonRelatedCalls() throws Exception {
+    doTest(false);
+  }
+
   public void testMappingAny2ParameterPrimitiveLvalue() throws Exception {
     doTest(false);
   }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceConstantTest.java b/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceConstantTest.java
index 14a53f4..2eefaa1 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceConstantTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceConstantTest.java
@@ -19,10 +19,13 @@
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Pass;
 import com.intellij.psi.PsiExpression;
+import com.intellij.psi.PsiLiteralExpression;
 import com.intellij.psi.PsiLocalVariable;
+import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
 import com.intellij.refactoring.introduceField.IntroduceConstantHandler;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * User: anna
@@ -43,6 +46,28 @@
     });
   }
 
+  @Nullable
+  @Override
+  protected PsiExpression getExpressionFromEditor() {
+    final PsiExpression expression = super.getExpressionFromEditor();
+    if (expression != null) {
+      return expression;
+    }
+    final PsiExpression expr = PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiExpression.class);
+    return expr instanceof PsiLiteralExpression ? expr : null;
+  }
+
+  public void testReplaceAllInsideParenthesized() throws Exception {
+
+    doTest(new Pass<AbstractInplaceIntroducer>() {
+      @Override
+      public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
+        inplaceIntroduceFieldPopup.setReplaceAllOccurrences(true);
+
+      }
+    });
+  }
+
   public void testReplaceAllWithClassRefType() throws Exception {
 
     doTest(new Pass<AbstractInplaceIntroducer>() {
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceParameterTest.java b/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceParameterTest.java
index 697b423..841a67e 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceParameterTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/InplaceIntroduceParameterTest.java
@@ -86,6 +86,14 @@
     });
   }
 
+  public void testLocalInsideAnonymous() throws Exception {
+    doTest(new Pass<AbstractInplaceIntroducer>() {
+      @Override
+      public void pass(AbstractInplaceIntroducer inplaceIntroducePopup) {
+      }
+    });
+  }
+
   @Override
   protected String getBasePath() {
     return BASE_PATH;
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
index fcadcd1..3474537 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
@@ -28,7 +28,6 @@
 import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
 import com.intellij.testFramework.LightCodeInsightTestCase;
 import com.intellij.util.containers.MultiMap;
-import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 
 import java.util.Collection;
@@ -37,66 +36,65 @@
  * @author dsl
  */
 public class IntroduceVariableTest extends LightCodeInsightTestCase {
-
   @NotNull
   @Override
   protected String getTestDataPath() {
     return JavaTestUtil.getJavaTestDataPath();
   }
 
-  public void testSimpleExpression() throws Exception {
+  public void testSimpleExpression() {
     doTest(new MockIntroduceVariableHandler("i", false, false, true, "int"));
   }
 
-  public void testInsideFor() throws Exception {
+  public void testInsideFor() {
     doTest(new MockIntroduceVariableHandler("temp", false, false, true, "int"));
   }
 
-  public void testReplaceAll() throws Exception {
-    doTest(new MockIntroduceVariableHandler("s", true, true, true, "java.lang.String"));
+  public void testReplaceAll() {
+    doTest(new MockIntroduceVariableHandler("s", true, true, true, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testIDEADEV3678() throws Exception {
+  public void testIDEADEV3678() {
     doTest(new MockIntroduceVariableHandler("component", true, true, true, CommonClassNames.JAVA_LANG_OBJECT));
   }
 
-  public void testIDEADEV13369() throws Exception {
+  public void testIDEADEV13369() {
     doTest(new MockIntroduceVariableHandler("ints", true, true, true, "int[]"));
   }
 
-  public void testAnonymousClass() throws Exception {
+  public void testAnonymousClass() {
     doTest(new MockIntroduceVariableHandler("temp", true, false, true, "int"));
   }
 
-  public void testAnonymousClass1() throws Exception {
+  public void testAnonymousClass1() {
     doTest(new MockIntroduceVariableHandler("runnable", false, false, false, CommonClassNames.JAVA_LANG_RUNNABLE));
   }
 
-  public void testAnonymousClass2() throws Exception {
+  public void testAnonymousClass2() {
     doTest(new MockIntroduceVariableHandler("j", true, false, false, "int"));
   }
 
-  public void testAnonymousClass3() throws Exception {
+  public void testAnonymousClass3() {
     doTest(new MockIntroduceVariableHandler("j", true, false, false, "Foo"));
   }
 
-  public void testAnonymousClass4() throws Exception {
+  public void testAnonymousClass4() {
     doTest(new MockIntroduceVariableHandler("j", true, false, false, "int"));
   }
 
-  public void testAnonymousClass5() throws Exception {
+  public void testAnonymousClass5() {
     doTest(new MockIntroduceVariableHandler("j", true, false, false, "int"));
   }
 
-  public void testLambda() throws Exception {
+  public void testLambda() {
     doTest(new MockIntroduceVariableHandler("j", true, false, false, "int"));
   }
 
-  public void testParenthized() throws Exception {
+  public void testParenthized() {
     doTest(new MockIntroduceVariableHandler("temp", true, false, false, "int"));
   }
 
-  public void testExpectedType8Inference() throws Exception {
+  public void testExpectedType8Inference() {
     final PsiResolveHelperImpl helper = (PsiResolveHelperImpl)JavaPsiFacade.getInstance(getProject()).getResolveHelper();
     helper.setTestHelper(new PsiGraphInferenceHelper(getPsiManager()));
     try {
@@ -108,64 +106,64 @@
     }
   }
 
-  public void testMethodCall() throws Exception {
+  public void testMethodCall() {
     doTest(new MockIntroduceVariableHandler("temp", true, true, true, CommonClassNames.JAVA_LANG_OBJECT));
   }
 
-  public void testMethodCallInSwitch() throws Exception {
+  public void testMethodCallInSwitch() {
     doTest(new MockIntroduceVariableHandler("i", true, true, true, "int"));
   }
 
-  public void testParenthizedOccurence() throws Exception {
+  public void testParenthizedOccurence() {
     doTest(new MockIntroduceVariableHandler("empty", true, true, true, "boolean"));
   }
 
-  public void testParenthizedOccurence1() throws Exception {
-    doTest(new MockIntroduceVariableHandler("s", true, true, true, "java.lang.String"));
+  public void testParenthizedOccurence1() {
+    doTest(new MockIntroduceVariableHandler("s", true, true, true, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testConflictingField() throws Exception {
-    doTest(new MockIntroduceVariableHandler("name", true, false, true, "java.lang.String"));
+  public void testConflictingField() {
+    doTest(new MockIntroduceVariableHandler("name", true, false, true, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testConflictingFieldInExpression() throws Exception {
+  public void testConflictingFieldInExpression() {
     doTest(new MockIntroduceVariableHandler("name", false, false, true, "int"));
   }
 
-  public void testStaticConflictingField() throws Exception {
+  public void testStaticConflictingField() {
     doTest(new MockIntroduceVariableHandler("name", false, false, true, "int"));
   }
 
-  public void testNonConflictingField() throws Exception {
+  public void testNonConflictingField() {
      doTest(new MockIntroduceVariableHandler("name", false, false, true, "int"));
   }
 
-  public void testScr16910() throws Exception {
+  public void testScr16910() {
     doTest(new MockIntroduceVariableHandler("i", true, true, false, "int"));
   }
 
-  public void testSCR18295() throws Exception {
-    doTest(new MockIntroduceVariableHandler("it", true, false, false, "java.lang.String"));
+  public void testSCR18295() {
+    doTest(new MockIntroduceVariableHandler("it", true, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSCR18295a() throws Exception {
-    doTest(new MockIntroduceVariableHandler("it", false, false, false, "java.lang.String"));
+  public void testSCR18295a() {
+    doTest(new MockIntroduceVariableHandler("it", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testFromInjected() throws Exception {
-    doTest(new MockIntroduceVariableHandler("regexp", false, false, false, "java.lang.String"));
+  public void testFromInjected() {
+    doTest(new MockIntroduceVariableHandler("regexp", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSCR10412() throws Exception {
+  public void testSCR10412() {
     doTest(new MockIntroduceVariableHandler("newVar", false, false, false, "java.lang.String[]"));
   }
 
-  public void testSCR22718() throws Exception {
+  public void testSCR22718() {
     doTest(new MockIntroduceVariableHandler("object", true, true, false, CommonClassNames.JAVA_LANG_OBJECT));
   }
 
-  public void testSCR26075() throws Exception {
-    doTest(new MockIntroduceVariableHandler("wrong", false, false, false, "java.lang.String") {
+  public void testSCR26075() {
+    doTest(new MockIntroduceVariableHandler("wrong", false, false, false, CommonClassNames.JAVA_LANG_STRING) {
       @Override
       protected void assertValidationResult(boolean validationResult) {
         assertFalse(validationResult);
@@ -182,59 +180,59 @@
     });
   }
 
-  public void testConflictingFieldInOuterClass() throws Exception {
-    doTest(new MockIntroduceVariableHandler("text", true, true, false, "java.lang.String"));
+  public void testConflictingFieldInOuterClass() {
+    doTest(new MockIntroduceVariableHandler("text", true, true, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSkipSemicolon() throws Exception {
+  public void testSkipSemicolon() {
     doTest(new MockIntroduceVariableHandler("mi5", false, false, false, "int"));
   }
 
-  public void testInsideIf() throws Exception {
-    doTest(new MockIntroduceVariableHandler("s1", false, false, false, "java.lang.String"));
+  public void testInsideIf() {
+    doTest(new MockIntroduceVariableHandler("s1", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testInsideElse() throws Exception {
-    doTest(new MockIntroduceVariableHandler("s1", false, false, false, "java.lang.String"));
+  public void testInsideElse() {
+    doTest(new MockIntroduceVariableHandler("s1", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testInsideWhile() throws Exception {
+  public void testInsideWhile() {
     doTest(new MockIntroduceVariableHandler("temp", false, false, false, "int"));
   }
 
-  public void testSCR40281() throws Exception {
+  public void testSCR40281() {
     doTest(new MockIntroduceVariableHandler("temp", false, false, false, "Set<? extends Map<?,java.lang.String>.Entry<?,java.lang.String>>"));
   }
 
-  public void testWithIfBranches() throws Exception {
+  public void testWithIfBranches() {
     doTest(new MockIntroduceVariableHandler("temp", true, false, false, "int"));
   }
 
-  public void testInsideForLoop() throws Exception {
+  public void testInsideForLoop() {
     doTest(new MockIntroduceVariableHandler("temp", true, false, false, "int"));
   }
 
-  public void testDuplicateGenericExpressions() throws Exception {
+  public void testDuplicateGenericExpressions() {
     doTest(new MockIntroduceVariableHandler("temp", true, false, false, "Foo2<? extends java.lang.Runnable>"));
   }
 
-  public void testStaticImport() throws Exception {
+  public void testStaticImport() {
     doTest(new MockIntroduceVariableHandler("i", true, true, false, "int"));
   }
 
-  public void testThisQualifier() throws Exception {
+  public void testThisQualifier() {
     doTest(new MockIntroduceVariableHandler("count", true, true, false, "int"));
   }
 
-  public void testSubLiteral() throws Exception {
-    doTest(new MockIntroduceVariableHandler("str", false, false, false, "java.lang.String"));
+  public void testSubLiteral() {
+    doTest(new MockIntroduceVariableHandler("str", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSubLiteral1() throws Exception {
-    doTest(new MockIntroduceVariableHandler("str", false, false, false, "java.lang.String"));
+  public void testSubLiteral1() {
+    doTest(new MockIntroduceVariableHandler("str", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSubLiteralFailure() throws Exception {
+  public void testSubLiteralFailure() {
     try {
       doTest(new MockIntroduceVariableHandler("str", false, false, false, "int"));
     }
@@ -246,35 +244,35 @@
     fail("Should not be able to perform refactoring");
   }
 
-  public void testSubLiteralFromExpression() throws Exception {
-    doTest(new MockIntroduceVariableHandler("str", false, false, false, "java.lang.String"));
+  public void testSubLiteralFromExpression() {
+    doTest(new MockIntroduceVariableHandler("str", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSubExpressionFromIntellijidearulezzz() throws Exception {
-    doTest(new MockIntroduceVariableHandler("str", false, false, false, "java.lang.String"));
+  public void testSubExpressionFromIntellijidearulezzz() {
+    doTest(new MockIntroduceVariableHandler("str", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testSubPrimitiveLiteral() throws Exception {
+  public void testSubPrimitiveLiteral() {
     doTest(new MockIntroduceVariableHandler("str", false, false, false, "boolean"));
   }
 
-  public void testArrayFromVarargs() throws Exception {
+  public void testArrayFromVarargs() {
     doTest(new MockIntroduceVariableHandler("strs", false, false, false, "java.lang.String[]"));
   }
 
-  public void testArrayFromVarargs1() throws Exception {
+  public void testArrayFromVarargs1() {
     doTest(new MockIntroduceVariableHandler("strs", false, false, false, "java.lang.String[]"));
   }
 
-  public void testEnumArrayFromVarargs() throws Exception {
+  public void testEnumArrayFromVarargs() {
     doTest(new MockIntroduceVariableHandler("strs", false, false, false, "E[]"));
   }
 
-  public void testFromFinalFieldOnAssignment() throws Exception {
-    doTest(new MockIntroduceVariableHandler("strs", false, false, false, "java.lang.String"));
+  public void testFromFinalFieldOnAssignment() {
+    doTest(new MockIntroduceVariableHandler("strs", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testNoArrayFromVarargs() throws Exception {
+  public void testNoArrayFromVarargs() {
     try {
       doTest(new MockIntroduceVariableHandler("strs", false, false, false, "java.lang.String[]"));
     }
@@ -286,7 +284,7 @@
     fail("Should not be able to perform refactoring");
   }
 
-   public void testNoArrayFromVarargs1() throws Exception {
+   public void testNoArrayFromVarargs1() {
     try {
       doTest(new MockIntroduceVariableHandler("strs", false, false, false, "java.lang.String[]"));
     }
@@ -298,59 +296,59 @@
     fail("Should not be able to perform refactoring");
   }
 
-  public void testNonExpression() throws Exception {
+  public void testNonExpression() {
     doTest(new MockIntroduceVariableHandler("sum", true, true, false, "int"));
   }
 
-  public void testTypeAnnotations() throws Exception {
+  public void testTypeAnnotations() {
     doTest(new MockIntroduceVariableHandler("y1", true, false, false, "@TA C"));
   }
 
-  public void testReturnStatementWithoutSemicolon() throws Exception {
-    doTest(new MockIntroduceVariableHandler("b", true, true, false, "java.lang.String"));
+  public void testReturnStatementWithoutSemicolon() {
+    doTest(new MockIntroduceVariableHandler("b", true, true, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testAndAndSubexpression() throws Exception {
+  public void testAndAndSubexpression() {
     doTest(new MockIntroduceVariableHandler("ab", true, true, false, "boolean"));
   }
 
-  public void testSubexpressionWithSpacesInSelection() throws Exception {
+  public void testSubexpressionWithSpacesInSelection() {
     doTest(new MockIntroduceVariableHandler("ab", true, true, false, "boolean"));
   }
 
-  public void testDuplicatesAnonymousClassCreationWithSimilarParameters () throws Exception {
+  public void testDuplicatesAnonymousClassCreationWithSimilarParameters () {
     doTest(new MockIntroduceVariableHandler("foo1", true, true, false, "Foo"));
   }
 
-  public void testDifferentForeachParameters () throws Exception {
-    doTest(new MockIntroduceVariableHandler("tostr", true, true, false, "java.lang.String"));
+  public void testDifferentForeachParameters () {
+    doTest(new MockIntroduceVariableHandler("tostr", true, true, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testCollapsedToDiamond() throws Exception {
+  public void testCollapsedToDiamond() {
     doTest(new MockIntroduceVariableHandler("a", true, true, true, "java.util.ArrayList<java.lang.String>"));
   }
 
-  public void testCantCollapsedToDiamond() throws Exception {
+  public void testCantCollapsedToDiamond() {
     doTest(new MockIntroduceVariableHandler("a", true, true, true, "Foo<java.lang.Number>"));
   }
 
-  public void testFromForInitializer() throws Exception {
+  public void testFromForInitializer() {
     doTest(new MockIntroduceVariableHandler("list", true, true, true, "java.util.List"));
   }
 
-  public void testInvalidPostfixExpr() throws Exception {
+  public void testInvalidPostfixExpr() {
     doTest(new MockIntroduceVariableHandler("a1", true, false, true, "int[]"));
   }
 
-  public void testPolyadic() throws Exception {
+  public void testPolyadic() {
     doTest(new MockIntroduceVariableHandler("b1", true, true, true, "boolean"));
   }
 
-  public void testAssignmentToUnresolvedReference() throws Exception {
+  public void testAssignmentToUnresolvedReference() {
     doTest(new MockIntroduceVariableHandler("collection", true, true, true, "java.util.List<? extends java.util.Collection<?>>"));
   }
 
-  public void testNameSuggestion() throws Exception {
+  public void testNameSuggestion() {
     final String expectedTypeName = "Path";
     doTest(new MockIntroduceVariableHandler("path", true, false, false, expectedTypeName) {
       @Override
@@ -370,7 +368,7 @@
     });
   }
 
-  public void testSiblingInnerClassType() throws Exception {
+  public void testSiblingInnerClassType() {
     doTest(new MockIntroduceVariableHandler("vari", true, false, false, "A.B") {
       @Override
       public IntroduceVariableSettings getSettings(Project project, Editor editor,
@@ -388,7 +386,7 @@
     });
   }
 
-  public void testNonExpressionPriorityFailure() throws Exception {
+  public void testNonExpressionPriorityFailure() {
     doTest(new MockIntroduceVariableHandler("sum", true, true, false, "int"){
       @Override
       protected void showErrorMessage(Project project, Editor editor, String message) {
@@ -398,10 +396,9 @@
     });
   }
 
-
-  public void testIncorrectExpressionSelected() throws Exception {
+  public void testIncorrectExpressionSelected() {
     try {
-      doTest(new MockIntroduceVariableHandler("toString", false, false, false, "java.lang.String"));
+      doTest(new MockIntroduceVariableHandler("toString", false, false, false, CommonClassNames.JAVA_LANG_STRING));
     }
     catch (Exception e) {
       assertEquals(e.getMessage(), "Error message:Cannot perform refactoring.\n" +
@@ -411,51 +408,50 @@
     fail("Should not be able to perform refactoring");
   }
 
-  public void testMultiCatchSimple() throws Exception {
+  public void testMultiCatchSimple() {
     doTest(new MockIntroduceVariableHandler("e", true, true, false, "java.lang.Exception", true));
   }
 
-  public void testMultiCatchTyped() throws Exception {
+  public void testMultiCatchTyped() {
     doTest(new MockIntroduceVariableHandler("b", true, true, false, "java.lang.Exception", true));
   }
 
-  public void testBeforeVoidStatement() throws Exception {
+  public void testBeforeVoidStatement() {
     doTest(new MockIntroduceVariableHandler("c", false, false, false, CommonClassNames.JAVA_LANG_OBJECT));
   }
 
-  public void testWriteUsages() throws Exception {
+  public void testWriteUsages() {
     doTest(new MockIntroduceVariableHandler("c", true, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
 
-  public void testLambdaExpr() throws Exception {
-
+  public void testLambdaExpr() {
     doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
   }
 
-  public void testMethodRef() throws Exception {
+  public void testMethodRef() {
     doTest(new MockIntroduceVariableHandler("c", false, false, false, "Test.Bar"));
   }
 
-  public void testLambdaExprNotAccepted() throws Exception {
-    doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<X>"));
+  public void testLambdaExprNotAccepted() {
+    doTest(new MockIntroduceVariableHandler("c", false, false, false, "SAM<java.lang.Integer>"));
   }
 
-  public void testOneLineLambdaVoidCompatible() throws Exception {
-    doTest(new MockIntroduceVariableHandler("c", false, false, false, "java.lang.String"));
+  public void testOneLineLambdaVoidCompatible() {
+    doTest(new MockIntroduceVariableHandler("c", false, false, false, CommonClassNames.JAVA_LANG_STRING));
   }
-  public void testOneLineLambdaValueCompatible() throws Exception {
+  public void testOneLineLambdaValueCompatible() {
     doTest(new MockIntroduceVariableHandler("c", false, false, false, "int"));
   }
 
-  public void testNormalizeDeclarations() throws Exception {
+  public void testNormalizeDeclarations() {
     doTest(new MockIntroduceVariableHandler("i3", false, false, false, "int"));
   }
 
-  public void testMethodReferenceExpr() throws Exception {
+  public void testMethodReferenceExpr() {
     doTest(new MockIntroduceVariableHandler("m", false, false, false, "Foo.I"));
   }
 
-  public void testReturnNonExportedArray() throws Exception {
+  public void testReturnNonExportedArray() {
     doTest(new MockIntroduceVariableHandler("i", false, false, false, "java.io.File[]") {
       @Override
       protected boolean isInplaceAvailableInTestMode() {
@@ -464,8 +460,8 @@
     });
   }
 
-  private void doTest(IntroduceVariableBase testMe) throws Exception {
-    @NonNls String baseName = "/refactoring/introduceVariable/" + getTestName(false);
+  private void doTest(IntroduceVariableBase testMe) {
+    String baseName = "/refactoring/introduceVariable/" + getTestName(false);
     configureByFile(baseName + ".java");
     testMe.invoke(getProject(), getEditor(), getFile(), null);
     checkResultByFile(baseName + ".after.java");
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveInnerTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveInnerTest.java
index 2e6865b..c56ff82 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/MoveInnerTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveInnerTest.java
@@ -85,6 +85,10 @@
     doTest(createAction("p.A.B", "B", false, null, false, false, null));
   }
 
+  public void testConstructorUtilClassVisibility() throws Exception {
+    doTest(createAction("p.A.B", "B", false, null, false, false, null));
+  }
+
   public void testFieldAccessInSuper() throws Exception {
     doTest(createAction("p.A.B", "B", true, "a", false, false, null));
   }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java b/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
index cbf0955..f0d4e77 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/PullUpTest.java
@@ -16,17 +16,24 @@
 package com.intellij.refactoring;
 
 import com.intellij.JavaTestUtil;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.pom.java.LanguageLevel;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.refactoring.listeners.JavaRefactoringListenerManager;
 import com.intellij.refactoring.listeners.MoveMemberListener;
+import com.intellij.refactoring.memberPullUp.PullUpConflictsUtil;
 import com.intellij.refactoring.memberPullUp.PullUpProcessor;
 import com.intellij.refactoring.util.DocCommentPolicy;
+import com.intellij.refactoring.util.classMembers.InterfaceContainmentVerifier;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
+import com.intellij.testFramework.IdeaTestUtil;
+import com.intellij.util.containers.MultiMap;
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.Arrays;
+
 /**
  * @author ven
  */
@@ -86,6 +93,16 @@
     doTest(new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class));
   }
 
+  public void testNotFunctionalAnymore() {
+    setLanguageLevel(LanguageLevel.JDK_1_8);
+    doTest(true, "Functional expression demands functional interface to have exact one method", new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class, true));
+  }
+
+  public void testStillFunctional() {
+    setLanguageLevel(LanguageLevel.JDK_1_8);
+    doTest(true, new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class, false));
+  }
+
   public void testAsDefault() {
     final RefactoringTestUtil.MemberDescriptor descriptor = new RefactoringTestUtil.MemberDescriptor("get", PsiMethod.class);
     doTest(descriptor);
@@ -156,6 +173,13 @@
   }
 
   private void doTest(final boolean checkMembersMovedCount, RefactoringTestUtil.MemberDescriptor... membersToFind) {
+    doTest(checkMembersMovedCount, null, membersToFind);
+  }
+
+  private void doTest(final boolean checkMembersMovedCount,
+                      String conflictMessage,
+                      RefactoringTestUtil.MemberDescriptor... membersToFind) {
+    final MultiMap<PsiElement, String> conflictsMap = new MultiMap<PsiElement, String>();
     configureByFile(BASE_PATH + getTestName(false) + ".java");
     PsiElement elementAt = getFile().findElementAt(getEditor().getCaretModel().getOffset());
     final PsiClass sourceClass = PsiTreeUtil.getParentOfType(elementAt, PsiClass.class);
@@ -169,7 +193,7 @@
       assertTrue(interfaces[0].isWritable());
       targetClass = interfaces[0];
     }
-    MemberInfo[] infos = RefactoringTestUtil.findMembers(sourceClass, membersToFind);
+    final MemberInfo[] infos = RefactoringTestUtil.findMembers(sourceClass, membersToFind);
 
     final int[] countMoved = {0};
     final MoveMemberListener listener = new MoveMemberListener() {
@@ -180,10 +204,35 @@
       }
     };
     JavaRefactoringListenerManager.getInstance(getProject()).addMoveMembersListener(listener);
+    final PsiDirectory targetDirectory = targetClass.getContainingFile().getContainingDirectory();
+    final PsiPackage targetPackage = targetDirectory != null ? JavaDirectoryService.getInstance().getPackage(targetDirectory) : null;
+    conflictsMap.putAllValues(
+      PullUpConflictsUtil
+        .checkConflicts(infos, sourceClass, targetClass, targetPackage, targetDirectory, new InterfaceContainmentVerifier() {
+          @Override
+          public boolean checkedInterfacesContain(PsiMethod psiMethod) {
+            return PullUpProcessor.checkedInterfacesContain(Arrays.asList(infos), psiMethod);
+          }
+        })
+    );
     final PullUpProcessor helper = new PullUpProcessor(sourceClass, targetClass, infos, new DocCommentPolicy(DocCommentPolicy.ASIS));
     helper.run();
     UIUtil.dispatchAllInvocationEvents();
     JavaRefactoringListenerManager.getInstance(getProject()).removeMoveMembersListener(listener);
+
+    if (conflictMessage != null && conflictsMap.isEmpty()) {
+      fail("Conflict was not detected");
+    }
+
+    if (conflictMessage == null && !conflictsMap.isEmpty()) {
+      fail(conflictsMap.values().iterator().next());
+    }
+
+    if (conflictMessage != null) {
+      assertEquals(conflictMessage, conflictsMap.values().iterator().next());
+      return;
+    }
+
     if (checkMembersMovedCount) {
       assertEquals(countMoved[0], membersToFind.length);
     }
@@ -195,4 +244,9 @@
   protected String getTestDataPath() {
     return JavaTestUtil.getJavaTestDataPath();
   }
+
+  @Override
+  protected Sdk getProjectJDK() {
+    return IdeaTestUtil.getMockJdk18();
+  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/PushDownTest.java b/java/java-tests/testSrc/com/intellij/refactoring/PushDownTest.java
index 5ea40f6..299a646 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/PushDownTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/PushDownTest.java
@@ -16,12 +16,14 @@
 package com.intellij.refactoring;
 
 import com.intellij.codeInsight.TargetElementUtilBase;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.psi.*;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.refactoring.memberPushDown.PushDownProcessor;
 import com.intellij.refactoring.util.DocCommentPolicy;
 import com.intellij.refactoring.util.classMembers.MemberInfo;
 import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
+import com.intellij.testFramework.IdeaTestUtil;
 import com.intellij.usageView.UsageInfo;
 import com.intellij.util.containers.MultiMap;
 
@@ -54,6 +56,12 @@
   public void testExtensionMethodToInterface() { doTest(); }
   public void testExtensionMethodToClass() { doTest(); }
 
+  public void testFunctionalExpression() { doTest(true);}
+  public void testFunctionalInterface() { doTest(true);}
+  public void testFunctionalExpressionDefaultMethod() { doTest();}
+
+  public void testInterfaceConstants() { doTest();}
+
   private void doTest() {
     doTest(false);
   }
@@ -122,4 +130,9 @@
 
     checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
   }
+
+  @Override
+  protected Sdk getProjectJDK() {
+    return IdeaTestUtil.getMockJdk18();
+  }
 }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java b/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java
index a6768c9..e99d8a5 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/SafeDeleteTest.java
@@ -134,6 +134,35 @@
     }
   }
 
+  public void testParameterFromFunctionalInterface() throws Exception {
+    try {
+      LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
+      doSingleFileTest();
+      fail("Conflict was not detected");
+    }
+    catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
+      String message = e.getMessage();
+      assertEquals("class <b><code>SAM</code></b> has 1 usage that is not safe to delete.", message);
+    }
+  }
+
+  public void testFunctionalInterfaceMethod() throws Exception {
+    try {
+      LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
+      doSingleFileTest();
+      fail("Conflict was not detected");
+    }
+    catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
+      String message = e.getMessage();
+      assertEquals("class <b><code>SAM</code></b> has 1 usage that is not safe to delete.", message);
+    }
+  }
+
+  public void testFunctionalInterfaceDefaultMethod() throws Exception {
+    LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
+    doSingleFileTest();
+  }
+
   public void testMethodDeepHierarchy() throws Exception {
     doTest("Super");
   }
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
index ec5ab9e..c77b344 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodTest.java
@@ -260,6 +260,10 @@
     doTest(true);
   }
 
+  public void testMethodInsideChangeIfStatement() throws Exception {
+    doTest();
+  }
+
   private void doTestInlineThisOnly() {
     @NonNls String fileName = "/refactoring/inlineMethod/" + getTestName(false) + ".java";
     configureByFile(fileName);
diff --git a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java
index 8d61ad0..25af740 100644
--- a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java
+++ b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java
@@ -16,14 +16,14 @@
 package com.intellij.roots;
 
 import com.intellij.ProjectTopics;
+import com.intellij.openapi.application.ex.PathManagerEx;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
-import com.intellij.openapi.roots.impl.ModifiableModelCommitter;
 import com.intellij.openapi.projectRoots.ProjectJdkTable;
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.projectRoots.SdkModificator;
-import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
 import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.impl.ModifiableModelCommitter;
 import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
@@ -58,6 +58,47 @@
     super.tearDown();
   }
 
+  public void testEventsAfterFileModifications() throws Exception {
+    final File root = FileUtil.createTempDirectory(getTestName(true), "");
+    File dir1 = new File(root, "dir1");
+    assertTrue(dir1.mkdirs());
+    final VirtualFile vDir1 = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir1);
+
+    final Module moduleA = createModule("a.iml");
+    final ModifiableRootModel model = ModuleRootManager.getInstance(moduleA).getModifiableModel();
+    myModuleRootListener.reset();
+    
+    model.addContentEntry(vDir1.getUrl());
+    model.commit();
+
+    assertEventsCount(1);
+    assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir1);
+    
+    vDir1.delete(null);
+    assertEventsCount(1);
+    assertEmpty(ModuleRootManager.getInstance(moduleA).getContentRoots());
+ 
+    File dir2 = new File(root, "dir2");
+    dir2.mkdirs();
+    final VirtualFile vDir2 = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir2);
+
+    vDir2.rename(null, "dir1");
+    assertEventsCount(1);
+    assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir2);
+
+    // when the existing root is renamed, it remains a root
+    vDir2.rename(null, "dir2");
+    assertEventsCount(0);
+    assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir2);
+ 
+    // and event if it is moved, it's still a root
+    File subdir = new File(root, "subdir");
+    subdir.mkdirs();
+    vDir2.move(null, LocalFileSystem.getInstance().refreshAndFindFileByIoFile(subdir));
+    assertEventsCount(0);
+    assertSameElements(ModuleRootManager.getInstance(moduleA).getContentRoots(), vDir2);
+  }
+
   public void testProjectLibraryChangeEvent() throws Exception {
     final LibraryTable projectLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject);
     verifyLibraryTableEditing(projectLibraryTable);
@@ -68,16 +109,33 @@
     verifyLibraryTableEditing(globalLibraryTable);
   }
 
-  public void testProjectLibraryEventsInUncommitedModel() throws Exception {
+  public void testProjectLibraryEventsInUncommittedModel() throws Exception {
     final LibraryTable projectLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject);
-    verifyLibraryTableEditingInUncommitedModel(projectLibraryTable);
+    verifyLibraryTableEditingInUncommittedModel(projectLibraryTable);
   }
 
-  public void testGlobalLibraryEventsInUncommitedModel() throws Exception {
+  public void testGlobalLibraryEventsInUncommittedModel() throws Exception {
     final LibraryTable globalLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable();
-    verifyLibraryTableEditingInUncommitedModel(globalLibraryTable);
+    verifyLibraryTableEditingInUncommittedModel(globalLibraryTable);
   }
 
+  public void testEditLibraryForModuleLoadFromXml() throws IOException {
+    File moduleFile = PathManagerEx.findFileUnderProjectHome("java/java-tests/testData/moduleRootManager/rootsChanged/emptyModule/a.iml", getClass());
+    Module a = loadModule(moduleFile, true);
+    assertEventsCount(1);
+
+    final Sdk jdk = IdeaTestUtil.getMockJdk17();
+    ProjectJdkTable.getInstance().addJdk(jdk);
+    assertEventsCount(0);
+
+    ModuleRootModificationUtil.setModuleSdk(a, jdk);
+    assertEventsCount(1);
+
+    final SdkModificator sdkModificator = jdk.getSdkModificator();
+    sdkModificator.addRoot(getVirtualFile(createTempDirectory()), OrderRootType.CLASSES);
+    sdkModificator.commitChanges();
+    assertEventsCount(1);
+  }
 
   public void testModuleJdkEditing() throws Exception {
     final Module moduleA = createModule("a.iml");
@@ -93,9 +151,7 @@
     rootModelA.setSdk(jdk);
     rootModelB.setSdk(jdk);
     ModifiableRootModel[] rootModels = new ModifiableRootModel[]{rootModelA, rootModelB};
-    if (rootModels.length > 0) {
-      ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
-    }
+    ModifiableModelCommitter.multiCommit(rootModels, ModuleManager.getInstance(rootModels[0].getProject()).getModifiableModel());
     assertEventsCount(1);
 
     final SdkModificator sdkModificator = jdk.getSdkModificator();
@@ -192,7 +248,7 @@
     assertEventsCount(1);
   }
 
-  private void verifyLibraryTableEditingInUncommitedModel(final LibraryTable libraryTable) {
+  private void verifyLibraryTableEditingInUncommittedModel(final LibraryTable libraryTable) {
     final Module moduleA = createModule("a.iml");
     final Module moduleB = createModule("b.iml");
     assertEventsCount(2);
diff --git a/java/java-tests/testSrc/com/intellij/unscramble/UnscrambleDialogTest.java b/java/java-tests/testSrc/com/intellij/unscramble/UnscrambleDialogTest.java
index e49823e..7124d3b 100644
--- a/java/java-tests/testSrc/com/intellij/unscramble/UnscrambleDialogTest.java
+++ b/java/java-tests/testSrc/com/intellij/unscramble/UnscrambleDialogTest.java
@@ -17,6 +17,7 @@
 
 import com.intellij.JavaTestUtil;
 import com.intellij.execution.ui.RunContentDescriptor;
+import com.intellij.openapi.util.Disposer;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
 
@@ -65,6 +66,7 @@
   private RunContentDescriptor showText(String unscramble) {
     RunContentDescriptor descriptor = UnscrambleDialog.showUnscrambledText(null, "foo", getProject(), unscramble);
     assertNotNull(descriptor);
+    Disposer.register(myModule, descriptor);
     return descriptor;
   }
 
diff --git a/java/jdkAnnotations/java/io/annotations.xml b/java/jdkAnnotations/java/io/annotations.xml
index 45f54e4..53a61f7 100644
--- a/java/jdkAnnotations/java/io/annotations.xml
+++ b/java/jdkAnnotations/java/io/annotations.xml
@@ -60,6 +60,24 @@
   <item name="java.io.DataInputStream java.lang.String readUTF(java.io.DataInput)">
     <annotation name="org.jetbrains.annotations.NotNull" />
   </item>
+  <item name='java.io.DataInputStream java.lang.String readUTF(java.io.DataInput) 0'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
+  <item name='java.io.DataOutput void write(byte[]) 0'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
+  <item name='java.io.DataOutput void write(byte[], int, int) 0'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
+  <item name='java.io.DataOutput void writeBytes(java.lang.String) 0'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
+  <item name='java.io.DataOutput void writeChars(java.lang.String) 0'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
+  <item name='java.io.DataOutput void writeUTF(java.lang.String) 0'>
+    <annotation name='org.jetbrains.annotations.NotNull'/>
+  </item>
   <item name="java.io.File File(java.io.File, java.lang.String) 1">
     <annotation name="org.jetbrains.annotations.NonNls" />
     <annotation name="org.jetbrains.annotations.NotNull" />
diff --git a/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java b/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java
index 655dc95..516248d 100644
--- a/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java
+++ b/java/openapi/src/com/intellij/ide/util/projectWizard/JavaModuleBuilder.java
@@ -47,6 +47,9 @@
   private List<Pair<String,String>> mySourcePaths;
   // Pair<Library path, Source path>
   private final List<Pair<String, String>> myModuleLibraries = new ArrayList<Pair<String, String>>();
+  public static final int JAVA_WEIGHT = 100;
+  public static final int BUILD_SYSTEM_WEIGHT = 80;
+  public static final int JAVA_MOBILE_WEIGHT = 60;
 
   public final void setCompilerOutputPath(String compilerOutputPath) {
     myCompilerOutputPath = acceptParameter(compilerOutputPath);
@@ -157,4 +160,9 @@
   protected static String getPathForOutputPathStep() {
     return null;
   }
+
+  @Override
+  public int getWeight() {
+    return JAVA_WEIGHT;
+  }
 }
diff --git a/java/openapi/src/com/intellij/openapi/roots/libraries/JarVersionDetectionUtil.java b/java/openapi/src/com/intellij/openapi/roots/libraries/JarVersionDetectionUtil.java
index 2e5472e..903ad91 100644
--- a/java/openapi/src/com/intellij/openapi/roots/libraries/JarVersionDetectionUtil.java
+++ b/java/openapi/src/com/intellij/openapi/roots/libraries/JarVersionDetectionUtil.java
@@ -13,14 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.intellij.openapi.roots.libraries;
 
-import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.module.Module;
+import com.intellij.openapi.projectRoots.JdkUtil;
 import com.intellij.openapi.roots.LibraryOrderEntry;
 import com.intellij.openapi.roots.ModuleRootManager;
 import com.intellij.openapi.roots.OrderEntry;
+import com.intellij.openapi.util.io.JarUtil;
 import com.intellij.openapi.vfs.JarFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
@@ -35,47 +35,32 @@
 import java.util.jar.Manifest;
 
 public class JarVersionDetectionUtil {
-  private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.libraries.JarVersionDetectionUtil");
-
-  private JarVersionDetectionUtil() {
-  }
+  private JarVersionDetectionUtil() { }
 
   @Nullable
-  public static String detectJarVersion(@NotNull final String detectionClass, @NotNull Module module) {
-    try {
-      return detectJarVersion(getDetectionJar(detectionClass, module));
-    }
-    catch (IOException e) {
-      return null;
-    }
-  }
-
-  @Nullable
-  public static String detectJarVersion(@NotNull String detectionClass, @NotNull List<VirtualFile> files) {
-    final VirtualFile jar = LibrariesHelper.getInstance().findRootByClass(files, detectionClass);
-    if (jar != null && jar.getFileSystem() instanceof JarFileSystem) {
-      final VirtualFile manifestFile = jar.findFileByRelativePath(JarFile.MANIFEST_NAME);
-      if (manifestFile != null) {
-        try {
-          final InputStream input = manifestFile.getInputStream();
-          try {
-            return new Manifest(input).getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
-          }
-          finally {
-            input.close();
-          }
-        }
-        catch (IOException e) {
-          LOG.debug(e);
-          return null;
+  public static String detectJarVersion(@NotNull String detectionClass, @NotNull Module module) {
+    for (OrderEntry library : ModuleRootManager.getInstance(module).getOrderEntries()) {
+      if (library instanceof LibraryOrderEntry) {
+        VirtualFile jar = LibrariesHelper.getInstance().findJarByClass(((LibraryOrderEntry)library).getLibrary(), detectionClass);
+        if (jar != null && jar.getFileSystem() instanceof JarFileSystem) {
+          return JdkUtil.getJarMainAttribute(jar, Attributes.Name.IMPLEMENTATION_VERSION);
         }
       }
     }
+
     return null;
   }
 
   @Nullable
-  public static String detectJarVersion(com.intellij.openapi.vfs.JarFile zipFile) {
+  public static String detectJarVersion(@NotNull String detectionClass, @NotNull List<VirtualFile> files) {
+    VirtualFile jarRoot = LibrariesHelper.getInstance().findRootByClass(files, detectionClass);
+    return jarRoot != null && jarRoot.getFileSystem() instanceof JarFileSystem ?
+           JdkUtil.getJarMainAttribute(jarRoot, Attributes.Name.IMPLEMENTATION_VERSION) : null;
+  }
+
+  /** @deprecated use {@link JarUtil#getJarAttribute(File, Attributes.Name)} (to remove in IDEA 15) */
+  @SuppressWarnings("UnusedDeclaration")
+  public static String detectJarVersion(@Nullable com.intellij.openapi.vfs.JarFile zipFile) {
     if (zipFile == null) {
       return null;
     }
@@ -94,40 +79,17 @@
     }
   }
 
-  @Nullable
-  private static com.intellij.openapi.vfs.JarFile getDetectionJar(final String detectionClass, Module module) throws IOException {
-      for (OrderEntry library : ModuleRootManager.getInstance(module).getOrderEntries()) {
-        if (library instanceof LibraryOrderEntry) {
-          VirtualFile file = LibrariesHelper.getInstance().findJarByClass(((LibraryOrderEntry)library).getLibrary(), detectionClass);
-          if (file != null && file.getFileSystem() instanceof JarFileSystem) {
-            return JarFileSystem.getInstance().getJarFile(file);
-          }
-        }
-      }
-    return null;
-  }
-
-  private static String getJarAttribute(@NotNull File jar, @NotNull String attributeName, @Nullable String entryName) throws IOException {
-    JarFile runJar = new JarFile(jar);
-    try {
-      Attributes attributes = entryName == null ? runJar.getManifest().getMainAttributes() : runJar.getManifest().getAttributes(entryName);
-      return attributes.getValue(attributeName);
-    }
-    finally {
-      runJar.close();
-    }
-  }
-
   public static String getBundleVersion(@NotNull File jar) throws IOException {
-    return getJarAttribute(jar, "Bundle-Version", null);
+    return JarUtil.getJarAttribute(jar, new Attributes.Name("Bundle-Version"));
   }
 
   public static String getImplementationVersion(@NotNull File jar) throws IOException {
-    return getJarAttributeVersion(jar, Attributes.Name.IMPLEMENTATION_VERSION, null);
+    return JarUtil.getJarAttribute(jar, Attributes.Name.IMPLEMENTATION_VERSION);
   }
 
-  public static String getJarAttributeVersion(@NotNull File jar, @NotNull Attributes.Name attributeName, @Nullable String entryName) throws IOException {
-    return getJarAttribute(jar, attributeName.toString(), entryName);
+  /** @deprecated use {@link JarUtil#getJarAttribute(File, Attributes.Name)} (to remove in IDEA 15) */
+  @SuppressWarnings("UnusedDeclaration")
+  public static String getJarAttributeVersion(@NotNull File jar, @NotNull Attributes.Name attribute, @Nullable String entryName) {
+    return entryName != null ? JarUtil.getJarAttribute(jar, entryName, attribute) : JarUtil.getJarAttribute(jar, attribute);
   }
 }
-
diff --git a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
index 2867bb1..b4b654d 100644
--- a/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
+++ b/java/openapi/src/com/intellij/ui/classFilter/ClassFilterEditor.java
@@ -249,7 +249,7 @@
     }
 
     public boolean isCellEditable(int rowIndex, int columnIndex) {
-      return isEnabled() && (columnIndex == CHECK_MARK);
+      return isEnabled();
     }
 
     public void removeRow(final int idx) {
diff --git a/java/testFramework/src/com/intellij/debugger/DebuggerTestCase.java b/java/testFramework/src/com/intellij/debugger/DebuggerTestCase.java
index b11a7e0..a04d8f3 100644
--- a/java/testFramework/src/com/intellij/debugger/DebuggerTestCase.java
+++ b/java/testFramework/src/com/intellij/debugger/DebuggerTestCase.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.
@@ -36,9 +36,11 @@
 import com.intellij.execution.process.ProcessOutputTypes;
 import com.intellij.execution.runners.ExecutionEnvironment;
 import com.intellij.execution.runners.ProgramRunner;
+import com.intellij.execution.ui.ExecutionConsole;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.ModalityState;
 import com.intellij.openapi.editor.Document;
+import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.options.SettingsEditor;
 import com.intellij.openapi.project.Project;
@@ -109,8 +111,14 @@
 
   @Override
   protected void tearDown() throws Exception {
-    super.tearDown();
+    FileEditorManagerEx.getInstanceEx(getProject()).closeAllFiles();
+    ExecutionResult executionResult = myDebugProcess == null ? null : myDebugProcess.getExecutionResult();
+    ExecutionConsole console = executionResult == null ? null : executionResult.getExecutionConsole();
+    if (console != null) {
+      Disposer.dispose(console);
+    }
     myConsoleBuffer = null;
+    super.tearDown();
   }
 
   protected void createLocalProcess(String className) throws ExecutionException, InterruptedException, InvocationTargetException {
diff --git a/java/testFramework/src/com/intellij/debugger/impl/OutputChecker.java b/java/testFramework/src/com/intellij/debugger/impl/OutputChecker.java
index a391c96..113587f 100644
--- a/java/testFramework/src/com/intellij/debugger/impl/OutputChecker.java
+++ b/java/testFramework/src/com/intellij/debugger/impl/OutputChecker.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.
@@ -24,19 +24,20 @@
 import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.projectRoots.ex.JavaSdkUtil;
 import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
-import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.util.Key;
 import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.ThrowableComputable;
 import com.intellij.openapi.util.io.FileUtilRt;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.util.text.StringUtilRt;
 import com.intellij.openapi.vfs.CharsetToolkit;
 import com.intellij.util.containers.HashMap;
-import junit.framework.Assert;
+import org.junit.Assert;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -172,91 +173,78 @@
 
     if (application == null) return buffer;
 
-    final Exception[] ex = new Exception[]{null};
-
-    String actual = application.runReadAction(new Computable<String>() {
+    return application.runReadAction(new ThrowableComputable<String, Exception>() {
       @Override
-      public String compute() {
-        try {
-          String internalJdkHome = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk().getHomeDirectory().getPath();
-          //System.out.println("internalJdkHome = " + internalJdkHome);
+      public String compute() throws UnknownHostException {
+        String internalJdkHome = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk().getHomeDirectory().getPath();
+        //System.out.println("internalJdkHome = " + internalJdkHome);
 
-          String result = buffer;
-          //System.out.println("Original Output = " + result);
-          final boolean shouldIgnoreCase = !SystemInfo.isFileSystemCaseSensitive;
+        String result = buffer;
+        //System.out.println("Original Output = " + result);
+        final boolean shouldIgnoreCase = !SystemInfo.isFileSystemCaseSensitive;
 
-          result = StringUtil.replace(result, "\r\n", "\n");
-          result = StringUtil.replace(result, "\r", "\n");
-          result = replaceAdditionalInOutput(result);
-          result = StringUtil.replace(result, testJdk.getHomePath(), "!TEST_JDK!", shouldIgnoreCase);
-          result = StringUtil.replace(result, myAppPath, "!APP_PATH!", shouldIgnoreCase);
-          result = StringUtil.replace(result, myAppPath.replace(File.separatorChar, '/'), "!APP_PATH!", shouldIgnoreCase);
-          result = StringUtil.replace(result, JavaSdkUtil.getIdeaRtJarPath(), "!RT_JAR!", shouldIgnoreCase);
-          result = StringUtil.replace(result, JavaSdkUtil.getJunit4JarPath(), "!JUNIT4_JAR!", shouldIgnoreCase);
-          result = StringUtil.replace(result, InetAddress.getLocalHost().getCanonicalHostName(), "!HOST_NAME!", shouldIgnoreCase);
-          result = StringUtil.replace(result, InetAddress.getLocalHost().getHostName(), "!HOST_NAME!", shouldIgnoreCase);
-          result = StringUtil.replace(result, "127.0.0.1", "!HOST_NAME!", shouldIgnoreCase);
-          result = StringUtil.replace(result, JavaSdkUtil.getIdeaRtJarPath().replace('/', File.separatorChar), "!RT_JAR!", shouldIgnoreCase);
-          result = StringUtil.replace(result, internalJdkHome.replace('/', File.separatorChar), "!JDK_HOME!", shouldIgnoreCase);
-          result = StringUtil.replace(result, internalJdkHome, "!JDK_HOME!", shouldIgnoreCase);
-          result = StringUtil.replace(result, PathManager.getHomePath(), "!IDEA_HOME!", shouldIgnoreCase);
-          result = StringUtil.replace(result, "Process finished with exit code 255", "Process finished with exit code -1");
+        result = StringUtil.replace(result, "\r\n", "\n");
+        result = StringUtil.replace(result, "\r", "\n");
+        result = replaceAdditionalInOutput(result);
+        result = StringUtil.replace(result, testJdk.getHomePath(), "!TEST_JDK!", shouldIgnoreCase);
+        result = StringUtil.replace(result, myAppPath, "!APP_PATH!", shouldIgnoreCase);
+        result = StringUtil.replace(result, myAppPath.replace(File.separatorChar, '/'), "!APP_PATH!", shouldIgnoreCase);
+        result = StringUtil.replace(result, JavaSdkUtil.getIdeaRtJarPath(), "!RT_JAR!", shouldIgnoreCase);
+        result = StringUtil.replace(result, JavaSdkUtil.getJunit4JarPath(), "!JUNIT4_JAR!", shouldIgnoreCase);
+        result = StringUtil.replace(result, InetAddress.getLocalHost().getCanonicalHostName(), "!HOST_NAME!", shouldIgnoreCase);
+        result = StringUtil.replace(result, InetAddress.getLocalHost().getHostName(), "!HOST_NAME!", shouldIgnoreCase);
+        result = StringUtil.replace(result, "127.0.0.1", "!HOST_NAME!", shouldIgnoreCase);
+        result = StringUtil.replace(result, JavaSdkUtil.getIdeaRtJarPath().replace('/', File.separatorChar), "!RT_JAR!", shouldIgnoreCase);
+        result = StringUtil.replace(result, internalJdkHome.replace('/', File.separatorChar), "!JDK_HOME!", shouldIgnoreCase);
+        result = StringUtil.replace(result, internalJdkHome, "!JDK_HOME!", shouldIgnoreCase);
+        result = StringUtil.replace(result, PathManager.getHomePath(), "!IDEA_HOME!", shouldIgnoreCase);
+        result = StringUtil.replace(result, "Process finished with exit code 255", "Process finished with exit code -1");
 
-//          result = result.replaceAll(" +\n", "\n");
-          result = result.replaceAll("!HOST_NAME!:\\d*", "!HOST_NAME!:!HOST_PORT!");
-          result = result.replaceAll("at \\'.*?\\'", "at '!HOST_NAME!:PORT_NAME!'");
-          result = result.replaceAll("address: \\'.*?\\'", "address: '!HOST_NAME!:PORT_NAME!'");
-          result = result.replaceAll("file.*AppletPage.*\\.html", "file:/!APPLET_HTML!");
-          result = result.replaceAll("\"(!JDK_HOME!.*?)\"", "$1");
-          result = result.replaceAll("\"(!APP_PATH!.*?)\"", "$1");
+        //          result = result.replaceAll(" +\n", "\n");
+        result = result.replaceAll("!HOST_NAME!:\\d*", "!HOST_NAME!:!HOST_PORT!");
+        result = result.replaceAll("at \\'.*?\\'", "at '!HOST_NAME!:PORT_NAME!'");
+        result = result.replaceAll("address: \\'.*?\\'", "address: '!HOST_NAME!:PORT_NAME!'");
+        result = result.replaceAll("file.*AppletPage.*\\.html", "file:/!APPLET_HTML!");
+        result = result.replaceAll("\"(!JDK_HOME!.*?)\"", "$1");
+        result = result.replaceAll("\"(!APP_PATH!.*?)\"", "$1");
 
-          result = result.replaceAll("-Didea.launcher.port=\\d*", "-Didea.launcher.port=!IDEA_LAUNCHER_PORT!");
-          result = result.replaceAll("-Dfile.encoding=[\\w\\d-]*", "-Dfile.encoding=!FILE_ENCODING!");
-          result = result.replaceAll("\\((.*)\\:\\d+\\)", "($1:!LINE_NUMBER!)");
+        result = result.replaceAll("-Didea.launcher.port=\\d*", "-Didea.launcher.port=!IDEA_LAUNCHER_PORT!");
+        result = result.replaceAll("-Dfile.encoding=[\\w\\d-]*", "-Dfile.encoding=!FILE_ENCODING!");
+        result = result.replaceAll("\\((.*)\\:\\d+\\)", "($1:!LINE_NUMBER!)");
 
-          int commandLineStart = result.indexOf("!JDK_HOME!");
-          while (commandLineStart != -1) {
-            final StringBuilder builder = new StringBuilder(result);
-            int i = commandLineStart + 1;
-            while (i < builder.length()) {
-              char c = builder.charAt(i);
-              if (c == '\n') break;
-              else if (c == File.separatorChar) builder.setCharAt(i, '\\');
-              i++;
-            }
-            result = builder.toString();
-            commandLineStart = result.indexOf("!JDK_HOME!", commandLineStart + 1);
+        int commandLineStart = result.indexOf("!JDK_HOME!");
+        while (commandLineStart != -1) {
+          final StringBuilder builder = new StringBuilder(result);
+          int i = commandLineStart + 1;
+          while (i < builder.length()) {
+            char c = builder.charAt(i);
+            if (c == '\n') break;
+            else if (c == File.separatorChar) builder.setCharAt(i, '\\');
+            i++;
           }
+          result = builder.toString();
+          commandLineStart = result.indexOf("!JDK_HOME!", commandLineStart + 1);
+        }
 
-          result = stripQuotesAroundClasspath(result);
+        result = stripQuotesAroundClasspath(result);
 
-          final Matcher matcher = Pattern.compile("-classpath\\s+(\\S+)\\s+").matcher(result);
-          while (matcher.find()) {
-            final String classPath = matcher.group(1);
-            final String[] classPathElements = classPath.split(File.pathSeparator);
-            if (sortClassPath) {
-              Arrays.sort(classPathElements);
-            }
-            final String sortedPath = StringUtil.join(classPathElements, ";");
-            result = StringUtil.replace(result, classPath, sortedPath);
+        final Matcher matcher = Pattern.compile("-classpath\\s+(\\S+)\\s+").matcher(result);
+        while (matcher.find()) {
+          final String classPath = matcher.group(1);
+          final String[] classPathElements = classPath.split(File.pathSeparator);
+          if (sortClassPath) {
+            Arrays.sort(classPathElements);
           }
-
-          result = JDI_BUG_OUTPUT_PATTERN_1.matcher(result).replaceAll("");
-          result = JDI_BUG_OUTPUT_PATTERN_2.matcher(result).replaceAll("");
-
-          return result;
+          final String sortedPath = StringUtil.join(classPathElements, ";");
+          result = StringUtil.replace(result, classPath, sortedPath);
         }
-        catch (Exception exception) {
-          ex[0] = exception;
-          return null;
-        }
+
+        result = JDI_BUG_OUTPUT_PATTERN_1.matcher(result).replaceAll("");
+        result = JDI_BUG_OUTPUT_PATTERN_2.matcher(result).replaceAll("");
+
+        return result;
       }
     });
-
-
-    if (ex[0] != null) throw ex[0];
-
-    return actual;
   }
 
   protected String replaceAdditionalInOutput(String str) {
diff --git a/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java b/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java
index 89b2578..087180b 100644
--- a/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java
+++ b/java/testFramework/src/com/intellij/find/FindManagerTestUtils.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.
@@ -16,7 +16,7 @@
 package com.intellij.find;
 
 import com.intellij.testFramework.LightVirtualFile;
-import junit.framework.Assert;
+import org.junit.Assert;
 
 public class FindManagerTestUtils {
   static void runFindInCommentsAndLiterals(FindManager findManager, FindModel findModel, String text) {
diff --git a/java/testFramework/src/com/intellij/testFramework/CompilerTester.java b/java/testFramework/src/com/intellij/testFramework/CompilerTester.java
index f899cc1..8040420 100644
--- a/java/testFramework/src/com/intellij/testFramework/CompilerTester.java
+++ b/java/testFramework/src/com/intellij/testFramework/CompilerTester.java
@@ -242,11 +242,14 @@
 
     @Override
     public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
+      System.out.println("ErrorReportingCallback.finished");
       try {
         for (CompilerMessageCategory category : CompilerMessageCategory.values()) {
+          System.out.println("category = " + category);
           CompilerMessage[] messages = compileContext.getMessages(category);
           for (CompilerMessage message : messages) {
             final String text = message.getMessage();
+            System.out.println("message = " + message);
             if (category != CompilerMessageCategory.INFORMATION || !(text.startsWith("Compilation completed successfully") || text.startsWith("Using javac"))) {
               myMessages.add(message);
             }
diff --git a/java/testFramework/src/com/intellij/testFramework/ModuleTestCase.java b/java/testFramework/src/com/intellij/testFramework/ModuleTestCase.java
index 5930288..5c63d39 100644
--- a/java/testFramework/src/com/intellij/testFramework/ModuleTestCase.java
+++ b/java/testFramework/src/com/intellij/testFramework/ModuleTestCase.java
@@ -96,10 +96,19 @@
   }
 
   protected Module loadModule(final File moduleFile) {
+    return loadModule(moduleFile, false);
+  }
+
+  protected Module loadModule(final File moduleFile, final boolean loadComponentStates) {
     Module module = ApplicationManager.getApplication().runWriteAction(
       new Computable<Module>() {
         @Override
         public Module compute() {
+          ProjectImpl project = (ProjectImpl)myProject;
+          boolean oldOptimiseTestLoadSpeed = project.isOptimiseTestLoadSpeed();
+          if (loadComponentStates) {
+            project.setOptimiseTestLoadSpeed(false);
+          }
           try {
             LocalFileSystem.getInstance().refreshIoFiles(Collections.singletonList(moduleFile));
             return ModuleManager.getInstance(myProject).loadModule(moduleFile.getAbsolutePath());
@@ -108,6 +117,9 @@
             LOG.error(e);
             return null;
           }
+          finally {
+            project.setOptimiseTestLoadSpeed(oldOptimiseTestLoadSpeed);
+          }
         }
       }
     );
diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java b/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java
index f1eaaf2..5d98612 100644
--- a/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java
+++ b/java/testFramework/src/com/intellij/testFramework/fixtures/LightCodeInsightFixtureTestCase.java
@@ -19,6 +19,7 @@
 import com.intellij.openapi.fileTypes.FileType;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
 import com.intellij.openapi.roots.ContentEntry;
 import com.intellij.openapi.roots.LanguageLevelModuleExtension;
 import com.intellij.openapi.roots.ModifiableRootModel;
@@ -47,6 +48,17 @@
       model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_7);
     }
   };
+  public static final LightProjectDescriptor JAVA_8 = new DefaultLightProjectDescriptor() {
+    @Override
+    public Sdk getSdk() {
+      return IdeaTestUtil.getMockJdk18();
+    }
+
+    @Override
+    public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
+      model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_8);
+    }
+  };
   public static final LightProjectDescriptor JAVA_LATEST = new DefaultLightProjectDescriptor();
 
 
diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaCodeInsightTestFixtureImpl.java b/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaCodeInsightTestFixtureImpl.java
index 525df5c..d348a5e 100644
--- a/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaCodeInsightTestFixtureImpl.java
+++ b/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaCodeInsightTestFixtureImpl.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.
@@ -27,13 +27,14 @@
 import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture;
 import com.intellij.testFramework.fixtures.TempDirTestFixture;
 import com.intellij.util.ui.UIUtil;
-import junit.framework.Assert;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
+import org.junit.Assert;
 
 /**
  * @author yole
  */
+@SuppressWarnings("TestOnlyProblems")
 public class JavaCodeInsightTestFixtureImpl extends CodeInsightTestFixtureImpl implements JavaCodeInsightTestFixture {
   public JavaCodeInsightTestFixtureImpl(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirFixture) {
     super(projectFixture, tempDirFixture);