diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2013-02-08 15:14:04 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2013-02-08 15:14:04 -0800 |
commit | 9edc8f6b58f71ec510ba36b838f115718d9a174d (patch) | |
tree | 06f6df92024fa534ff27e1c0b5fc8b2002848093 /java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java | |
parent | b56ea2a18f232d79481e778085fd64e8ae486fc3 (diff) | |
download | idea-9edc8f6b58f71ec510ba36b838f115718d9a174d.tar.gz |
Snapshot of commit 84dc01e773388c2c72a1fc437f313dd5747e7809
from branch master of git://git.jetbrains.org/idea/community.git
Diffstat (limited to 'java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java')
-rw-r--r-- | java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java index e4c7098f6a21..d7f106a4852b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -712,7 +712,7 @@ public class HighlightMethodUtil { PsiType type = expression.getType(); boolean showShort = showShortType(i, parameters, expressions, substitutor); - @NonNls String mismatchColor = showShort ? null : "red"; + @NonNls String mismatchColor = showShort ? null : (UIUtil.isUnderDarcula() ? "ff6464" : "red"); ms += "<td> " + "<b><nobr>" + (i == 0 ? "(" : "") + "<font " + (showShort ? "" : "color=" + mismatchColor) + ">" + XmlStringUtil.escapeString(showShort ? type.getPresentableText() : HighlightUtil.formatType(type)) @@ -853,21 +853,24 @@ public class HighlightMethodUtil { @Nullable static HighlightInfo checkMethodCanHaveBody(PsiMethod method) { PsiClass aClass = method.getContainingClass(); - boolean hasBody = method.getBody() == null; + boolean hasNoBody = method.getBody() == null; boolean isInterface = aClass != null && aClass.isInterface(); boolean isExtension = method.hasModifierProperty(PsiModifier.DEFAULT); + boolean isStatic = method.hasModifierProperty(PsiModifier.STATIC); String message = null; - if (hasBody) { + if (hasNoBody) { if (isExtension) { message = JavaErrorMessages.message("extension.method.should.have.a.body"); + } else if (isInterface && isStatic) { + message = "Static methods in interfaces should have a body"; } } else if (isInterface) { - if (!isExtension) { + if (!isExtension && !isStatic) { message = JavaErrorMessages.message("interface.methods.cannot.have.body"); } - else { + else if (isExtension) { return HighlightUtil.checkExtensionMethodsFeature(method); } } @@ -884,7 +887,7 @@ public class HighlightMethodUtil { TextRange textRange = HighlightNamesUtil.getMethodDeclarationTextRange(method); HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, textRange, message); - if (hasBody) { + if (hasNoBody) { QuickFixAction.registerQuickFixAction(info, new DeleteMethodBodyFix(method)); } if (method.hasModifierProperty(PsiModifier.ABSTRACT) && isInterface) { |