Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Trofimov
2015-08-20 17:09:58 +02:00
52 changed files with 405 additions and 172 deletions
@@ -19,7 +19,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Ref;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.util.ui.UIUtil;
import cucumber.runtime.Env;
import cucumber.runtime.Runtime;
import cucumber.runtime.RuntimeOptions;
import cucumber.runtime.io.MultiLoader;
@@ -39,8 +38,14 @@ public class CucumberMain {
}
public static void main(String[] args) throws IOException {
int exitstatus = run(args, Thread.currentThread().getContextClassLoader());
System.exit(exitstatus);
int exitStatus;
try {
exitStatus = run(args, Thread.currentThread().getContextClassLoader());
}
catch (Throwable e) {
exitStatus = 1;
}
System.exit(exitStatus);
}
@@ -60,17 +65,18 @@ public class CucumberMain {
Runtime runtime = new Runtime(resourceLoader, classFinder, classLoader, runtimeOptions);
runtimeRef.set(runtime);
runtime.run();
} catch (Throwable throwable) {
errorRef.set(throwable);
Logger.getInstance(CucumberMain.class).error(throwable);
}
}
});
}
catch (Throwable t) {
errorRef.set(t);
Logger.getInstance(CucumberMain.class).error(t);
}
catch (Throwable throwable) {
errorRef.set(throwable);
Logger.getInstance(CucumberMain.class).error(throwable);
}
}
});
}
catch (Throwable t) {
errorRef.set(t);
Logger.getInstance(CucumberMain.class).error(t);
}
final Throwable throwable = errorRef.get();
if (throwable != null) {
+1 -1
View File
@@ -290,7 +290,7 @@ libraryLicense(name: "EditorConfig Java Core", libraryName: "editorconfig-core-j
libraryLicense(name: "Fest", libraryName: "fest", version: "", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://code.google.com/p/fest/")
libraryLicense(name: "Gherkin", libraryName: "Gherkin", version: "2.12.2", license: "MIT", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/cucumber/gherkin")
libraryLicense(name: "imgscalr", libraryName: "imgscalr", version: "4.2", license: "Apache 2.0", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/thebuzzmedia/imgscalr")
libraryLicense(name: "Spantable", libraryName: "spantable.jar", version: "unknown", license: "LGPL 2.1", licenseUrl: "http://www.gnu.org/licenses/lgpl.html", url: "http://code.google.com/p/spantable/")
libraryLicense(name: "Spantable", libraryName: "spantable.jar", version: "patched", license: "LGPL 2.1", licenseUrl: "http://www.gnu.org/licenses/lgpl.html", url: "https://android.googlesource.com/platform/prebuilts/tools/+/master/common/spantable/")
libraryLicense(name: "JGit", libraryName: "jgit", version: "4.0", license: "Eclipse Distribution License 1.0", licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://eclipse.org/jgit/")
libraryLicense(name: "JGit", libraryName: "jackson", version: "2.5.1", license: "Apache 2.0", licenseUrl: "http://www.eclipse.org/org/documents/edl-v10.php", url: "https://github.com/FasterXML/jackson")
jetbrainsLibrary("Coverage")
@@ -273,8 +273,15 @@ public class DebuggerSession implements AbstractDebuggerSession {
}
public void stepOut(int stepSize) {
final SuspendContextImpl suspendContext = getSuspendContext();
final DebugProcessImpl.ResumeCommand cmd = myDebugProcess.createStepOutCommand(suspendContext, stepSize);
SuspendContextImpl suspendContext = getSuspendContext();
DebugProcessImpl.ResumeCommand cmd = null;
for (JvmSteppingCommandProvider handler : JvmSteppingCommandProvider.EP_NAME.getExtensions()) {
cmd = handler.getStepOutCommand(suspendContext, stepSize);
if (cmd != null) break;
}
if (cmd == null) {
cmd = myDebugProcess.createStepOutCommand(suspendContext, stepSize);
}
setSteppingThrough(cmd.getContextThread());
resumeAction(cmd, Event.STEP);
}
@@ -284,8 +291,15 @@ public class DebuggerSession implements AbstractDebuggerSession {
}
public void stepOver(boolean ignoreBreakpoints, int stepSize) {
final SuspendContextImpl suspendContext = getSuspendContext();
final DebugProcessImpl.ResumeCommand cmd = myDebugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints, stepSize);
SuspendContextImpl suspendContext = getSuspendContext();
DebugProcessImpl.ResumeCommand cmd = null;
for (JvmSteppingCommandProvider handler : JvmSteppingCommandProvider.EP_NAME.getExtensions()) {
cmd = handler.getStepOverCommand(suspendContext, ignoreBreakpoints, stepSize);
if (cmd != null) break;
}
if (cmd == null) {
cmd = myDebugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints, stepSize);
}
setSteppingThrough(cmd.getContextThread());
resumeAction(cmd, Event.STEP);
}
@@ -296,7 +310,14 @@ public class DebuggerSession implements AbstractDebuggerSession {
public void stepInto(final boolean ignoreFilters, final @Nullable MethodFilter smartStepFilter, int stepSize) {
final SuspendContextImpl suspendContext = getSuspendContext();
final DebugProcessImpl.ResumeCommand cmd = myDebugProcess.createStepIntoCommand(suspendContext, ignoreFilters, smartStepFilter, stepSize);
DebugProcessImpl.ResumeCommand cmd = null;
for (JvmSteppingCommandProvider handler : JvmSteppingCommandProvider.EP_NAME.getExtensions()) {
cmd = handler.getStepIntoCommand(suspendContext, ignoreFilters, smartStepFilter, stepSize);
if (cmd != null) break;
}
if (cmd == null) {
cmd = myDebugProcess.createStepIntoCommand(suspendContext, ignoreFilters, smartStepFilter, stepSize);
}
setSteppingThrough(cmd.getContextThread());
resumeAction(cmd, Event.STEP);
}
@@ -0,0 +1,54 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.debugger.impl;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.MethodFilter;
import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.Nullable;
/**
* @author egor
*/
public abstract class JvmSteppingCommandProvider {
public static ExtensionPointName<JvmSteppingCommandProvider> EP_NAME =
ExtensionPointName.create("com.intellij.debugger.jvmSteppingCommandProvider");
/**
* @return null if can not handle
*/
public DebugProcessImpl.ResumeCommand getStepIntoCommand(SuspendContextImpl suspendContext,
boolean ignoreFilters,
final MethodFilter smartStepFilter,
int stepSize) {
return null;
}
/**
* @return null if can not handle
*/
public DebugProcessImpl.ResumeCommand getStepOutCommand(SuspendContextImpl suspendContext, int stepSize) {
return null;
}
/**
* @return null if can not handle
*/
public DebugProcessImpl.ResumeCommand getStepOverCommand(SuspendContextImpl suspendContext, boolean ignoreBreakpoints, int stepSize) {
return null;
}
}
@@ -62,6 +62,7 @@ import org.jetbrains.jps.model.serialization.PathMacroUtil;
import java.io.*;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -195,12 +196,16 @@ public abstract class JavaTestFrameworkRunnableState<T extends ModuleBasedConfig
}
if (!StringUtil.isEmptyOrSpaces(parameters)) {
javaParameters.getProgramParametersList().add("@name" + parameters);
javaParameters.getProgramParametersList().addAll(getNamedParams(parameters));
}
return javaParameters;
}
protected List<String> getNamedParams(String parameters) {
return Collections.singletonList("@name" + parameters);
}
private ServerSocket myForkSocket = null;
@Nullable
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.*;
import com.intellij.psi.util.MethodSignature;
import com.intellij.psi.util.PsiTypesUtil;
@@ -25,12 +26,16 @@ import com.intellij.psi.util.TypeConversionUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* User: anna
*/
public class LambdaHighlightingUtil {
private static final Logger LOG = Logger.getInstance("#" + LambdaHighlightingUtil.class.getName());
@Nullable
public static String checkInterfaceFunctional(@NotNull PsiClass psiClass) {
return checkInterfaceFunctional(psiClass, "Target type of a lambda conversion must be an interface");
@@ -90,14 +95,16 @@ public class LambdaHighlightingUtil {
@Nullable
public static String checkInterfaceFunctional(PsiType functionalInterfaceType) {
if (functionalInterfaceType instanceof PsiIntersectionType) {
int count = 0;
final Set<MethodSignature> signatures = new HashSet<MethodSignature>();
for (PsiType type : ((PsiIntersectionType)functionalInterfaceType).getConjuncts()) {
if (checkInterfaceFunctional(type) == null) {
count++;
final MethodSignature signature = LambdaUtil.getFunction(PsiUtil.resolveClassInType(type));
LOG.assertTrue(signature != null, type.getCanonicalText());
signatures.add(signature);
}
}
if (count > 1) {
if (signatures.size() > 1) {
return "Multiple non-overriding abstract methods found in " + functionalInterfaceType.getPresentableText();
}
return null;
@@ -114,7 +114,7 @@ public class JavaCompletionContributor extends CompletionContributor {
if (JavaKeywordCompletion.DECLARATION_START.getValue().accepts(position) ||
JavaKeywordCompletion.isInsideParameterList(position) ||
psiElement().inside(psiElement(PsiJavaCodeReferenceElement.class).withParent(psiAnnotation())).accepts(position)) {
isInsideAnnotationName(position)) {
return new OrFilter(ElementClassFilter.CLASS, ElementClassFilter.PACKAGE_FILTER);
}
@@ -166,6 +166,11 @@ public class JavaCompletionContributor extends CompletionContributor {
return TrueFilter.INSTANCE;
}
private static boolean isInsideAnnotationName(PsiElement position) {
PsiAnnotation anno = PsiTreeUtil.getParentOfType(position, PsiAnnotation.class, true, PsiMember.class);
return anno != null && PsiTreeUtil.isAncestor(anno.getNameReferenceElement(), position, true);
}
private static ElementFilter createAnnotationFilter(PsiElement position) {
OrFilter orFilter = new OrFilter(ElementClassFilter.CLASS,
ElementClassFilter.PACKAGE_FILTER,
@@ -81,22 +81,18 @@ public class TypeInfo {
private static final int HAS_ARRAY_COUNT = 0x40;
private static final int HAS_ELLIPSIS = 0x80;
private static final TypeInfo NULL = new TypeInfo((StringRef)null, (byte)0, false, PsiAnnotationStub.EMPTY_ARRAY);
private static final TypeInfo NULL = new TypeInfo(null, (byte)0, false, PsiAnnotationStub.EMPTY_ARRAY);
public final StringRef text;
public final String text;
public final byte arrayCount;
public final boolean isEllipsis;
private final PsiAnnotationStub[] myAnnotationStubs;
public TypeInfo(String text, byte arrayCount, boolean ellipsis, @NotNull PsiAnnotationStub[] annotationStubs) {
this(StringRef.fromString(text == null ? null : internFrequentType(text)), arrayCount, ellipsis, annotationStubs);
}
private TypeInfo(StringRef text, byte arrayCount, boolean isEllipsis, @NotNull PsiAnnotationStub[] annotationStubs) {
this.text = text;
this.text = text == null ? null : internFrequentType(text);
this.arrayCount = arrayCount;
this.isEllipsis = isEllipsis;
this.isEllipsis = ellipsis;
myAnnotationStubs = annotationStubs;
}
@@ -123,7 +119,7 @@ public class TypeInfo {
@NotNull
public String getShortTypeText() {
if (text == null) return "";
String name = PsiNameHelper.getShortClassName(text.getString());
String name = PsiNameHelper.getShortClassName(text);
if (arrayCount > 0) {
name += StringUtil.repeat("[]", arrayCount);
}
@@ -227,7 +223,7 @@ public class TypeInfo {
byte arrayCount = isSet(flags, HAS_ARRAY_COUNT) ? record.readByte() : 0;
boolean hasEllipsis = isSet(flags, HAS_ELLIPSIS);
StringRef text = frequentIndex == 0 ? record.readName() : StringRef.fromString(ourIndexFrequentType[frequentIndex]);
String text = frequentIndex == 0 ? StringRef.toString(record.readName()) : ourIndexFrequentType[frequentIndex];
return new TypeInfo(text, arrayCount, hasEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
}
@@ -238,7 +234,7 @@ public class TypeInfo {
return;
}
String text = typeInfo.text.getString();
String text = typeInfo.text;
byte arrayCount = typeInfo.arrayCount;
int frequentIndex = ourFrequentTypeIndex.get(text);
int flags = (typeInfo.isEllipsis ? HAS_ELLIPSIS : 0) | (arrayCount != 0 ? HAS_ARRAY_COUNT : 0) | frequentIndex;
@@ -259,7 +255,7 @@ public class TypeInfo {
return null;
}
if (typeInfo.arrayCount == 0 && typeInfo.myAnnotationStubs.length == 0) {
return typeInfo.text.getString();
return typeInfo.text;
}
StringBuilder buf = new StringBuilder();
@@ -268,7 +264,7 @@ public class TypeInfo {
buf.append(stub.getText()).append(' ');
}
buf.append(typeInfo.text.getString());
buf.append(typeInfo.text);
int arrayCount = typeInfo.isEllipsis ? typeInfo.arrayCount - 1 : typeInfo.arrayCount;
for (int i = 0; i < arrayCount; i++) {
@@ -27,7 +27,6 @@ import com.intellij.psi.stubs.PsiFileStub;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.ArrayUtil;
import com.intellij.util.cls.ClsFormatException;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.org.objectweb.asm.*;
@@ -344,7 +343,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
byte flags = PsiFieldStubImpl.packFlags((access & Opcodes.ACC_ENUM) != 0, (access & Opcodes.ACC_DEPRECATED) != 0, false, false);
TypeInfo type = fieldType(desc, signature);
String initializer = constToString(value, type.text.getString(), false);
String initializer = constToString(value, type.text, false);
PsiFieldStub stub = new PsiFieldStubImpl(myResult, name, type, initializer, flags);
PsiModifierListStub modList = new PsiModifierListStubImpl(stub, packFieldFlags(access));
return new AnnotationCollectingVisitor(modList);
@@ -412,9 +411,8 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
List<String> args = new ArrayList<String>();
List<String> throwables = exceptions != null ? new ArrayList<String>() : null;
StringRef stringRef = StringRef.fromString(canonicalMethodName);
int modifiersMask = packMethodFlags(access, myResult.isInterface());
PsiMethodStubImpl stub = new PsiMethodStubImpl(myResult, stringRef, flags, signature, args, throwables, desc, modifiersMask);
PsiMethodStubImpl stub = new PsiMethodStubImpl(myResult, canonicalMethodName, flags, signature, args, throwables, desc, modifiersMask);
PsiModifierListStub modList = (PsiModifierListStub)stub.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
assert modList != null : stub;
@@ -119,7 +119,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);
return new PsiMethodStubImpl(parentStub, StringRef.fromString(name), typeInfo, flags, StringRef.fromString(defValueText));
return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
@Override
@@ -139,7 +139,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
final TypeInfo type = TypeInfo.readTYPE(dataStream);
byte flags = dataStream.readByte();
final StringRef defaultMethodValue = PsiMethodStubImpl.isAnnotationMethod(flags) ? dataStream.readName() : null;
return new PsiMethodStubImpl(parentStub, name, type, flags, defaultMethodValue);
return new PsiMethodStubImpl(parentStub, StringRef.toString(name), type, flags, StringRef.toString(defaultMethodValue));
}
@Override
@@ -30,7 +30,6 @@ import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.BitUtil;
import com.intellij.util.cls.ClsFormatException;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -39,8 +38,8 @@ import java.util.List;
public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodStub {
private final TypeInfo myReturnType;
private final byte myFlags;
private final StringRef myName;
private StringRef myDefaultValueText;
private final String myName;
private String myDefaultValueText;
private static final int CONSTRUCTOR = 0x01;
private static final int VARARGS = 0x02;
@@ -51,7 +50,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
private static final int HAS_DOC_COMMENT = 0x40;
public PsiMethodStubImpl(StubElement parent,
StringRef name,
String name,
byte flags,
String signature,
@NotNull List<String> args,
@@ -81,7 +80,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
myFlags = (byte)(flags | (parsedViaGenericSignature ? PARSED_VIA_GENERIC_SIGNATURE : 0));
}
public PsiMethodStubImpl(StubElement parent, StringRef name, @NotNull TypeInfo returnType, byte flags, StringRef defaultValueText) {
public PsiMethodStubImpl(StubElement parent, String name, @NotNull TypeInfo returnType, byte flags, @Nullable String defaultValueText) {
super(parent, isAnnotationMethod(flags) ? JavaStubElementTypes.ANNOTATION_METHOD : JavaStubElementTypes.METHOD);
myReturnType = returnType;
myFlags = flags;
@@ -114,7 +113,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
@Override
public String getDefaultValueText() {
return StringRef.toString(myDefaultValueText);
return myDefaultValueText;
}
@Override
@@ -158,7 +157,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
@Override
public String getName() {
return StringRef.toString(myName);
return myName;
}
public byte getFlags() {
@@ -166,7 +165,7 @@ public class PsiMethodStubImpl extends StubBase<PsiMethod> implements PsiMethodS
}
public void setDefaultValueText(final String defaultValueText) {
myDefaultValueText = StringRef.fromString(defaultValueText);
myDefaultValueText = defaultValueText;
}
public static byte packFlags(boolean isConstructor,
@@ -0,0 +1,12 @@
public class MainClass1 {
{
fu<caret>
}
void fun1() {}
void fun10() {}
void fun2() {}
}
@@ -0,0 +1,12 @@
interface Z {
void m();
}
interface X extends Z {}
interface Y extends Z {}
class Test {
{
((X & <caret>Y) () -> {}).m();
}
}
@@ -140,4 +140,13 @@ public class FragmentCompletionTest extends LightCodeInsightFixtureTestCase {
assert !myFixture.lookupElementStrings.contains('class')
}
public void "test annotation context"() {
def ctxFile = myFixture.addClass("class Class { void foo(int context) { @Anno int a; } }").containingFile
def context = ctxFile.findElementAt(ctxFile.text.indexOf('Anno'))
PsiFile file = JavaCodeFragmentFactory.getInstance(project).createExpressionCodeFragment("c<caret>", context, null, true);
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
myFixture.completeBasic()
assert myFixture.lookupElementStrings.contains('context')
}
}
@@ -704,4 +704,8 @@ interface TxANotAnno {}
checkPreferredItems 0, 'MainClass1', 'MainClass2', 'Maa'
}
public void testNaturalSorting() {
checkPreferredItems 0, 'fun1', 'fun2', 'fun10'
}
}
@@ -18,7 +18,11 @@ package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import com.intellij.codeInsight.daemon.impl.analysis.LambdaHighlightingUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiType;
import com.intellij.psi.PsiTypeCastExpression;
import com.intellij.psi.PsiTypeElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -86,4 +90,17 @@ public class FunctionalInterfaceTest extends LightDaemonAnalyzerTestCase {
public void testAbstractClass() throws Exception {
doTestFunctionalInterface("Target type of a lambda conversion must be an interface");
}
public void testIntersectionTypeWithSameBaseInterfaceInConjuncts() throws Exception {
String filePath = BASE_PATH + "/" + getTestName(false) + ".java";
configureByFile(filePath);
final PsiTypeCastExpression castExpression =
PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiTypeCastExpression.class);
assertNotNull(castExpression);
final PsiTypeElement castTypeElement = castExpression.getCastType();
assertNotNull(castTypeElement);
final PsiType type = castTypeElement.getType();
final String errorMessage = LambdaHighlightingUtil.checkInterfaceFunctional(type);
assertEquals(null, errorMessage);
}
}
@@ -18,6 +18,7 @@ package com.intellij.psi.stubs;
import com.intellij.util.io.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.DataInputStream;
import java.io.IOException;
@@ -35,10 +36,12 @@ public class StubInputStream extends DataInputStream {
myNameStorage = nameStorage;
}
@NotNull
public String readUTFFast() throws IOException {
return IOUtil.readUTFFast(myStringIOBuffer, this);
}
@Nullable
public StringRef readName() throws IOException {
return DataInputOutputUtil.readNAME(this, myNameStorage);
}
@@ -89,11 +89,11 @@ public class DiffManagerImpl extends DiffManagerEx {
@Override
public List<DiffTool> getDiffTools() {
List<DiffTool> result = new ArrayList<DiffTool>();
Collections.addAll(result, DiffTool.EP_NAME.getExtensions());
result.add(SimpleDiffTool.INSTANCE);
result.add(UnifiedDiffTool.INSTANCE);
result.add(BinaryDiffTool.INSTANCE);
result.add(DirDiffTool.INSTANCE);
Collections.addAll(result, DiffTool.EP_NAME.getExtensions());
return result;
}
@@ -40,6 +40,6 @@ public class UnifiedDiffTool implements FrameDiffTool {
@NotNull
@Override
public String getName() {
return "Oneside viewer";
return "Unified viewer";
}
}
@@ -601,7 +601,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
StringBuilder info = new StringBuilder();
Document document1 = getDocument(Side.LEFT);
Document document2 = getDocument(Side.RIGHT);
info.append("==== OnesideDiffViewer Debug Info ====");
info.append("==== UnifiedDiffViewer Debug Info ====");
info.append("myMasterSide - ").append(myMasterSide).append('\n');
info.append("myLeftDocument.length() - ").append(document1.getTextLength()).append('\n');
info.append("myRightDocument.length() - ").append(document2.getTextLength()).append('\n');
@@ -619,7 +619,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
.append(":").append(pair1.second).append('\n');
info.append("non-strict transferEndLine - ").append(pair2.first[0]).append("-").append(pair2.first[1])
.append(":").append(pair2.second).append('\n');
info.append("---- OnesideDiffViewer Debug Info ----");
info.append("---- UnifiedDiffViewer Debug Info ----");
LOG.warn(info.toString());
}
@@ -60,7 +60,7 @@ public class CompletionLookupArranger extends LookupArranger {
public int compare(LookupElement o1, LookupElement o2) {
String invariant = PRESENTATION_INVARIANT.get(o1);
assert invariant != null;
return invariant.compareToIgnoreCase(PRESENTATION_INVARIANT.get(o2));
return StringUtil.naturalCompare(invariant, PRESENTATION_INVARIANT.get(o2));
}
};
static final int MAX_PREFERRED_COUNT = 5;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.util.DocumentUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
@@ -92,7 +93,7 @@ public class AutoIndentLinesHandler implements CodeInsightActionHandler {
codeStyleManager.adjustLineIndent(file, lineStart);
}
} else {
codeStyleManager.adjustLineIndent(file, new TextRange(startOffset, endOffset));
codeStyleManager.adjustLineIndent(file, new TextRange(DocumentUtil.getLineStartOffset(startOffset, document), endOffset));
}
}
@@ -30,6 +30,7 @@ public class DataInputOutputUtil {
private DataInputOutputUtil() {}
@Nullable
public static StringRef readNAME(@NotNull DataInput record, @NotNull AbstractStringEnumerator nameStore) throws IOException {
return StringRef.fromStream(record, nameStore);
}
@@ -47,7 +47,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.WindowWrapper;
import com.intellij.openapi.util.BooleanGetter;
import com.intellij.openapi.util.Computable;
@@ -306,7 +305,8 @@ public class ApplyPatchAction extends DumbAwareAction {
}
@NotNull
public static DiffRequest createBadDiffRequest(@NotNull final VirtualFile file,
public static DiffRequest createBadDiffRequest(@Nullable Project project,
@NotNull final VirtualFile file,
@NotNull final ApplyPatchForBaseRevisionTexts texts) throws DiffRequestProducerException {
if (texts.getLocal() == null) {
throw new DiffRequestProducerException("Can't show diff for '" + file.getPresentableUrl() + "'");
@@ -317,10 +317,11 @@ public class ApplyPatchAction extends DumbAwareAction {
final List<String> titles = ContainerUtil.list(VcsBundle.message("diff.title.local"), "Patched (with problems)");
final DiffContentFactory contentFactory = DiffContentFactory.getInstance();
final DocumentContent originalContent = contentFactory.create(texts.getLocal().toString(), file.getFileType());
DocumentContent localContent = contentFactory.createDocument(project, file);
if (localContent == null) localContent = contentFactory.create(texts.getLocal().toString(), file.getFileType());
final DiffContent mergedContent = contentFactory.create(texts.getPatched(), file.getFileType());
final List<DiffContent> contents = ContainerUtil.list(originalContent, mergedContent);
final List<DiffContent> contents = ContainerUtil.list(localContent, mergedContent);
final DiffRequest request = new SimpleDiffRequest(windowTitle, contents, titles);
DiffUtil.addNotification(new DiffIsApproximateNotification(), request);
@@ -20,10 +20,8 @@ import com.intellij.diff.chains.DiffRequestProducerException;
import com.intellij.diff.contents.DocumentContent;
import com.intellij.diff.requests.DiffRequest;
import com.intellij.diff.requests.SimpleDiffRequest;
import com.intellij.diff.requests.UnknownFileTypeDiffRequest;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.UnknownFileType;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Getter;
@@ -71,16 +69,17 @@ public class PatchDiffRequestFactory {
ApplyPatchForBaseRevisionTexts texts = textsRef.get();
if (texts.getBase() == null) {
return ApplyPatchAction.createBadDiffRequest(file, texts);
return ApplyPatchAction.createBadDiffRequest(project, file, texts);
}
else {
DiffContentFactory contentFactory = DiffContentFactory.getInstance();
String path = FileUtil.toSystemDependentName(file.getPresentableUrl());
FileType type = file.getFileType();
String windowTitle = VcsBundle.message("patch.apply.conflict.title", path);
DocumentContent localContent = contentFactory.create(texts.getLocal().toString(), type);
DiffContentFactory contentFactory = DiffContentFactory.getInstance();
DocumentContent localContent = contentFactory.createDocument(project, file);
if (localContent == null) localContent = contentFactory.create(texts.getLocal().toString(), type);
DocumentContent baseContent = contentFactory.create(texts.getBase().toString(), type);
DocumentContent patchedContent = contentFactory.create(texts.getPatched(), type);
@@ -104,6 +104,7 @@ public class TextFilePatchInProgress extends AbstractFilePatchInProgress<TextFil
};
String afterTitle = getPatch().getAfterVersionId();
if (afterTitle == null) afterTitle = "Patched Version";
return PatchDiffRequestFactory.createConflict(project, file, afterTitle, getter, getName(), context, indicator);
}
else {
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2013 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2015 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.
@@ -27,6 +27,7 @@ import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.PsiReplacementUtil;
import com.siyeh.ig.psiutils.ExpectedTypeUtils;
import com.siyeh.ig.psiutils.InstanceOfUtils;
import com.siyeh.ig.psiutils.TypeUtils;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -135,13 +136,13 @@ public class OverlyStrongTypeCastInspection extends BaseInspection {
//then it's redundant, and caught by the built-in inspection
return;
}
if (isTypeParameter(expectedType)) {
if (TypeUtils.isTypeParameter(expectedType)) {
return;
}
if (expectedType instanceof PsiArrayType) {
final PsiArrayType arrayType = (PsiArrayType)expectedType;
final PsiType componentType = arrayType.getDeepComponentType();
if (isTypeParameter(componentType)) {
if (TypeUtils.isTypeParameter(componentType)) {
return;
}
}
@@ -180,14 +181,5 @@ public class OverlyStrongTypeCastInspection extends BaseInspection {
}
registerError(castTypeElement, expectedType);
}
private boolean isTypeParameter(PsiType type) {
if (!(type instanceof PsiClassType)) {
return false;
}
final PsiClassType classType = (PsiClassType)type;
final PsiClass aClass = classType.resolve();
return aClass != null && aClass instanceof PsiTypeParameter;
}
}
}
@@ -27,10 +27,7 @@ import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.PsiReplacementUtil;
import com.siyeh.ig.psiutils.ExpectedTypeUtils;
import com.siyeh.ig.psiutils.ExpressionUtils;
import com.siyeh.ig.psiutils.MethodCallUtils;
import com.siyeh.ig.psiutils.ParenthesesUtils;
import com.siyeh.ig.psiutils.*;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -242,13 +239,8 @@ public class UnnecessaryBoxingInspection extends BaseInspection {
}
else if (parent instanceof PsiTypeCastExpression) {
final PsiTypeCastExpression castExpression = (PsiTypeCastExpression)parent;
final PsiType castType = castExpression.getType();
if (castType instanceof PsiClassType) {
final PsiClassType classType = (PsiClassType)castType;
final PsiClass aClass = classType.resolve();
if (aClass instanceof PsiTypeParameter) {
return false;
}
if (TypeUtils.isTypeParameter(castExpression.getType())) {
return false;
}
}
else if (parent instanceof PsiConditionalExpression) {
@@ -28,6 +28,7 @@ import com.siyeh.ig.BaseInspectionVisitor;
import com.siyeh.ig.InspectionGadgetsFix;
import com.siyeh.ig.psiutils.MethodCallUtils;
import com.siyeh.ig.psiutils.ParenthesesUtils;
import com.siyeh.ig.psiutils.TypeUtils;
import org.jdom.Element;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
@@ -124,6 +125,9 @@ public class UnaryPlusInspection extends BaseInspection {
return;
}
final PsiType type = operand.getType();
if (type == null) {
return;
}
if (onlyReportInsideBinaryExpression) {
final PsiElement parent = ParenthesesUtils.getParentSkipParentheses(prefixExpression);
if (!(operand instanceof PsiParenthesizedExpression) && !(operand instanceof PsiPrefixExpression) &&
@@ -131,7 +135,7 @@ public class UnaryPlusInspection extends BaseInspection {
return;
}
}
else if (PsiType.BYTE.equals(type) || PsiType.SHORT.equals(type)) {
else if (TypeUtils.unaryNumericPromotion(type) != type) {
PsiExpression expression = prefixExpression;
PsiElement parent = expression.getParent();
while (parent instanceof PsiParenthesizedExpression) {
@@ -173,7 +173,7 @@ public class ExpectedTypeUtils {
expectedType = type;
}
else if (isShiftOperation(tokenType)) {
expectedType = unaryNumericPromotion(wrappedExpressionType);
expectedType = TypeUtils.unaryNumericPromotion(wrappedExpressionType);
}
else if (ComparisonUtils.isEqualityComparison(polyadicExpression)) {
final PsiExpression operand1 = operands[0];
@@ -229,30 +229,6 @@ public class ExpectedTypeUtils {
return null;
}
/**
* JLS 5.6.1 Unary Numeric Promotion
*/
private static PsiType unaryNumericPromotion(PsiType type) {
if (type == null) {
return null;
}
if (type.equalsToText("java.lang.Byte") || type.equalsToText("java.lang.Short") ||
type.equalsToText("java.lang.Character") || type.equalsToText("java.lang.Integer") ||
type.equals(PsiType.BYTE) || type.equals(PsiType.SHORT) || type.equals(PsiType.CHAR)) {
return PsiType.INT;
}
else if (type.equalsToText("java.lang.Long")) {
return PsiType.LONG;
}
else if (type.equalsToText("java.lang.Float")) {
return PsiType.FLOAT;
}
else if (type.equalsToText("java.lang.Double")) {
return PsiType.DOUBLE;
}
return type;
}
@Override
public void visitPrefixExpression(@NotNull PsiPrefixExpression expression) {
final PsiType type = expression.getType();
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2014 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2015 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.
@@ -204,4 +204,37 @@ public class TypeUtils {
}
return false;
}
public static boolean isTypeParameter(PsiType type) {
if (!(type instanceof PsiClassType)) {
return false;
}
final PsiClassType classType = (PsiClassType)type;
final PsiClass aClass = classType.resolve();
return aClass != null && aClass instanceof PsiTypeParameter;
}
/**
* JLS 5.6.1 Unary Numeric Promotion
*/
public static PsiType unaryNumericPromotion(PsiType type) {
if (type == null) {
return null;
}
if (type.equalsToText("java.lang.Byte") || type.equalsToText("java.lang.Short") ||
type.equalsToText("java.lang.Character") || type.equalsToText("java.lang.Integer") ||
type.equals(PsiType.BYTE) || type.equals(PsiType.SHORT) || type.equals(PsiType.CHAR)) {
return PsiType.INT;
}
else if (type.equalsToText("java.lang.Long")) {
return PsiType.LONG;
}
else if (type.equalsToText("java.lang.Float")) {
return PsiType.FLOAT;
}
else if (type.equalsToText("java.lang.Double")) {
return PsiType.DOUBLE;
}
return type;
}
}
@@ -398,13 +398,8 @@ public class WeakestTypeFinder {
}
}
if (!checked) {
final PsiType returnType = method.getReturnType();
if (returnType instanceof PsiClassType) {
final PsiClassType classType = (PsiClassType)returnType;
final PsiClass aClass = classType.resolve();
if (aClass instanceof PsiTypeParameter) {
return false;
}
if (TypeUtils.isTypeParameter(method.getReturnType())) {
return false;
}
final PsiClass containingClass = method.getContainingClass();
checkClass(containingClass, weakestTypeClasses);
@@ -8,4 +8,11 @@ class UnaryPlus {
m(+b); // calls different method when unary plus removed.
System.out.println(<warning descr="Unary '+' operator">+</warning>1);
}
public void n(Byte i) {}
public void n(int i) {}
void n() {
Byte b = 1;
m(+b);
}
}
@@ -22,6 +22,7 @@ import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyLanguage;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyElementType;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrThrowsClause;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
@@ -34,6 +35,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEn
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameter;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeParameterList;
import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.GrThrowsClauseImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.GrVariableDeclarationImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrBlockImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.blocks.GrClosableBlockImpl;
@@ -311,8 +313,12 @@ public interface GroovyElementTypes {
GroovyElementType EXPLICIT_CONSTRUCTOR = new GroovyElementType("explicit constructor invokation");
//throws
GroovyElementType THROW_CLAUSE = new GroovyElementType("throw clause", true);
GrReferenceListElementType<GrThrowsClause> THROW_CLAUSE = new GrReferenceListElementType<GrThrowsClause>("throw clause") {
@Override
public GrThrowsClause createPsi(@NotNull GrReferenceListStub stub) {
return new GrThrowsClauseImpl(stub);
}
};
//annotation
GroovyElementType ANNOTATION_ARRAY_INITIALIZER = new GroovyElementType("annotation array initializer");
GroovyElementType ANNOTATION_ARGUMENTS = new GroovyElementType("annotation arguments", true);
@@ -337,7 +343,7 @@ public interface GroovyElementTypes {
@Override
public GrParameterStub createStub(@NotNull GrParameter psi, StubElement parentStub) {
return new GrParameterStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi), GrStubUtils.getTypeText(
psi.getTypeElementGroovy()));
psi.getTypeElementGroovy()), GrParameterStub.encodeFlags(psi.getInitializerGroovy() != null, psi.isVarArgs()));
}
@Override
@@ -345,6 +351,7 @@ public interface GroovyElementTypes {
dataStream.writeName(stub.getName());
GrStubUtils.writeStringArray(dataStream, stub.getAnnotations());
GrStubUtils.writeNullableString(dataStream, stub.getTypeText());
dataStream.writeVarInt(stub.getFlags());
}
@NotNull
@@ -353,7 +360,8 @@ public interface GroovyElementTypes {
final StringRef name = dataStream.readName();
final String[] annotations = GrStubUtils.readStringArray(dataStream);
final String typeText = GrStubUtils.readNullableString(dataStream);
return new GrParameterStub(parentStub, name, annotations, typeText);
final int flags = dataStream.readVarInt();
return new GrParameterStub(parentStub, name, annotations, typeText, flags);
}
};
@@ -16,12 +16,11 @@
package org.jetbrains.plugins.groovy.lang.psi.api.auxiliary;
import com.intellij.psi.PsiReferenceList;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrReferenceList;
/**
* @author: Dmitry.Krasilschikov
* @date: 03.04.2007
*/
public interface GrThrowsClause extends GroovyPsiElement, PsiReferenceList {
public interface GrThrowsClause extends GrReferenceList {
}
@@ -23,26 +23,36 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiJavaCodeReferenceElement;
import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.impl.light.LightClassReference;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrThrowsClause;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.GrClassReferenceType;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.typedef.GrReferenceListImpl;
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrReferenceListStub;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import java.util.ArrayList;
import java.util.List;
/**
* @author: Dmitry.Krasilschikov
* @date: 03.04.2007
*/
public class GrThrowsClauseImpl extends GroovyPsiElementImpl implements GrThrowsClause {
public class GrThrowsClauseImpl extends GrReferenceListImpl implements GrThrowsClause {
public GrThrowsClauseImpl(GrReferenceListStub stub) {
super(stub, GroovyElementTypes.THROW_CLAUSE);
}
@Override
protected IElementType getKeywordType() {
return GroovyTokenTypes.kTHROWS;
}
public GrThrowsClauseImpl(@NotNull ASTNode node) {
super(node);
}
@@ -75,23 +85,6 @@ public class GrThrowsClauseImpl extends GroovyPsiElementImpl implements GrThrows
return result.toArray(new PsiJavaCodeReferenceElement[result.size()]);
}
@Override
@NotNull
public PsiClassType[] getReferencedTypes() {
List<GrCodeReferenceElement> refs = new ArrayList<GrCodeReferenceElement>();
for (PsiElement cur = getFirstChild(); cur != null; cur = cur.getNextSibling()) {
if (cur instanceof GrCodeReferenceElement) refs.add((GrCodeReferenceElement)cur);
}
if (refs.isEmpty()) return PsiClassType.EMPTY_ARRAY;
PsiClassType[] result = new PsiClassType[refs.size()];
for (int i = 0; i < result.length; i++) {
result[i] = new GrClassReferenceType(refs.get(i));
}
return result;
}
@Override
public Role getRole() {
return Role.THROWS_LIST;
@@ -184,6 +184,11 @@ public class GrParameterImpl extends GrVariableBaseImpl<GrParameterStub> impleme
@Override
public boolean isOptional() {
final GrParameterStub stub = getStub();
if (stub != null) {
return GrParameterStub.hasInitializer(stub.getFlags());
}
return getInitializerGroovy() != null;
}
@@ -242,6 +247,11 @@ public class GrParameterImpl extends GrVariableBaseImpl<GrParameterStub> impleme
@Override
public boolean isVarArgs() {
GrParameterStub stub = getStub();
if (stub != null) {
return GrParameterStub.isVarRags(stub.getFlags());
}
PsiElement dots = getEllipsisDots();
return dots != null;
}
@@ -331,7 +331,7 @@ public abstract class GrMethodBaseImpl extends GrStubElementBase<GrMethodStub> i
@Override
@NotNull
public PsiReferenceList getThrowsList() {
return (PsiReferenceList)findNotNullChildByType(GroovyElementTypes.THROW_CLAUSE);
return ObjectUtils.assertNotNull(getStubOrPsiChild(GroovyElementTypes.THROW_CLAUSE));
}
@Override
@@ -95,15 +95,13 @@ public class GrReflectedMethodImpl extends LightMethodBuilder implements GrRefle
}
}
for (PsiElement modifier : baseMethod.getModifierList().getModifiers()) {
if (modifier instanceof GrAnnotation) {
final String qualifiedName = ((GrAnnotation)modifier).getQualifiedName();
if (qualifiedName != null) {
myModifierList.addAnnotation(qualifiedName);
}
else {
myModifierList.addAnnotation(((GrAnnotation)modifier).getShortName());
}
for (PsiAnnotation annotation : baseMethod.getModifierList().getRawAnnotations()) {
final String qualifiedName = annotation.getQualifiedName();
if (qualifiedName != null) {
myModifierList.addAnnotation(qualifiedName);
}
else {
myModifierList.addAnnotation(((GrAnnotation)annotation).getShortName());
}
}
@@ -18,6 +18,7 @@ package org.jetbrains.plugins.groovy.lang.psi.stubs;
import com.intellij.psi.stubs.NamedStub;
import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.BitUtil;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
@@ -30,15 +31,18 @@ public class GrParameterStub extends StubBase<GrParameter> implements NamedStub<
private final StringRef myName;
private final String[] myAnnotations;
private final String myTypeText;
private final int myFlags;
public GrParameterStub(StubElement parent,
StringRef name,
final String[] annotations,
String typeText) {
String typeText,
int flags) {
super(parent, GroovyElementTypes.PARAMETER);
myName = name;
myAnnotations = annotations;
myTypeText = typeText;
myFlags = flags;
}
@Override
@@ -55,4 +59,19 @@ public class GrParameterStub extends StubBase<GrParameter> implements NamedStub<
return myTypeText;
}
public int getFlags() {
return myFlags;
}
public static int encodeFlags(boolean hasInitializer, boolean isVarArgs) {
return (hasInitializer ? 2 : 0) + (isVarArgs ? 1 : 0);
}
public static boolean hasInitializer(int flags) {
return BitUtil.isSet(flags, 2);
}
public static boolean isVarRags(int flags) {
return BitUtil.isSet(flags, 1);
}
}
@@ -58,7 +58,7 @@ public class GrStubFileElementType extends IStubFileElementType<GrFileStub> {
@Override
public int getStubVersion() {
return super.getStubVersion() + 23;
return super.getStubVersion() + 24;
}
@Override
@@ -14,11 +14,9 @@
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.lang.psi
import com.intellij.psi.*
import org.jetbrains.plugins.groovy.LightGroovyTestCase
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyFileImpl
/**
* Created by Max Medvedev on 12/4/13
*/
@@ -220,4 +218,18 @@ class X {
assert file.contentsLoaded
}
public void "test do not load content for findMethodsByName"() {
GroovyFileImpl file = myFixture.addFileToProject('usage.groovy', '''\
class X {
void foo(int a, int b = 2) {}
}
''') as GroovyFileImpl
assert !file.contentsLoaded
PsiClass clazz = file.classes[0]
assert !file.contentsLoaded
assert clazz.findMethodsByName('foo', false).size() == 2
assert !file.contentsLoaded
}
}
+15
View File
@@ -275,14 +275,17 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Parameter list]
[Parameter : file]
[Modifiers]
[Throw clause]
[Constructor : ConfigObject]
[Modifiers]
[Parameter list]
[Throw clause]
[Method : writeTo]
[Modifiers]
[Parameter list]
[Parameter : outArg]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Method : getProperty]
@@ -290,24 +293,29 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Parameter list]
[Parameter : name]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Method : flatten]
[Modifiers]
[Parameter list]
[Throw clause]
[Method : flatten]
[Modifiers]
[Parameter list]
[Parameter : target]
[Modifiers]
[Throw clause]
[Method : merge]
[Modifiers]
[Parameter list]
[Parameter : other]
[Modifiers]
[Throw clause]
[Method : toProperties]
[Modifiers]
[Parameter list]
[Throw clause]
[Variable definitions]
[Modifiers]
[Method : toProperties]
@@ -315,6 +323,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Parameter list]
[Parameter : prefix]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Parameter list]
@@ -325,6 +334,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Modifiers]
[Parameter : other]
[Modifiers]
[Throw clause]
[Parameter : entry]
[Modifiers]
[Variable definitions]
@@ -342,6 +352,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Modifiers]
[Parameter : apply]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Parameter : key]
@@ -389,6 +400,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Modifiers]
[Parameter : out]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Parameter list]
@@ -407,6 +419,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Modifiers]
[Parameter : out]
[Modifiers]
[Throw clause]
[Parameter list]
[Variable definitions]
[Modifiers]
@@ -416,6 +429,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Parameter list]
[Parameter : props]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Parameter : e]
@@ -429,6 +443,7 @@ class ConfigObject extends LinkedHashMap implements Writable {
[Modifiers]
[Parameter : map]
[Modifiers]
[Throw clause]
[Parameter : key]
[Modifiers]
[Variable definitions]
+12 -1
View File
@@ -305,21 +305,25 @@ class ConfigBinding extends Binding {
[Constructor : ConfigSlurper]
[Modifiers]
[Parameter list]
[Throw clause]
[Constructor : ConfigSlurper]
[Modifiers]
[Parameter list]
[Parameter : env]
[Modifiers]
[Throw clause]
[Method : setBinding]
[Modifiers]
[Parameter list]
[Parameter : vars]
[Modifiers]
[Throw clause]
[Method : parse]
[Modifiers]
[Parameter list]
[Parameter : properties]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Parameter : key]
@@ -351,21 +355,25 @@ class ConfigBinding extends Binding {
[Parameter list]
[Parameter : script]
[Modifiers]
[Throw clause]
[Method : parse]
[Modifiers]
[Parameter list]
[Parameter : scriptClass]
[Modifiers]
[Throw clause]
[Method : parse]
[Modifiers]
[Parameter list]
[Parameter : script]
[Modifiers]
[Throw clause]
[Method : parse]
[Modifiers]
[Parameter list]
[Parameter : scriptLocation]
[Modifiers]
[Throw clause]
[Method : parse]
[Modifiers]
[Parameter list]
@@ -373,6 +381,7 @@ class ConfigBinding extends Binding {
[Modifiers]
[Parameter : location]
[Modifiers]
[Throw clause]
[Variable definitions]
[Modifiers]
[Variable definitions]
@@ -439,10 +448,12 @@ class ConfigBinding extends Binding {
[Parameter list]
[Parameter : c]
[Modifiers]
[Throw clause]
[Method : setVariable]
[Modifiers]
[Parameter list]
[Parameter : name]
[Modifiers]
[Parameter : value]
[Modifiers]
[Modifiers]
[Throw clause]
+2 -1
View File
@@ -16,4 +16,5 @@ class Stub {
[Modifiers]
[Parameter list]
[Parameter : i]
[Modifiers]
[Modifiers]
[Throw clause]
+2 -1
View File
@@ -16,4 +16,5 @@
[Modifiers]
[Type parameter list]
[Type parameter : T]
[Parameter list]
[Parameter list]
[Throw clause]
Binary file not shown.
Binary file not shown.
@@ -217,6 +217,17 @@ public class TestNGRunnableState extends JavaTestFrameworkRunnableState<TestNGCo
return javaParameters;
}
@Override
protected List<String> getNamedParams(String parameters) {
try {
Integer.parseInt(parameters);
return super.getNamedParams(parameters);
}
catch (NumberFormatException e) {
return Arrays.asList(parameters.split(" "));
}
}
@NotNull
@Override
protected String getForkMode() {
@@ -110,7 +110,9 @@ public class PyCharmEduInitialConfigurator {
"SelectIn", "GotoTypeDeclaration", "QuickChangeScheme",
"GotoTest", "GotoRelated", "Hierarchy Actions", "Bookmarks",
"Goto Error/Bookmark Actions", "GoToEditPointGroup",
"Change Navigation Actions", "Method Navigation Actions");
"Change Navigation Actions", "Method Navigation Actions",
"EvaluateExpression", "Pause", "ViewBreakpoints",
"XDebugger.MuteBreakpoints");
public static class First {
+2
View File
@@ -135,6 +135,8 @@
area="IDEA_PROJECT"/>
<extensionPoint name="debugger.jvmSmartStepIntoHandler"
interface="com.intellij.debugger.actions.JvmSmartStepIntoHandler"/>
<extensionPoint name="debugger.jvmSteppingCommandProvider"
interface="com.intellij.debugger.impl.JvmSteppingCommandProvider"/>
<extensionPoint name="debugger.frameExtraVarsProvider"
interface="com.intellij.debugger.engine.FrameExtraVariablesProvider"/>
@@ -245,8 +245,9 @@ public class XmlResourceResolver implements XMLEntityResolver {
if (publicId != null) {
try {
String userDir = new File(System.getProperty("user.dir")).toURI().getPath();
if (new URI(publicId).getPath().startsWith(userDir)) {
publicId = publicId.substring(publicId.indexOf(userDir) + userDir.length());
String publicIdPath = new URI(publicId).getPath();
if (publicIdPath.startsWith(userDir)) {
publicId = publicIdPath.substring(publicIdPath.indexOf(userDir) + userDir.length());
}
}
catch (Exception e) {