• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NEW类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.bcel.generic.NEW的典型用法代码示例。如果您正苦于以下问题:Java NEW类的具体用法?Java NEW怎么用?Java NEW使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NEW类属于org.apache.bcel.generic包,在下文中一共展示了NEW类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleCodeFragment

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
/** Handles a single code fragment. */
private void handleCodeFragment(List<String> resultList,
		ConstantPoolGen cpg, Code code) {
	for (Instruction i : new InstructionList(code.getCode())
			.getInstructions()) {
		if (i instanceof NEW) {
			NEW newInstruction = (NEW) i;
			ObjectType ot = newInstruction.getLoadClassType(cpg);

			if (ot == null) { // ot is primitive type
				continue;
			}

			String newClassName = ot.getClassName();
			if (!resultList.contains(newClassName)
					&& !isBlacklisted(newClassName)) {
				resultList.add(newClassName);
			}
		}
	}
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:22,代码来源:CreationListBuilder.java


示例2: isPEI

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
/**
 * Return whether or not the given instruction can throw exceptions.
 *
 * @param handle
 *            the instruction
 * @return true if the instruction can throw an exception, false otherwise
 */
private boolean isPEI(InstructionHandle handle) {
    Instruction ins = handle.getInstruction();

    if (!(ins instanceof ExceptionThrower))
        return false;

    if (ins instanceof NEW)
        return false;
    // if (ins instanceof ATHROW) return false;
    if (ins instanceof GETSTATIC)
        return false;
    if (ins instanceof PUTSTATIC)
        return false;
    if (ins instanceof ReturnInstruction)
        return false;
    if (ins instanceof INSTANCEOF)
        return false;
    if (ins instanceof MONITOREXIT)
        return false;
    if (ins instanceof LDC)
        return false;
    return true;

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:BetterCFGBuilder2.java


示例3: visitNEW

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitNEW(NEW o){
	indexValid(o, o.getIndex());
	Constant c = cpg.getConstant(o.getIndex());
	if (!	(c instanceof ConstantClass)){
		constraintViolated(o, "Expecting a CONSTANT_Class operand, but found a '"+c+"'.");
	}
	else{
		ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant( ((ConstantClass) c).getNameIndex() ));
		Type t = Type.getType("L"+cutf8.getBytes()+";");
		if (t instanceof ArrayType){
			constraintViolated(o, "NEW must not be used to create an array.");
		}
	}
	
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:17,代码来源:Pass3aVerifier.java


示例4: match

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
public MatchResult match(InstructionHandle handle, ConstantPoolGen cpg,
                         ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) throws DataflowAnalysisException {

	Instruction ins = handle.getInstruction();
	if (!(ins instanceof NEW))
		return null;

	LocalVariable result = new LocalVariable(after.getTopValue());
	return addOrCheckDefinition(result, bindingSet);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:New.java


示例5: visitNEW

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
@Override
public void visitNEW(NEW obj) {
    Taint taint = new Taint(Taint.State.SAFE);
    ObjectType type = obj.getLoadClassType(cpg);
    taint.setRealInstanceClass(type);
    if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) {
        taint.setDebugInfo("new " + type.getClassName() + "()");
    }
    getFrame().pushValue(taint);
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:11,代码来源:TaintFrameModelingVisitor.java


示例6: visitNEW

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
public void visitNEW(NEW n) {
	Type t = n.getType(poolGen);
	log.log("         instr(new)=" + t, Project.MSG_DEBUG);
	String type = t.toString();

	design.checkClass(type);
}
 
开发者ID:cniweb,项目名称:ant-contrib,代码行数:8,代码来源:InstructionVisitor.java


示例7: isNullCheck

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
public static boolean isNullCheck(InstructionHandle h, ConstantPoolGen cpg) {
    if (!(h.getInstruction() instanceof IFNONNULL))
        return false;
    h = h.getNext();
    final Instruction newInstruction = h.getInstruction();
    if (!(newInstruction instanceof NEW))
        return false;
    final ObjectType loadClassType = ((NEW) newInstruction).getLoadClassType(cpg);
    if (!loadClassType.getClassName().equals("java.lang.NullPointerException"))
        return false;
    h = h.getNext();
    return check(h, NULLCHECK1) || check(h, NULLCHECK2);

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:15,代码来源:UnconditionalValueDerefAnalysis.java


示例8: match

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
@Override
public MatchResult match(InstructionHandle handle, ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after,
        BindingSet bindingSet) throws DataflowAnalysisException {

    Instruction ins = handle.getInstruction();
    if (!(ins instanceof NEW))
        return null;

    LocalVariable result = new LocalVariable(after.getTopValue());
    return addOrCheckDefinition(result, bindingSet);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:12,代码来源:New.java


示例9: run

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
@Override
public void run() {
	String args[] = EntryPoint.getArgs();
	String inputJarFileName = args[0];
	String outputSrgMappingsFileName = args[1];
	try (
		PrintWriter outputSrgMappingWriter = new PrintWriter(outputSrgMappingsFileName);
		JarFile inputJarFile = new JarFile(inputJarFileName)
	) {
		for (JarEntry jarEntry : new EnumerationIterator<>(inputJarFile.entries())) {
			if (jarEntry.isDirectory() || !jarEntry.getName().endsWith(".class")) {
				continue;
			}
			String original = Utils.stripClassEnding(jarEntry.getName());
			JavaClass clazz = new ClassParser(inputJarFile.getInputStream(jarEntry), original).parse();
			if (clazz.isEnum()) {
				Method staticInit = getCLInit(clazz);
				//skip enums with no static init method
				if (staticInit == null) {
					continue;
				}
				ConstantPoolGen cpGen = new ClassGen(clazz).getConstantPool();
				MethodGen methodGen = new MethodGen(staticInit, clazz.getClassName(), cpGen);
				Iterator<Instruction> instrIter = Arrays.asList(methodGen.getInstructionList().getInstructions()).iterator();
				while (instrIter.hasNext()) {
					//first goes NEW
					Instruction instr = instrIter.next();
					if (!(instr instanceof NEW)) {
						break;
					}
					//but it may actually be another new, so we check if it is for enum constant
					if (!((NEW) instr).getLoadClassType(cpGen).getClassName().equals(clazz.getClassName())) {
						break;
					}
					//then goes dup, skip it
					instrIter.next();
					//LDC with our real enum name
					String realName = (String) ((LDC) instrIter.next()).getValue(cpGen);
					//now skip everything, until we reach invokespecial with <init> for this enum field
					while (true) {
						Instruction nextInstr = instrIter.next();
						if (nextInstr instanceof INVOKESPECIAL) {
							INVOKESPECIAL ispecial = ((INVOKESPECIAL) nextInstr);
							if (ispecial.getMethodName(cpGen).equals("<init>") && (ispecial.getClassName(cpGen).equals(clazz.getClassName()))) {
								break;
							}
						}
					}
					//next is putstatic with our obufscated field name
					PUTSTATIC putstatic = (PUTSTATIC) instrIter.next();
					String obfName = putstatic.getFieldName(cpGen);
					//now print the mapping
					outputSrgMappingWriter.println(MappingUtils.createSRG(clazz.getClassName(), obfName, realName));
				}
			}
		}
	} catch (Throwable t) {
		t.printStackTrace();
	}
}
 
开发者ID:MCCarbon,项目名称:DecompileTools,代码行数:61,代码来源:EnumConstNameRestorer.java


示例10: visitNEW

import org.apache.bcel.generic.NEW; //导入依赖的package包/类
@Override
public void visitNEW(NEW obj) {
    produce(IsNullValue.nonNullValue());
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:IsNullValueFrameModelingVisitor.java



注:本文中的org.apache.bcel.generic.NEW类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Emitter类代码示例发布时间:2022-05-22
下一篇:
Java PostInsertEventListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap