Skip to content

Commit aa202bc

Browse files
Jörg Kubitzakurtakov
authored andcommitted
remove redundant MatchEvent.fMatchContainer
Only either fMatchContainer or fMatches could have been set. There is no point in trying to avoid allocating the array - it can not be reused in parallel anyway
1 parent 6e8dd1a commit aa202bc

File tree

1 file changed

+4
-7
lines changed
  • bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/text

1 file changed

+4
-7
lines changed

bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/text/MatchEvent.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
* @since 3.0
2525
*/
2626
public class MatchEvent extends SearchResultEvent {
27-
private static final long serialVersionUID = 6009335074727417445L;
27+
private static final long serialVersionUID = 6009335074727417446L;
2828
private int fKind;
2929
private Match[] fMatches;
30-
private Match[] fMatchContainer = new Match[1];
3130
/**
3231
* Constant for a matches being added.
3332
*
@@ -68,8 +67,6 @@ public int getKind() {
6867
public Match[] getMatches() {
6968
if (fMatches != null)
7069
return fMatches;
71-
else if (fMatchContainer[0] != null)
72-
return fMatchContainer;
7370
else
7471
return fgEmtpyMatches;
7572
}
@@ -88,8 +85,9 @@ protected void setKind(int kind) {
8885
* @param match the match to set
8986
*/
9087
protected void setMatch(Match match) {
91-
fMatchContainer[0] = match;
92-
fMatches = null;
88+
Match[] matches = new Match[1];
89+
matches[0] = match;
90+
fMatches = matches;
9391
}
9492

9593
/**
@@ -98,7 +96,6 @@ protected void setMatch(Match match) {
9896
* @param matches the matches to set
9997
*/
10098
protected void setMatches(Match[] matches) {
101-
fMatchContainer[0] = null;
10299
fMatches = matches;
103100
}
104101
}

0 commit comments

Comments
 (0)