Giter Site home page Giter Site logo

mhoennig / columbo Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 150 KB

bytecode inspection of classes in classpath to determine usage of specified classes/methods etc., e.g. for special @Deprecated annotations with expiry version or check for usage of @Internal elements

License: Other

Java 99.22% Shell 0.78%

columbo's People

Contributors

mhoennig avatar

Watchers

 avatar  avatar  avatar

Forkers

tobiasstamann

columbo's Issues

bytecode within anonymous classes not detected

Bytecode within anonymous classes is not detected if it extends a superclass:

    public Runnable anonExtendingAClass = new Thread() {
        @Override
        public void run() {
            new Integer(42).toString();
        }
    };

Surprisingly it is detected if it implements an interface:

    public Runnable anonImplementingAnInterface = new Runnable() {
        @Override
        public void run() {
            new String("Hello").toString();
        }
    };

typeNameToClass throws exception instead of callback onClassNotFound

java.lang.NoClassDefFoundError: B[some referenced class references from A]
at A[some business class from classpath].(DataRestrictionCategoryType.java:44)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at de.javagil.columbo.internal.BytecodeUtil.typeNameToClass(BytecodeUtil.java:170)
at de.javagil.columbo.internal.BytecodeUtil.taggedTypeNameToClass(BytecodeUtil.java:133)
at de.javagil.columbo.internal.BytecodeUtil.determineParameterTypes(BytecodeUtil.java:112)
at de.javagil.columbo.internal.ClassVisitor.visitMethod(ClassVisitor.java:90)
at de.javagil.columbo.internal.ClassVisitor.visitMethod(ClassVisitor.java:52)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at de.javagil.columbo.internal.ClassVisitor.getReferersOfClassName(ClassVisitor.java:131)
at de.javagil.columbo.internal.ClassVisitor.inspect(ClassVisitor.java:122)
at de.javagil.columbo.api.BytecodeInspector.inspect(BytecodeInspector.java:77)

java.lang.NoClassDefFoundError in MethodVisitor.onFieldAccess

java.lang.NoClassDefFoundError: [some referred class]
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredField(Class.java:1880)
at de.javagil.columbo.internal.BytecodeUtil.findField(BytecodeUtil.java:241)
at de.javagil.columbo.internal.MethodVisitor.findField(MethodVisitor.java:159)
at de.javagil.columbo.internal.MethodVisitor.onFieldAccess(MethodVisitor.java:118)
at de.javagil.columbo.internal.MethodVisitor.visitFieldInsn(MethodVisitor.java:90)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at de.javagil.columbo.internal.ClassVisitor.getReferersOfClassName(ClassVisitor.java:137)
at de.javagil.columbo.internal.ClassVisitor.inspect(ClassVisitor.java:128)
at de.javagil.columbo.api.BytecodeInspector.inspect(BytecodeInspector.java:77)

InspectionException in visitFieldInsn/taggedTypeNameToClass on inconsistent classpath

de.javagil.columbo.api.InspectionException: could not determine class in type some/not/anymore/existing/ClientClass
at de.javagil.columbo.internal.BytecodeUtil.taggedTypeNameToClass(BytecodeUtil.java:137)
at de.javagil.columbo.internal.MethodVisitor.visitFieldInsn(MethodVisitor.java:86)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at de.javagil.columbo.internal.ClassVisitor.getReferersOfClassName(ClassVisitor.java:137)
at de.javagil.columbo.internal.ClassVisitor.inspect(ClassVisitor.java:128)
at de.javagil.columbo.api.BytecodeInspector.inspect(BytecodeInspector.java:77)

byte#clone() + [B#clone() need special treatment

currently onMethodNotFound is called when bytecode contains byte#clone() or [B#clone(), which is wrong. Such methods do not really exist in Java, but seem to be special treated in the JVM. Therefore some special treatment is neccessary in columbo as well,

ReferenceVisitor.on...NotFound() lacks referrer

Implementations of ReferenceVisitor have no access to the referrer if some Java element was not found by reflection. Thus the referrer should be passed to the on...NotFound() methods as an argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.