mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-51944
This commit is contained in:
@@ -68,7 +68,6 @@ public class HighlightUtil {
|
||||
private static final Map<String, Set<String>> ourClassInitializerIncompatibleModifiers;
|
||||
private static final Set<String> ourConstructorNotAllowedModifiers;
|
||||
|
||||
private static final Key<String> HAS_OVERFLOW_IN_CHILD = Key.create("HAS_OVERFLOW_IN_CHILD");
|
||||
@NonNls private static final String SERIAL_VERSION_UID_FIELD_NAME = "serialVersionUID";
|
||||
@NonNls private static final String SERIAL_PERSISTENT_FIELDS_FIELD_NAME = "serialPersistentFields";
|
||||
private static final QuickFixFactory QUICK_FIX_FACTORY = QuickFixFactory.getInstance();
|
||||
@@ -1766,30 +1765,6 @@ public class HighlightUtil {
|
||||
}
|
||||
|
||||
|
||||
static HighlightInfo checkConstantExpressionOverflow(PsiExpression expr) {
|
||||
boolean overflow = false;
|
||||
try {
|
||||
if (expr.getUserData(HAS_OVERFLOW_IN_CHILD) == null && TypeConversionUtil.isNumericType(expr.getType())) {
|
||||
JavaPsiFacade.getInstance(expr.getProject()).getConstantEvaluationHelper().computeConstantExpression(expr, true);
|
||||
}
|
||||
else {
|
||||
overflow = true;
|
||||
}
|
||||
}
|
||||
catch (ConstantEvaluationOverflowException e) {
|
||||
overflow = true;
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.OVERFLOW_WARNING, expr, JavaErrorMessages.message("numeric.overflow.in.expression"));
|
||||
}
|
||||
finally {
|
||||
PsiElement parent = expr.getParent();
|
||||
if (overflow && parent instanceof PsiExpression) {
|
||||
parent.putUserData(HAS_OVERFLOW_IN_CHILD, "");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
private static String redIfNotMatch(PsiType type, boolean matches) {
|
||||
if (matches) return getFQName(type, false);
|
||||
|
||||
-1
@@ -354,7 +354,6 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkAssertOperatorTypes(expression));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkSynchronizedExpressionType(expression));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkConditionalExpressionBranchTypesMatch(expression));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkConstantExpressionOverflow(expression));
|
||||
if (!myHolder.hasErrorResults()
|
||||
&& expression.getParent() instanceof PsiThrowStatement
|
||||
&& ((PsiThrowStatement)expression.getParent()).getException() == expression) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.codeInspection.ex;
|
||||
|
||||
import com.intellij.codeInspection.InspectionToolProvider;
|
||||
import com.intellij.codeInspection.LossyEncodingInspection;
|
||||
import com.intellij.codeInspection.NumericOverflowInspection;
|
||||
import com.intellij.codeInspection.RedundantSuppressInspection;
|
||||
import com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstance;
|
||||
import com.intellij.codeInspection.canBeFinal.CanBeFinalInspection;
|
||||
@@ -79,6 +80,7 @@ public class StandardInspectionToolsProvider implements InspectionToolProvider {
|
||||
|
||||
DataFlowInspection.class,
|
||||
DefUseInspection.class,
|
||||
NumericOverflowInspection.class,
|
||||
RedundantCastInspection.class,
|
||||
RedundantTypeArgsInspection.class,
|
||||
RedundantArrayForVarargsCallInspection.class,
|
||||
|
||||
@@ -87,7 +87,6 @@ public interface HighlightInfoType {
|
||||
|
||||
HighlightInfoType WARNING = new HighlightInfoTypeImpl(HighlightSeverity.WARNING, CodeInsightColors.WARNINGS_ATTRIBUTES);
|
||||
HighlightInfoType INFO = new HighlightInfoTypeImpl(HighlightSeverity.INFO, CodeInsightColors.INFO_ATTRIBUTES);
|
||||
HighlightInfoType OVERFLOW_WARNING = new HighlightInfoTypeImpl(HighlightSeverity.WARNING, CodeInsightColors.ERRORS_ATTRIBUTES);
|
||||
HighlightInfoType INFORMATION = new HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, CodeInsightColors.INFORMATION_ATTRIBUTES);
|
||||
HighlightSeverity INJECTED_FRAGMENT_SEVERITY = new HighlightSeverity("INJECTED_FRAGMENT_SEVERITY", HighlightSeverity.INFORMATION.myVal-1);
|
||||
HighlightInfoType INJECTED_LANGUAGE_FRAGMENT = new HighlightInfoTypeImpl(INJECTED_FRAGMENT_SEVERITY, CodeInsightColors.INFORMATION_ATTRIBUTES);
|
||||
|
||||
@@ -37,10 +37,10 @@ public class Descriptor {
|
||||
private final HighlightDisplayKey myKey;
|
||||
|
||||
private final Element myConfig;
|
||||
private InspectionProfileEntry myTool;
|
||||
private final InspectionProfileEntry myTool;
|
||||
private final HighlightDisplayLevel myLevel;
|
||||
private boolean myEnabled = false;
|
||||
private NamedScope myScope;
|
||||
private final NamedScope myScope;
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.Descriptor");
|
||||
private final ScopeToolState myState;
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -47,7 +46,7 @@ public class ResourceUtil {
|
||||
if (url == null) continue;
|
||||
|
||||
try {
|
||||
final URLConnection connection = url.openConnection();
|
||||
url.openConnection();
|
||||
}
|
||||
catch (IOException e) {
|
||||
continue;
|
||||
@@ -105,7 +104,8 @@ public class ResourceUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static @NotNull String loadText(@NotNull URL url) throws IOException {
|
||||
@NotNull
|
||||
public static String loadText(@NotNull URL url) throws IOException {
|
||||
InputStream inputStream = new BufferedInputStream(URLUtil.openStream(url));
|
||||
|
||||
InputStreamReader reader = null;
|
||||
|
||||
Reference in New Issue
Block a user