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

Java Deprecated类代码示例

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

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



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

示例1: markedAsNotUsable

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
private boolean markedAsNotUsable(Method obj) {
    for (Attribute a : obj.getAttributes())
        if (a instanceof Deprecated)
            return true;
    Code code = obj.getCode();
    if (code == null)
        return false;
    byte[] codeBytes = code.getCode();
    if (codeBytes.length > 1 && codeBytes.length < 10) {
        int lastOpcode = codeBytes[codeBytes.length - 1] & 0xff;
        if (lastOpcode != ATHROW)
            return false;
        for (int b : codeBytes)
            if ((b & 0xff) == RETURN)
                return false;
        return true;
    }
    return false;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:Naming.java


示例2: visitDeprecated

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitDeprecated(Deprecated obj){//vmspec2 4.7.10
	checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

	String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
	if (! name.equals("Deprecated")){
		throw new ClassConstraintException("The Deprecated attribute '"+tostring(obj)+"' is not correctly named 'Deprecated' but '"+name+"'.");
	}
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:9,代码来源:Pass2Verifier.java


示例3: visitDeprecated

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitDeprecated(Deprecated obj) {//vmspec2 4.7.10
    checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

    String name = ((ConstantUtf8) cp.getConstant(obj.getNameIndex())).getBytes();
    if (!name.equals("Deprecated")) {
        throw new ClassConstraintException("The Deprecated attribute '" + tostring(obj) + "' is not correctly named 'Deprecated' but '" + name + "'.");
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:9,代码来源:Pass2Verifier.java


示例4: visitJavaClass

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitJavaClass(JavaClass obj){
	Attribute[] atts = obj.getAttributes();
	boolean foundSourceFile = false;
	boolean foundInnerClasses = false;

	// Is there an InnerClass referenced?
	// This is a costly check; existing verifiers don't do it!
	boolean hasInnerClass = new InnerClassDetector(jc).innerClassReferenced();

	for (int i=0; i<atts.length; i++){
		if ((! (atts[i] instanceof SourceFile)) &&
		    (! (atts[i] instanceof Deprecated))     &&
		    (! (atts[i] instanceof InnerClasses)) &&
		    (! (atts[i] instanceof Synthetic))){
			addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of the ClassFile structure '"+tostring(obj)+"' is unknown and will therefore be ignored.");
		}

		if (atts[i] instanceof SourceFile){
			if (foundSourceFile == false) foundSourceFile = true;
			else throw new ClassConstraintException("A ClassFile structure (like '"+tostring(obj)+"') may have no more than one SourceFile attribute."); //vmspec2 4.7.7
		}

		if (atts[i] instanceof InnerClasses){
			if (foundInnerClasses == false) foundInnerClasses = true;
			else{
				if (hasInnerClass){
					throw new ClassConstraintException("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). More than one InnerClasses attribute was found.");
				}
			}
			if (!hasInnerClass){
				addMessage("No referenced Inner Class found, but InnerClasses attribute '"+tostring(atts[i])+"' found. Strongly suggest removal of that attribute.");
			}
		}

	}
	if (hasInnerClass && !foundInnerClasses){
		//throw new ClassConstraintException("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
		//vmspec2, page 125 says it would be a constraint: but existing verifiers
		//don't check it and javac doesn't satisfy it when it comes to anonymous
		//inner classes
		addMessage("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
	}
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:44,代码来源:Pass2Verifier.java


示例5: visitField

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitField(Field obj){

			if (jc.isClass()){
				int maxone=0;
				if (obj.isPrivate()) maxone++;
				if (obj.isProtected()) maxone++;
				if (obj.isPublic()) maxone++;
				if (maxone > 1){
					throw new ClassConstraintException("Field '"+tostring(obj)+"' must only have at most one of its ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC modifiers set.");
				}

				if (obj.isFinal() && obj.isVolatile()){
					throw new ClassConstraintException("Field '"+tostring(obj)+"' must only have at most one of its ACC_FINAL, ACC_VOLATILE modifiers set.");
				}
			}
			else{ // isInterface!
				if (!obj.isPublic()){
					throw new ClassConstraintException("Interface field '"+tostring(obj)+"' must have the ACC_PUBLIC modifier set but hasn't!");
				}
				if (!obj.isStatic()){
					throw new ClassConstraintException("Interface field '"+tostring(obj)+"' must have the ACC_STATIC modifier set but hasn't!");
				}
				if (!obj.isFinal()){
					throw new ClassConstraintException("Interface field '"+tostring(obj)+"' must have the ACC_FINAL modifier set but hasn't!");
				}
			}

			if ((obj.getAccessFlags() & ~(ACC_PUBLIC|ACC_PRIVATE|ACC_PROTECTED|ACC_STATIC|ACC_FINAL|ACC_VOLATILE|ACC_TRANSIENT)) > 0){
				addMessage("Field '"+tostring(obj)+"' has access flag(s) other than ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_VOLATILE, ACC_TRANSIENT set (ignored).");
			}

			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

			String name = obj.getName();
			if (! validFieldName(name)){
				throw new ClassConstraintException("Field '"+tostring(obj)+"' has illegal name '"+obj.getName()+"'.");
			}

			// A descriptor is often named signature in BCEL
			checkIndex(obj, obj.getSignatureIndex(), CONST_Utf8);

			String sig  = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)

			try{
				Type.getType(sig);  /* Don't need the return value */
			}
			catch (ClassFormatError cfe){ // sometimes BCEL is a little harsh describing exceptional situations.
				throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.");
			}

			String nameanddesc = (name+sig);
			if (field_names_and_desc.contains(nameanddesc)){
				throw new ClassConstraintException("No two fields (like '"+tostring(obj)+"') are allowed have same names and descriptors!");
			}
			if (field_names.contains(name)){
				addMessage("More than one field of name '"+name+"' detected (but with different type descriptors). This is very unusual.");
			}
			field_names_and_desc.add(nameanddesc);
			field_names.add(name);

			Attribute[] atts = obj.getAttributes();
			for (int i=0; i<atts.length; i++){
				if ((! (atts[i] instanceof ConstantValue)) &&
				    (! (atts[i] instanceof Synthetic))     &&
				    (! (atts[i] instanceof Deprecated))){
					addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of Field '"+tostring(obj)+"' is unknown and will therefore be ignored.");
				}
				if  (! (atts[i] instanceof ConstantValue)){
					addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of Field '"+tostring(obj)+"' is not a ConstantValue and is therefore only of use for debuggers and such.");
				}
			}
		}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:73,代码来源:Pass2Verifier.java


示例6: visitDeprecated

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitDeprecated(Deprecated obj){
	tostring = toString(obj);
}
 
开发者ID:linchaolong,项目名称:ApkToolPlus,代码行数:4,代码来源:StringRepresentation.java


示例7: visitJavaClass

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitJavaClass(JavaClass obj){
	Attribute[] atts = obj.getAttributes();
	boolean foundSourceFile = false;
	boolean foundInnerClasses = false;

	// Is there an InnerClass referenced?
	// This is a costly check; existing verifiers don't do it!
	boolean hasInnerClass = new InnerClassDetector(jc).innerClassReferenced();

	for (int i=0; i<atts.length; i++){
		if ((! (atts[i] instanceof SourceFile)) &&
		    (! (atts[i] instanceof Deprecated))     &&
		    (! (atts[i] instanceof InnerClasses)) &&
		    (! (atts[i] instanceof Synthetic))){
			addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of the ClassFile structure '"+tostring(obj)+"' is unknown and will therefore be ignored.");
		}

		if (atts[i] instanceof SourceFile){
			if (foundSourceFile == false) {
                      foundSourceFile = true;
                  } else {
                      throw new ClassConstraintException("A ClassFile structure (like '"+tostring(obj)+"') may have no more than one SourceFile attribute."); //vmspec2 4.7.7
                  }
		}

		if (atts[i] instanceof InnerClasses){
			if (foundInnerClasses == false) {
                      foundInnerClasses = true;
                  } else{
				if (hasInnerClass){
					throw new ClassConstraintException("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). More than one InnerClasses attribute was found.");
				}
			}
			if (!hasInnerClass){
				addMessage("No referenced Inner Class found, but InnerClasses attribute '"+tostring(atts[i])+"' found. Strongly suggest removal of that attribute.");
			}
		}

	}
	if (hasInnerClass && !foundInnerClasses){
		//throw new ClassConstraintException("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
		//vmspec2, page 125 says it would be a constraint: but existing verifiers
		//don't check it and javac doesn't satisfy it when it comes to anonymous
		//inner classes
		addMessage("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
	}
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:48,代码来源:Pass2Verifier.java


示例8: visitField

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitField(Field obj){

			if (jc.isClass()){
				int maxone=0;
				if (obj.isPrivate()) {
                    maxone++;
                }
				if (obj.isProtected()) {
                    maxone++;
                }
				if (obj.isPublic()) {
                    maxone++;
                }
				if (maxone > 1){
					throw new ClassConstraintException("Field '"+tostring(obj)+"' must only have at most one of its ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC modifiers set.");
				}

				if (obj.isFinal() && obj.isVolatile()){
					throw new ClassConstraintException("Field '"+tostring(obj)+"' must only have at most one of its ACC_FINAL, ACC_VOLATILE modifiers set.");
				}
			}
			else{ // isInterface!
				if (!obj.isPublic()){
					throw new ClassConstraintException("Interface field '"+tostring(obj)+"' must have the ACC_PUBLIC modifier set but hasn't!");
				}
				if (!obj.isStatic()){
					throw new ClassConstraintException("Interface field '"+tostring(obj)+"' must have the ACC_STATIC modifier set but hasn't!");
				}
				if (!obj.isFinal()){
					throw new ClassConstraintException("Interface field '"+tostring(obj)+"' must have the ACC_FINAL modifier set but hasn't!");
				}
			}

			if ((obj.getAccessFlags() & ~(ACC_PUBLIC|ACC_PRIVATE|ACC_PROTECTED|ACC_STATIC|ACC_FINAL|ACC_VOLATILE|ACC_TRANSIENT)) > 0){
				addMessage("Field '"+tostring(obj)+"' has access flag(s) other than ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_VOLATILE, ACC_TRANSIENT set (ignored).");
			}

			checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

			String name = obj.getName();
			if (! validFieldName(name)){
				throw new ClassConstraintException("Field '"+tostring(obj)+"' has illegal name '"+obj.getName()+"'.");
			}

			// A descriptor is often named signature in BCEL
			checkIndex(obj, obj.getSignatureIndex(), CONST_Utf8);

			String sig  = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)

			try{
				Type.getType(sig);  /* Don't need the return value */
			}
			catch (ClassFormatException cfe){
                throw new ClassConstraintException("Illegal descriptor (==signature) '"+sig+"' used by '"+tostring(obj)+"'.");
			}

			String nameanddesc = (name+sig);
			if (field_names_and_desc.contains(nameanddesc)){
				throw new ClassConstraintException("No two fields (like '"+tostring(obj)+"') are allowed have same names and descriptors!");
			}
			if (field_names.contains(name)){
				addMessage("More than one field of name '"+name+"' detected (but with different type descriptors). This is very unusual.");
			}
			field_names_and_desc.add(nameanddesc);
			field_names.add(name);

			Attribute[] atts = obj.getAttributes();
			for (int i=0; i<atts.length; i++){
				if ((! (atts[i] instanceof ConstantValue)) &&
				    (! (atts[i] instanceof Synthetic))     &&
				    (! (atts[i] instanceof Deprecated))){
					addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of Field '"+tostring(obj)+"' is unknown and will therefore be ignored.");
				}
				if  (! (atts[i] instanceof ConstantValue)){
					addMessage("Attribute '"+tostring(atts[i])+"' as an attribute of Field '"+tostring(obj)+"' is not a ConstantValue and is therefore only of use for debuggers and such.");
				}
			}
		}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:79,代码来源:Pass2Verifier.java


示例9: visitDeprecated

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitDeprecated(Deprecated obj) {
    tostring = toString(obj);
}
 
开发者ID:Hu6,项目名称:VestaClient,代码行数:4,代码来源:StringRepresentation.java


示例10: visitDeprecated

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitDeprecated(Deprecated attribute) {
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:3,代码来源:DecompilingVisitor.java


示例11: visitJavaClass

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitJavaClass(JavaClass obj) {
    Attribute[] atts = obj.getAttributes();
    boolean foundSourceFile = false;
    boolean foundInnerClasses = false;

    // Is there an InnerClass referenced?
    // This is a costly check; existing verifiers don't do it!
    boolean hasInnerClass = new InnerClassDetector(jc).innerClassReferenced();

    for (Attribute att : atts) {
        if ((!(att instanceof SourceFile)) &&
                (!(att instanceof Deprecated)) &&
                (!(att instanceof InnerClasses)) &&
                (!(att instanceof Synthetic))) {
            addMessage("Attribute '" + tostring(att) + "' as an attribute of the ClassFile structure '" + tostring(obj) + "' is unknown and will therefore be ignored.");
        }

        if (att instanceof SourceFile) {
            if (!foundSourceFile) foundSourceFile = true;
            else
                throw new ClassConstraintException("A ClassFile structure (like '" + tostring(obj) + "') may have no more than one SourceFile attribute."); //vmspec2 4.7.7
        }

        if (att instanceof InnerClasses) {
            if (!foundInnerClasses) foundInnerClasses = true;
            else {
                if (hasInnerClass) {
                    throw new ClassConstraintException("A Classfile structure (like '" + tostring(obj) + "') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). More than one InnerClasses attribute was found.");
                }
            }
            if (!hasInnerClass) {
                addMessage("No referenced Inner Class found, but InnerClasses attribute '" + tostring(att) + "' found. Strongly suggest removal of that attribute.");
            }
        }

    }
    if (hasInnerClass && !foundInnerClasses) {
        //throw new ClassConstraintException("A Classfile structure (like '"+tostring(obj)+"') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
        //vmspec2, page 125 says it would be a constraint: but existing verifiers
        //don't check it and javac doesn't satisfy it when it comes to anonymous
        //inner classes
        addMessage("A Classfile structure (like '" + tostring(obj) + "') must have exactly one InnerClasses attribute if at least one Inner Class is referenced (which is the case). No InnerClasses attribute was found.");
    }
}
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:45,代码来源:Pass2Verifier.java


示例12: visitField

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitField(Field obj) {

            if (jc.isClass()) {
                int maxone = 0;
                if (obj.isPrivate()) maxone++;
                if (obj.isProtected()) maxone++;
                if (obj.isPublic()) maxone++;
                if (maxone > 1) {
                    throw new ClassConstraintException("Field '" + tostring(obj) + "' must only have at most one of its ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC modifiers set.");
                }

                if (obj.isFinal() && obj.isVolatile()) {
                    throw new ClassConstraintException("Field '" + tostring(obj) + "' must only have at most one of its ACC_FINAL, ACC_VOLATILE modifiers set.");
                }
            } else { // isInterface!
                if (!obj.isPublic()) {
                    throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_PUBLIC modifier set but hasn't!");
                }
                if (!obj.isStatic()) {
                    throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_STATIC modifier set but hasn't!");
                }
                if (!obj.isFinal()) {
                    throw new ClassConstraintException("Interface field '" + tostring(obj) + "' must have the ACC_FINAL modifier set but hasn't!");
                }
            }

            if ((obj.getAccessFlags() & ~(ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_STATIC | ACC_FINAL | ACC_VOLATILE | ACC_TRANSIENT)) > 0) {
                addMessage("Field '" + tostring(obj) + "' has access flag(s) other than ACC_PUBLIC, ACC_PRIVATE, ACC_PROTECTED, ACC_STATIC, ACC_FINAL, ACC_VOLATILE, ACC_TRANSIENT set (ignored).");
            }

            checkIndex(obj, obj.getNameIndex(), CONST_Utf8);

            String name = obj.getName();
            if (!validFieldName(name)) {
                throw new ClassConstraintException("Field '" + tostring(obj) + "' has illegal name '" + obj.getName() + "'.");
            }

            // A descriptor is often named signature in BCEL
            checkIndex(obj, obj.getSignatureIndex(), CONST_Utf8);

            String sig = ((ConstantUtf8) (cp.getConstant(obj.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)

            try {
                Type.getType(sig);  /* Don't need the return value */
            } catch (ClassFormatError cfe) { // sometimes BCEL is a little harsh describing exceptional situations.
                throw new ClassConstraintException("Illegal descriptor (==signature) '" + sig + "' used by '" + tostring(obj) + "'.");
            }

            String nameanddesc = (name + sig);
            if (field_names_and_desc.contains(nameanddesc)) {
                throw new ClassConstraintException("No two fields (like '" + tostring(obj) + "') are allowed have same names and descriptors!");
            }
            if (field_names.contains(name)) {
                addMessage("More than one field of name '" + name + "' detected (but with different type descriptors). This is very unusual.");
            }
            field_names_and_desc.add(nameanddesc);
            field_names.add(name);

            Attribute[] atts = obj.getAttributes();
            for (Attribute att : atts) {
                if ((!(att instanceof ConstantValue)) &&
                        (!(att instanceof Synthetic)) &&
                        (!(att instanceof Deprecated))) {
                    addMessage("Attribute '" + tostring(att) + "' as an attribute of Field '" + tostring(obj) + "' is unknown and will therefore be ignored.");
                }
                if (!(att instanceof ConstantValue)) {
                    addMessage("Attribute '" + tostring(att) + "' as an attribute of Field '" + tostring(obj) + "' is not a ConstantValue and is therefore only of use for debuggers and such.");
                }
            }
        }
 
开发者ID:miuirussia,项目名称:KJBE,代码行数:71,代码来源:Pass2Verifier.java


示例13: visitDeprecated

import org.apache.bcel.classfile.Deprecated; //导入依赖的package包/类
public void visitDeprecated(Deprecated attribute) { printEndMethod(attribute); } 
开发者ID:diana-hep,项目名称:root4j,代码行数:2,代码来源:JasminVisitor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Collision类代码示例发布时间:2022-05-22
下一篇:
Java ShouldThrowException类代码示例发布时间: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