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

The following examples show how to use com.sun.tools.javac.util.List#toArray() . 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: DocletInvoker.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 2
Source File: T6238612.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void test(List<String> list, String[] array) {
    String[] result = list.toArray(array);

    if (result.length < list.size()) {
        error("returned array is too small; expected: " + list.size() + ", found: " + result.length);
        return;
    }

    if (list.size() <= array.length && result != array)
        error("new array wrongly created");

    int i = 0;
    for (String s: list)
        check(result, i++, s);

    if (i < result.length)
        check(result, i, null);
}
 
Example 3
Source File: DocletInvoker.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 4
Source File: T6238612.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void test(List<String> list, String[] array) {
    String[] result = list.toArray(array);

    if (result.length < list.size()) {
        error("returned array is too small; expected: " + list.size() + ", found: " + result.length);
        return;
    }

    if (list.size() <= array.length && result != array)
        error("new array wrongly created");

    int i = 0;
    for (String s: list)
        check(result, i++, s);

    if (i < result.length)
        check(result, i, null);
}
 
Example 5
Source File: T6238612.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void test(List<String> list, String[] array) {
    String[] result = list.toArray(array);

    if (result.length < list.size()) {
        error("returned array is too small; expected: " + list.size() + ", found: " + result.length);
        return;
    }

    if (list.size() <= array.length && result != array)
        error("new array wrongly created");

    int i = 0;
    for (String s: list)
        check(result, i++, s);

    if (i < result.length)
        check(result, i, null);
}
 
Example 6
Source File: DocletInvoker.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 7
Source File: T6238612.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void test(List<String> list, String[] array) {
    String[] result = list.toArray(array);

    if (result.length < list.size()) {
        error("returned array is too small; expected: " + list.size() + ", found: " + result.length);
        return;
    }

    if (list.size() <= array.length && result != array)
        error("new array wrongly created");

    int i = 0;
    for (String s: list)
        check(result, i++, s);

    if (i < result.length)
        check(result, i, null);
}
 
Example 8
Source File: DocletInvoker.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 9
Source File: DocletInvoker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 10
Source File: T6238612.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void test(List<String> list, String[] array) {
    String[] result = list.toArray(array);

    if (result.length < list.size()) {
        error("returned array is too small; expected: " + list.size() + ", found: " + result.length);
        return;
    }

    if (list.size() <= array.length && result != array)
        error("new array wrongly created");

    int i = 0;
    for (String s: list)
        check(result, i++, s);

    if (i < result.length)
        check(result, i, null);
}
 
Example 11
Source File: DocletInvoker.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal);
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 12
Source File: DocletInvoker.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
Example 13
Source File: LambdaToMethod.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Generate an indy method call with given name, type and static bootstrap
 * arguments types
 */
private JCExpression makeIndyCall(DiagnosticPosition pos, Type site, Name bsmName,
        List<Object> staticArgs, MethodType indyType, List<JCExpression> indyArgs,
        Name methName) {
    int prevPos = make.pos;
    try {
        make.at(pos);
        List<Type> bsm_staticArgs = List.of(syms.methodHandleLookupType,
                syms.stringType,
                syms.methodTypeType).appendList(bsmStaticArgToTypes(staticArgs));

        Symbol bsm = rs.resolveInternalMethod(pos, attrEnv, site,
                bsmName, bsm_staticArgs, List.nil());

        DynamicMethodSymbol dynSym =
                new DynamicMethodSymbol(methName,
                                        syms.noSymbol,
                                        bsm.isStatic() ?
                                            ClassFile.REF_invokeStatic :
                                            ClassFile.REF_invokeVirtual,
                                        (MethodSymbol)bsm,
                                        indyType,
                                        staticArgs.toArray());

        JCFieldAccess qualifier = make.Select(make.QualIdent(site.tsym), bsmName);
        qualifier.sym = dynSym;
        qualifier.type = indyType.getReturnType();

        JCMethodInvocation proxyCall = make.Apply(List.nil(), qualifier, indyArgs);
        proxyCall.type = indyType.getReturnType();
        return proxyCall;
    } finally {
        make.at(prevPos);
    }
}
 
Example 14
Source File: PackageDocImpl.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
Example 15
Source File: PackageDocImpl.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
Example 16
Source File: PackageDocImpl.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
Example 17
Source File: PackageDocImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
Example 18
Source File: PackageDocImpl.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
Example 19
Source File: PackageDocImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
Example 20
Source File: PackageDocImpl.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}