Java Code Examples for com.sun.tools.javac.util.List#contains()
The following examples show how to use
com.sun.tools.javac.util.List#contains() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Check.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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); }
Example 2
Source File: Check.java From hottub with GNU General Public License v2.0 | 6 votes |
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); }
Example 3
Source File: Check.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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); }
Example 4
Source File: Analyzer.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * 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; }
Example 5
Source File: Check.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
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); }
Example 6
Source File: Check.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 6 votes |
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); }
Example 7
Source File: Check.java From hottub with GNU General Public License v2.0 | 5 votes |
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); } }
Example 8
Source File: Check.java From javaide with GNU General Public License v3.0 | 5 votes |
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); } }
Example 9
Source File: ZipArchive.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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)); }
Example 10
Source File: JavadocTool.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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); } } } } }
Example 11
Source File: Check.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
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); } }
Example 12
Source File: ZipArchive.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
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)); }
Example 13
Source File: TList.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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) { } } }
Example 14
Source File: TList.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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) { } } }
Example 15
Source File: JavadocTool.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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); } } } } }
Example 16
Source File: TList.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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) { } } }
Example 17
Source File: TList.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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(); } }
Example 18
Source File: TList.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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(); } }
Example 19
Source File: Check.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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, "cyclic.inheritance", t); } else if (t.hasTag(TYPEVAR)) { tv = (TypeVar)t; seen = seen.prepend(tv); for (Type b : types.getBounds(tv)) checkNonCyclic1(pos, b, seen); } }
Example 20
Source File: TList.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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) { } } }