From dce0c362bb653c9cc099e916298f1974c4f7decb Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 21 Oct 2014 17:49:44 +0400 Subject: [PATCH 01/16] IDEA-131592 Menu disappeared after debugging Node application --- .../src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java index 79c8dc49c398..5c14020f603f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/BreakpointEditor.java @@ -90,6 +90,10 @@ public class BreakpointEditor { } public void actionPerformed(AnActionEvent e) { + Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext()); + if (component instanceof JComboBox && SwingUtilities.isDescendingFrom(component, getMainPanel())) { + ((JComboBox)component).hidePopup(); + } done(); } }; From b98a93f1513f5cacb2397d0da337372acf06fd05 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 21 Oct 2014 17:50:52 +0400 Subject: [PATCH 02/16] user resources should go first --- .../com/intellij/xml/util/XmlResourceResolver.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java index fcb3b8dd1da6..90de88e273f8 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java @@ -110,9 +110,6 @@ public class XmlResourceResolver implements XMLEntityResolver { baseFile = myFile; } - PsiFile byLocation = resolveByLocation(myFile, systemId); - if (byLocation != null) return byLocation; - String version = null; String tagName = null; if (baseFile == myFile) { @@ -122,7 +119,15 @@ public class XmlResourceResolver implements XMLEntityResolver { version = rootTag.getAttributeValue("version"); } } - + String resource = ((ExternalResourceManagerEx)ExternalResourceManager.getInstance()).getUserResource(myProject, systemId, version); + if (resource != null) { + XmlFile file = XmlUtil.findXmlFile(myFile, resource); + if (file != null) return file; + } + + PsiFile byLocation = resolveByLocation(myFile, systemId); + if (byLocation != null) return byLocation; + PsiFile psiFile = ExternalResourceManager.getInstance().getResourceLocation(systemId, baseFile, version); if (psiFile == null) { psiFile = XmlUtil.findXmlFile(baseFile, systemId); From 0b4c6bcb5f5b827e9fcf2aaf6a9fd8cdae180659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Tue, 21 Oct 2014 15:52:35 +0200 Subject: [PATCH 03/16] InspectionGadgets.xml: use "defaultExtensionNs" --- .../src/META-INF/InspectionGadgets.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml index 850537221330..861c5ce8afda 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/META-INF/InspectionGadgets.xml @@ -1,6 +1,6 @@ - + Date: Mon, 20 Oct 2014 17:36:15 +0400 Subject: [PATCH 04/16] Mark dirty & batch refresh VirtualFiles instead of refreshing on-by-one Fixes IDEA-120150, IDEA-115773 --- .../vcs/update/RefreshVFsSynchronously.java | 113 +++++++----------- .../svn/checkout/SvnCheckoutProvider.java | 3 +- 2 files changed, 42 insertions(+), 74 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/RefreshVFsSynchronously.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/RefreshVFsSynchronously.java index 447bcf4564f2..cd8d109ecab9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/RefreshVFsSynchronously.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/RefreshVFsSynchronously.java @@ -15,15 +15,13 @@ */ package com.intellij.openapi.vcs.update; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.newvfs.NewVirtualFile; -import com.intellij.util.concurrency.Semaphore; +import com.intellij.util.ArrayUtil; +import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -40,63 +38,42 @@ public class RefreshVFsSynchronously { FilesToRefreshCollector callback = new FilesToRefreshCollector(); UpdateFilesHelper.iterateFileGroupFilesDeletedOnServerFirst(updatedFiles, callback); - for (File file : callback.getToRefreshDeletedOrReplaced()) { - refreshDeletedOrReplaced(file); - } + refreshDeletedOrReplaced(callback.getToRefreshDeletedOrReplaced()); + refreshFiles(callback.getToRefresh()); + } - if (ApplicationManager.getApplication().isUnitTestMode()) { - LocalFileSystem.getInstance().refreshIoFiles(callback.getToRefresh(), false, false, null); - return; + private static void refreshFiles(@NotNull Collection files) { + Collection filesToRefresh = ContainerUtil.newHashSet(); + for (File file : files) { + VirtualFile vf = findFirstValidVirtualParent(file); + if (vf != null) { + filesToRefresh.add(vf); + } } - final Semaphore semaphore = new Semaphore(); - semaphore.down(); - try { - LocalFileSystem.getInstance().refreshIoFiles(callback.getToRefresh(), true, false, new Runnable() { - @Override - public void run() { - semaphore.up(); - } - }); + VfsUtil.markDirtyAndRefresh(false, false, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class)); + } + + private static void refreshDeletedOrReplaced(@NotNull Collection deletedOrReplaced) { + Collection filesToRefresh = ContainerUtil.newHashSet(); + for (File file : deletedOrReplaced) { + File parent = file.getParentFile(); + VirtualFile vf = findFirstValidVirtualParent(parent); + if (vf != null) { + filesToRefresh.add(vf); + } } - catch (Throwable t) { - semaphore.up(); - throw new RuntimeException(t); - } - semaphore.waitFor(); + VfsUtil.markDirtyAndRefresh(false, true, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class)); } @Nullable - public static VirtualFile findCreatedFile(final File root) { - refresh(root); - final LocalFileSystem lfs = LocalFileSystem.getInstance(); - return lfs.findFileByIoFile(root); - } - - private static void refresh(final File root) { - final LocalFileSystem lfs = LocalFileSystem.getInstance(); - VirtualFile vFile = lfs.refreshAndFindFileByIoFile(root); - if (vFile != null) { - vFile.refresh(false, false); - return; - } - } - - private static void refreshDeletedOrReplaced(final File root) { - final File parent = root.getParentFile(); + private static VirtualFile findFirstValidVirtualParent(@Nullable File file) { + LocalFileSystem lfs = LocalFileSystem.getInstance(); VirtualFile vf = null; - // parent should also notice the change - final LocalFileSystem localFileSystem = LocalFileSystem.getInstance(); - final VirtualFile rootVf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(root); - if (parent != null) { - vf = localFileSystem.refreshAndFindFileByIoFile(parent); - } - if (vf == null) { - vf = rootVf; - } - if (vf != null) { - ((NewVirtualFile)vf).markDirtyRecursively(); - vf.refresh(false, true); + while (file != null && (vf == null || !vf.isValid())) { + vf = lfs.findFileByIoFile(file); + file = file.getParentFile(); } + return vf == null || !vf.isValid() ? null : vf; } public static void updateChangesForRollback(final List changes) { @@ -108,31 +85,23 @@ public class RefreshVFsSynchronously { } private static void updateChangesImpl(final List changes, final ChangeWrapper wrapper) { - // approx so ok - final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator(); - if (pi != null) { - pi.setIndeterminate(false); - } - final double num = changes.size(); - - int cnt = 0; + Collection deletedOrReplaced = ContainerUtil.newHashSet(); + Collection toRefresh = ContainerUtil.newHashSet(); for (Change change : changes) { if ((! wrapper.beforeNull(change)) && (wrapper.movedOrRenamedOrReplaced(change) || (wrapper.afterNull(change)))) { - refreshDeletedOrReplaced(wrapper.getBeforeFile(change)); - } else if (! wrapper.beforeNull(change)) { - refresh(wrapper.getBeforeFile(change)); + deletedOrReplaced.add(wrapper.getBeforeFile(change)); + } else if (!wrapper.beforeNull(change)) { + toRefresh.add(wrapper.getBeforeFile(change)); } - if ((! wrapper.afterNull(change)) && + if ((! wrapper.afterNull(change)) && (wrapper.beforeNull(change) || (! Comparing.equal(change.getAfterRevision().getFile(), change.getBeforeRevision().getFile()))) ) { - refresh(wrapper.getAfterFile(change)); - } - if (pi != null) { - ++ cnt; - pi.setFraction(cnt/num); - pi.setText2("Refreshing: " + change.toString()); + toRefresh.add(wrapper.getAfterFile(change)); } } + + refreshFiles(toRefresh); + refreshDeletedOrReplaced(deletedOrReplaced); } private static class RollbackChangeWrapper implements ChangeWrapper { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java index c7422ef2a220..4cc34751cb41 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/checkout/SvnCheckoutProvider.java @@ -33,7 +33,6 @@ import com.intellij.openapi.vcs.CheckoutProvider; import com.intellij.openapi.vcs.VcsConfiguration; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx; -import com.intellij.openapi.vcs.update.RefreshVFsSynchronously; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.StatusBar; @@ -139,7 +138,7 @@ public class SvnCheckoutProvider implements CheckoutProvider { Messages.showErrorDialog(SvnBundle.message("message.text.cannot.checkout", exception[0].getMessage()), SvnBundle.message("message.title.check.out")); } - final VirtualFile vf = RefreshVFsSynchronously.findCreatedFile(target); + VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(target); if (vf != null) { vf.refresh(true, true, new Runnable() { public void run() { From fadf51fa0873096190949d612e693dda292fb90c Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 21 Oct 2014 17:50:13 +0400 Subject: [PATCH 05/16] [git] refresh file status after reset from the log --- plugins/git4idea/src/git4idea/reset/GitResetOperation.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git4idea/src/git4idea/reset/GitResetOperation.java b/plugins/git4idea/src/git4idea/reset/GitResetOperation.java index 1934ed7aa1c6..f211057cdff0 100644 --- a/plugins/git4idea/src/git4idea/reset/GitResetOperation.java +++ b/plugins/git4idea/src/git4idea/reset/GitResetOperation.java @@ -32,6 +32,7 @@ import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.ui.UIUtil; import com.intellij.vcs.log.VcsFullCommitDetails; +import com.intellij.vcsUtil.VcsUtil; import git4idea.GitPlatformFacade; import git4idea.GitUtil; import git4idea.branch.GitBranchUiHandlerImpl; @@ -94,6 +95,7 @@ public class GitResetOperation { results.put(repository, result); repository.update(); VfsUtil.markDirtyAndRefresh(true, true, false, root); + VcsUtil.markFileAsDirty(myProject, root); } } finally { From 66276ed742d54a9e26a25eb6c9ca4eca6a6659b9 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 21 Oct 2014 17:58:31 +0400 Subject: [PATCH 06/16] [git] IDEA-131036 notNullize environment variable values --- plugins/git4idea/src/git4idea/commands/GitHandler.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index c2d85b7e3126..a1cf820e97db 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.openapi.vcs.VcsException; @@ -441,14 +442,14 @@ public abstract class GitHandler { myEnv.put(GitSSHHandler.SSH_USE_PROXY_ENV, String.valueOf(useHttpProxy)); if (useHttpProxy) { - myEnv.put(GitSSHHandler.SSH_PROXY_HOST_ENV, httpConfigurable.PROXY_HOST); + myEnv.put(GitSSHHandler.SSH_PROXY_HOST_ENV, StringUtil.notNullize(httpConfigurable.PROXY_HOST)); myEnv.put(GitSSHHandler.SSH_PROXY_PORT_ENV, String.valueOf(httpConfigurable.PROXY_PORT)); boolean proxyAuthentication = httpConfigurable.PROXY_AUTHENTICATION; myEnv.put(GitSSHHandler.SSH_PROXY_AUTHENTICATION_ENV, String.valueOf(proxyAuthentication)); if (proxyAuthentication) { - myEnv.put(GitSSHHandler.SSH_PROXY_USER_ENV, httpConfigurable.PROXY_LOGIN); - myEnv.put(GitSSHHandler.SSH_PROXY_PASSWORD_ENV, httpConfigurable.getPlainProxyPassword()); + myEnv.put(GitSSHHandler.SSH_PROXY_USER_ENV, StringUtil.notNullize(httpConfigurable.PROXY_LOGIN)); + myEnv.put(GitSSHHandler.SSH_PROXY_PASSWORD_ENV, StringUtil.notNullize(httpConfigurable.getPlainProxyPassword())); } } } From 76f830e34f05d7642c896c6bd51e4e4921007e28 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 21 Oct 2014 16:08:52 +0200 Subject: [PATCH 07/16] reset presentations cache on toolbar refresh --- .../intellij/openapi/actionSystem/impl/ActionToolbarImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java index 529d5ba1c62f..74b9c4dcc1b2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java @@ -927,6 +927,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar { @Override public void updateActionsImmediately() { ApplicationManager.getApplication().assertIsDispatchThread(); + myPresentationFactory.reset(); updateActions(true, false, false); } From c757d87d57c4e8f09c2cf0870fe67222f8c7584e Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 21 Oct 2014 16:09:23 +0200 Subject: [PATCH 08/16] rollback --- .../git4idea/src/git4idea/cherrypick/GitCherryPickAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java index 9a425cb8a84b..7c5e18f16fd2 100644 --- a/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java +++ b/plugins/git4idea/src/git4idea/cherrypick/GitCherryPickAction.java @@ -143,7 +143,7 @@ public class GitCherryPickAction extends DumbAwareAction { return; } - e.getPresentation().setEnabledAndVisible(enabled(project, log, details)); + e.getPresentation().setEnabled(enabled(project, log, details)); e.getPresentation().setText(isAutoCommit(project) ? NAME : NAME + "..."); } From 360deca27f55191bf9d25551bdc3af5e1ef8217c Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 21 Oct 2014 18:06:04 +0400 Subject: [PATCH 09/16] IDEA-131658 try-catch-finally is not supported --- .../decompiler/stats/CatchAllStatement.java | 2 +- .../java/decompiler/SingleClassesTest.java | 1 + .../classes/pkg/TestTryCatchFinally.class | Bin 0 -> 890 bytes .../testData/results/TestTryCatchFinally.dec | 16 ++++++++++ .../testData/src/pkg/TestTryCatchFinally.java | 29 ++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 plugins/java-decompiler/engine/testData/classes/pkg/TestTryCatchFinally.class create mode 100644 plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec create mode 100644 plugins/java-decompiler/engine/testData/src/pkg/TestTryCatchFinally.java diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java index 2e4ab8256bd9..f2321ac47bfb 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java @@ -132,7 +132,7 @@ public class CatchAllStatement extends Statement { if (first.type == TYPE_TRYCATCH && first.varDefinitions.isEmpty() && isFinally && !labeled && !first.isLabeled() && (lstSuccs.isEmpty() || !lstSuccs.get(0).explicit)) { TextBuffer content = ExprProcessor.jmpWrapper(first, indent, true, tracer); - content.setStart(content.length() - new_line_separator.length()); + content.setLength(content.length() - new_line_separator.length()); buf.append(content); } else { diff --git a/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java index f0de32df2361..20d4fa88a329 100644 --- a/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/plugins/java-decompiler/engine/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -36,4 +36,5 @@ public class SingleClassesTest extends SingleClassesTestBase { @Test public void testInvalidMethodSignature() { doTest("InvalidMethodSignature"); } @Test public void testInnerClassConstructor() { doTest("pkg/TestInnerClassConstructor"); } @Test public void testInnerClassConstructor11() { doTest("v11/TestInnerClassConstructor"); } + @Test public void testTryCatchFinally() { doTest("pkg/TestTryCatchFinally"); } } diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestTryCatchFinally.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestTryCatchFinally.class new file mode 100644 index 0000000000000000000000000000000000000000..16dc30dc15fb6b2ac725db6c2c0b506e0cbf9540 GIT binary patch literal 890 zcmaJ=TTdE67(K&n)^!y`5TV*udjl2egXJ&r?`Ti3?8P812B4^?nmZq?b>jrL^xQP{x zRgPOGIC2JV>v%`QT@Cj*@*D+**mK*p)k}tOzVMbIvh6h`Lww(M?nqGe*Z+g7bQoytx{D5w%e){_84ZWN;FOngg>AUl-C%{s@Dw~a@W=s7Hd?Y7WB4- zY8>y{u5g^*rY>e7js(ZLg$<-QiWW9eV&E4Xj{6oK;332OSbFDUL;A}0T!zdzJ8WpH zYdcLDFhqBPzzZxqLRrIO3s3Nre(+CQr7N0YNQ_Gz)lX!DHvErf?Ktp04BeO;6Zc#t zTUyQVMbMEnov2gob(CzAyO z+hizSbuO2V>cSZkoZt`lS}FX8ZzykQE<-ARnOMOJX6P2`F9f-BF4z4(f7GSWwM>Fj`pKfvFe!$?l`VQ%y>-G@bM zBhF{c9*)MvU!gN9M2gf!Y!J(YaTMsO= Date: Tue, 21 Oct 2014 18:33:27 +0400 Subject: [PATCH 10/16] IDEA-131657 Don't expand foldings on 'Move Caret to Next/Previous Word' actions --- .../openapi/actionSystem/IdeActions.java | 2 + .../editor/actions/EditorActionUtil.java | 62 +++++++++++++------ .../editor/actions/NextPrevWordTest.java | 42 +++++++++++++ 3 files changed, 87 insertions(+), 19 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java index 66486d8da4be..9d7a307615dc 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java @@ -46,6 +46,8 @@ public interface IdeActions { @NonNls String ACTION_EDITOR_MOVE_CARET_PAGE_DOWN = "EditorPageDown"; @NonNls String ACTION_EDITOR_NEXT_WORD = "EditorNextWord"; @NonNls String ACTION_EDITOR_PREVIOUS_WORD = "EditorPreviousWord"; + @NonNls String ACTION_EDITOR_NEXT_WORD_WITH_SELECTION = "EditorNextWordWithSelection"; + @NonNls String ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION = "EditorPreviousWordWithSelection"; @NonNls String ACTION_EDITOR_TAB = "EditorTab"; @NonNls String ACTION_EDITOR_ESCAPE = "EditorEscape"; @NonNls String ACTION_EDITOR_JOIN_LINES = "EditorJoinLines"; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java index 74a2bf9ca75b..717f32340da7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/EditorActionUtil.java @@ -603,23 +603,35 @@ public class EditorActionUtil { : caretModel.getLogicalPosition(); int offset = caretModel.getOffset(); - CharSequence text = document.getCharsSequence(); if (offset == document.getTextLength()) { return; } - int newOffset = offset + 1; - int lineNumber = caretModel.getLogicalPosition().line; - if (lineNumber >= document.getLineCount()) return; - int maxOffset = document.getLineEndOffset(lineNumber); - if (newOffset > maxOffset) { - if (lineNumber + 1 >= document.getLineCount()) { - return; - } - maxOffset = document.getLineEndOffset(lineNumber + 1); + + int newOffset; + + FoldRegion currentFoldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset); + if (currentFoldRegion != null) { + newOffset = currentFoldRegion.getEndOffset(); } - for (; newOffset < maxOffset; newOffset++) { - if (isWordOrLexemeStart(editor, newOffset, camel)) { - break; + else { + newOffset = offset + 1; + int lineNumber = caretModel.getLogicalPosition().line; + if (lineNumber >= document.getLineCount()) return; + int maxOffset = document.getLineEndOffset(lineNumber); + if (newOffset > maxOffset) { + if (lineNumber + 1 >= document.getLineCount()) { + return; + } + maxOffset = document.getLineEndOffset(lineNumber + 1); + } + for (; newOffset < maxOffset; newOffset++) { + if (isWordOrLexemeStart(editor, newOffset, camel)) { + break; + } + } + FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(newOffset); + if (foldRegion != null) { + newOffset = foldRegion.getStartOffset(); } } caretModel.moveToOffset(newOffset); @@ -687,13 +699,25 @@ public class EditorActionUtil { int offset = editor.getCaretModel().getOffset(); if (offset == 0) return; - int lineNumber = editor.getCaretModel().getLogicalPosition().line; - CharSequence text = document.getCharsSequence(); - int newOffset = offset - 1; - int minOffset = lineNumber > 0 ? document.getLineEndOffset(lineNumber - 1) : 0; - for (; newOffset > minOffset; newOffset--) { - if (isWordOrLexemeStart(editor, newOffset, camel)) break; + int newOffset; + + FoldRegion currentFoldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset - 1); + if (currentFoldRegion != null) { + newOffset = currentFoldRegion.getStartOffset(); } + else { + int lineNumber = editor.getCaretModel().getLogicalPosition().line; + newOffset = offset - 1; + int minOffset = lineNumber > 0 ? document.getLineEndOffset(lineNumber - 1) : 0; + for (; newOffset > minOffset; newOffset--) { + if (isWordOrLexemeStart(editor, newOffset, camel)) break; + } + FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(newOffset); + if (foldRegion != null && newOffset > foldRegion.getStartOffset()) { + newOffset = foldRegion.getEndOffset(); + } + } + editor.getCaretModel().moveToOffset(newOffset); EditorModificationUtil.scrollToCaret(editor); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java index a8bdd4e9875f..c9cea52f0cc0 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/NextPrevWordTest.java @@ -16,6 +16,8 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.editor.FoldRegion; +import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; /** @@ -52,4 +54,44 @@ public class NextPrevWordTest extends LightPlatformCodeInsightFixtureTestCase { myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD); myFixture.checkResult("class Foo { String s = \"a\\xb\"; }"); } + + public void testPrevNextWordWithFolding() { + myFixture.configureByText("a.txt", "brown fox"); + EditorTestUtil.addFoldRegion(myFixture.getEditor(), 4, 7, "...", true); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD); + myFixture.checkResult("brown fox"); + FoldRegion[] foldRegions = myFixture.getEditor().getFoldingModel().getAllFoldRegions(); + assertEquals(1, foldRegions.length); + assertFalse(foldRegions[0].isExpanded()); + } + + public void testPrevNextWordWithSelectionAndFolding() { + myFixture.configureByText("a.txt", "brown fox"); + EditorTestUtil.addFoldRegion(myFixture.getEditor(), 4, 7, "...", true); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD_WITH_SELECTION); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD_WITH_SELECTION); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD_WITH_SELECTION); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION); + myFixture.checkResult("brown fox"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION); + myFixture.checkResult("brown fox"); + FoldRegion[] foldRegions = myFixture.getEditor().getFoldingModel().getAllFoldRegions(); + assertEquals(1, foldRegions.length); + assertFalse(foldRegions[0].isExpanded()); + } } From 8a02adc86c31307719fd356034c7123c698783a4 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 21 Oct 2014 18:33:18 +0400 Subject: [PATCH 11/16] Restore some obsolete method in GitHistoryUtils for TeamCity plugin compatibility --- .../src/git4idea/history/GitHistoryUtils.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java index 5990b29a298e..1337735820ac 100644 --- a/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java +++ b/plugins/git4idea/src/git4idea/history/GitHistoryUtils.java @@ -682,6 +682,18 @@ public class GitHistoryUtils { return rc; } + /** + * Keep for compatibility with TeamCity plugin. + * To remove in IDEA 15. + */ + @Deprecated + @SuppressWarnings("unused") + public static List> onlyHashesHistory(Project project, FilePath path, final String... parameters) + throws VcsException { + final VirtualFile root = GitUtil.getGitRoot(path); + return onlyHashesHistory(project, path, root, parameters); + } + public static List> onlyHashesHistory(Project project, FilePath path, final VirtualFile root, final String... parameters) throws VcsException { // adjust path using change manager From 82828535c7c19560b1408802ab387ac858b70edd Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Tue, 21 Oct 2014 18:35:05 +0400 Subject: [PATCH 12/16] IDEA-127636 Show History command missing in Find Action --- .../ide/util/gotoByName/GotoActionModel.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java index d4a88b2ad19c..3a9001e005ac 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoActionModel.java @@ -198,8 +198,11 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C if (o.value instanceof OptionDescription && !(value instanceof OptionDescription)) return -1; int diff = o.getMatchingDegree() - getMatchingDegree(); + if (diff != 0) return diff; //noinspection unchecked - return diff != 0 ? diff : value.compareTo(o.value); + int compare = value.compareTo(o.value); + if (compare != 0) return compare; + return o.hashCode() - hashCode(); } } @@ -679,9 +682,16 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C @Override public int compareTo(@NotNull ActionWrapper o) { int compared = myMode.compareTo(o.getMode()); - return compared != 0 - ? compared - : StringUtil.compare(myAction.getTemplatePresentation().getText(), o.getAction().getTemplatePresentation().getText(), true); + if (compared != 0) return compared; + Presentation myPresentation = myAction.getTemplatePresentation(); + Presentation oPresentation = o.getAction().getTemplatePresentation(); + int byText = StringUtil.compare(myPresentation.getText(), oPresentation.getText(), true); + if (byText != 0) return byText; + int byGroup = Comparing.compare(myGroupName, o.getGroupName()); + if (byGroup !=0) return byGroup; + int byDesc = StringUtil.compare(myPresentation.getDescription(), oPresentation.getDescription(), true); + if (byDesc != 0) return byDesc; + return 0; } private boolean isAvailable() { From 0adfeda089907900a3ee76ba40a06733cd833a07 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Tue, 21 Oct 2014 16:43:25 +0200 Subject: [PATCH 13/16] EA-59103 - CME: THashIterator.nextIndex --- .../util/indexing/FileId2ValueMapping.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileId2ValueMapping.java b/platform/lang-impl/src/com/intellij/util/indexing/FileId2ValueMapping.java index 8c2b0f782e19..ef34f1e7b3c0 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileId2ValueMapping.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileId2ValueMapping.java @@ -15,8 +15,12 @@ */ package com.intellij.util.indexing; +import com.intellij.util.SmartList; +import gnu.trove.TIntArrayList; import gnu.trove.TIntObjectHashMap; +import java.util.List; + /** * Created by Maxim.Mossienko on 7/4/2014. */ @@ -28,11 +32,29 @@ class FileId2ValueMapping { id2ValueMap = new TIntObjectHashMap(); valueContainer = _valueContainer; + TIntArrayList removedFileIdList = null; + List removedValueList = null; + for (final ValueContainer.ValueIterator valueIterator = _valueContainer.getValueIterator(); valueIterator.hasNext();) { final Value value = valueIterator.next(); for (final ValueContainer.IntIterator intIterator = valueIterator.getInputIdsIterator(); intIterator.hasNext();) { - associateFileIdToValue(intIterator.next(), value); + int id = intIterator.next(); + Value previousValue = id2ValueMap.put(id, value); + if (previousValue != null) { // delay removal of duplicated id -> value mapping since it will affect valueIterator we are using + if (removedFileIdList == null) { + removedFileIdList = new TIntArrayList(); + removedValueList = new SmartList(); + } + removedFileIdList.add(id); + removedValueList.add(previousValue); + } + } + } + + if (removedFileIdList != null) { + for(int i = 0, size = removedFileIdList.size(); i < size; ++i) { + valueContainer.removeValue(removedFileIdList.get(i), removedValueList.get(i)); } } } From 3608bcaaa166705a15ab54b3c90d2865b12c0896 Mon Sep 17 00:00:00 2001 From: irengrig Date: Tue, 21 Oct 2014 17:04:17 +0200 Subject: [PATCH 14/16] backspace handler, extract brace matching --- .../codeInsight/editorActions/BackspaceHandler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BackspaceHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BackspaceHandler.java index c130b8a856bf..62088f6bff8c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BackspaceHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/BackspaceHandler.java @@ -109,9 +109,7 @@ public class BackspaceHandler extends EditorWriteActionHandler { chars = editor.getDocument().getCharsSequence(); if (c == '(' || c == '[' || c == '{'){ char c1 = chars.charAt(offset); - if (c == '(' && c1 != ')') return true; - if (c == '[' && c1 != ']') return true; - if (c == '{' && c1 != '}') return true; + if (c1 != getRightChar(c)) return true; HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(offset); BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator); @@ -144,6 +142,14 @@ public class BackspaceHandler extends EditorWriteActionHandler { return true; } + public static char getRightChar(final char c) { + if (c == '(') return ')'; + if (c == '[') return ']'; + if (c == '{') return '}'; + assert false; + return c; + } + private static boolean isOffsetInsideInjected(Editor injectedEditor, int injectedOffset) { if (injectedOffset == 0 || injectedOffset >= injectedEditor.getDocument().getTextLength()) { return false; From bbdfec42458e16367a0d5f8cdf458a65622d9fce Mon Sep 17 00:00:00 2001 From: irengrig Date: Tue, 21 Oct 2014 17:04:56 +0200 Subject: [PATCH 15/16] brace matching util, check for each brace type once --- .../codeInsight/highlighting/BraceMatchingUtil.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java index 2eceba6e82e6..55793515e999 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java @@ -136,13 +136,17 @@ public class BraceMatchingUtil { } String tagName = getTagName(myMatcher, fileText, iterator); if (!isStrict && !Comparing.equal(brace1TagName, tagName, isCaseSensitive)) continue; - if (forward ? isLBraceToken(iterator, fileText, fileType) : isRBraceToken(iterator, fileText, fileType)) { + + final boolean isLeftBrace = isLBraceToken(iterator, fileText, fileType); + final boolean isRightBrace = isRBraceToken(iterator, fileText, fileType); + + if (forward ? isLeftBrace : isRightBrace) { myBraceStack.push(tokenType); if (isStrict) { myTagNameStack.push(tagName); } } - else if (forward ? isRBraceToken(iterator, fileText, fileType) : isLBraceToken(iterator, fileText, fileType)) { + else if (forward ? isRightBrace : isLeftBrace) { IElementType topTokenType = myBraceStack.pop(); String topTagName = null; if (isStrict) { From 4019c206a61a42696118b49554304f2c0f611942 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 21 Oct 2014 19:10:42 +0400 Subject: [PATCH 16/16] decompiler: fixed line mapping in try-catch block --- .../decompiler/stats/CatchAllStatement.java | 20 ++++++-------- ...lassSimpleBytecodeMapping$InnerClass.class | Bin 647 -> 647 bytes ...assSimpleBytecodeMapping$InnerClass2.class | Bin 650 -> 650 bytes .../pkg/TestClassSimpleBytecodeMapping.class | Bin 1234 -> 1338 bytes .../classes/pkg/TestTryCatchFinally.class | Bin 890 -> 1172 bytes .../TestClassSimpleBytecodeMapping.dec | 26 ++++++++++-------- .../testData/results/TestTryCatchFinally.dec | 15 ++++++++++ .../pkg/TestClassSimpleBytecodeMapping.java | 2 ++ .../testData/src/pkg/TestTryCatchFinally.java | 16 +++++++++++ 9 files changed, 55 insertions(+), 24 deletions(-) diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java index f2321ac47bfb..a3d597d8bc69 100644 --- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java +++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java @@ -26,7 +26,6 @@ import org.jetbrains.java.decompiler.modules.decompiler.StatEdge; import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor; import org.jetbrains.java.decompiler.struct.gen.VarType; -import org.jetbrains.java.decompiler.util.InterpreterUtil; import java.util.ArrayList; import java.util.Arrays; @@ -113,9 +112,6 @@ public class CatchAllStatement extends Statement { } public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) { - String indstr = InterpreterUtil.getIndentString(indent); - String indstr1 = null; - String new_line_separator = DecompilerContext.getNewLineSeparator(); TextBuffer buf = new TextBuffer(); @@ -124,7 +120,7 @@ public class CatchAllStatement extends Statement { boolean labeled = isLabeled(); if (labeled) { - buf.append(indstr).append("label").append(this.id.toString()).append(":").append(new_line_separator); + buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } @@ -133,33 +129,33 @@ public class CatchAllStatement extends Statement { !labeled && !first.isLabeled() && (lstSuccs.isEmpty() || !lstSuccs.get(0).explicit)) { TextBuffer content = ExprProcessor.jmpWrapper(first, indent, true, tracer); content.setLength(content.length() - new_line_separator.length()); + tracer.incrementCurrentSourceLine(-1); buf.append(content); } else { - buf.append(indstr).append("try {").append(new_line_separator); + buf.appendIndent(indent).append("try {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, true, tracer)); - buf.append(indstr).append("}"); + buf.appendIndent(indent).append("}"); } buf.append(isFinally ? " finally" : - " catch (" + vars.get(0).toJava(indent, tracer) + ")").append(" {").append(new_line_separator); + " catch (" + vars.get(0).toJava(indent, tracer) + ")").append(" {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); if (monitor != null) { - indstr1 = InterpreterUtil.getIndentString(indent + 1); - buf.append(indstr1).append("if(").append(monitor.toJava(indent, tracer)).append(") {").append(new_line_separator); + buf.appendIndent(indent+1).append("if(").append(monitor.toJava(indent, tracer)).append(") {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } buf.append(ExprProcessor.jmpWrapper(handler, indent + 1 + (monitor != null ? 1 : 0), true, tracer)); if (monitor != null) { - buf.append(indstr1).append("}").append(new_line_separator); + buf.appendIndent(indent + 1).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } - buf.append(indstr).append("}").append(new_line_separator); + buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); return buf; diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSimpleBytecodeMapping$InnerClass.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSimpleBytecodeMapping$InnerClass.class index bd3481b595d2962323804b5798c3af2f8536d2af..7c87161ed506b83d595000fb4e80ac07b527bb4e 100644 GIT binary patch delta 23 ecmZo?ZD-wJ$;7BN*@{VzRfmCtL3eU4lN10yZ3M0W delta 23 ecmZo?ZD-wJ$;7BJ*@{VzRf~axL3?s8lN10yGX$sr diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSimpleBytecodeMapping$InnerClass2.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSimpleBytecodeMapping$InnerClass2.class index b28c357352dddde5e162f26a2954c2098c9371a0..64638d907d634d5735c4c6dbabe5313df6a5567f 100644 GIT binary patch delta 23 ecmeBT?PA?v!^CJZ*_KI<)r^6I!F+N7lN10!c?8=4 delta 23 ecmeBT?PA?v!^CJb*_KI<)r5hA!E|x~lN10!KLphP diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSimpleBytecodeMapping.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestClassSimpleBytecodeMapping.class index 010c748a4b0e901939b82ec4ac0a9fd151508f08..2d9a8beca899d1c4d239c59b703dae9264fea809 100644 GIT binary patch delta 629 zcmYk3TTc^F6otPtZ8_7^0b4+&MFra0DlL>&RJ`E@0Z~C?ygUy&DrPb@t?`nW^e;&I z=&Om(XoAXvzH8!x|H8!IVB9m&)Opxz@3q(2dz~{sk~^mJ_4m$aV3uo!LCQ%EaoA?k zP@$@sG9;KbWT@H9gjhE;IASwvILa}bTpsg)q`S_{70ZZ{N8 zukzZOvkDV2n=k$NoaWr-&s$?7WHsjen4$Wq8OFf7m>Ea zeUT*BeG^+&qupPza_4~bW2mY$#kRz7&MPdL47JKfoICHZ2K%>(zhz=o^6ECbdep$$ zzkKS;mQ0f6q#1~?ATcfWLbM_$C6bcoMN^`mGU<*qGZaNslI>-wN=(ZS4{fE0UDr(9 z(BzGj^1OfT6$C9|bmbFiMem{}qU&|}&(|x+{x!rvk+(f@!-(6k-6D$U_(;sDkL7$<3VMZ+3 zfCuCP+8Fg2bC?e(Fz)jr;3X55N!K~m!Zb6MSC(1J>)J}nyr~@?n916|@4X4SEN?^J z@!rt9R@vCyuUO_nK9H)fn&HI+^C8bj8_amfQ&N_XA)iD`x-l$jou7*fgYq2A|is1w|S0p2QvtlbWVO OvN3gb3gbfet?VAAjy2=} diff --git a/plugins/java-decompiler/engine/testData/classes/pkg/TestTryCatchFinally.class b/plugins/java-decompiler/engine/testData/classes/pkg/TestTryCatchFinally.class index 16dc30dc15fb6b2ac725db6c2c0b506e0cbf9540..244dfad62acaff777b67a3cdb983b0607dfb458a 100644 GIT binary patch literal 1172 zcmaJ>OHUJF6g|@iGYkWT@>Z}E6!=#Og%b^|1K$&T#Q*;!lkdl`FW&&nU{ysI;;k6PeFYCxJj9rSaTy5( zNfi@FDVUUzR-q!UU`qImFpq?pmho7|6A3K~re(TI5`u~3YYCw>yJ$#=Y?+p^Q#;x- zoV>nQW+vd^LT*tIZSy9-YbM?aEwqEh@WZ?~%k@1vGMeRRI zHzlY!yXF*(4O7e+$P=4)j@NXzu)kqidbxZ&B_?W!qFcr@4bL%4K2^KsQpKExdGt$= z-}+by-A#V$9|}grHEpYbr{t`L1>7UP(OW`)6YuL;t(oPb;jm`iacoD!B9??%*6;!= zET|loGPlr_(AjLYyLVs|DEdmu?|zM7e&4a*`wPAbJg&ON5wC<2xi){{rk#1kZM*DZ z=ttShHrLbCRS}>v6?ZksY+9~S5{i_H?oDzAf#w9nF!nxP*zRYa$ zKX}EpFO~NsZUVE2qmy5<_yr+}Tc+*dX_#K34^Ny!I%B|H(6)HVC~Y75X$AB<0tnO3 zeL^4_tRp0RnEnKbZ4t{}9NKB-JLms`216HTUb({AEo?Z17(JjMMca)L&!>>~e88hI zg*N`zOH7RXM~LcUHwdRFtZViQPDV~B&PY0%+N1WxllmjyQEtrSCuSdOa(CV E2TVZoBLDyZ delta 394 zcmXw#IZFdk5XXOSbG*%F6E)^G8jWWTk9apCiik~=pp9ib3NeUrHes!8ZERFn zMZv<-%F@qbAY`jb`&wGh7FEZ8iviz?AT=^6DPfg&ahc8W1!FL9yQdW#Rg=vw&&W91QF%^+%0;VuQfQ%SQilr1qiK}E~w;5JtuL 16 28 <-> 17 34 <-> 23 -42 <-> 42 -47 <-> 31 -52 <-> 36 +44 <-> 44 +49 <-> 33 +54 <-> 38 diff --git a/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec b/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec index 1524da840379..9840bfccb285 100644 --- a/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec +++ b/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec @@ -1,6 +1,21 @@ package pkg; public class TestTryCatchFinally { + public void test1(String var1) { + try { + System.out.println("sout1"); + } catch (Exception var9) { + try { + System.out.println("sout2"); + } catch (Exception var8) { + ; + } + } finally { + System.out.println("finally"); + } + + } + public int test(String var1) { try { int var2 = Integer.parseInt(var1); diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestClassSimpleBytecodeMapping.java b/plugins/java-decompiler/engine/testData/src/pkg/TestClassSimpleBytecodeMapping.java index bc07e46bcaa8..0b9df2e79252 100644 --- a/plugins/java-decompiler/engine/testData/src/pkg/TestClassSimpleBytecodeMapping.java +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestClassSimpleBytecodeMapping.java @@ -34,6 +34,8 @@ public class TestClassSimpleBytecodeMapping { Integer.parseInt(a); } catch (Exception e) { System.out.println(e); + } finally { + System.out.println("Finally"); } } diff --git a/plugins/java-decompiler/engine/testData/src/pkg/TestTryCatchFinally.java b/plugins/java-decompiler/engine/testData/src/pkg/TestTryCatchFinally.java index 2e244be22e8a..da3588a3eb50 100644 --- a/plugins/java-decompiler/engine/testData/src/pkg/TestTryCatchFinally.java +++ b/plugins/java-decompiler/engine/testData/src/pkg/TestTryCatchFinally.java @@ -16,6 +16,22 @@ package pkg; public class TestTryCatchFinally { + public void test1(String x) { + try { + System.out.println("sout1"); + } catch (Exception e) { + try { + System.out.println("sout2"); + } catch (Exception e2) { + // Empty + // Empty + // Empty + } + } finally { + System.out.println("finally"); + } + } + public int test(String a) { try { return Integer.parseInt(a);