Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
d23a2526
Commit
d23a2526
authored
8 years ago
by
Tagir Valeev
Browse files
Options
Download
Email Patches
Plain Diff
Unnecessary boxing to compare primitives inspection applied
parent
b5897ecd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushTargetTextField.java
+1
-2
...pl/src/com/intellij/dvcs/push/ui/PushTargetTextField.java
platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java
+4
-4
...-impl/src/com/intellij/ui/popup/PopupPositionManager.java
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/SourceFolderImpl.java
+2
-2
...src/com/intellij/openapi/roots/impl/SourceFolderImpl.java
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/GenericPatchApplier.java
+2
-3
...ij/openapi/diff/impl/patch/apply/GenericPatchApplier.java
platform/vcs-tests/testSrc/com/intellij/openapi/vcs/HackSearchTest.java
+1
-1
...ests/testSrc/com/intellij/openapi/vcs/HackSearchTest.java
spellchecker/src/com/intellij/spellchecker/engine/Suggestion.java
+1
-1
...cker/src/com/intellij/spellchecker/engine/Suggestion.java
with
11 additions
and
13 deletions
+11
-13
platform/dvcs-impl/src/com/intellij/dvcs/push/ui/PushTargetTextField.java
+
1
-
2
View file @
d23a2526
...
...
@@ -21,7 +21,6 @@ import com.intellij.util.containers.ContainerUtil;
import
com.intellij.util.textCompletion.DefaultTextCompletionValueDescriptor
;
import
com.intellij.util.textCompletion.TextCompletionProvider
;
import
com.intellij.util.textCompletion.TextFieldWithCompletion
;
import
com.intellij.util.textCompletion.ValuesCompletionProvider
;
import
com.intellij.util.textCompletion.ValuesCompletionProvider.ValuesCompletionProviderDumbAware
;
import
org.jetbrains.annotations.NotNull
;
...
...
@@ -54,7 +53,7 @@ public class PushTargetTextField extends TextFieldWithCompletion {
return
new
ValuesCompletionProviderDumbAware
<>(
new
DefaultTextCompletionValueDescriptor
.
StringValueDescriptor
()
{
@Override
public
int
compare
(
String
item1
,
String
item2
)
{
return
Integer
.
valueOf
(
ContainerUtil
.
indexOf
(
targetVariants
,
item1
)
).
compareTo
(
ContainerUtil
.
indexOf
(
targetVariants
,
item2
));
return
Integer
.
compare
(
ContainerUtil
.
indexOf
(
targetVariants
,
item1
)
,
ContainerUtil
.
indexOf
(
targetVariants
,
item2
));
}
},
targetVariants
);
}
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/ui/popup/PopupPositionManager.java
+
4
-
4
View file @
d23a2526
...
...
@@ -35,7 +35,7 @@ import javax.swing.*;
import
java.awt.*
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.
Comparator
;
import
java.util.
List
;
/**
* @author pegov
...
...
@@ -216,7 +216,7 @@ public class PopupPositionManager {
}
else
{
// ok, popup does not fit, will try to resize it
final
java
.
util
.
List
<
Rectangle
>
boxes
=
new
ArrayList
<>();
final
List
<
Rectangle
>
boxes
=
new
ArrayList
<>();
// right
boxes
.
add
(
crop
(
myScreenRect
,
new
Rectangle
(
myRelativeOnScreen
.
x
+
myRelativeTo
.
getWidth
()
+
myGap
,
myRelativeOnScreen
.
y
,
myScreenRect
.
width
,
myScreenRect
.
height
)));
...
...
@@ -234,8 +234,8 @@ public class PopupPositionManager {
myScreenRect
.
width
,
myScreenRect
.
height
)));
Collections
.
sort
(
boxes
,
(
o1
,
o2
)
->
{
final
int
i
=
new
Integer
(
o1
.
width
).
compareTo
(
o2
.
width
);
return
i
==
0
?
new
Integer
(
o1
.
height
).
compareTo
(
o2
.
height
)
:
i
;
final
int
i
=
Integer
.
compare
(
o1
.
width
,
o2
.
width
);
return
i
==
0
?
Integer
.
compare
(
o1
.
height
,
o2
.
height
)
:
i
;
});
final
Rectangle
suitableBox
=
boxes
.
get
(
boxes
.
size
()
-
1
);
...
...
This diff is collapsed.
Click to expand it.
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/SourceFolderImpl.java
+
2
-
2
View file @
d23a2526
...
...
@@ -137,9 +137,9 @@ public class SourceFolderImpl extends ContentFolderBaseImpl implements SourceFol
SourceFolderImpl
sourceFolder
=
(
SourceFolderImpl
)
folder
;
i
=
getPackagePrefix
().
compareTo
(
sourceFolder
.
getPackagePrefix
());
if
(
i
!=
0
)
return
i
;
i
=
Boolean
.
valueOf
(
isTestSource
()
).
compareTo
(
sourceFolder
.
isTestSource
());
i
=
Boolean
.
compare
(
isTestSource
()
,
sourceFolder
.
isTestSource
());
if
(
i
!=
0
)
return
i
;
i
=
Boolean
.
valueOf
(
isForGeneratedSources
()
).
compareTo
(
sourceFolder
.
isForGeneratedSources
());
i
=
Boolean
.
compare
(
isForGeneratedSources
()
,
sourceFolder
.
isForGeneratedSources
());
if
(
i
!=
0
)
return
i
;
//todo[nik] perhaps we should use LinkedSet instead of SortedSet and get rid of this method
return
myJpsElement
.
getRootType
().
getClass
().
getName
().
compareTo
(
sourceFolder
.
getRootType
().
getClass
().
getName
());
...
...
This diff is collapsed.
Click to expand it.
platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/GenericPatchApplier.java
+
2
-
3
View file @
d23a2526
...
...
@@ -64,8 +64,7 @@ public class GenericPatchApplier {
Collections
.
addAll
(
myLines
,
LineTokenizer
.
tokenize
(
text
,
false
));
myBaseFileEndsWithNewLine
=
StringUtil
.
endsWithLineBreak
(
text
);
myHunks
=
hunks
;
final
Comparator
<
TextRange
>
textRangeComparator
=
(
o1
,
o2
)
->
new
Integer
(
o1
.
getStartOffset
()).
compareTo
(
new
Integer
(
o2
.
getStartOffset
()));
final
Comparator
<
TextRange
>
textRangeComparator
=
Comparator
.
comparingInt
(
TextRange:
:
getStartOffset
);
myTransformations
=
new
TreeMap
<>(
textRangeComparator
);
myNotExact
=
new
ArrayList
<>();
myNotBound
=
new
ArrayList
<>();
...
...
@@ -1319,7 +1318,7 @@ public class GenericPatchApplier {
@Override
public
int
compare
(
SplitHunk
o1
,
SplitHunk
o2
)
{
return
Integer
.
valueOf
(
o1
.
getStartLineBefore
()
).
compareTo
(
Integer
.
valueOf
(
o2
.
getStartLineBefore
())
)
;
return
Integer
.
compare
(
o1
.
getStartLineBefore
()
,
o2
.
getStartLineBefore
());
}
}
}
This diff is collapsed.
Click to expand it.
platform/vcs-tests/testSrc/com/intellij/openapi/vcs/HackSearchTest.java
+
1
-
1
View file @
d23a2526
...
...
@@ -90,7 +90,7 @@ public class HackSearchTest extends TestCase {
private
static
class
ZComparator
implements
Comparator
<
Z
>
{
@Override
public
int
compare
(
Z
o1
,
Z
o2
)
{
return
new
Integer
(
o1
.
getInt
()).
compareTo
(
new
Integer
(
o2
.
getInt
())
)
;
return
Integer
.
compare
(
o1
.
getInt
(),
o2
.
getInt
());
}
}
}
This diff is collapsed.
Click to expand it.
spellchecker/src/com/intellij/spellchecker/engine/Suggestion.java
+
1
-
1
View file @
d23a2526
...
...
@@ -57,7 +57,7 @@ public class Suggestion implements Comparable<Suggestion> {
@Override
public
int
compareTo
(
@NotNull
Suggestion
o
)
{
int
c
=
new
Integer
(
getMetrics
()
).
compareTo
(
o
.
getMetrics
());
int
c
=
Integer
.
compare
(
getMetrics
()
,
o
.
getMetrics
());
return
c
!=
0
?
c
:
StringUtil
.
compare
(
word
,
o
.
word
,
true
);
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment