Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ekaterina Tuzova
2014-02-07 19:49:47 +04:00
48 changed files with 622 additions and 413 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ libraryLicense(name: "Antlr", libraryName: "antlr.jar", version: "3.1.3", licens
libraryLicense(name: "Guava", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html")
libraryLicense(name: "Guava", libraryName: "guava-tools", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html")
libraryLicense(name: "Groovy", version: "2.2.1", license: "Apache 2.0", url: "http://groovy.codehaus.org/")
libraryLicense(name: "Gson", libraryName: "gson", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/")
libraryLicense(name: "Gson", version: "2.2.4", libraryName: "gson", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/")
libraryLicense(name: "ini4j", libraryName: "ini4j-0.5.2-patched", version: "0.5.2 (with a patch by JetBrains)", license: "Apache 2.0", url: "http://ini4j.sourceforge.net/", attachedTo: "git4idea")
libraryLicense(name: "ISO RELAX", libraryName: "isorelax.jar", license: "MIT License", url: "http://sourceforge.net/projects/iso-relax/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
libraryLicense(name: "JavaCVS", attachedTo: "javacvs-src", version: "no version number available (with patches by JetBrains)", license: "Sun Public License", url: "http://javacvs.netbeans.org/library/", licenseUrl: "http://www.netbeans.org/about/legal/spl.html")
@@ -27,6 +27,8 @@ import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.fileTypes.PlainTextLanguage;
import com.intellij.openapi.fileTypes.PlainTextParserDefinition;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.util.ClassExtension;
import com.intellij.openapi.util.Disposer;
@@ -40,6 +42,7 @@ import com.intellij.psi.impl.compiled.ClsStubBuilderFactory;
import com.intellij.psi.impl.compiled.DefaultClsStubBuilderFactory;
import com.intellij.psi.impl.file.PsiPackageImplementationHelper;
import com.intellij.psi.impl.source.tree.CoreJavaASTFactory;
import com.intellij.psi.impl.source.tree.PlainTextASTFactory;
import com.intellij.psi.presentation.java.*;
import com.intellij.psi.stubs.BinaryFileStubBuilders;
@@ -55,6 +58,9 @@ public class JavaCoreApplicationEnvironment extends CoreApplicationEnvironment {
registerFileType(ArchiveFileType.INSTANCE, "jar;zip");
registerFileType(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess;rb");
addExplicitExtension(LanguageASTFactory.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextASTFactory());
addExplicitExtension(LanguageParserDefinitions.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextParserDefinition());
addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileViewProviderFactory());
addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder());
@@ -37,7 +37,7 @@ import com.intellij.psi.util.PsiUtilCore;
import org.jetbrains.annotations.NotNull;
public class PlainTextParserDefinition implements ParserDefinition {
private static final IFileElementType PLAIN_FILE_ELEMENT_TYPE = new IFileElementType(FileTypes.PLAIN_TEXT.getLanguage()) {
private static final IFileElementType PLAIN_FILE_ELEMENT_TYPE = new IFileElementType(PlainTextFileType.INSTANCE.getLanguage()) {
@Override
public ASTNode parseContents(ASTNode chameleon) {
final CharSequence chars = chameleon.getChars();
@@ -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.
@@ -279,7 +279,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
public void run() {
final Project project = myFile.getProject();
VirtualFile file = myFile.getVirtualFile();
assert file != null: "Virtual file is null for " + file;
assert file != null: "Virtual file is null for " + myFile;
OpenFileDescriptor descriptor = new OpenFileDescriptor(project, file);
final Editor editor = FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
@@ -26,6 +26,7 @@ import com.intellij.util.containers.FactoryMap;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.indexing.*;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.IOUtil;
import com.intellij.util.io.KeyDescriptor;
import org.jetbrains.annotations.NotNull;
@@ -129,7 +130,7 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
@Override
public Key read(DataInput in) throws IOException {
boolean isInclude = in.readBoolean();
return isInclude ? new IncludeKey(in.readUTF()) : new FileKey(in.readInt());
return isInclude ? IncludeKey.read(in) : new FileKey(in.readInt());
}
};
}
@@ -192,7 +193,7 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
@Override
public int getVersion() {
return 2;
return 3;
}
interface Key {
@@ -202,6 +203,7 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
}
private static class IncludeKey implements Key {
private static final byte[] myBuffer = IOUtil.allocReadWriteUTFBuffer();
private final String myFileName;
public IncludeKey(String fileName) {
@@ -215,7 +217,9 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
@Override
public void writeValue(DataOutput out) throws IOException {
out.writeUTF(myFileName);
synchronized (myBuffer) {
IOUtil.writeUTFFast(myBuffer, out, myFileName);
}
}
@Override
@@ -227,6 +231,12 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
public boolean equals(Object obj) {
return obj instanceof IncludeKey && ((IncludeKey)obj).myFileName.equals(myFileName);
}
static Key read(DataInput in) throws IOException {
synchronized (myBuffer){
return new IncludeKey(IOUtil.readUTFFast(myBuffer, in));
}
}
}
private static class FileKey implements Key {
@@ -2200,12 +2200,12 @@ public class FileBasedIndexImpl extends FileBasedIndex {
myUpdateSemaphoreRef.compareAndSet(semaphore, null);
}
private static final int MAX_FILES_TO_PROCESS_OUTSIDE_PROJECT = 5;
private static final int MAX_FILES_TO_PROCESS_OUTSIDE_SCOPE = 5;
private void forceUpdate(@Nullable Project project, @Nullable GlobalSearchScope filter, @Nullable VirtualFile restrictedTo, boolean onlyRemoveOutdatedData) {
myChangedFilesCollector.ensureAllInvalidateTasksCompleted();
ProjectIndexableFilesFilter indexableFilesFilter = projectIndexableFiles(project);
int filesProcessedOutsideProject = 0;
int filesProcessedOutsideScope = 0;
UpdateSemaphore updateSemaphore;
do{
@@ -2216,36 +2216,34 @@ public class FileBasedIndexImpl extends FileBasedIndex {
//noinspection ForLoopReplaceableByForEach
for (int i = 0, size = filesToUpdate.size(); i < size; ++i) {
VirtualFile file = filesToUpdate.get(i);
boolean forceProcessFile;
if (indexableFilesFilter != null &&
file instanceof VirtualFileWithId &&
!indexableFilesFilter.containsFileId(((VirtualFileWithId)file).getId())) { // project files filtering
if (filesProcessedOutsideProject >= MAX_FILES_TO_PROCESS_OUTSIDE_PROJECT) continue;
if ((indexableFilesFilter != null && // project files filtering
file instanceof VirtualFileWithId &&
!indexableFilesFilter.containsFileId(((VirtualFileWithId)file).getId())
) ||
filter != null && !filter.accept(file) ||
restrictedTo != null && restrictedTo != file
) {
if (filesProcessedOutsideScope >= MAX_FILES_TO_PROCESS_OUTSIDE_SCOPE) continue;
// In order to have myFilesToUpdate empty for avoiding contention on scanning large concurrent set
// we need eventually to process all files in it including the ones that do not belong to any project
// e.g. the files that have vfs built but avoided due to project exclusion: files under .git / user home / etc
++filesProcessedOutsideProject;
forceProcessFile = true;
} else {
forceProcessFile = Comparing.equal(file, restrictedTo);
// we need eventually to process all files in it including the ones that do not belong to any project or current scope
// e.g. the files that have vfs built but avoided due to project / scope exclusion: workspace.xml / files under .git / user home / etc
++filesProcessedOutsideScope;
}
if (filter == null || filter.accept(file) || forceProcessFile) {
try {
updateSemaphore.down();
// process only files that can affect result
processFileImpl(project, new com.intellij.ide.caches.FileContent(file), onlyRemoveOutdatedData);
}
catch (ProcessCanceledException e) {
updateSemaphore.reportUpdateCanceled();
throw e;
}
finally {
updateSemaphore.up();
}
try {
updateSemaphore.down();
// process only files that can affect result
processFileImpl(project, new com.intellij.ide.caches.FileContent(file), onlyRemoveOutdatedData);
}
catch (ProcessCanceledException e) {
updateSemaphore.reportUpdateCanceled();
throw e;
}
finally {
updateSemaphore.up();
}
}
// If several threads entered the method at the same time and there were files to update,
@@ -129,7 +129,6 @@ public class ProcessPopup {
builder.setResizable(true);
builder.setTitle(IdeBundle.message("progress.window.title"));
builder.setDimensionServiceKey(null, "ProcessPopupWindow", true);
builder.setMinSize(getMinSize());
builder.setCancelOnClickOutside(false);
builder.setRequestFocus(requestFocus);
builder.setBelongsToGlobalPopupStack(false);
@@ -138,15 +137,14 @@ public class ProcessPopup {
builder.setCancelButton(new MinimizeButton("Hide"));
JFrame frame = (JFrame)UIUtil.findUltimateParent(myProgressPanel);
Dimension contentSize = myRootContent.getPreferredSize();
if (frame != null) {
Dimension contentSize = myRootContent.getPreferredSize();
Rectangle bounds = frame.getBounds();
int width = Math.max(bounds.width / 4, contentSize.width);
int height = Math.min(bounds.height / 4, contentSize.height);
int x = (int)(bounds.getMaxX() - width);
int y = (int)(bounds.getMaxY() - height);
builder.setMinSize(new Dimension(width, height));
myPopup = builder.createPopup();
StatusBarEx sb = (StatusBarEx)((IdeFrame)frame).getStatusBar();
@@ -154,7 +152,6 @@ public class ProcessPopup {
y -= sb.getSize().height;
}
myPopup.showInScreenCoordinates(myProgressPanel.getRootPane(), new Point(x - 5, y - 5));
} else {
myPopup = builder.createPopup();
@@ -191,13 +188,6 @@ public class ProcessPopup {
return size;
}
private static Dimension getMinSize() {
final Dimension size = ScreenUtil.getMainScreenBounds().getSize();
size.width *= 0.1d;
size.height *= 0.1d;
return size;
}
public void hide() {
if (myPopup != null) {
final JBPopup popup = myPopup;
@@ -164,8 +164,6 @@ public class AbstractPopup implements JBPopup {
private UiActivity myActivityKey;
private Disposable myProjectDisposable;
AbstractPopup() {
}
@@ -700,17 +698,9 @@ public class AbstractPopup implements JBPopup {
sizeToSet = myForcedSize;
}
if (myMinSize == null) {
myMinSize = myContent.getMinimumSize();
}
if (sizeToSet == null) {
sizeToSet = myContent.getPreferredSize();
}
if (sizeToSet != null) {
sizeToSet.width = Math.max(sizeToSet.width, myMinSize.width);
sizeToSet.height = Math.max(sizeToSet.height, myMinSize.height);
sizeToSet.width = Math.max(sizeToSet.width, myContent.getMinimumSize().width);
sizeToSet.height = Math.max(sizeToSet.height, myContent.getMinimumSize().height);
myContent.setSize(sizeToSet);
myContent.setPreferredSize(sizeToSet);
@@ -838,6 +828,7 @@ public class AbstractPopup implements JBPopup {
}
}
setMinimumSize(myMinSize);
final Runnable afterShow = new Runnable() {
@Override
@@ -1656,7 +1647,16 @@ public class AbstractPopup implements JBPopup {
@Override
public void setMinimumSize(Dimension size) {
myMinSize = size;
if (size == null) {
myMinSize = myHeaderPanel.getPreferredSize();
} else {
myMinSize.setSize(Math.min(size.width, myHeaderPanel.getPreferredSize().width),
Math.min(size.height, myHeaderPanel.getPreferredSize().height));
}
if (myWindow != null) {
myWindow.setMinimumSize(myMinSize);
}
}
public Runnable getFinalRunnable() {
@@ -3,8 +3,9 @@
// If plugin name or version contains a space you can quote it like in command line.
NodeJS 134.680 134.31 134.307 134.262 134.198 134.125
com.jetbrains.php 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12
com.jetbrains.php 133.679 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12
com.jetbrains.lang.ejs 131.17 131.12
com.jetbrains.twig 133.51 130.1639
Karma 134.686 134.31
org.intellij.scala 0.32.512
org.jetbrains.kannotator 0.2.420
@@ -1037,7 +1037,7 @@ non.synchronized.method.overrides.synchronized.method.problem.descriptor=Unsynch
public.field.accessed.in.synchronized.context.problem.descriptor=Non-private field <code>#ref</code> accessed in synchronized context #loc
field.accessed.synchronized.and.unsynchronized.problem.descriptor=Field <code>#ref</code> is accessed in both synchronized and unsynchronized contexts #loc
extended.for.statement.problem.descriptor=Extended <code>#ref</code> statement #loc
object.allocation.in.loop.problem.descriptor=Object allocation <code>#ref</code> in loop #loc
object.allocation.in.loop.problem.descriptor=Object allocation <code>new #ref()</code> in loop #loc
instantiating.object.to.get.class.object.problem.descriptor=Instantiating object to get Class object #loc
field.may.be.static.problem.descriptor=Field <code>#ref</code> may be 'static' #loc
method.may.be.static.problem.descriptor=Method <code>#ref()</code> may be 'static' #loc
@@ -1045,15 +1045,15 @@ class.initializer.may.be.static.problem.descriptor=Class initializer may be 'sta
map.replaceable.by.enum.map.problem.descriptor=<code>#ref</code> replaceable with 'EnumMap' #loc
set.replaceable.by.enum.set.problem.descriptor=<code>#ref</code> replaceable with 'EnumSet' #loc
inner.class.may.be.static.problem.descriptor=Inner class <code>#ref</code> may be 'static' #loc
string.buffer.must.have.initial.capacity.problem.descriptor=<code>#ref</code> without initial capacity #loc
string.buffer.must.have.initial.capacity.problem.descriptor=<code>new #ref()</code> without initial capacity #loc
string.buffer.replaceable.by.string.builder.problem.descriptor=<code>StringBuffer #ref</code> may be declared as 'StringBuilder' #loc
string.buffer.replaceable.by.string.problem.descriptor=<code>{0} #ref</code> can be replaced with ''String'' #loc
new.string.buffer.replaceable.by.string.problem.descriptor=<code>#ref</code> can be replaced with 'String' #loc
string.replaceable.by.string.buffer.problem.descriptor=Non-constant <code>String #ref</code> should probably be declared as ''StringBuilder'' #loc
collections.must.have.initial.capacity.problem.descriptor=<code>#ref</code> without initial capacity #loc
collections.must.have.initial.capacity.problem.descriptor=<code>new #ref()</code> without initial capacity #loc
string.concatenation.in.loops.problem.descriptor=String concatenation <code>#ref</code> in loop #loc
string.concatenation.inside.string.buffer.append.problem.descriptor=String concatenation as argument to <code>{0}.#ref()</code> call #loc
boolean.constructor.problem.descriptor=Boolean constructor call <code>#ref</code> #loc
boolean.constructor.problem.descriptor=Boolean constructor call #loc
string.to.string.problem.descriptor=<code>#ref</code> is redundant #loc
substring.zero.problem.descriptor=<code>#ref</code> is redundant #loc
string.buffer.to.string.in.concatenation.problem.descriptor=Calls to <code>StringBuffer.#ref()</code> in concatenation #loc
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -173,7 +173,7 @@ public class BooleanConstructorInspection extends BaseInspection {
if (expressions.length != 1) {
return;
}
registerError(expression);
registerNewExpressionError(expression);
}
}
}
@@ -71,7 +71,7 @@ public class ObjectAllocationInLoopInspection extends BaseInspection {
if (isAllocatedOnlyOnce(expression)) {
return;
}
registerError(expression);
registerNewExpressionError(expression);
}
private static boolean isAllocatedOnlyOnce(
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ public class StringBufferMustHaveInitialCapacityInspection
if (args.length != 0) {
return;
}
registerError(expression);
registerNewExpressionError(expression);
}
}
}
@@ -1,40 +0,0 @@
package com.siyeh.igtest.performance;
import java.io.IOException;
import java.util.*;
public class CollectionsMustHaveInitialCapacityInspection
{
public CollectionsMustHaveInitialCapacityInspection()
{
}
public void foo() throws IOException
{
// new HashMap<String, String>();
// new HashMap<String, String>(3);
new HashMap();
new HashMap(3);
new WeakHashMap();
new WeakHashMap(3);
new HashSet();
new HashSet(3);
new Hashtable();
new Hashtable(3);
new BitSet();
new BitSet(3);
new Vector();
new Vector(3);
new ArrayList();
new ArrayList(3);
}
}
@@ -1,21 +0,0 @@
package com.siyeh.igtest.performance;
import java.io.IOException;
public class StringBufferMustHaveInitialCapacityInspection
{
public StringBufferMustHaveInitialCapacityInspection()
{
}
public void foo() throws IOException
{
new StringBuffer();
new StringBuffer(3);
new StringBuffer("foo");
new StringBuilder();
new StringBuilder(3);
new StringBuilder("foo");
}
}
@@ -4,14 +4,14 @@
<file>BooleanConstructor.java</file>
<line>7</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Boolean constructor call</problem_class>
<description>Boolean constructor call &lt;code&gt;new Boolean(b)&lt;/code&gt; #loc</description>
<description>Boolean constructor call #loc</description>
</problem>
<problem>
<file>BooleanConstructor.java</file>
<line>8</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Boolean constructor call</problem_class>
<description>Boolean constructor call &lt;code&gt;new Boolean(true)&lt;/code&gt; #loc</description>
<description>Boolean constructor call #loc</description>
</problem>
</problems>
@@ -0,0 +1,10 @@
package com.siyeh.igtest.performance.object_allocation_in_loop;
class ObjectAllocationInLoop {
void m() {
while (true) {
new <warning descr="Object allocation 'new Object()' in loop">Object</warning>();
}
}
}
@@ -0,0 +1,13 @@
package com.siyeh.igtest.performance.string_buffer_must_have_initial_capacity;
class StringBufferMustHaveInitialCapacity {
void m() {
new <warning descr="'new StringBuffer()' without initial capacity">StringBuffer</warning>();
new StringBuffer(3);
new StringBuffer("foo");
new <warning descr="'new StringBuilder()' without initial capacity">StringBuilder</warning>();
new StringBuilder(3);
new StringBuilder("foo"); }
}
@@ -31,11 +31,55 @@ public class CollectionsMustHaveInitialCapacityInspectionTest extends LightInspe
protected String[] getEnvironmentClasses() {
return new String[] {
"package java.util.concurrent;" +
"public class ConcurrentHashMap {}"
"public class ConcurrentHashMap {}",
"package java.util;" +
"public class WeakHashMap {" +
" public WeakHashMap() {}" +
" public WeakHashMap(int c) {}" +
"}",
"package java.util;" +
"public class HashSet {" +
" public HashSet() {}" +
" public HashSet(int c) {}" +
"}",
"package java.util;" +
"public class BitSet {" +
" public BitSet() {}" +
" public BitSet(int c) {}" +
"}",
"package java.util;" +
"public class Vector {" +
" public Vector() {}" +
" public Vector(int c) {}" +
"}"
};
}
public void testSimple() {
doStatementTest("new /*'java.util.concurrent.ConcurrentHashMap' without initial capacity*/java.util.concurrent.ConcurrentHashMap/**/();");
doStatementTest("new /*'new java.util.concurrent.ConcurrentHashMap()' without initial capacity*/java.util.concurrent.ConcurrentHashMap/**/();");
}
public void testMore() {
doTest("import java.util.*;" +
"class X {" +
" void m() {" +
" new /*'new HashMap<String, String>()' without initial capacity*/HashMap<String, String>/**/();" +
" new HashMap<String, String>(3);" +
" new /*'new HashMap()' without initial capacity*/HashMap/**/();" +
" new HashMap(3);" +
" new /*'new WeakHashMap()' without initial capacity*/WeakHashMap/**/();" +
" new WeakHashMap(3);" +
" new /*'new HashSet()' without initial capacity*/HashSet/**/();" +
" new HashSet(3);" +
" new /*'new Hashtable()' without initial capacity*/Hashtable/**/();" +
" new Hashtable(3);" +
" new /*'new BitSet()' without initial capacity*/BitSet/**/();" +
" new BitSet(3);" +
" new /*'new Vector()' without initial capacity*/Vector/**/();" +
" new Vector(3);" +
" new /*'new ArrayList()' without initial capacity*/ArrayList/**/();" +
" new ArrayList(3);" +
" }" +
"}");
}
}
@@ -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.siyeh.ig.performance;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
/**
* @author Bas Leijdekkers
*/
public class ObjectAllocationInLoopInspectionTest extends LightInspectionTestCase {
@Override
protected InspectionProfileEntry getInspection() {
return new ObjectAllocationInLoopInspection();
}
public void testObjectAllocationInLoop() { doTest(); }
}
@@ -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.siyeh.ig.performance;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
/**
* @author Bas Leijdekkers
*/
public class StringBufferMustHaveInitialCapacityInspectionTest extends LightInspectionTestCase {
@Override
protected InspectionProfileEntry getInspection() {
return new StringBufferMustHaveInitialCapacityInspection();
}
public void testStringBufferMustHaveInitialCapacity() { doTest(); }
}
@@ -20,14 +20,17 @@ import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.project.ModuleData;
import com.intellij.openapi.externalSystem.util.ExternalSystemConstants;
import com.intellij.openapi.externalSystem.util.Order;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.gradle.tooling.model.idea.IdeaModule;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.model.WarModel;
import org.jetbrains.plugins.gradle.model.data.WarModelData;
import org.jetbrains.plugins.gradle.model.WebConfiguration;
import org.jetbrains.plugins.gradle.model.data.WebConfigurationModelData;
import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension;
import org.jetbrains.plugins.gradle.util.GradleConstants;
import java.util.Collections;
import java.util.List;
import java.util.Set;
/**
@@ -42,14 +45,22 @@ public class JavaEEGradleProjectResolverExtension extends AbstractProjectResolve
@Override
public void populateModuleExtraModels(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule) {
WarModel warModel = resolverCtx.getExtraProject(gradleModule, WarModel.class);
if (warModel != null) {
WarModelData warModelData = new WarModelData(GradleConstants.SYSTEM_ID, warModel.getWebAppDirName(), warModel.getWebAppDir());
warModelData.setWebXml(warModel.getWebXml());
warModelData.setWebRoots(warModel.getWebRoots());
warModelData.setClasspath(warModel.getClasspath());
warModelData.setManifestContent(warModel.getManifestContent());
ideModule.createChild(WarModelData.KEY, warModelData);
final WebConfiguration webConfiguration = resolverCtx.getExtraProject(gradleModule, WebConfiguration.class);
if (webConfiguration != null) {
List<WebConfigurationModelData.War> warModels =
ContainerUtil.map(webConfiguration.getWarModels(), new Function<WebConfiguration.WarModel, WebConfigurationModelData.War>() {
@Override
public WebConfigurationModelData.War fun(WebConfiguration.WarModel model) {
WebConfigurationModelData.War war = new WebConfigurationModelData.War(model.getWarName(), model.getWebAppDirName(), model.getWebAppDir());
war.setWebXml(model.getWebXml());
war.setWebRoots(model.getWebRoots());
war.setClasspath(model.getClasspath());
war.setManifestContent(model.getManifestContent());
return war;
}
});
ideModule.createChild(WebConfigurationModelData.KEY, new WebConfigurationModelData(GradleConstants.SYSTEM_ID, warModels));
}
nextResolver.populateModuleExtraModels(gradleModule, ideModule);
@@ -58,6 +69,6 @@ public class JavaEEGradleProjectResolverExtension extends AbstractProjectResolve
@NotNull
@Override
public Set<Class> getExtraProjectModelClasses() {
return Collections.<Class>singleton(WarModel.class);
return Collections.<Class>singleton(WebConfiguration.class);
}
}
@@ -1,138 +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 org.jetbrains.plugins.gradle.model.data;
import com.intellij.openapi.externalSystem.model.Key;
import com.intellij.openapi.externalSystem.model.ProjectKeys;
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
import com.intellij.openapi.externalSystem.model.project.AbstractExternalEntityData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
/**
* @author Vladislav.Soroka
* @since 11/6/13
*/
public class WarModelData extends AbstractExternalEntityData {
private static final long serialVersionUID = 1L;
@NotNull
public static final Key<WarModelData> KEY = Key.create(WarModelData.class, ProjectKeys.LIBRARY_DEPENDENCY.getProcessingWeight() + 1);
@NotNull
private final String myWebAppDirName;
@NotNull
private final File myWebAppDir;
@Nullable
private File myWebXml;
@NotNull
private Map<String, Set<String>> myWebRoots;
@NotNull
private Set<File> myClasspath;
@Nullable
private String myManifestContent;
public WarModelData(@NotNull ProjectSystemId owner, @NotNull String webAppDirName, @NotNull File webAppDir) {
super(owner);
myWebAppDirName = webAppDirName;
myWebAppDir = webAppDir;
myWebRoots = Collections.emptyMap();
myClasspath = Collections.emptySet();
}
@NotNull
public String getWebAppDirName() {
return myWebAppDirName;
}
@NotNull
public File getWebAppDir() {
return myWebAppDir;
}
public void setWebXml(@Nullable File webXml) {
myWebXml = webXml;
}
@Nullable
public File getWebXml() {
return myWebXml;
}
public void setWebRoots(@Nullable Map<String, Set<String>> webRoots) {
myWebRoots = webRoots == null ? Collections.<String, Set<String>>emptyMap() : webRoots;
}
@NotNull
public Map<String, Set<String>> getWebRoots() {
return myWebRoots;
}
public void setClasspath(@Nullable Set<File> classpath) {
myClasspath = classpath == null ? Collections.<File>emptySet() : classpath;
}
@NotNull
public Set<File> getClasspath() {
return myClasspath;
}
public void setManifestContent(@Nullable String manifestContent) {
myManifestContent = manifestContent;
}
@Nullable
public String getManifestContent() {
return myManifestContent;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
WarModelData that = (WarModelData)o;
if (!myWebAppDirName.equals(that.myWebAppDirName)) return false;
if (!myWebRoots.equals(that.myWebRoots)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + myWebAppDirName.hashCode();
result = 31 * result + myWebRoots.hashCode();
return result;
}
@Override
public String toString() {
return "WarModelData{" +
"myWebAppDirName='" + myWebAppDirName + '\'' +
", myWebAppDir=" + myWebAppDir +
", myWebXml=" + myWebXml +
", myWebRoots=" + myWebRoots +
'}';
}
}
@@ -0,0 +1,194 @@
/*
* 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 org.jetbrains.plugins.gradle.model.data;
import com.intellij.openapi.externalSystem.model.Key;
import com.intellij.openapi.externalSystem.model.ProjectKeys;
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
import com.intellij.openapi.externalSystem.model.project.AbstractExternalEntityData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Vladislav.Soroka
* @since 11/6/13
*/
public class WebConfigurationModelData extends AbstractExternalEntityData {
private static final long serialVersionUID = 1L;
@NotNull
public static final Key<WebConfigurationModelData> KEY = Key.create(WebConfigurationModelData.class, ProjectKeys.LIBRARY_DEPENDENCY.getProcessingWeight() + 1);
@NotNull
private final List<War> myWars;
public WebConfigurationModelData(@NotNull ProjectSystemId owner, @NotNull List<War> warModels) {
super(owner);
myWars = warModels;
}
@NotNull
public List<War> getWars() {
return myWars;
}
public static class War {
@NotNull
private final String myName;
@NotNull
private final String myWebAppDirName;
@NotNull
private final File myWebAppDir;
@Nullable
private File myWebXml;
@NotNull
private Map<String, Set<String>> myWebRoots;
@NotNull
private Set<File> myClasspath;
@Nullable
private String myManifestContent;
public War(@NotNull String name, @NotNull String webAppDirName, @NotNull File webAppDir) {
myName = name;
myWebAppDirName = webAppDirName;
myWebAppDir = webAppDir;
myWebRoots = Collections.emptyMap();
myClasspath = Collections.emptySet();
}
@NotNull
public String getName() {
return myName;
}
@NotNull
public String getWebAppDirName() {
return myWebAppDirName;
}
@NotNull
public File getWebAppDir() {
return myWebAppDir;
}
public void setWebXml(@Nullable File webXml) {
myWebXml = webXml;
}
@Nullable
public File getWebXml() {
return myWebXml;
}
public void setWebRoots(@Nullable Map<String, Set<String>> webRoots) {
myWebRoots = webRoots == null ? Collections.<String, Set<String>>emptyMap() : webRoots;
}
@NotNull
public Map<String, Set<String>> getWebRoots() {
return myWebRoots;
}
public void setClasspath(@Nullable Set<File> classpath) {
myClasspath = classpath == null ? Collections.<File>emptySet() : classpath;
}
@NotNull
public Set<File> getClasspath() {
return myClasspath;
}
public void setManifestContent(@Nullable String manifestContent) {
myManifestContent = manifestContent;
}
@Nullable
public String getManifestContent() {
return myManifestContent;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
War that = (War)o;
if (!myName.equals(that.myName)) return false;
if (!myWebAppDirName.equals(that.myWebAppDirName)) return false;
if (!myWebRoots.equals(that.myWebRoots)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + myName.hashCode();
result = 31 * result + myWebAppDirName.hashCode();
result = 31 * result + myWebRoots.hashCode();
return result;
}
@Override
public String toString() {
return "War{" +
"myName='" + myName + '\'' +
", myWebAppDirName='" + myWebAppDirName + '\'' +
", myWebAppDir=" + myWebAppDir +
", myWebXml=" + myWebXml +
", myWebRoots=" + myWebRoots +
'}';
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof WebConfigurationModelData)) return false;
if (!super.equals(o)) return false;
WebConfigurationModelData data = (WebConfigurationModelData)o;
if (!myWars.equals(data.myWars)) return false;
return true;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + myWars.hashCode();
return result;
}
@Override
public String toString() {
return "WebConfigurationModelData{" +
"myWars=" + myWars +
'}';
}
}
@@ -122,8 +122,11 @@ public class GradleTaskManager extends AbstractExternalSystemTaskManager<GradleE
public boolean cancelTask(@NotNull ExternalSystemTaskId id, @NotNull ExternalSystemTaskNotificationListener listener)
throws ExternalSystemException {
for (GradleTaskManagerExtension gradleTaskManagerExtension : GradleTaskManagerExtension.EP_NAME.getExtensions()) {
if (gradleTaskManagerExtension.cancelTask(id, listener)) return true;
// extension points are available only in IDE process
if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) {
for (GradleTaskManagerExtension gradleTaskManagerExtension : GradleTaskManagerExtension.EP_NAME.getExtensions()) {
if (gradleTaskManagerExtension.cancelTask(id, listener)) return true;
}
}
// TODO replace with cancellation gradle API invocation when it will be ready, see http://issues.gradle.org/browse/GRADLE-1539
@@ -36,7 +36,7 @@ public class GradleProjectWizardTest extends NewProjectWizardTestCase {
if (step instanceof ProjectTypeStep) {
assertTrue(((ProjectTypeStep)step).setSelectedTemplate("Gradle", null));
List<ModuleWizardStep> steps = myWizard.getSequence().getSelectedSteps();
assertEquals(4, steps.size());
assertEquals(3, steps.size());
}
}
});
@@ -25,16 +25,13 @@ import org.gradle.api.java.archives.Manifest;
import org.gradle.api.plugins.WarPlugin;
import org.gradle.api.tasks.bundling.War;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.model.WebConfiguration;
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
import org.jetbrains.plugins.gradle.model.WarModel;
import org.jetbrains.plugins.gradle.tooling.internal.WarModelImpl;
import org.jetbrains.plugins.gradle.tooling.internal.WebConfigurationImpl;
import java.io.File;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author Vladislav.Soroka
@@ -47,7 +44,7 @@ public class WarModelBuilderImpl implements ModelBuilderService {
@Override
public boolean canBuild(String modelName) {
return WarModel.class.getName().equals(modelName);
return WebConfiguration.class.getName().equals(modelName);
}
@Nullable
@@ -63,10 +60,14 @@ public class WarModelBuilderImpl implements ModelBuilderService {
? new File(project.getProjectDir(), webAppDirName)
: (File)project.property(WEB_APP_DIR_PROPERTY);
WarModelImpl warModel = new WarModelImpl(webAppDirName, webAppDir);
List<WebConfiguration.WarModel> warModels = new ArrayList<WebConfiguration.WarModel>();
for (Task task : project.getTasks()) {
if (task instanceof War) {
final WebConfigurationImpl.WarModelImpl warModel = new WebConfigurationImpl.WarModelImpl(((War)task).getArchiveName(), webAppDirName, webAppDir);
final War warTask = (War)task;
warModel.setWebXml(warTask.getWebXml());
@@ -111,11 +112,11 @@ public class WarModelBuilderImpl implements ModelBuilderService {
manifest.writeTo(writer);
warModel.setManifestContent(writer.toString());
}
break;
warModels.add(warModel);
}
}
return warModel;
return new WebConfigurationImpl(warModels);
}
private static void addPath(Map<String, Set<String>> webRoots, String relativePath, String path) {
@@ -15,8 +15,12 @@
*/
package org.jetbrains.plugins.gradle.model;
import org.gradle.tooling.model.DomainObjectSet;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -24,16 +28,24 @@ import java.util.Set;
* @author Vladislav.Soroka
* @since 11/5/13
*/
public interface WarModel extends Serializable {
String getWebAppDirName();
public interface WebConfiguration extends Serializable {
File getWebAppDir();
List<? extends WarModel> getWarModels();
File getWebXml();
interface WarModel extends Serializable {
@NotNull
String getWarName();
Map<String, Set<String>> getWebRoots();
String getWebAppDirName();
Set<File> getClasspath();
File getWebAppDir();
String getManifestContent();
File getWebXml();
Map<String, Set<String>> getWebRoots();
Set<File> getClasspath();
String getManifestContent();
}
}
@@ -1,86 +0,0 @@
/*
* 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 org.jetbrains.plugins.gradle.tooling.internal;
import org.jetbrains.plugins.gradle.model.WarModel;
import java.io.File;
import java.util.Map;
import java.util.Set;
/**
* @author Vladislav.Soroka
* @since 11/5/13
*/
public class WarModelImpl implements WarModel {
private final String myWebAppDirName;
private final File myWebAppDir;
private File myWebXml;
private Map<String, Set<String>> myWebRoots;
private Set<File> myClasspath;
private String myManifestContent;
public WarModelImpl(String webAppDirName, File webAppDir) {
myWebAppDirName = webAppDirName;
myWebAppDir = webAppDir;
}
@Override
public String getWebAppDirName() {
return myWebAppDirName;
}
@Override
public File getWebAppDir() {
return myWebAppDir;
}
public void setWebXml(File webXml) {
myWebXml = webXml;
}
@Override
public File getWebXml() {
return myWebXml;
}
@Override
public Map<String, Set<String>> getWebRoots() {
return myWebRoots;
}
public void setWebRoots(Map<String, Set<String>> webRoots) {
myWebRoots = webRoots;
}
public void setClasspath(Set<File> classpath) {
myClasspath = classpath;
}
@Override
public Set<File> getClasspath() {
return myClasspath;
}
public void setManifestContent(String manifestContent) {
myManifestContent = manifestContent;
}
@Override
public String getManifestContent() {
return myManifestContent;
}
}
@@ -0,0 +1,112 @@
/*
* 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 org.jetbrains.plugins.gradle.tooling.internal;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.model.WebConfiguration;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author Vladislav.Soroka
* @since 11/5/13
*/
public class WebConfigurationImpl implements WebConfiguration {
@NotNull
private final List<WarModel> myWarModels;
public WebConfigurationImpl(@NotNull List<WarModel> warModels) {
myWarModels = warModels;
}
@Override
public List<? extends WarModel> getWarModels() {
return myWarModels;
}
public static class WarModelImpl implements WarModel {
@NotNull
private final String warName;
private final String myWebAppDirName;
private final File myWebAppDir;
private File myWebXml;
private Map<String, Set<String>> myWebRoots;
private Set<File> myClasspath;
private String myManifestContent;
public WarModelImpl(@NotNull String name, String webAppDirName, File webAppDir) {
warName = name;
myWebAppDirName = webAppDirName;
myWebAppDir = webAppDir;
}
@NotNull
@Override
public String getWarName() {
return warName;
}
@Override
public String getWebAppDirName() {
return myWebAppDirName;
}
@Override
public File getWebAppDir() {
return myWebAppDir;
}
public void setWebXml(File webXml) {
myWebXml = webXml;
}
@Override
public File getWebXml() {
return myWebXml;
}
@Override
public Map<String, Set<String>> getWebRoots() {
return myWebRoots;
}
public void setWebRoots(Map<String, Set<String>> webRoots) {
myWebRoots = webRoots;
}
public void setClasspath(Set<File> classpath) {
myClasspath = classpath;
}
@Override
public Set<File> getClasspath() {
return myClasspath;
}
public void setManifestContent(String manifestContent) {
myManifestContent = manifestContent;
}
@Override
public String getManifestContent() {
return myManifestContent;
}
}
}
@@ -20,7 +20,7 @@ import com.intellij.util.containers.ContainerUtil;
import org.gradle.tooling.model.DomainObjectSet;
import org.gradle.tooling.model.idea.IdeaModule;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.model.WarModel;
import org.jetbrains.plugins.gradle.model.WebConfiguration;
import org.junit.Test;
import java.util.List;
@@ -32,9 +32,9 @@ import static org.junit.Assert.assertEquals;
* @author Vladislav.Soroka
* @since 11/29/13
*/
public class WarModelBuilderImplTest extends AbstractModelBuilderTest {
public class WebConfigurationBuilderImplTest extends AbstractModelBuilderTest {
public WarModelBuilderImplTest(@NotNull String gradleVersion) {
public WebConfigurationBuilderImplTest(@NotNull String gradleVersion) {
super(gradleVersion);
}
@@ -42,21 +42,23 @@ public class WarModelBuilderImplTest extends AbstractModelBuilderTest {
public void testDefaultWarModel() throws Exception {
DomainObjectSet<? extends IdeaModule> ideaModules = allModels.getIdeaProject().getModules();
List<WarModel> ideaModule = ContainerUtil.mapNotNull(ideaModules, new Function<IdeaModule, WarModel>() {
List<WebConfiguration> ideaModule = ContainerUtil.mapNotNull(ideaModules, new Function<IdeaModule, WebConfiguration>() {
@Override
public WarModel fun(IdeaModule module) {
return allModels.getExtraProject(module, WarModel.class);
public WebConfiguration fun(IdeaModule module) {
return allModels.getExtraProject(module, WebConfiguration.class);
}
});
assertEquals(1, ideaModule.size());
WarModel warModel = ideaModule.get(0);
WebConfiguration webConfiguration = ideaModule.get(0);
assertEquals(1, webConfiguration.getWarModels().size());
final WebConfiguration.WarModel warModel = webConfiguration.getWarModels().iterator().next();
assertEquals("src/main/webapp", warModel.getWebAppDirName());
}
@Override
protected Set<Class> getModels() {
return ContainerUtil.<Class>set(WarModel.class);
return ContainerUtil.<Class>set(WebConfiguration.class);
}
}
@@ -18,13 +18,11 @@ public class HgEncodingUtil {
if (HGENCODING != null && HGENCODING.length() > 0 && Charset.isSupported(HGENCODING)) {
return Charset.forName(HGENCODING);
}
else {
Charset defaultCharset = EncodingProjectManager.getInstance(project).getDefaultCharset();
if (defaultCharset != null) {
return defaultCharset;
}
Charset defaultCharset = null;
if (!project.isDisposed()) {
defaultCharset = EncodingProjectManager.getInstance(project).getDefaultCharset();
}
return Charset.defaultCharset();
return defaultCharset != null ? defaultCharset : Charset.defaultCharset();
}
@NotNull
@@ -61,7 +61,10 @@ public class MavenProject {
.put("5", "1.5")
.put("1.6", "1.6")
.put("1.7", "1.7")
.put("7", "1.7").build();
.put("7", "1.7")
.put("1.8", "1.8")
.put("8", "1.8")
.build();
public enum ProcMode {BOTH, ONLY, NONE}
@@ -514,6 +514,7 @@ public class MavenServerManager extends RemoteObjectWrapper<MavenServer> impleme
final Element element = new Element("maven-version");
element.setAttribute("version", useMaven2 ? "2.x" : "3.x");
element.setAttribute("vmOptions", mavenEmbedderVMOptions);
element.setAttribute("embedderJdk", embedderJdk);
return element;
}
@@ -524,6 +525,9 @@ public class MavenServerManager extends RemoteObjectWrapper<MavenServer> impleme
String vmOptions = state.getAttributeValue("vmOptions");
mavenEmbedderVMOptions = vmOptions == null ? DEFAULT_VM_OPTIONS : vmOptions;
String embedderJdk = state.getAttributeValue("embedderJdk");
this.embedderJdk = embedderJdk == null ? MavenRunnerSettings.USE_INTERNAL_JAVA : embedderJdk;
}
private static class RemoteMavenServerLogger extends MavenRemoteObject implements MavenServerLogger {
@@ -54,7 +54,7 @@ public class MavenExtensionCompletionAndResolutionTest extends MavenDomWithIndic
" </extensions>" +
"</build>");
assertCompletionVariants(myProjectPom, "test", "org.apache.maven.plugins", "org.codehaus.mojo");
assertCompletionVariants(myProjectPom, "org.codehaus.plexus", "test", "org.apache.maven.plugins", "org.codehaus.mojo", "intellij.test");
}
public void testArtifactIdCompletion() throws Exception {
@@ -43,7 +43,7 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
"<version>1</version>");
}
@Bombed(year = 2013, month = Calendar.APRIL, day = 25, user = "sergey.evdokimov")
@Bombed(year = 2014, month = Calendar.APRIL, day = 25, user = "sergey.evdokimov")
public void testGroupIdCompletion() throws Exception {
createProjectPom("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -57,7 +57,7 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
" </plugins>" +
"</build>");
assertCompletionVariants(myProjectPom, "test", "org.apache.maven.plugins", "org.codehaus.mojo");
assertCompletionVariants(myProjectPom, "org.codehaus.plexus", "intellij.test", "test", "org.apache.maven.plugins", "org.codehaus.mojo");
}
@Bombed(year = 2013, month = Calendar.APRIL, day = 25, user = "sergey.evdokimov")
@@ -16,6 +16,7 @@
package org.jetbrains.idea.maven.importing;
import com.intellij.ProjectTopics;
import com.intellij.idea.Bombed;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
@@ -29,6 +30,7 @@ import org.jetbrains.idea.maven.server.MavenServerManager;
import org.jetbrains.idea.maven.server.MavenServerManagerHelper;
import java.io.File;
import java.util.Calendar;
import java.util.List;
public class MiscImportingTest extends MavenImportingTestCase {
@@ -275,6 +277,7 @@ public class MiscImportingTest extends MavenImportingTestCase {
assertEquals(0, myProjectsTree.getRootProjects().get(0).getProblems().size());
}
@Bombed(year = 2014, month = Calendar.JUNE, day = 25, user = "sergey.evdokimov")
public void testMavenExtensionsAreLoadedAndAfterProjectsReadIsCalled() throws Exception {
MavenCustomRepositoryHelper helper = new MavenCustomRepositoryHelper(myDir, "plugins");
setRepositoryPath(helper.getTestDataPath("plugins"));
@@ -303,6 +306,7 @@ public class MiscImportingTest extends MavenImportingTestCase {
assertEquals(myProjectPom.getPath().replace('\\', '/'), mavenProject.getProperties().getProperty("workspace-info"));
}
@Bombed(year = 2014, month = Calendar.JUNE, day = 25, user = "sergey.evdokimov")
public void testExceptionsFromMavenExtensionsAreReportedAsProblems() throws Exception {
MavenCustomRepositoryHelper helper = new MavenCustomRepositoryHelper(myDir, "plugins");
setRepositoryPath(helper.getTestDataPath("plugins"));
@@ -326,7 +330,7 @@ public class MiscImportingTest extends MavenImportingTestCase {
List<MavenProject> projects = myProjectsTree.getProjects();
assertEquals(1, projects.size());
MavenProject mavenProject = projects.get(0);
assertEquals(1, mavenProject.getProblems().size());
assertEquals(mavenProject.getProblems().toString(), 1, mavenProject.getProblems().size());
assertEquals("throw!", mavenProject.getProblems().get(0).getDescription());
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

+2 -2
View File
@@ -4,9 +4,9 @@
<id>PythonCore</id>
<name>Python Community Edition</name>
<idea-version since-build="130.0" until-build="133.0"/>
<idea-version since-build="134.1007" until-build="134.*"/>
<description>Smart editing for Python scripts</description>
<version>3.0.1</version>
<version>3.1</version>
<depends>com.intellij.modules.java</depends>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 135 KiB

@@ -16,10 +16,15 @@
package com.jetbrains.python;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testFramework.ParsingTestCase;
import com.intellij.testFramework.TestDataPath;
import com.jetbrains.python.fixtures.PyTestCase;
import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* @author yole
@@ -220,7 +225,7 @@ public class PythonParsingTest extends ParsingTestCase {
}
public void testTrailingSemicolon() { // PY-363
doTest();
doTest();
}
public void testStarExpression() { // PEP-3132
@@ -322,7 +327,7 @@ public class PythonParsingTest extends ParsingTestCase {
public void testIncompleteFor() { // PY-3792
doTest();
}
public void testCallInAssignment() { // PY-5062
doTest();
}
@@ -451,6 +456,7 @@ public class PythonParsingTest extends ParsingTestCase {
finally {
myLanguageLevel = prev;
}
ensureEachFunctionHasStatementList(myFile, PyFunction.class);
}
@Override
@@ -459,4 +465,13 @@ public class PythonParsingTest extends ParsingTestCase {
file.getVirtualFile().putUserData(LanguageLevel.KEY, myLanguageLevel);
return file;
}
public static <T extends PyFunction> void ensureEachFunctionHasStatementList(
@NotNull PsiFile parentFile,
@NotNull Class<T> functionType) {
Collection<T> functions = PsiTreeUtil.findChildrenOfType(parentFile, functionType);
for (T functionToCheck : functions) {
functionToCheck.getStatementList(); //To make sure each function has statement list (does not throw exception)
}
}
}
@@ -294,7 +294,7 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
public void wrap(@NotNull final String selection, @NotNull final CustomTemplateCallback callback) {
final TextFieldWithStoredHistory field = new TextFieldWithStoredHistory(EMMET_RECENT_WRAP_ABBREVIATIONS_KEY);
final Dimension fieldPreferredSize = field.getPreferredSize();
field.setPreferredSize(new Dimension(Math.max(160, fieldPreferredSize.width), fieldPreferredSize.height));
field.setPreferredSize(new Dimension(Math.max(220, fieldPreferredSize.width), fieldPreferredSize.height));
field.setHistorySize(10);
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
final BalloonImpl balloon = (BalloonImpl)popupFactory.createDialogBalloonBuilder(field, XmlBundle.message("emmet.title"))