Merge branch 'master' into sort

Conflicts:
	platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
This commit is contained in:
peter
2011-02-15 21:25:18 +01:00
18 changed files with 123 additions and 42 deletions
@@ -1009,10 +1009,23 @@ class ControlFlowAnalyzer extends JavaJspElementVisitor {
final PsiType type = catchBlockParameters[i].getType();
// todo cast param
if (type instanceof PsiClassType && ExceptionUtil.isUncheckedExceptionOrSuperclass((PsiClassType)type) ||
type instanceof PsiDisjunctionType && ExceptionUtil.isUncheckedExceptionOrSuperclass(((PsiDisjunctionType)type).getLeastUpperBound())) {
if (type instanceof PsiClassType && ExceptionUtil.isUncheckedExceptionOrSuperclass((PsiClassType)type)) {
myUnhandledExceptionCatchBlocks.push(catchBlocks[i]);
}
else if (type instanceof PsiDisjunctionType) {
final PsiType lub = ((PsiDisjunctionType)type).getLeastUpperBound();
if (lub instanceof PsiClassType && ExceptionUtil.isUncheckedExceptionOrSuperclass((PsiClassType)lub)) {
myUnhandledExceptionCatchBlocks.push(catchBlocks[i]);
}
else if (lub instanceof PsiIntersectionType) {
for (PsiType conjunct : ((PsiIntersectionType)lub).getConjuncts()) {
if (conjunct instanceof PsiClassType && ExceptionUtil.isUncheckedExceptionOrSuperclass((PsiClassType)conjunct)) {
myUnhandledExceptionCatchBlocks.push(catchBlocks[i]);
break;
}
}
}
}
}
PsiCodeBlock finallyBlock = statement.getFinallyBlock();
@@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.parsing;
import com.intellij.codeInsight.daemon.JavaErrorMessages;
import com.intellij.lang.ASTFactory;
import com.intellij.lang.ASTNode;
import com.intellij.lexer.FilterLexer;
import com.intellij.lexer.JavaLexer;
import com.intellij.lexer.Lexer;
@@ -406,7 +407,7 @@ public class ExpressionParsing extends Parsing {
final CompositeElement expr = parseUnaryExpression(lexer);
if (expr == null) {
final TreeElement lastNode = TreeUtil.findLastLeaf(type);
final ASTNode lastNode = TreeUtil.findLastLeaf(type);
if (lastNode.getElementType() != JavaTokenType.GT) { //cannot parse correct parenthesized expression if we already parsed correct parameterized type
lexer.restore(pos);
return parsePostfixExpression(lexer);
@@ -1,18 +1,23 @@
abstract class C {
private static class NE { }
private static class E extends Exception { }
private static class E extends Exception { public String s; }
private static class E1 extends E { }
private static class E2 extends E { }
private static class E3 extends E { }
private static class RE extends RuntimeException { }
private interface I { }
private static class IE1 extends E implements I { }
private static class IE2 extends E implements I { }
abstract void f() throws E1, E2;
abstract void g() throws IE1, IE2;
void m() {
try { f(); } catch (E1 | E2 e) { }
try { f(); } catch (E2 | E e) { e.printStackTrace(); }
try { f(); } catch (E2 | E e) { e.printStackTrace(); System.out.println(e.s); }
try { f(); } catch (E2 | E1 e) { } catch (E e) { } catch (RE e) { }
try { f(); } catch (E1 | E e) { E ee = e; }
try { g(); } catch (IE1 | IE2 e) { E ee = e; I ii = e; }
try { f(); } catch (E1 | E2 | <error descr="Exception 'C.E3' is never thrown in the corresponding try block">E3</error> e) { }
try { f(); } catch (<error descr="Exception 'C.E3' is never thrown in the corresponding try block">E3</error> | E e) { }
@@ -30,7 +30,7 @@ import java.util.List;
public class PsiDisjunctionType extends PsiType {
private final PsiTypeElement myTypeElement;
private final List<PsiType> myTypes;
private final CachedValue<PsiClassType> myLubCache;
private final CachedValue<PsiType> myLubCache;
public PsiDisjunctionType(final PsiTypeElement typeElement) {
super(PsiAnnotation.EMPTY_ARRAY);
@@ -46,19 +46,18 @@ public class PsiDisjunctionType extends PsiType {
}));
final CachedValuesManager cacheManager = CachedValuesManager.getManager(myTypeElement.getProject());
myLubCache = cacheManager.createCachedValue(new CachedValueProvider<PsiClassType>() {
public Result<PsiClassType> compute() {
myLubCache = cacheManager.createCachedValue(new CachedValueProvider<PsiType>() {
public Result<PsiType> compute() {
PsiType lub = myTypes.get(0);
for (int i = 1; i < myTypes.size(); i++) {
lub = GenericsUtil.getLeastUpperBound(lub, myTypes.get(i), myTypeElement.getManager());
}
assert lub instanceof PsiClassType : getCanonicalText() + ", " + lub;
return Result.create((PsiClassType)lub, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
return Result.create(lub, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
}
}, false);
}
public PsiClassType getLeastUpperBound() {
public PsiType getLeastUpperBound() {
return myLubCache.getValue();
}
@@ -102,7 +101,11 @@ public class PsiDisjunctionType extends PsiType {
@Override
public <A> A accept(final PsiTypeVisitor<A> visitor) {
return visitor.visitClassType(getLeastUpperBound());
final PsiType lub = getLeastUpperBound();
if (lub instanceof PsiClassType) {
return visitor.visitClassType((PsiClassType)lub);
}
return visitor.visitType(lub);
}
@Override
@@ -98,6 +98,12 @@ public final class PsiUtil extends PsiUtilBase {
if (type instanceof PsiClassType) {
return ((PsiClassType)type).resolveGenerics();
}
if (type instanceof PsiDisjunctionType) {
final PsiType lub = ((PsiDisjunctionType)type).getLeastUpperBound();
if (lub instanceof PsiClassType) {
return ((PsiClassType)lub).resolveGenerics();
}
}
if (type == null && expression instanceof PsiReferenceExpression) {
JavaResolveResult resolveResult = ((PsiReferenceExpression)expression).advancedResolve(false);
if (resolveResult.getElement() instanceof PsiClass) {
@@ -372,7 +378,10 @@ public final class PsiUtil extends PsiUtilBase {
return resolveClassInType(((PsiArrayType) type).getComponentType());
}
if (type instanceof PsiDisjunctionType) {
return ((PsiDisjunctionType)type).getLeastUpperBound().resolve();
final PsiType lub = ((PsiDisjunctionType)type).getLeastUpperBound();
if (lub instanceof PsiClassType) {
return ((PsiClassType)lub).resolve();
}
}
return null;
}
@@ -385,6 +394,12 @@ public final class PsiUtil extends PsiUtilBase {
if (type instanceof PsiArrayType) {
return resolveGenericsClassInType(((PsiArrayType) type).getComponentType());
}
if (type instanceof PsiDisjunctionType) {
final PsiType lub = ((PsiDisjunctionType)type).getLeastUpperBound();
if (lub instanceof PsiClassType) {
return ((PsiClassType)lub).resolveGenerics();
}
}
return PsiClassType.ClassResolveResult.EMPTY;
}
@@ -108,14 +108,7 @@ public abstract class AbstractConsoleRunnerWithHistory {
myProcessHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
myRunAction.getTemplatePresentation().setEnabled(false);
myConsoleView.getConsole().setPrompt("");
myConsoleView.getConsole().getConsoleEditor().setRendererMode(true);
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
myConsoleView.getConsole().getConsoleEditor().getComponent().updateUI();
}
});
finishConsole();
}
});
@@ -155,6 +148,17 @@ public abstract class AbstractConsoleRunnerWithHistory {
myProcessHandler.startNotify();
}
protected void finishConsole() {
myRunAction.getTemplatePresentation().setEnabled(false);
myConsoleView.getConsole().setPrompt("");
myConsoleView.getConsole().getConsoleEditor().setRendererMode(true);
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
myConsoleView.getConsole().getConsoleEditor().getComponent().updateUI();
}
});
}
protected abstract LanguageConsoleViewImpl createConsoleView();
@Nullable
@@ -166,7 +166,7 @@ public class EditorSearchComponent extends JPanel implements DataProvider, LiveP
myProject = project;
myEditor = editor;
myLivePreview = new LivePreview(myEditor.getProject());
myLivePreview = new LivePreview(myEditor.getProject(), 0);
myLivePreview.addCursorListener(this);
myLivePreview.setDelegate(myLivePreviewController);
@@ -378,7 +378,7 @@ public class EditorSearchComponent extends JPanel implements DataProvider, LiveP
replacement.add(myPreserveCase);
for (Component comp : replacement.getComponents()) {
if (comp instanceof JComponent) {
setSmallerFont((JComponent)comp);
setSmallerFontAndOpaque((JComponent)comp);
}
}
}
@@ -156,6 +156,8 @@ public class LivePreview extends DocumentAdapter implements ReplacementView.Dele
private Runnable myContinuation;
private int myUserActivityDelay = USER_ACTIVITY_TRIGGERING_DELAY;
public Runnable getContinuation() {
return myContinuation;
}
@@ -174,7 +176,11 @@ public class LivePreview extends DocumentAdapter implements ReplacementView.Dele
public LivePreview(Project project) {
myProject = project;
// updateEditorReference();
}
public LivePreview(Project project, int delay) {
this(project);
myUserActivityDelay = delay;
}
public Delegate getDelegate() {
@@ -223,7 +229,7 @@ public class LivePreview extends DocumentAdapter implements ReplacementView.Dele
public void run() {
updateInBackground();
}
}, USER_ACTIVITY_TRIGGERING_DELAY);
}, myUserActivityDelay);
}
}
@@ -237,7 +237,7 @@ public class FormatterUtil {
}
public static void replaceLastWhiteSpace(final ASTNode astNode, final String whiteSpace, final TextRange textRange) {
LeafElement lastWS = TreeUtil.findLastLeaf(astNode);
ASTNode lastWS = TreeUtil.findLastLeaf(astNode);
if (lastWS.getElementType() != TokenType.WHITE_SPACE) {
lastWS = null;
}
@@ -227,7 +227,7 @@ public class CodeEditUtil {
@Nullable
private static ASTNode findLastLeaf(ASTNode first, ASTNode last) {
do{
final LeafElement leaf = TreeUtil.findLastLeaf(last);
final ASTNode leaf = TreeUtil.findLastLeaf(last);
if(leaf != null) return leaf;
last = last.getTreePrev();
if (last == null) return null;
@@ -142,12 +142,12 @@ public class TreeUtil {
}
@Nullable
public static LeafElement findLastLeaf(ASTNode element) {
public static ASTNode findLastLeaf(ASTNode element) {
if (element instanceof LeafElement) {
return (LeafElement)element;
return element;
}
for (ASTNode child = element.getLastChildNode(); child != null; child = child.getTreePrev()) {
LeafElement leaf = findLastLeaf(child);
ASTNode leaf = findLastLeaf(child);
if (leaf != null) return leaf;
}
return null;
@@ -304,7 +304,7 @@ public class TreeUtil {
}
@Nullable
public static LeafElement prevLeaf(TreeElement start, @Nullable CommonParentState commonParent) {
public static ASTNode prevLeaf(TreeElement start, @Nullable CommonParentState commonParent) {
while (true) {
if (start == null) return null;
if (commonParent != null) {
@@ -314,7 +314,7 @@ public class TreeUtil {
commonParent.nextLeafBranchStart = start;
}
ASTNode prevTree = start;
LeafElement prev = null;
ASTNode prev = null;
while (prev == null && (prevTree = prevTree.getTreePrev()) != null) {
prev = findLastLeaf(prevTree);
}
@@ -93,8 +93,13 @@ public class BackgroundTaskQueue {
ProgressManager.getInstance().runProcess(new Runnable() {
@Override
public void run() {
// calls task's run and onCancel() or onSuccess()
RunBackgroundable.runIfBackgroundThread(backgroundable, pi, runnable);
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
// calls task's run and onCancel() or onSuccess()
RunBackgroundable.runIfBackgroundThread(backgroundable, pi, runnable);
}
});
}
}, pi);
}
@@ -20,7 +20,10 @@ import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiDisjunctionType;
import com.intellij.psi.PsiType;
import com.intellij.psi.PsiTypeElement;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.spellchecker.inspections.SplitterFactory;
import com.intellij.spellchecker.tokenizer.Token;
@@ -28,6 +31,10 @@ import com.intellij.spellchecker.tokenizer.Tokenizer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by IntelliJ IDEA.
*
@@ -38,7 +45,10 @@ public class PsiTypeTokenizer extends Tokenizer<PsiTypeElement> {
@Nullable
@Override
public Token[] tokenize(@NotNull PsiTypeElement element) {
final PsiClass psiClass = PsiUtil.resolveClassInType(element.getType());
final PsiType type = element.getType();
if (type instanceof PsiDisjunctionType) return tokenizeComplexType(element);
final PsiClass psiClass = PsiUtil.resolveClassInType(type);
if (psiClass == null || psiClass.getContainingFile() == null || psiClass.getContainingFile().getVirtualFile() == null) {
return null;
@@ -57,6 +67,19 @@ public class PsiTypeTokenizer extends Tokenizer<PsiTypeElement> {
SplitterFactory.getInstance().getIdentifierSplitter())};
}
@Nullable
private Token[] tokenizeComplexType(PsiTypeElement element) {
final List<PsiTypeElement> subTypes = PsiTreeUtil.getChildrenOfTypeAsList(element, PsiTypeElement.class);
final List<Token> result = new ArrayList<Token>(subTypes.size());
for (PsiTypeElement subType : subTypes) {
final Token[] tokens = tokenize(subType);
if (tokens != null) {
result.addAll(Arrays.asList(tokens));
}
}
return result.size() != 0 ? result.toArray(new Token[result.size()]) : null;
}
@NotNull
private TextRange getRangeToCheck(@NotNull String text, @NotNull String name) {
final int i = text.indexOf(name);
@@ -298,6 +298,7 @@ utils
validator
validators
vararg
varargs
varbinary
varchar
varcharacter
+1 -1
View File
@@ -42,4 +42,4 @@ SVNKit Continuous Build Server: https://teamcity.svnkit.com/
5. CONTACTS
On all questions related to SVNKit please contact us at support@svnkit.com
On all questions related to SVNKit please contact us at support@svnkit.com
Binary file not shown.
Binary file not shown.
@@ -155,13 +155,18 @@ public class SvnAuthenticationManager extends DefaultSVNAuthenticationManager im
private PersistentAuthenticationProviderProxy(File authDir, String userName) {
ISVNAuthenticationStorageOptions delegatingOptions = new ISVNAuthenticationStorageOptions() {
public boolean isNonInteractive() throws SVNException {
return getAuthenticationStorageOptions().isNonInteractive();
}
public boolean isNonInteractive() throws SVNException {
return getAuthenticationStorageOptions().isNonInteractive();
}
public ISVNAuthStoreHandler getAuthStoreHandler() throws SVNException {
return getAuthenticationStorageOptions().getAuthStoreHandler();
}
public ISVNAuthStoreHandler getAuthStoreHandler() throws SVNException {
return getAuthenticationStorageOptions().getAuthStoreHandler();
}
@Override
public ISVNGnomeKeyringPasswordProvider getGnomeKeyringPasswordProvider() {
return getAuthenticationStorageOptions().getGnomeKeyringPasswordProvider();
}
@Override
public boolean isSSLPassphrasePromptSupported() {