本文整理匯總了Java中com.sun.tools.javac.util.List.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java List.contains方法的具體用法?Java List.contains怎麽用?Java List.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.tools.javac.util.List
的用法示例。
在下文中一共展示了List.contains方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isDeprecatedOverrideIgnorable
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
private boolean isDeprecatedOverrideIgnorable(MethodSymbol m, ClassSymbol origin) {
// If the method, m, is defined in an interface, then ignore the issue if the method
// is only inherited via a supertype and also implemented in the supertype,
// because in that case, we will rediscover the issue when examining the method
// in the supertype.
// If the method, m, is not defined in an interface, then the only time we need to
// address the issue is when the method is the supertype implemementation: any other
// case, we will have dealt with when examining the supertype classes
ClassSymbol mc = m.enclClass();
Type st = types.supertype(origin.type);
if (st.tag != CLASS)
return true;
MethodSymbol stimpl = m.implementation((ClassSymbol)st.tsym, types, false);
if (mc != null && ((mc.flags() & INTERFACE) != 0)) {
List<Type> intfs = types.interfaces(origin.type);
return (intfs.contains(mc.type) ? false : (stimpl != null));
}
else
return (stimpl != m);
}
示例2: isDeprecatedOverrideIgnorable
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
private boolean isDeprecatedOverrideIgnorable(MethodSymbol m, ClassSymbol origin) {
// If the method, m, is defined in an interface, then ignore the issue if the method
// is only inherited via a supertype and also implemented in the supertype,
// because in that case, we will rediscover the issue when examining the method
// in the supertype.
// If the method, m, is not defined in an interface, then the only time we need to
// address the issue is when the method is the supertype implemementation: any other
// case, we will have dealt with when examining the supertype classes
ClassSymbol mc = m.enclClass();
Type st = types.supertype(origin.type);
if (!st.hasTag(CLASS))
return true;
MethodSymbol stimpl = m.implementation((ClassSymbol)st.tsym, types, false);
if (mc != null && ((mc.flags() & INTERFACE) != 0)) {
List<Type> intfs = types.interfaces(origin.type);
return (intfs.contains(mc.type) ? false : (stimpl != null));
}
else
return (stimpl != m);
}
示例3: getAnalyzerModes
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* This method is used to parse the {@code find} option.
* Possible modes are separated by colon; a mode can be excluded by
* prepending '-' to its name. Finally, the special mode 'all' can be used to
* add all modes to the resulting enum.
*/
static EnumSet<AnalyzerMode> getAnalyzerModes(String opt, Source source) {
if (opt == null) {
return EnumSet.noneOf(AnalyzerMode.class);
}
List<String> modes = List.from(opt.split(","));
EnumSet<AnalyzerMode> res = EnumSet.noneOf(AnalyzerMode.class);
if (modes.contains("all")) {
res = EnumSet.allOf(AnalyzerMode.class);
}
for (AnalyzerMode mode : values()) {
if (modes.contains(mode.opt)) {
res.add(mode);
} else if (modes.contains("-" + mode.opt) || !mode.sourceFilter.test(source)) {
res.remove(mode);
}
}
return res;
}
示例4: contains
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
public boolean contains(RelativePath name) {
RelativeDirectory dirname = name.dirname();
String basename = name.basename();
if (basename.length() == 0)
return false;
List<String> list = map.get(dirname);
return (list != null && list.contains(basename));
}
示例5: checkNonCyclic1
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
final TypeVar tv;
if (t.tag == TYPEVAR && (t.tsym.flags() & UNATTRIBUTED) != 0)
return;
if (seen.contains(t)) {
tv = (TypeVar)t;
tv.bound = types.createErrorType(t);
log.error(pos, "cyclic.inheritance", t);
} else if (t.tag == TYPEVAR) {
tv = (TypeVar)t;
seen = seen.prepend(tv);
for (Type b : types.getBounds(tv))
checkNonCyclic1(pos, b, seen);
}
}
示例6: searchSubPackage
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
* Recursively search all directories in path for subdirectory name.
* Add all packages found in such a directory to packages list.
*/
private void searchSubPackage(String packageName,
ListBuffer<String> packages,
List<String> excludedPackages,
Collection<File> pathnames) {
if (excludedPackages.contains(packageName))
return;
String packageFilename = packageName.replace('.', File.separatorChar);
boolean addedPackage = false;
for (File pathname : pathnames) {
File f = new File(pathname, packageFilename);
String filenames[] = f.list();
// if filenames not null, then found directory
if (filenames != null) {
for (String filename : filenames) {
if (!addedPackage
&& (isValidJavaSourceFile(filename) ||
isValidJavaClassFile(filename))
&& !packages.contains(packageName)) {
packages.append(packageName);
addedPackage = true;
} else if (isValidClassName(filename) &&
(new File(f, filename)).isDirectory()) {
searchSubPackage(packageName + "." + filename,
packages, excludedPackages, pathnames);
}
}
}
}
}
示例7: checkNonCyclic1
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
final TypeVar tv;
if (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0)
return;
if (seen.contains(t)) {
tv = (TypeVar)t.unannotatedType();
tv.bound = types.createErrorType(t);
log.error(pos, "cyclic.inheritance", t);
} else if (t.hasTag(TYPEVAR)) {
tv = (TypeVar)t.unannotatedType();
seen = seen.prepend(tv);
for (Type b : types.getBounds(tv))
checkNonCyclic1(pos, b, seen);
}
}
示例8: checkNonCyclic1
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
private void checkNonCyclic1(DiagnosticPosition pos, Type t, List<TypeVar> seen) {
final TypeVar tv;
if (t.hasTag(TYPEVAR) && (t.tsym.flags() & UNATTRIBUTED) != 0)
return;
if (seen.contains(t)) {
tv = (TypeVar)t;
tv.bound = types.createErrorType(t);
log.error(pos, Errors.CyclicInheritance(t));
} else if (t.hasTag(TYPEVAR)) {
tv = (TypeVar)t;
seen = seen.prepend(tv);
for (Type b : types.getBounds(tv))
checkNonCyclic1(pos, b, seen);
}
}
示例9: test_contains_Object
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_contains_Object() {
System.err.println("test contains(Object)");
for (Map.Entry<java.util.List<String>,List<String>> e: examples.entrySet()) {
java.util.List<String> ref = e.getKey();
List<String> l = e.getValue();
boolean expect = ref.contains("1");
boolean found = l.contains("1");
if (expect != found)
throw new AssertionError();
}
}
示例10: test_remove_Object
import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test_remove_Object() {
System.err.println("test remove(Object)");
for (List<String> l: examples.values()) {
boolean hasX = l.contains("X");
try {
l.remove("X");
if (hasX)
throw new AssertionError();
} catch (UnsupportedOperationException ex) {
}
}
}