mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-16 13:35:22 +02:00
Bug 579982: More removing of cached Matcher objects
This follows on from 1c404b050d
Change-Id: I764ba6a96aa650f38ef90521b2a67cc87903b2d5
This commit is contained in:
parent
ed59ec722b
commit
937b4d5798
4 changed files with 64 additions and 24 deletions
|
@ -81,6 +81,7 @@
|
||||||
</p>
|
</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="#newUIAbstractPage">org.eclipse.cdt.ui.newui.AbstractPage reduced visibility of many fields</a></li>
|
<li><a href="#newUIAbstractPage">org.eclipse.cdt.ui.newui.AbstractPage reduced visibility of many fields</a></li>
|
||||||
|
<li><a href="#ArgletsMatcher2">java.util.regex.Matcher use in JSONCDB API will be removed</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -580,6 +581,18 @@
|
||||||
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=579666" target="_blank">Bug 579666</a>.
|
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=579666" target="_blank">Bug 579666</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h3>2. <a name="ArgletsMatcher2">java.util.regex.Matcher use in JSONCDB API will be removed</a></h3>
|
||||||
|
<p>
|
||||||
|
The following method will be removed from the API as it encourages non-safe constructs of reusing Matchers instead of Patterns.
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>org.eclipse.cdt.jsoncdb.core.participant.Arglets.BuiltinDetectionArgsGeneric.processArgument(IArgumentCollector, String, Matcher[])
|
||||||
|
- use org.eclipse.cdt.jsoncdb.core.participant.Arglets.BuiltinDetectionArgsGeneric.processArgument(IArgumentCollector, String, Pattern[]) instead</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=579982" target="_blank">Bug 579982</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ Bundle-Name: %bundleName
|
||||||
Bundle-Description: %bundleDescription
|
Bundle-Description: %bundleDescription
|
||||||
Bundle-Copyright: %Bundle-Copyright
|
Bundle-Copyright: %Bundle-Copyright
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.jsoncdb.core;singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.jsoncdb.core;singleton:=true
|
||||||
Bundle-Version: 1.2.100.qualifier
|
Bundle-Version: 1.3.0.qualifier
|
||||||
Bundle-Vendor: %Bundle-Vendor
|
Bundle-Vendor: %Bundle-Vendor
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||||
|
|
|
@ -387,10 +387,30 @@ public final class Arglets {
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
public static abstract class BuiltinDetectionArgsGeneric extends BuiltinDetctionArgsGeneric {
|
public static abstract class BuiltinDetectionArgsGeneric extends BuiltinDetctionArgsGeneric {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.cdt.jsoncdb.core.participant.IArglet#processArgument(IArgumentCollector,
|
* @see org.eclipse.cdt.jsoncdb.core.participant.IArglet#processArgument(IArgumentCollector,
|
||||||
* IPath, String)
|
* IPath, String)
|
||||||
|
* @since 1.3
|
||||||
*/
|
*/
|
||||||
|
protected final int processArgument(IArgumentCollector resultCollector, String argsLine,
|
||||||
|
Pattern[] optionPatterns) {
|
||||||
|
for (Pattern pattern : optionPatterns) {
|
||||||
|
Matcher matcher = pattern.matcher(argsLine);
|
||||||
|
if (matcher.lookingAt()) {
|
||||||
|
resultCollector.addBuiltinDetectionArgument(matcher.group());
|
||||||
|
return matcher.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;// no input consumed
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.jsoncdb.core.participant.IArglet#processArgument(IArgumentCollector,
|
||||||
|
* IPath, String)
|
||||||
|
* @deprecated Use {@link #processArgument(IArgumentCollector, String, Pattern[])} instead.
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
@Override
|
@Override
|
||||||
protected final int processArgument(IArgumentCollector resultCollector, String argsLine,
|
protected final int processArgument(IArgumentCollector resultCollector, String argsLine,
|
||||||
Matcher[] optionMatchers) {
|
Matcher[] optionMatchers) {
|
||||||
|
@ -450,24 +470,25 @@ public final class Arglets {
|
||||||
*/
|
*/
|
||||||
public static class Sysroot_GCC extends BuiltinDetectionArgsGeneric implements IArglet {
|
public static class Sysroot_GCC extends BuiltinDetectionArgsGeneric implements IArglet {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private static final Matcher[] optionMatchers = {
|
private static final Pattern[] optionPatterns = {
|
||||||
/* "--sysroot=" quoted directory */
|
/* "--sysroot=" quoted directory */
|
||||||
Pattern.compile("--sysroot=" + REGEX_INCLUDEPATH_QUOTED_DIR).matcher(EMPTY_STR),
|
Pattern.compile("--sysroot=" + REGEX_INCLUDEPATH_QUOTED_DIR), //
|
||||||
/* "--sysroot=" unquoted directory */
|
/* "--sysroot=" unquoted directory */
|
||||||
Pattern.compile("--sysroot=" + REGEX_INCLUDEPATH_UNQUOTED_DIR).matcher(EMPTY_STR),
|
Pattern.compile("--sysroot=" + REGEX_INCLUDEPATH_UNQUOTED_DIR), //
|
||||||
/* "-isysroot=" quoted directory */
|
/* "-isysroot=" quoted directory */
|
||||||
Pattern.compile("-isysroot=" + REGEX_INCLUDEPATH_QUOTED_DIR).matcher(EMPTY_STR),
|
Pattern.compile("-isysroot=" + REGEX_INCLUDEPATH_QUOTED_DIR), //
|
||||||
/* "-isysroot=" unquoted directory */
|
/* "-isysroot=" unquoted directory */
|
||||||
Pattern.compile("-isysroot=" + REGEX_INCLUDEPATH_UNQUOTED_DIR).matcher(EMPTY_STR),
|
Pattern.compile("-isysroot=" + REGEX_INCLUDEPATH_UNQUOTED_DIR), //
|
||||||
/* "--no-sysroot-prefix" */
|
/* "--no-sysroot-prefix" */
|
||||||
Pattern.compile("--no-sysroot-prefix").matcher(EMPTY_STR) };
|
Pattern.compile("--no-sysroot-prefix"), //
|
||||||
|
};
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String)
|
* @see org.eclipse.cdt.jsoncdb.core.participant.IArglet#processArgs(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
||||||
return processArgument(resultCollector, argsLine, optionMatchers);
|
return processArgument(resultCollector, argsLine, optionPatterns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,16 +498,18 @@ public final class Arglets {
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public static class Target_Clang extends BuiltinDetectionArgsGeneric implements IArglet {
|
public static class Target_Clang extends BuiltinDetectionArgsGeneric implements IArglet {
|
||||||
private static final Matcher[] optionMatchers = {
|
@SuppressWarnings("nls")
|
||||||
|
private static final Pattern[] optionPatterns = {
|
||||||
/* "--target=" triple */
|
/* "--target=" triple */
|
||||||
Pattern.compile("--target=\\w+(-\\w+)*").matcher(EMPTY_STR) }; //$NON-NLS-1$
|
Pattern.compile("--target=\\w+(-\\w+)*") //
|
||||||
|
};
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* @see de.marw.cmake.cdt.lsp.IArglet#processArgs(java.lang.String)
|
* @see de.marw.cmake.cdt.lsp.IArglet#processArgs(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
||||||
return processArgument(resultCollector, argsLine, optionMatchers);
|
return processArgument(resultCollector, argsLine, optionPatterns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,20 +520,23 @@ public final class Arglets {
|
||||||
*/
|
*/
|
||||||
public static class LangStd_GCC extends BuiltinDetectionArgsGeneric implements IArglet {
|
public static class LangStd_GCC extends BuiltinDetectionArgsGeneric implements IArglet {
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
private static final Matcher[] optionMatchers = { Pattern.compile("-std=\\S+").matcher(EMPTY_STR),
|
private static final Pattern[] optionPatterns = { //
|
||||||
Pattern.compile("-ansi").matcher(EMPTY_STR),
|
Pattern.compile("-std=\\S+"), //
|
||||||
Pattern.compile("-fPIC", Pattern.CASE_INSENSITIVE).matcher(EMPTY_STR),
|
Pattern.compile("-ansi"), //
|
||||||
Pattern.compile("-fPIE", Pattern.CASE_INSENSITIVE).matcher(EMPTY_STR),
|
Pattern.compile("-fPIC", Pattern.CASE_INSENSITIVE), //
|
||||||
Pattern.compile("-fstack-protector\\S+").matcher(EMPTY_STR),
|
Pattern.compile("-fPIE", Pattern.CASE_INSENSITIVE), //
|
||||||
Pattern.compile("-march=\\\\S+").matcher(EMPTY_STR), Pattern.compile("-mcpu=\\\\S+").matcher(EMPTY_STR),
|
Pattern.compile("-fstack-protector\\S+"), //
|
||||||
Pattern.compile("-mtune=\\\\S+").matcher(EMPTY_STR), Pattern.compile("-pthread").matcher(EMPTY_STR), };
|
Pattern.compile("-march=\\\\S+"), //
|
||||||
|
Pattern.compile("-mcpu=\\\\S+"), //
|
||||||
|
Pattern.compile("-mtune=\\\\S+"), //
|
||||||
|
Pattern.compile("-pthread"), };
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String)
|
* @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
||||||
return processArgument(resultCollector, argsLine, optionMatchers);
|
return processArgument(resultCollector, argsLine, optionPatterns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.jsoncdb.nvidia;
|
package org.eclipse.cdt.jsoncdb.nvidia;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.cdt.jsoncdb.core.participant.Arglets.BuiltinDetectionArgsGeneric;
|
import org.eclipse.cdt.jsoncdb.core.participant.Arglets.BuiltinDetectionArgsGeneric;
|
||||||
|
@ -21,14 +20,16 @@ import org.eclipse.core.runtime.IPath;
|
||||||
* standard {@code --std=xxx}.
|
* standard {@code --std=xxx}.
|
||||||
*/
|
*/
|
||||||
public class NvccLangStdArglet extends BuiltinDetectionArgsGeneric implements IArglet {
|
public class NvccLangStdArglet extends BuiltinDetectionArgsGeneric implements IArglet {
|
||||||
private static final Matcher[] optionMatchers = { Pattern.compile("--std \\S+").matcher(""), //$NON-NLS-1$ //$NON-NLS-2$
|
@SuppressWarnings("nls")
|
||||||
Pattern.compile("-std \\S+").matcher(""), }; //$NON-NLS-1$ //$NON-NLS-2$
|
private static final Pattern[] optionPatterns = { Pattern.compile("--std \\S+"), //
|
||||||
|
Pattern.compile("-std \\S+"), //
|
||||||
|
};
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String)
|
* @see org.eclipse.cdt.jsoncdb.IArglet#processArgs(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
public int processArgument(IArgumentCollector resultCollector, IPath cwd, String argsLine) {
|
||||||
return processArgument(resultCollector, argsLine, optionMatchers);
|
return processArgument(resultCollector, argsLine, optionPatterns);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue