mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed integer multiplication in long context
This commit is contained in:
+7
-3
@@ -37,9 +37,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* refactored from {@link com.intellij.codeInsight.intention.impl.MoveInitializerToConstructorAction}
|
||||
* refactored from {@link MoveInitializerToConstructorAction}
|
||||
*
|
||||
* @author Danila Ponomarenko
|
||||
*/
|
||||
@@ -83,7 +84,10 @@ public abstract class BaseMoveInitializerToMethodAction extends PsiElementBaseIn
|
||||
if (methodsToAddInitialization.isEmpty()) return;
|
||||
|
||||
final List<PsiExpressionStatement> assignments = addFieldAssignments(field, methodsToAddInitialization);
|
||||
field.getInitializer().delete();
|
||||
PsiExpression initializer = field.getInitializer();
|
||||
if (initializer != null) {
|
||||
initializer.delete();
|
||||
}
|
||||
|
||||
if (!assignments.isEmpty()) {
|
||||
highlightRExpression((PsiAssignmentExpression)assignments.get(0).getExpression(), project, editor);
|
||||
@@ -131,7 +135,7 @@ public abstract class BaseMoveInitializerToMethodAction extends PsiElementBaseIn
|
||||
initializer = RefactoringUtil.convertInitializerToNormalExpression(initializer, field.getType());
|
||||
|
||||
final PsiAssignmentExpression expression = (PsiAssignmentExpression)statement.getExpression();
|
||||
expression.getRExpression().replace(initializer);
|
||||
Objects.requireNonNull(expression.getRExpression()).replace(Objects.requireNonNull(initializer));
|
||||
|
||||
final PsiElement newStatement = codeBlock.addBefore(statement, findFirstFieldUsage(codeBlock.getStatements(), field));
|
||||
replaceWithQualifiedReferences(newStatement, newStatement, factory);
|
||||
|
||||
@@ -789,7 +789,7 @@ public final class IconLoader {
|
||||
Image image = loadFromUrl(ctx, isDark());
|
||||
icon = checkIcon(image, CachedImageIcon.this);
|
||||
|
||||
if (icon != null && icon.getIconWidth() * icon.getIconHeight() * 4 < ImageLoader.CACHED_IMAGE_MAX_SIZE) {
|
||||
if (icon != null && 4L * icon.getIconWidth() * icon.getIconHeight() < ImageLoader.CACHED_IMAGE_MAX_SIZE) {
|
||||
scaledIconsCache.put(key(ctx), new SoftReference<ImageIcon>(icon));
|
||||
}
|
||||
return icon;
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ImageLoader implements Serializable {
|
||||
}
|
||||
Image image = loadImpl(url, stream, scale);
|
||||
if (image != null && cacheKey != null &&
|
||||
image.getWidth(null) * image.getHeight(null) * 4 <= CACHED_IMAGE_MAX_SIZE)
|
||||
4L * image.getWidth(null) * image.getHeight(null) <= CACHED_IMAGE_MAX_SIZE)
|
||||
{
|
||||
ourCache.put(cacheKey, image);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user