Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-09-10 17:15:00 +04:00
9 changed files with 64 additions and 43 deletions
@@ -736,7 +736,8 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
}
public void flushVariable(@NotNull DfaVariableValue variable) {
if (variable.getPsiVariable().hasModifierProperty(PsiModifier.FINAL)) {
PsiVariable psiVariable = variable.getPsiVariable();
if (psiVariable instanceof PsiField && psiVariable.hasModifierProperty(PsiModifier.FINAL)) {
return;
}
@@ -0,0 +1,16 @@
public class Test {
public static void main(Object[] args) throws Exception {
boolean elvisLives = false;
for (final Object o : args) {
if (o instanceof Integer) {
elvisLives = true;
} else {
if (elvisLives) {
System.err.println("Elvis is alive!");
}
}
}
}
}
@@ -75,5 +75,6 @@ public class DataFlowInspectionFixtureTest extends JavaCodeInsightFixtureTestCas
public void testNotEqualsDoesntImplyNotNullity() throws Throwable { doTest(); }
public void testEqualsEnumConstant() throws Throwable { doTest(); }
public void testEqualsConstant() throws Throwable { doTest(); }
public void testFinalLoopVariableInstanceof() throws Throwable { doTest(); }
}
@@ -82,11 +82,11 @@ public class JBEditorTabs extends JBTabsImpl {
int _y = effectiveBounds.y + insets.top;
int _width = effectiveBounds.width - insets.left - insets.right + (getTabsPosition() == JBTabsPosition.right ? 1 : 0);
int _height = effectiveBounds.height - insets.top - insets.bottom;
if ((!isSingleRow() /* for multiline */) || (isSingleRow() && isHorizontalTabs())) {
if (isSingleRow() && getPosition() == JBTabsPosition.bottom) {
_y += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
_y += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
} else {
if (isSingleRow()) {
_height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
@@ -98,7 +98,7 @@ public class JBEditorTabs extends JBTabsImpl {
}
}
}
Color tabColor = label.getInfo().getTabColor();
if (tabColor != null) {
//g2d.setPaint(new LinearGradientPaint(_x, _y, _x, _y + effectiveBounds.height, new float[] {.3f, .6f, 1f}, new Color[] {new SameColor(170), new SameColor(150), new SameColor(90)}));
@@ -192,7 +192,7 @@ public class JBEditorTabs extends JBTabsImpl {
Rectangle r = label.getBounds();
ShapeInfo selectedShape = _computeSelectedLabelShape();
Insets insets = getTabsBorder().getEffectiveBorder();
Insets i = selectedShape.path.transformInsets(insets);
@@ -218,23 +218,23 @@ public class JBEditorTabs extends JBTabsImpl {
if (tabColor != null) {
g2d.setColor(multiplyColor(tabColor));
g2d.fill(selectedShape.fillPath.getShape());
g2d.setPaint(new GradientPaint(_x, _y, new Color(255, 255, 255, 150), _x, _y + _height, new Color(255, 255, 255, 0)));
} else {
g2d.setPaint(new GradientPaint(_x, _y, new SameColor(255), _x, _y + _height, new SameColor(230)));
}
g2d.fill(selectedShape.fillPath.getShape());
g2d.setColor(new Color(255, 255, 255, 180));
g2d.draw(selectedShape.fillPath.getShape());
// fix right side due to swing stupidity (fill & draw will occupy different shapes)
g2d.draw(selectedShape.labelPath
.transformLine(selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() +
selectedShape.labelPath.deltaY(1),
selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() -
selectedShape.labelPath.deltaY(4)));
selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() -
selectedShape.labelPath.deltaY(4)));
if (!isHorizontalTabs()) {
// side shadow
@@ -258,7 +258,7 @@ public class JBEditorTabs extends JBTabsImpl {
g2d.setColor(new Color(0, 0, 0, 50));
g2d.draw(selectedShape.labelPath.transformLine(i.left, selectedShape.labelPath.getMaxY(),
selectedShape.path.getMaxX(),
selectedShape.path.getMaxX(),
selectedShape.labelPath.getMaxY()));
}
@@ -266,14 +266,14 @@ public class JBEditorTabs extends JBTabsImpl {
public Color getBackground() {
return new SameColor(142);
}
protected ShapeInfo _computeSelectedLabelShape() {
final ShapeInfo shape = new ShapeInfo();
shape.path = getEffectiveLayout().createShapeTransform(getSize());
shape.insets = shape.path.transformInsets(getLayoutInsets());
shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds());
shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1);
shape.labelTopY =
shape.labelPath.getY() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? shape.labelPath.deltaY(1) : 0) ;
@@ -282,7 +282,7 @@ public class JBEditorTabs extends JBTabsImpl {
shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1);
int leftX = shape.insets.left + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(1));
shape.path.moveTo(leftX, shape.labelBottomY);
shape.path.lineTo(shape.labelLeftX, shape.labelBottomY);
shape.path.lineTo(shape.labelLeftX, shape.labelTopY);
@@ -294,10 +294,10 @@ public class JBEditorTabs extends JBTabsImpl {
shape.path.lineTo(lastX, shape.labelBottomY);
shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1));
shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1));
shape.path.closePath();
shape.fillPath = shape.path.copy();
return shape;
}
}
@@ -109,10 +109,13 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
if (b.getModel().isSelected()) {
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g.setPaint(Gray._200);
g.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
g.drawLine(iconRect.x + 4, iconRect.y + 6, iconRect.x + 7, iconRect.y + 10);
g.drawLine(iconRect.x + 7, iconRect.y + 10, iconRect.x + iconRect.width + 1, iconRect.y -1);
g.setPaint(Gray._30);
g.drawLine(iconRect.x + 4, iconRect.y + 8, iconRect.x + 9, iconRect.y + 14);
g.drawLine(iconRect.x + 9, iconRect.y + 14, iconRect.x + iconRect.width, iconRect.y+2);
g.setPaint(Gray._200);
g.drawLine(iconRect.x + 4, iconRect.y + 6, iconRect.x + 9, iconRect.y + 12);
g.drawLine(iconRect.x + 9, iconRect.y + 12, iconRect.x + iconRect.width, iconRect.y);
}
config.restore();
//icon.paintIcon(c, g, iconRect.x, iconRect.y);
@@ -51,8 +51,6 @@ TextPane.caretForeground=cccccc
CheckBox.background=333333
CheckBox.foreground=cccccc
CheckBox.icon=AllIcons.Darcula.Checkbox
CheckBox.selectedIcon=AllIcons.Darcula.CheckboxSelected
CheckBoxUI=com.intellij.ide.ui.laf.borders.DarculaCheckBoxUI
RadioButton.foreground=cccccc
@@ -18,14 +18,12 @@ package standardDsls
import com.intellij.psi.PsiType
import com.intellij.psi.util.PsiUtil
import static standardDsls.Constants.NUMBER
import static standardDsls.Constants.STRING
/**
* @author Maxim.Medvedev
*/
private interface Constants {
String NUMBER = "java.lang.Number"
String STRING = "java.lang.String"
String WILDCARD_PREFIX = "? extends "
}
@@ -61,22 +59,25 @@ contributor(ctype:"groovy.lang.GString") {
delegatesTo(findClass("java.lang.String"))
}
contributor(ctype:NUMBER) {
method name: "plus", type: NUMBER, params:[arg:NUMBER]
method name: "minus", type: NUMBER, params:[arg:NUMBER]
method name: "multiply", type: NUMBER, params:[arg:NUMBER]
method name: "power", type: NUMBER, params:[arg:NUMBER]
method name: "div", type: NUMBER, params:[arg:NUMBER]
method name: "mod", type: NUMBER, params:[arg:NUMBER]
method name: "or", type: NUMBER, params:[arg:NUMBER]
method name: "and", type: NUMBER, params:[arg:NUMBER]
method name: "xor", type: NUMBER, params:[arg:NUMBER]
method name: "next", type: removeWildcard(psiType.canonicalText)
method name: "previous", type: removeWildcard(psiType.canonicalText)
method name: "negative", type: removeWildcard(psiType.canonicalText)
method name: "positive", type: removeWildcard(psiType.canonicalText)
[Integer, Double, Float, Byte, Long, Short, Number].each {
def className = it.canonicalName
contributor(ctype: className) {
method name: "plus", type: className, params: [arg: className]
method name: "minus", type: className, params: [arg: className]
method name: "multiply", type: className, params: [arg: className]
method name: "power", type: className, params: [arg: className]
method name: "div", type: className, params: [arg: className]
method name: "mod", type: className, params: [arg: className]
method name: "or", type: className, params: [arg: className]
method name: "and", type: className, params: [arg: className]
method name: "xor", type: className, params: [arg: className]
method name: "next", type: className
method name: "previous", type: className
method name: "negative", type: className
method name: "positive", type: className
method name: "plus", type: STRING, params:[arg:STRING]
method name: "plus", type: STRING, params: [arg: STRING]
}
}
contributor(ctype: 'groovy.lang.MetaClass') {
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiErrorElement;
import com.intellij.psi.PsiRecursiveElementVisitor;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
@@ -66,7 +67,7 @@ public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPa
result.add(HighlightInfo.createHighlightInfo(HighlightInfoType.INFORMATION, element, null, DefaultHighlighter.KEYWORD));
}
}
else if (!(element instanceof GroovyPsiElement)) {
else if (!(element instanceof GroovyPsiElement || element instanceof PsiErrorElement)) {
final TextAttributesKey attribute = getDeclarationAttribute(element);
if (attribute != null) {
result.add(HighlightInfo.createHighlightInfo(HighlightInfoType.INFORMATION, element, null, attribute));
@@ -10,13 +10,13 @@ return null;
public void foo(int x) {
final groovy.lang.Reference<java.lang.Integer> i = new groovy.lang.Reference<java.lang.Integer>(x);
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(new java.util.ArrayList<java.lang.Integer>(java.util.Arrays.asList(1, 2, 3)), new groovy.lang.Closure<java.lang.Number>(this, this) {
public java.lang.Number doCall(java.lang.Object it) {
org.codehaus.groovy.runtime.DefaultGroovyMethods.each(new java.util.ArrayList<java.lang.Integer>(java.util.Arrays.asList(1, 2, 3)), new groovy.lang.Closure<java.lang.Integer>(this, this) {
public java.lang.Integer doCall(java.lang.Object it) {
org.codehaus.groovy.runtime.DefaultGroovyMethods.print(this, i.get());
return setGroovyRef(i, i.get() + 1);
}
public java.lang.Number doCall() {
public java.lang.Integer doCall() {
return doCall(null);
}