Java Code Examples for com.sun.org.apache.bcel.internal.Constants#T_REFERENCE

The following examples show how to use com.sun.org.apache.bcel.internal.Constants#T_REFERENCE . 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: Utility.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return type of signature as a byte value as defined in <em>Constants</em>
 *
 * @param  signature in format described above
 * @return type of signature
 * @see    Constants
 */
public static final byte typeOfSignature(String signature)
  throws ClassFormatException
{
  try {
    switch(signature.charAt(0)) {
    case 'B' : return Constants.T_BYTE;
    case 'C' : return Constants.T_CHAR;
    case 'D' : return Constants.T_DOUBLE;
    case 'F' : return Constants.T_FLOAT;
    case 'I' : return Constants.T_INT;
    case 'J' : return Constants.T_LONG;
    case 'L' : return Constants.T_REFERENCE;
    case '[' : return Constants.T_ARRAY;
    case 'V' : return Constants.T_VOID;
    case 'Z' : return Constants.T_BOOLEAN;
    case 'S' : return Constants.T_SHORT;
    default:
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  } catch(StringIndexOutOfBoundsException e) {
    throw new ClassFormatException("Invalid method signature: " + signature);
  }
}
 
Example 2
Source File: FieldGen.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 3
Source File: Utility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return type of signature as a byte value as defined in <em>Constants</em>
 *
 * @param  signature in format described above
 * @return type of signature
 * @see    Constants
 */
public static final byte typeOfSignature(String signature)
  throws ClassFormatException
{
  try {
    switch(signature.charAt(0)) {
    case 'B' : return Constants.T_BYTE;
    case 'C' : return Constants.T_CHAR;
    case 'D' : return Constants.T_DOUBLE;
    case 'F' : return Constants.T_FLOAT;
    case 'I' : return Constants.T_INT;
    case 'J' : return Constants.T_LONG;
    case 'L' : return Constants.T_REFERENCE;
    case '[' : return Constants.T_ARRAY;
    case 'V' : return Constants.T_VOID;
    case 'Z' : return Constants.T_BOOLEAN;
    case 'S' : return Constants.T_SHORT;
    default:
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  } catch(StringIndexOutOfBoundsException e) {
    throw new ClassFormatException("Invalid method signature: " + signature);
  }
}
 
Example 4
Source File: FieldGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 5
Source File: FieldGen.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 6
Source File: FieldGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 7
Source File: Utility.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Return type of signature as a byte value as defined in <em>Constants</em>
 *
 * @param  signature in format described above
 * @return type of signature
 * @see    Constants
 */
public static final byte typeOfSignature(String signature)
  throws ClassFormatException
{
  try {
    switch(signature.charAt(0)) {
    case 'B' : return Constants.T_BYTE;
    case 'C' : return Constants.T_CHAR;
    case 'D' : return Constants.T_DOUBLE;
    case 'F' : return Constants.T_FLOAT;
    case 'I' : return Constants.T_INT;
    case 'J' : return Constants.T_LONG;
    case 'L' : return Constants.T_REFERENCE;
    case '[' : return Constants.T_ARRAY;
    case 'V' : return Constants.T_VOID;
    case 'Z' : return Constants.T_BOOLEAN;
    case 'S' : return Constants.T_SHORT;
    default:
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  } catch(StringIndexOutOfBoundsException e) {
    throw new ClassFormatException("Invalid method signature: " + signature);
  }
}
 
Example 8
Source File: Utility.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return type of signature as a byte value as defined in <em>Constants</em>
 *
 * @param  signature in format described above
 * @return type of signature
 * @see    Constants
 */
public static final byte typeOfSignature(String signature)
  throws ClassFormatException
{
  try {
    switch(signature.charAt(0)) {
    case 'B' : return Constants.T_BYTE;
    case 'C' : return Constants.T_CHAR;
    case 'D' : return Constants.T_DOUBLE;
    case 'F' : return Constants.T_FLOAT;
    case 'I' : return Constants.T_INT;
    case 'J' : return Constants.T_LONG;
    case 'L' : return Constants.T_REFERENCE;
    case '[' : return Constants.T_ARRAY;
    case 'V' : return Constants.T_VOID;
    case 'Z' : return Constants.T_BOOLEAN;
    case 'S' : return Constants.T_SHORT;
    default:
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  } catch(StringIndexOutOfBoundsException e) {
    throw new ClassFormatException("Invalid method signature: " + signature);
  }
}
 
Example 9
Source File: FieldGen.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 10
Source File: FieldGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 11
Source File: FieldGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 12
Source File: Utility.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return type of signature as a byte value as defined in <em>Constants</em>
 *
 * @param  signature in format described above
 * @return type of signature
 * @see    Constants
 */
public static final byte typeOfSignature(String signature)
  throws ClassFormatException
{
  try {
    switch(signature.charAt(0)) {
    case 'B' : return Constants.T_BYTE;
    case 'C' : return Constants.T_CHAR;
    case 'D' : return Constants.T_DOUBLE;
    case 'F' : return Constants.T_FLOAT;
    case 'I' : return Constants.T_INT;
    case 'J' : return Constants.T_LONG;
    case 'L' : return Constants.T_REFERENCE;
    case '[' : return Constants.T_ARRAY;
    case 'V' : return Constants.T_VOID;
    case 'Z' : return Constants.T_BOOLEAN;
    case 'S' : return Constants.T_SHORT;
    default:
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  } catch(StringIndexOutOfBoundsException e) {
    throw new ClassFormatException("Invalid method signature: " + signature);
  }
}
 
Example 13
Source File: FieldGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 14
Source File: Utility.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Return type of signature as a byte value as defined in <em>Constants</em>
 *
 * @param  signature in format described above
 * @return type of signature
 * @see    Constants
 */
public static final byte typeOfSignature(String signature)
  throws ClassFormatException
{
  try {
    switch(signature.charAt(0)) {
    case 'B' : return Constants.T_BYTE;
    case 'C' : return Constants.T_CHAR;
    case 'D' : return Constants.T_DOUBLE;
    case 'F' : return Constants.T_FLOAT;
    case 'I' : return Constants.T_INT;
    case 'J' : return Constants.T_LONG;
    case 'L' : return Constants.T_REFERENCE;
    case '[' : return Constants.T_ARRAY;
    case 'V' : return Constants.T_VOID;
    case 'Z' : return Constants.T_BOOLEAN;
    case 'S' : return Constants.T_SHORT;
    default:
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  } catch(StringIndexOutOfBoundsException e) {
    throw new ClassFormatException("Invalid method signature: " + signature);
  }
}
 
Example 15
Source File: FieldGen.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private int addConstant() {
  switch(type.getType()) {
  case Constants.T_INT: case Constants.T_CHAR: case Constants.T_BYTE:
  case Constants.T_BOOLEAN: case Constants.T_SHORT:
    return cp.addInteger(((Integer)value).intValue());

  case Constants.T_FLOAT:
    return cp.addFloat(((Float)value).floatValue());

  case Constants.T_DOUBLE:
    return cp.addDouble(((Double)value).doubleValue());

  case Constants.T_LONG:
    return cp.addLong(((Long)value).longValue());

  case Constants.T_REFERENCE:
    return cp.addString(((String)value));

  default:
    throw new RuntimeException("Oops: Unhandled : " + type.getType());
  }
}
 
Example 16
Source File: ObjectType.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param class_name fully qualified class name, e.g. java.lang.String
 */
public ObjectType(String class_name) {
  super(Constants.T_REFERENCE, "L" + class_name.replace('.', '/') + ";");
  this.class_name = class_name.replace('/', '.');
}
 
Example 17
Source File: ObjectType.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param class_name fully qualified class name, e.g. java.lang.String
 */
public ObjectType(String class_name) {
  super(Constants.T_REFERENCE, "L" + class_name.replace('.', '/') + ";");
  this.class_name = class_name.replace('/', '.');
}
 
Example 18
Source File: ObjectType.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param class_name fully qualified class name, e.g. java.lang.String
 */
public ObjectType(String class_name) {
  super(Constants.T_REFERENCE, "L" + class_name.replace('.', '/') + ";");
  this.class_name = class_name.replace('/', '.');
}
 
Example 19
Source File: ObjectType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param class_name fully qualified class name, e.g. java.lang.String
 */
public ObjectType(String class_name) {
  super(Constants.T_REFERENCE, "L" + class_name.replace('.', '/') + ";");
  this.class_name = class_name.replace('/', '.');
}
 
Example 20
Source File: ObjectType.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param class_name fully qualified class name, e.g. java.lang.String
 */
public ObjectType(String class_name) {
  super(Constants.T_REFERENCE, "L" + class_name.replace('.', '/') + ";");
  this.class_name = class_name.replace('/', '.');
}