mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String, String> COMPILER_LEVEL_TABLE = ImmutableMap.<String,String>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<String, String> table = new THashMap<String, String>();
|
||||
|
||||
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
|
||||
|
||||
@@ -467,6 +467,53 @@ public class MavenProjectTest extends MavenImportingTestCase {
|
||||
assertEquals("true", plugin.getConfigurationElement().getChildText("debug"));
|
||||
}
|
||||
|
||||
public void testCompilerPluginConfigurationFromProperties() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<properties>\n" +
|
||||
" <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n" +
|
||||
" <maven.compiler.source>1.7</maven.compiler.source>\n" +
|
||||
" <maven.compiler.target>1.7</maven.compiler.target>\n" +
|
||||
"</properties>");
|
||||
|
||||
importProject();
|
||||
|
||||
assertEquals("1.7", getMavenProject().getSourceLevel());
|
||||
assertEquals("1.7", getMavenProject().getTargetLevel());
|
||||
}
|
||||
|
||||
public void testCompilerPluginConfigurationFromPropertiesOverride() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<properties>\n" +
|
||||
" <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n" +
|
||||
" <maven.compiler.source>1.7</maven.compiler.source>\n" +
|
||||
" <maven.compiler.target>1.7</maven.compiler.target>\n" +
|
||||
"</properties>" +
|
||||
|
||||
"<build>" +
|
||||
" <plugins>" +
|
||||
" <plugin>" +
|
||||
" <groupId>org.apache.maven.plugins</groupId>" +
|
||||
" <artifactId>maven-compiler-plugin</artifactId>" +
|
||||
" <configuration>" +
|
||||
" <target>1.4</target>" +
|
||||
" <source>1.4</source>" +
|
||||
" </configuration>" +
|
||||
" </plugin>" +
|
||||
" </plugins>" +
|
||||
"</build>");
|
||||
|
||||
importProject();
|
||||
|
||||
assertEquals("1.4", getMavenProject().getSourceLevel());
|
||||
assertEquals("1.4", getMavenProject().getTargetLevel());
|
||||
}
|
||||
|
||||
public void testMergingPluginConfigurationFromBuildProfilesAndPluginsManagement() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
|
||||
Reference in New Issue
Block a user