Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2016-04-15 22:41:51 +0000
committerGerrit Code Review @ Eclipse.org2016-04-16 16:17:48 +0000
commitfc07efa909ea2702da76fe9842d258b96b4bc925 (patch)
tree7517debc7b91ae0d31e948c22b3a6a3c22638467 /core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist
parent0b7b2a87d365db7620ce42f571733bb6453225ca (diff)
downloadorg.eclipse.cdt-fc07efa909ea2702da76fe9842d258b96b4bc925.tar.gz
org.eclipse.cdt-fc07efa909ea2702da76fe9842d258b96b4bc925.tar.xz
org.eclipse.cdt-fc07efa909ea2702da76fe9842d258b96b4bc925.zip
Bug 491825 - Remove primitive wrapper creation
Using `new Integer` and other wrapper types such as `new Character` results in potential extra heap utilisation as the values are not cached. The built-in `Integer.valueOf` will perform caching on numbers in the range -128..127 (at least) using a flyweight pattern. In addition, parsing `int` values can be done with `Integer.parseInt` which avoids object construction. Adjust tests such as `"true".equals(expr)` to `Boolean.parseBoolean(expr)`. Change-Id: I0408a5c69afc4ca6ede71acaf6cc4abd67538006 Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java4
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistProcessor.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
index 7f8ddce8774..0c09172d37d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -279,7 +279,7 @@ public final class CompletionProposalComputerRegistry {
StringTokenizer inner= new StringTokenizer(tok.nextToken(), ":"); //$NON-NLS-1$
String id= inner.nextToken();
int rank= Integer.parseInt(inner.nextToken());
- ordered.put(id, new Integer(rank));
+ ordered.put(id, Integer.valueOf(rank));
}
List<CompletionProposalCategory> categories= new ArrayList<CompletionProposalCategory>();
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistProcessor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistProcessor.java
index 00063fcb142..88f7cac355d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistProcessor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/ContentAssistProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -82,7 +82,7 @@ import org.eclipse.cdt.internal.ui.util.Messages;
* @since 4.0
*/
public class ContentAssistProcessor implements IContentAssistProcessor {
- private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.cdt.ui/debug/contentassist")); //$NON-NLS-1$//$NON-NLS-2$
+ private static final boolean DEBUG= Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.cdt.ui/debug/contentassist")); //$NON-NLS-1$
/**
* Dialog settings key for the "all categories are disabled" warning dialog.

Back to the top