com.sun.tools.javac.code.Types.UniqueType Java Examples

The following examples show how to use com.sun.tools.javac.code.Types.UniqueType. 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: Code.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = (Type) o;

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #2
Source File: Code.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = ((Type)o).unannotatedType();

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #3
Source File: Code.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = ((Type)o).unannotatedType();

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #4
Source File: Code.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = (Type) o;

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #5
Source File: Pool.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
 *  If object is a symbol also enter its owner unless the owner is a
 *  package.  Return the object's index in the pool.
 */
public int put(Object value) {
    value = makePoolValue(value);
    Assert.check(!(value instanceof Type.TypeVar));
    Assert.check(!(value instanceof Types.UniqueType &&
                   ((UniqueType) value).type instanceof Type.TypeVar));
    Integer index = indices.get(value);
    if (index == null) {
        index = pp;
        indices.put(value, index);
        pool = ArrayUtils.ensureCapacity(pool, pp);
        pool[pp++] = value;
        if (value instanceof Long || value instanceof Double) {
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = null;
        }
    }
    return index.intValue();
}
 
Example #6
Source File: Code.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = ((Type)o).unannotatedType();

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #7
Source File: Code.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = ((Type)o).unannotatedType();

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #8
Source File: Code.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = ((Type)o).unannotatedType();

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #9
Source File: Pool.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        Type t = (Type)o;
        // ClassRefs can come from ClassSymbols or from Types.
        // Return the symbol for these types to avoid duplicates
        // in the constant pool
        if (t.hasTag(TypeTag.CLASS))
            return t.tsym;
        else
            return new UniqueType(t, types);
    } else {
        return o;
    }
}
 
Example #10
Source File: Pool.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** Place an object in the pool, unless it is already there.
 *  If object is a symbol also enter its owner unless the owner is a
 *  package.  Return the object's index in the pool.
 */
public int put(Object value) {
    value = makePoolValue(value);
    Assert.check(!(value instanceof Type.TypeVar));
    Assert.check(!(value instanceof Types.UniqueType &&
                   ((UniqueType) value).type instanceof Type.TypeVar));
    Integer index = indices.get(value);
    if (index == null) {
        index = pp;
        indices.put(value, index);
        pool = ArrayUtils.ensureCapacity(pool, pp);
        pool[pp++] = value;
        if (value instanceof Long || value instanceof Double) {
            pool = ArrayUtils.ensureCapacity(pool, pp);
            pool[pp++] = null;
        }
    }
    return index.intValue();
}
 
Example #11
Source File: Code.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** The type of a constant pool entry. */
private Type typeForPool(Object o) {
    if (o instanceof Integer) return syms.intType;
    if (o instanceof Float) return syms.floatType;
    if (o instanceof String) return syms.stringType;
    if (o instanceof Long) return syms.longType;
    if (o instanceof Double) return syms.doubleType;
    if (o instanceof ClassSymbol) return syms.classType;
    if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
    if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
    if (o instanceof Type) {
        Type ty = ((Type)o).unannotatedType();

        if (ty instanceof Type.ArrayType) return syms.classType;
        if (ty instanceof Type.MethodType) return syms.methodTypeType;
    }
    throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
}
 
Example #12
Source File: Pool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #13
Source File: Pool.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #14
Source File: Pool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #15
Source File: Pool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #16
Source File: Pool.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #17
Source File: Pool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #18
Source File: Pool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #19
Source File: Pool.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #20
Source File: Pool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #21
Source File: Pool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #22
Source File: Pool.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #23
Source File: Pool.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #24
Source File: Pool.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        Type t = (Type)o;
        // ClassRefs can come from ClassSymbols or from Types.
        // Return the symbol for these types to avoid duplicates
        // in the constant pool
        if (t.hasTag(TypeTag.CLASS))
            return t.tsym;
        else
            return new UniqueType(t, types);
    } else {
        return o;
    }
}
 
Example #25
Source File: Pool.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
Object makePoolValue(Object o) {
    if (o instanceof DynamicMethodSymbol) {
        return new DynamicMethod((DynamicMethodSymbol)o, types);
    } else if (o instanceof MethodSymbol) {
        return new Method((MethodSymbol)o, types);
    } else if (o instanceof VarSymbol) {
        return new Variable((VarSymbol)o, types);
    } else if (o instanceof Type) {
        return new UniqueType((Type)o, types);
    } else {
        return o;
    }
}
 
Example #26
Source File: Pool.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #27
Source File: Pool.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #28
Source File: Pool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private Object[] getUniqueTypeArray(Object[] objects, Types types) {
    Object[] result = new Object[objects.length];
    for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Type) {
            result[i] = new UniqueType((Type)objects[i], types);
        } else {
            result[i] = objects[i];
        }
    }
    return result;
}
 
Example #29
Source File: ClassFile.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
void setType(Type type) {
    this.uniqueType = new UniqueType(type, types);
}
 
Example #30
Source File: Pool.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public MethodHandle(int refKind, Symbol refSym, Types types) {
    this.refKind = refKind;
    this.refSym = refSym;
    this.uniqueType = new UniqueType(this.refSym.type, types);
    checkConsistent();
}