MCPcopy Create free account
hub / github.com/beanshell/beanshell / newCst

Method newCst

src/bsh/org/objectweb/asm/ClassWriter.java:648–666  ·  view source on GitHub ↗

Adds a number or string constant to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. @param cst the value of the constant to be added to the constant pool. This parameter must be an java.lang.Integer Integer, a {@link j

(final Object cst)

Source from the content-addressed store, hash-verified

646 */
647
648 Item newCst (final Object cst) {
649 if (cst instanceof Integer) {
650 int val = ((Integer)cst).intValue();
651 return newInteger(val);
652 } else if (cst instanceof Float) {
653 float val = ((Float)cst).floatValue();
654 return newFloat(val);
655 } else if (cst instanceof Long) {
656 long val = ((Long)cst).longValue();
657 return newLong(val);
658 } else if (cst instanceof Double) {
659 double val = ((Double)cst).doubleValue();
660 return newDouble(val);
661 } else if (cst instanceof String) {
662 return newString((String)cst);
663 } else {
664 throw new IllegalArgumentException("value " + cst);
665 }
666 }
667
668 /**
669 * Adds an UTF string to the constant pool of the class being build. Does

Callers 2

visitFieldMethod · 0.95
visitLdcInsnMethod · 0.80

Calls 6

newIntegerMethod · 0.95
newFloatMethod · 0.95
newLongMethod · 0.95
newDoubleMethod · 0.95
newStringMethod · 0.95
intValueMethod · 0.80

Tested by

no test coverage detected