Java Code Examples for sun.tools.java.Identifier#getQualifier()

The following examples show how to use sun.tools.java.Identifier#getQualifier() . 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: IDLNames.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 2
Source File: IDLNames.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 3
Source File: IDLNames.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 4
Source File: IDLNames.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 5
Source File: IDLNames.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 6
Source File: IDLNames.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 7
Source File: IDLNames.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}
 
Example 8
Source File: IDLNames.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Convert a qualified Identifier into an array of IDL names.
 * <p>
 * Section 28.3.2.1    (see CompoundType)
 * Throws exception if fails 28.3.2.7.
 */
public static String[] getModuleNames (Identifier theID,
                                       boolean boxIt,
                                       BatchEnvironment env) throws Exception {

    String[] result = null;

    if (theID.isQualified()) {

        // Extract the qualifier...

        Identifier id = theID.getQualifier();

        // 28.3.2.7 Case sensitive module names.

        env.modulesContext.assertPut(id.toString());

        // Count them...

        int count = 1;
        Identifier current = id;
        while (current.isQualified()) {
            current = current.getQualifier();
            count++;
        }

        result = new String[count];
        int index = count-1;
        current = id;

        // Now walk them and fill our array (backwards)...

        for (int i = 0; i < count; i++) {

            String item = current.getName().toString();

            // Check namesCache...

            String cachedItem = (String) env.namesCache.get(item);

            if (cachedItem == null) {

                // 28.3.2.4 Illegal identifier characters...

                cachedItem = convertToISOLatin1(item);

                // Run it through the name checks...

                cachedItem = getTypeOrModuleName(cachedItem);

                // Add it to the namesCache...

                env.namesCache.put(item,cachedItem);
            }

            result[index--] = cachedItem;
            current = current.getQualifier();
        }
    }


    // If it is supposed to be "boxed", prepend
    // IDL_BOXEDIDL_MODULE...

    if (boxIt) {
        if (result == null) {
            result = IDL_BOXEDIDL_MODULE;
        } else {
        String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
        System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
        System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
        result = boxed;
    }
    }

    return result;
}