From c187848b7a9244a43a762cce92b9469ce5aabbf3 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Wed, 29 Feb 2012 19:06:43 +0400 Subject: [PATCH 1/3] better output: skip $Proxies & recover from RMI calls --- platform/util/src/com/intellij/util/ExceptionUtil.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/util/src/com/intellij/util/ExceptionUtil.java b/platform/util/src/com/intellij/util/ExceptionUtil.java index 6238482b2f42..0c8f09e87728 100644 --- a/platform/util/src/com/intellij/util/ExceptionUtil.java +++ b/platform/util/src/com/intellij/util/ExceptionUtil.java @@ -71,7 +71,10 @@ public class ExceptionUtil { @NotNull public static String getThrowableText(@NotNull Throwable aThrowable, @NonNls @NotNull final String stackFrameSkipPattern) { @NonNls final String prefix = "\tat "; + @NonNls final String prefixProxy = prefix + "$Proxy"; + final String prefixRemoteUtil = prefix + "com.intellij.execution.rmi.RemoteUtil"; final String skipPattern = prefix + stackFrameSkipPattern; + final StringWriter stringWriter = new StringWriter(); @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") final PrintWriter writer = new PrintWriter(stringWriter) { @@ -85,7 +88,11 @@ public class ExceptionUtil { super.println("\tin "+ stripPackage(x, skipPattern.length())); } skipping = curSkipping; - if (skipping) return; + if (skipping) { + skipping = !x.startsWith(prefixRemoteUtil); + return; + } + if (x.startsWith(prefixProxy)) return; super.println(x); } } From 73c4e747c893bec7749af3ef39c58c1406ad1661 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Wed, 29 Feb 2012 16:21:44 +0100 Subject: [PATCH 2/3] Multiprocess debugging works with remote interpreters. Port obtaining reworked. --- .../com/intellij/execution/configurations/ParametersList.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java b/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java index 45d60475c89b..06cccde080c3 100644 --- a/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java +++ b/platform/platform-api/src/com/intellij/execution/configurations/ParametersList.java @@ -220,6 +220,10 @@ public class ParametersList implements Cloneable { myParameters.set(ind, value); } + public String get(int ind) { + return myParameters.get(ind); + } + public void add(@NonNls final String name, @NonNls final String value) { add(name); add(value); From 07badcd1a83aba5c4e0b448ba4af789f15c9c288 Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Wed, 29 Feb 2012 19:42:50 +0400 Subject: [PATCH 3/3] IDEA-81925 (Read source and target language level from maven properties) --- .../idea/maven/project/MavenProject.java | 38 +++++++-------- .../idea/maven/project/MavenProjectTest.java | 47 +++++++++++++++++++ 2 files changed, 66 insertions(+), 19 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java index 015bd7f96012..9487d00d168d 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProject.java @@ -15,6 +15,7 @@ */ package org.jetbrains.idea.maven.project; +import com.google.common.collect.ImmutableMap; import com.intellij.openapi.module.ModuleType; import com.intellij.openapi.module.StdModuleTypes; import com.intellij.openapi.project.Project; @@ -49,6 +50,17 @@ public class MavenProject { @NotNull private final VirtualFile myFile; @NotNull private volatile State myState = new State(); + private static Map COMPILER_LEVEL_TABLE = ImmutableMap.builder() + .put("1.1", "1.1") + .put("1.2", "1.2") + .put("1.3", "1.3") + .put("1.4", "1.4") + .put("1.5", "1.5") + .put("5", "1.5") + .put("1.6", "1.6") + .put("1.7", "1.7") + .put("7", "1.7").build(); + @Nullable public static MavenProject read(DataInputStream in) throws IOException { String path = in.readUTF(); @@ -750,6 +762,11 @@ public class MavenProject { @Nullable private String getCompilerLevel(String level) { String result = MavenJDOMUtil.findChildValueByPath(getCompilerConfig(), level); + + if (result == null) { + result = myState.myProperties.getProperty("maven.compiler." + level); + } + return normalizeCompilerLevel(result); } @@ -758,26 +775,9 @@ public class MavenProject { return getPluginConfiguration("org.apache.maven.plugins", "maven-compiler-plugin"); } - private static class CompilerLevelTable { - public static Map table = new THashMap(); - - static { - table.put("1.1", "1.1"); - table.put("1.2", "1.2"); - table.put("1.3", "1.3"); - table.put("1.4", "1.4"); - table.put("1.5", "1.5"); - table.put("5", "1.5"); - table.put("1.6", "1.6"); - table.put("1.7", "1.7"); - table.put("7", "1.7"); - } - } - @Nullable - public static String normalizeCompilerLevel(String level) { - if (level == null) return null; - return CompilerLevelTable.table.get(level); + public static String normalizeCompilerLevel(@Nullable String level) { + return COMPILER_LEVEL_TABLE.get(level); } @NotNull diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectTest.java index a393b9b226df..ab4b75b69a3b 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/project/MavenProjectTest.java @@ -467,6 +467,53 @@ public class MavenProjectTest extends MavenImportingTestCase { assertEquals("true", plugin.getConfigurationElement().getChildText("debug")); } + public void testCompilerPluginConfigurationFromProperties() throws Exception { + createProjectPom("test" + + "project" + + "1" + + + "\n" + + " UTF-8\n" + + " 1.7\n" + + " 1.7\n" + + ""); + + importProject(); + + assertEquals("1.7", getMavenProject().getSourceLevel()); + assertEquals("1.7", getMavenProject().getTargetLevel()); + } + + public void testCompilerPluginConfigurationFromPropertiesOverride() throws Exception { + createProjectPom("test" + + "project" + + "1" + + + "\n" + + " UTF-8\n" + + " 1.7\n" + + " 1.7\n" + + "" + + + "" + + " " + + " " + + " org.apache.maven.plugins" + + " maven-compiler-plugin" + + " " + + " 1.4" + + " 1.4" + + " " + + " " + + " " + + ""); + + importProject(); + + assertEquals("1.4", getMavenProject().getSourceLevel()); + assertEquals("1.4", getMavenProject().getTargetLevel()); + } + public void testMergingPluginConfigurationFromBuildProfilesAndPluginsManagement() throws Exception { createProjectPom("test" + "project" +