热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.bcel.generic.INVOKESPECIAL类的使用及代码示例

本文整理了Java中org.apache.bcel.generic.INVOKESPECIAL类的一些代码示例,展示了INVOKESPECIAL

本文整理了Java中org.apache.bcel.generic.INVOKESPECIAL类的一些代码示例,展示了INVOKESPECIAL类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。INVOKESPECIAL类的具体详情如下:
包路径:org.apache.bcel.generic.INVOKESPECIAL
类名称:INVOKESPECIAL

INVOKESPECIAL介绍

[英]INVOKESPECIAL - Invoke instance method; special handling for superclass, private and instance initialization method invocations

Stack: ..., objectref, [arg1, [arg2 ...]] -> ...

[中]INVOKESPECIAL-调用实例方法;超类、私有和实例初始化方法调用的特殊处理

Stack: ..., objectref, [arg1, [arg2 ...]] -> ...

代码示例

代码示例来源:origin: xalan/xalan

/**
* Expects a double on the stack and pushes a boxed double. Boxed
* double are represented by an instance of java.lang.Double.
*
* @see org.apache.xalan.xsltc.compiler.util.Type#translateTo
*/
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
ReferenceType type) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(new NEW(cpg.addClass(DOUBLE_CLASS)));
il.append(DUP_X2);
il.append(DUP_X2);
il.append(POP);
il.append(new INVOKESPECIAL(cpg.addMethodref(DOUBLE_CLASS,
"", "(D)V")));
}

代码示例来源:origin: find-sec-bugs/find-sec-bugs

if (("javax.crypto.Cipher").equals(invoke.getClassName(cpg)) &&
"init".equals(invoke.getMethodName(cpg))) {
ICONST icOnst= ByteCode.getPrevInstruction(location.getHandle(), ICONST.class);
if (iconst != null) {
else if (("javax.crypto.Cipher").equals(invoke.getClassName(cpg)) &&
"getIV".equals(invoke.getMethodName(cpg))) {
ivFetchFromCipher = true;
if (("javax.crypto.spec.IvParameterSpec").equals(invoke.getClassName(cpg)) &&
"".equals(invoke.getMethodName(cpg))) {

代码示例来源:origin: find-sec-bugs/find-sec-bugs

if(invoke.getMethodName(cpg).equals("") && invoke.getClassName(cpg).equals("java.lang.String") &&
invoke.getSignature(cpg).equals("(Ljava/lang/String;)V")) {
return getConstantLDC(h.getPrev(), cpg, clazz);

代码示例来源:origin: find-sec-bugs/find-sec-bugs

if(inst instanceof INVOKESPECIAL) {
INVOKESPECIAL invoke = (INVOKESPECIAL) inst;
if ("javax.servlet.http.COOKIE".equals(invoke.getClassName(cpg)) &&
"".equals(invoke.getMethodName(cpg))) {

代码示例来源:origin: xalan/xalan

final InstructionList newIL = new InstructionList();
InstructionList oldMethCopyInIL = new InstructionList();
InstructionList oldMethCopyOutIL = new InstructionList();
InstructionList newMethCopyInIL = new InstructionList();
InstructionList newMethCopyOutIL = new InstructionList();
oldMethCopyInIL.append(new NEW(cpg.addClass(argTypeName)));
oldMethCopyInIL.append(InstructionConstants.DUP);
oldMethCopyInIL.append(InstructionConstants.DUP);
oldMethCopyInIL.append(
new INVOKESPECIAL(cpg.addMethodref(argTypeName, "", "()V")));
outlinedMethodRef =
oldMethCopyOutIL.append(
new INVOKESTATIC(cpg.addMethodref(
classGen.getClassName(),
outlinedMethodName,
outlinedMethodRef =
oldMethCopyOutIL.append(
new INVOKEVIRTUAL(cpg.addMethodref(
classGen.getClassName(),
outlinedMethodName,

代码示例来源:origin: xalan/xalan

/**
* Create a constructor for the new class. Updates the reference to the
* collator in the super calls only when the stylesheet specifies a new
* language in xsl:sort.
*/
private static MethodGenerator compileInit(Vector sortObjects,
NodeSortRecordGenerator sortRecord,
ConstantPoolGen cpg,
String className)
{
final InstructionList il = new InstructionList();
final MethodGenerator init =
new MethodGenerator(ACC_PUBLIC,
org.apache.bcel.generic.Type.VOID,
null, null, "", className,
il, cpg);
// Call the constructor in the NodeSortRecord superclass
il.append(ALOAD_0);
il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD,
"", "()V")));
il.append(RETURN);
return init;
}

代码示例来源:origin: xalan/xalan

cpg.addUtf8(var.getEscapedName()),
cpg.addUtf8(var.getType().toSignature()),
null, cpg.getConstantPool()));
dups.add(varRef);
InstructionList il = new InstructionList();
final MethodGenerator cOnstructor=
new MethodGenerator(ACC_PUBLIC,
il.append(ALOAD_0);
il.append(ALOAD_1);
il.append(ALOAD_2);
il.append(new ALOAD(3));
il.append(new ALOAD(6));
il.append(new ALOAD(7));
il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_FACTORY,
"",
"(" + DOM_INTF_SIG
il.append(ILOAD_1);
il.append(ILOAD_2);
il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_FACTORY,
"makeNodeSortRecord", "(II)" + NODE_SORT_RECORD_SIG)));
il.append(DUP);

代码示例来源:origin: xalan/xalan

final String methodName = _mergeSet.getMethodName();
il.append(classGen.loadTranslet());
il.append(methodGen.loadDOM());
il.append(methodGen.loadIterator());
il.append(methodGen.loadHandler());
final int method = cpg.addMethodref(classGen.getClassName(),
methodName, ATTR_SET_SIG);
il.append(new INVOKESPECIAL(method));

代码示例来源:origin: bcel/bcel

/** Create an invoke instruction.
*
* @param class_name name of the called class
* @param name name of the called method
* @param ret_type return type of method
* @param arg_types argument types of method
* @param kind how to invoke, i.e., INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL,
* or INVOKESPECIAL
* @see Constants
*/
public InvokeInstruction createInvoke(String class_name, String name, Type ret_type,
Type[] arg_types, short kind) {
int index;
int nargs = 0;
String signature = Type.getMethodSignature(ret_type, arg_types);
for(int i=0; i nargs += arg_types[i].getSize();
if(kind == Constants.INVOKEINTERFACE)
index = cp.addInterfaceMethodref(class_name, name, signature);
else
index = cp.addMethodref(class_name, name, signature);
switch(kind) {
case Constants.INVOKESPECIAL: return new INVOKESPECIAL(index);
case Constants.INVOKEVIRTUAL: return new INVOKEVIRTUAL(index);
case Constants.INVOKESTATIC: return new INVOKESTATIC(index);
case Constants.INVOKEINTERFACE: return new INVOKEINTERFACE(index, nargs + 1);
default:
throw new RuntimeException("Oops: Unknown invoke kind:" + kind);
}
}

代码示例来源:origin: blackarbiter/Android_Code_Arbiter

if ("java.security.KeyPairGenerator".equals(invoke.getClassName(cpg)) && "initialize".equals(invoke.getMethodName(cpg))) {
Number n = null;
if ("(I)V".equals(invoke.getSignature(cpg))) {
n = ByteCode.getPushNumber(location.getHandle().getPrev());
if ("java.security.spec.RSAKeyGenParameterSpec".equals(invoke.getClassName(cpg)) && "".equals(invoke.getMethodName(cpg))) {
Number n = null;
if ("(ILjava/math/BigInteger;)V".equals(invoke.getSignature(cpg))) {
SIPUSH push = ByteCode.getPrevInstruction(location.getHandle(), SIPUSH.class);
if (push != null) {

代码示例来源:origin: com.mebigfatguy.fb-contrib/fb-contrib

INVOKESPECIAL is = (INVOKESPECIAL) ins;
ReferenceType rt = is.getReferenceType(cpg);
if (Values.CONSTRUCTOR.equals(is.getMethodName(cpg))) {
if ((rt instanceof ObjectType)
&& ((ObjectType) rt).getClassName().startsWith(clsContext.getJavaClass().getClassName() + Values.INNER_CLASS_SEPARATOR)) {
INVOKEVIRTUAL is = (INVOKEVIRTUAL) ins;
ReferenceType rt = is.getReferenceType(cpg);
if ((rt instanceof ObjectType) && ((ObjectType) rt).getClassName().equals(clsName)) {
String methodDesc = is.getName(cpg) + is.getSignature(cpg);
Set fields = methodFieldModifiers.get(methodDesc);
if (fields != null) {

代码示例来源:origin: bcel/bcel

String classname = o.getClassName(cpg);
JavaClass jc = Repository.lookupClass(classname);
Method[] ms = jc.getMethods();
Method m = null;
for (int i=0; i if ( (ms[i].getName().equals(o.getMethodName(cpg))) &&
(Type.getReturnType(ms[i].getSignature()).equals(o.getReturnType(cpg))) &&
(objarrayequals(Type.getArgumentTypes(ms[i].getSignature()), o.getArgumentTypes(cpg))) ){
m = ms[i];
break;
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature not found in class '"+jc.getClassName()+"'. The native verfier does allow the method to be declared in some superclass or implemented interface, which the Java Virtual Machine Specification, Second Edition does not.");
if (! (o.getMethodName(cpg).equals(Constants.CONSTRUCTOR_NAME) )){
if ( (meths[i].getName().equals(o.getMethodName(cpg))) &&
(Type.getReturnType(meths[i].getSignature()).equals(o.getReturnType(cpg))) &&
(objarrayequals(Type.getArgumentTypes(meths[i].getSignature()), o.getArgumentTypes(cpg))) ){
meth = meths[i];
break;
constraintViolated(o, "ACC_SUPER special lookup procedure not successful: method '"+o.getMethodName(cpg)+"' with proper signature not declared in superclass hierarchy.");

代码示例来源:origin: bcel/bcel

if ( (o.getMethodName(cpg).equals(Constants.CONSTRUCTOR_NAME)) && (!(stack().peek(o.getArgumentTypes(cpg).length) instanceof UninitializedObjectType)) ){
constraintViolated(o, "Possibly initializing object twice. A valid instruction sequence must not have an uninitialized object on the operand stack or in a local variable during a backwards branch, or in a local variable in code protected by an exception handler. Please see The Java Virtual Machine Specification, Second Edition, 4.9.4 (pages 147 and 148) for details.");
Type t = o.getType(cpg);
if (t instanceof ObjectType){
String name = ((ObjectType)t).getClassName();
Type[] argtypes = o.getArgumentTypes(cpg);
int nargs = argtypes.length;
if ( !(o.getMethodName(cpg).equals(Constants.CONSTRUCTOR_NAME))){
referenceTypeIsInitialized(o, (ReferenceType) objref);
if (!(objref instanceof ObjectType)){
String theClass = o.getClassName(cpg);
if ( ! Repository.instanceOf(objref_classname, theClass) ){
constraintViolated(o, "The 'objref' item '"+objref+"' does not implement '"+theClass+"' as expected.");

代码示例来源:origin: bcel/bcel

/** Symbolically executes the corresponding Java Virtual Machine instruction. */
public void visitINVOKESPECIAL(INVOKESPECIAL o){
if (o.getMethodName(cpg).equals(Constants.CONSTRUCTOR_NAME)){
UninitializedObjectType t = (UninitializedObjectType) stack().peek(o.getArgumentTypes(cpg).length);
if (t == frame._this){
frame._this = null;
}
stack().initializeObject(t);
locals().initializeObject(t);
}
stack().pop(); //objectref
for (int i=0; i stack().pop();
}
// We are sure the invoked method will xRETURN eventually
// We simulate xRETURNs functionality here because we
// don't really "jump into" and simulate the invoked
// method.
if (o.getReturnType(cpg) != Type.VOID){
Type t = o.getReturnType(cpg);
if ( t.equals(Type.BOOLEAN) ||
t.equals(Type.CHAR) ||
t.equals(Type.BYTE) ||
t.equals(Type.SHORT) )
t = Type.INT;
stack().push(t);
}
}
/** Symbolically executes the corresponding Java Virtual Machine instruction. */

代码示例来源:origin: contra/JMD

public static String getCallMethodName(Instruction ins, ConstantPoolGen cp) {
if (ins instanceof INVOKESTATIC) {
INVOKESTATIC invst = (INVOKESTATIC) ins;
return invst.getMethodName(cp);
} else if (ins instanceof INVOKEVIRTUAL) {
INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
return invst.getMethodName(cp);
} else if (ins instanceof INVOKEINTERFACE) {
INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
return invst.getMethodName(cp);
} else if (ins instanceof INVOKESPECIAL) {
INVOKESPECIAL invst = (INVOKESPECIAL) ins;
return invst.getMethodName(cp);
} else {
return null;
}
}

代码示例来源:origin: spotbugs/spotbugs

if ((prevIns instanceof INVOKESPECIAL && Const.CONSTRUCTOR_NAME.equals(((INVOKESPECIAL) prevIns).getMethodName(methodGen.getConstantPool())))
|| prevIns instanceof ANEWARRAY
|| prevIns instanceof NEWARRAY

代码示例来源:origin: contra/JMD

public static String getCallClassName(Instruction ins, ConstantPoolGen cp) {
if (ins instanceof INVOKESTATIC) {
INVOKESTATIC invst = (INVOKESTATIC) ins;
return invst.getClassName(cp);
} else if (ins instanceof INVOKEVIRTUAL) {
INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
return invst.getClassName(cp);
} else if (ins instanceof INVOKEINTERFACE) {
INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
return invst.getClassName(cp);
} else if (ins instanceof INVOKESPECIAL) {
INVOKESPECIAL invst = (INVOKESPECIAL) ins;
return invst.getClassName(cp);
} else {
return null;
}
}

代码示例来源:origin: contra/JMD

public static String getCallSignature(Instruction ins, ConstantPoolGen cp) {
if (ins instanceof INVOKESTATIC) {
INVOKESTATIC invst = (INVOKESTATIC) ins;
return invst.getSignature(cp);
} else if (ins instanceof INVOKEVIRTUAL) {
INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
return invst.getSignature(cp);
} else if (ins instanceof INVOKEINTERFACE) {
INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
return invst.getSignature(cp);
} else if (ins instanceof INVOKESPECIAL) {
INVOKESPECIAL invst = (INVOKESPECIAL) ins;
return invst.getSignature(cp);
} else {
return null;
}
}

代码示例来源:origin: contra/JMD

public static Type[] getCallArgTypes(Instruction ins, ConstantPoolGen cp) {
if (ins instanceof INVOKESTATIC) {
INVOKESTATIC invst = (INVOKESTATIC) ins;
return invst.getArgumentTypes(cp);
} else if (ins instanceof INVOKEVIRTUAL) {
INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
return invst.getArgumentTypes(cp);
} else if (ins instanceof INVOKEINTERFACE) {
INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
return invst.getArgumentTypes(cp);
} else if (ins instanceof INVOKESPECIAL) {
INVOKESPECIAL invst = (INVOKESPECIAL) ins;
return invst.getArgumentTypes(cp);
} else {
return null;
}
}

代码示例来源:origin: contra/JMD

public static String getCallReturnType(Instruction ins, ConstantPoolGen cp) {
if (ins instanceof INVOKESTATIC) {
INVOKESTATIC invst = (INVOKESTATIC) ins;
return invst.getReturnType(cp).toString();
} else if (ins instanceof INVOKEVIRTUAL) {
INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins;
return invst.getReturnType(cp).toString();
} else if (ins instanceof INVOKEINTERFACE) {
INVOKEINTERFACE invst = (INVOKEINTERFACE) ins;
return invst.getReturnType(cp).toString();
} else if (ins instanceof INVOKESPECIAL) {
INVOKESPECIAL invst = (INVOKESPECIAL) ins;
return invst.getReturnType(cp).toString();
} else {
return null;
}
}

推荐阅读
  • Java学习笔记之面向对象编程(OOP)
    本文介绍了Java学习笔记中的面向对象编程(OOP)内容,包括OOP的三大特性(封装、继承、多态)和五大原则(单一职责原则、开放封闭原则、里式替换原则、依赖倒置原则)。通过学习OOP,可以提高代码复用性、拓展性和安全性。 ... [详细]
  • Java中包装类的设计原因以及操作方法
    本文主要介绍了Java中设计包装类的原因以及操作方法。在Java中,除了对象类型,还有八大基本类型,为了将基本类型转换成对象,Java引入了包装类。文章通过介绍包装类的定义和实现,解答了为什么需要包装类的问题,并提供了简单易用的操作方法。通过本文的学习,读者可以更好地理解和应用Java中的包装类。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • Netty源代码分析服务器端启动ServerBootstrap初始化
    本文主要分析了Netty源代码中服务器端启动的过程,包括ServerBootstrap的初始化和相关参数的设置。通过分析NioEventLoopGroup、NioServerSocketChannel、ChannelOption.SO_BACKLOG等关键组件和选项的作用,深入理解Netty服务器端的启动过程。同时,还介绍了LoggingHandler的作用和使用方法,帮助读者更好地理解Netty源代码。 ... [详细]
  • ejava,刘聪dejava
    本文目录一览:1、什么是Java?2、java ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • PHP中的单例模式与静态变量的区别及使用方法
    本文介绍了PHP中的单例模式与静态变量的区别及使用方法。在PHP中,静态变量的存活周期仅仅是每次PHP的会话周期,与Java、C++不同。静态变量在PHP中的作用域仅限于当前文件内,在函数或类中可以传递变量。本文还通过示例代码解释了静态变量在函数和类中的使用方法,并说明了静态变量的生命周期与结构体的生命周期相关联。同时,本文还介绍了静态变量在类中的使用方法,并通过示例代码展示了如何在类中使用静态变量。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • 本文介绍了RxJava在Android开发中的广泛应用以及其在事件总线(Event Bus)实现中的使用方法。RxJava是一种基于观察者模式的异步java库,可以提高开发效率、降低维护成本。通过RxJava,开发者可以实现事件的异步处理和链式操作。对于已经具备RxJava基础的开发者来说,本文将详细介绍如何利用RxJava实现事件总线,并提供了使用建议。 ... [详细]
  • 本文整理了Java中com.evernote.android.job.JobRequest.getTransientExtras()方法的一些代码示例,展示了 ... [详细]
  • 本文整理了Java中org.apache.solr.common.SolrDocument.setField()方法的一些代码示例,展示了SolrDocum ... [详细]
  • 本文整理了Java中org.gwtbootstrap3.client.ui.Icon.addDomHandler()方法的一些代码示例,展示了Icon.ad ... [详细]
author-avatar
刘延庚
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有