From 3ef0d867cc3de27e124e30ade1457499696d2388 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 4 Nov 2010 13:23:38 +0000 Subject: [PATCH] Compiler warnings. --- .../eclipse/cdt/internal/core/model/PathEntryUtil.java | 2 -- .../org/eclipse/cdt/internal/core/index/CIndex.java | 8 ++++---- .../cdt/internal/core/cdtvariables/CdtMacroSupplier.java | 2 +- .../cdt/internal/ui/editor/ToggleCommentAction.java | 5 ++--- .../contentassist/CompletionProposalComputerRegistry.java | 2 +- .../uitree/uiwidgets/UIStringListWidget.java | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java index 7313c0202fe..f8415c36574 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java @@ -393,13 +393,11 @@ public class PathEntryUtil { if (otherPath.isPrefixOf(entryPath) && !otherPath.equals(entryPath) && !CoreModelUtil.isExcluded(entryPath.append("*"), exclusionPatterns)) { //$NON-NLS-1$ - String exclusionPattern = entryPath.removeFirstSegments(otherPath.segmentCount()).segment(0); if (CoreModelUtil.isExcluded(entryPath, exclusionPatterns)) { StringBuffer errMesg = new StringBuffer( CCorePlugin.getResourceString("CoreModel.PathEntry.NestedEntry")); //$NON-NLS-1$ return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString()); } else if (otherKind == IPathEntry.CDT_SOURCE) { - exclusionPattern += '/'; StringBuffer errMesg = new StringBuffer( CCorePlugin.getResourceString("CoreModel.PathEntry.NestedEntry")); //$NON-NLS-1$ return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString()); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java index 02d6abf38be..197c5e4cdca 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java @@ -267,14 +267,14 @@ public class CIndex implements IIndex { for (IIndexInclude include : includedBy) { if (handled.add(include.getIncludedByLocation())) { out.add(include); - if (depth != 0) { + if (nextLevel != null) { nextLevel.add(include.getIncludedBy()); } } } } } - if (depth == 0 || nextLevel.isEmpty()) { + if (nextLevel == null || nextLevel.isEmpty()) { return; } if (depth > 0) { @@ -304,7 +304,7 @@ public class CIndex implements IIndex { Object key= target != null ? (Object) target : include.getFullName(); if (handled.add(key)) { out.add(include); - if (depth != 0) { + if (nextLevel != null) { IIndexFile includedByFile= resolveInclude(include); if (includedByFile != null) { nextLevel.add(includedByFile); @@ -313,7 +313,7 @@ public class CIndex implements IIndex { } } } - if (depth == 0 || nextLevel.isEmpty()) { + if (nextLevel == null || nextLevel.isEmpty()) { return; } if (depth > 0) { diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java index 1ca596d0bc1..94b82c151ba 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/CdtMacroSupplier.java @@ -436,7 +436,7 @@ public class CdtMacroSupplier extends CoreMacroSupplierBase { macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,version); } else if("CDTVersion".equals(macroName)){ //$NON-NLS-1$ - String version = (String)CCorePlugin.getDefault().getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION); + String version = CCorePlugin.getDefault().getBundle().getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION); macro = new CdtVariable(macroName,ICdtVariable.VALUE_TEXT,version); } /* else if("MBSVersion".equals(macroName)){ //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java index cf8b3ac74e9..545c86eb512 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/ToggleCommentAction.java @@ -128,7 +128,6 @@ public final class ToggleCommentAction extends TextEditorAction { ITypedRegion[] regions= TextUtilities.computePartitioning(document, fDocumentPartitioning, block.getOffset(), block.getLength(), false); - int lineCount= 0; int[] lines= new int[regions.length * 2]; // [startline, endline, startline, endline, ...] // For each partition in the text selection, figure out the startline and endline. @@ -147,8 +146,8 @@ public final class ToggleCommentAction extends TextEditorAction { // otherwise, get the line number of the endline and store it in the array. lines[j + 1]= (lines[j] == -1 ? -1 : document.getLineOfOffset(offset)); - // Count the number of lines that are selected in this region - lineCount += lines[j + 1] - lines[j] + 1; + // We could count the number of lines that are selected in this region + // lineCount += lines[j + 1] - lines[j] + 1; assert i < regions.length; assert j < regions.length * 2; 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 6074ce793c8..2414437d023 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 @@ -331,7 +331,7 @@ public final class CompletionProposalComputerRegistry { final String avoidHint; final String culpritName= culprit == null ? null : culprit.getName(); if (affectedPlugins.isEmpty()) { - if (culpritName.equals(CUIPlugin.PLUGIN_ID)) { + if (CUIPlugin.PLUGIN_ID.equals(culpritName)) { // don't warn about internal computers return; } diff --git a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java index d7809670b99..e4f623b2dcd 100644 --- a/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java +++ b/core/org.eclipse.cdt.ui/templateengine/org/eclipse/cdt/ui/templateengine/uitree/uiwidgets/UIStringListWidget.java @@ -90,7 +90,7 @@ public class UIStringListWidget extends InputUIElement { if (items != null) { items = items.trim(); StringTokenizer st = new StringTokenizer(items, "|"); //$NON-NLS-1$ - for (int i = 0; st.hasMoreTokens(); i++) { + while (st.hasMoreTokens()) { itemsList.add(st.nextToken()); } }