Java Code Examples for com.sun.tools.javac.util.List#indexOf()

The following examples show how to use com.sun.tools.javac.util.List#indexOf() . 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: JavacHandlerUtil.java    From EasyMPermission with MIT License 6 votes vote down vote up
/**
 * Given a list of field names and a node referring to a type, finds each name in the list that does not match a field within the type.
 */
public static List<Integer> createListOfNonExistentFields(List<String> list, JavacNode type, boolean excludeStandard, boolean excludeTransient) {
	boolean[] matched = new boolean[list.size()];
	
	for (JavacNode child : type.down()) {
		if (list.isEmpty()) break;
		if (child.getKind() != Kind.FIELD) continue;
		JCVariableDecl field = (JCVariableDecl)child.get();
		if (excludeStandard) {
			if ((field.mods.flags & Flags.STATIC) != 0) continue;
			if (field.name.toString().startsWith("$")) continue;
		}
		if (excludeTransient && (field.mods.flags & Flags.TRANSIENT) != 0) continue;
		
		int idx = list.indexOf(child.getName());
		if (idx > -1) matched[idx] = true;
	}
	
	ListBuffer<Integer> problematic = new ListBuffer<Integer>();
	for (int i = 0 ; i < list.size() ; i++) {
		if (!matched[i]) problematic.append(i);
	}
	
	return problematic.toList();
}
 
Example 2
Source File: TList.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 3
Source File: TList.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 4
Source File: TList.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 5
Source File: TList.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 6
Source File: TList.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 7
Source File: TList.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 8
Source File: TList.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}
 
Example 9
Source File: TList.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void test_indexOf_Object() {
    System.err.println("test indexOf(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();
        for (int i = -1; i < ref.size(); i++) {
            String arg = (i == -1 ? "NOT IN LIST" : ref.get(i));
            int expect = ref.indexOf(arg);
            int found = l.indexOf(arg);
            if (expect != found)
                throw new AssertionError();
        }
    }
}