joaoarthurbm / designwizard

DesignWizard (https://sites.google.com/site/designwizardhomepage/) supports automated inspection of Java programs in a higher level than ASM bytecode manipulator.
Other
17 stars 8 forks source link

The call to method Design.getClass(Object.class.getName()) is throwing an InexistentEntityException #22

Open tacianosilva opened 9 years ago

tacianosilva commented 9 years ago

The call to method this.getClass(Object.class.getName()), in Design class, is throwing an InexistentEntityException because the Object (ClassNode for Object.class) doesn't exists in entities field in the Design class.

What should be done when the object class is not extracted?

        //FIXME it should not be public
    public void resolveDependences() {
        try {
            resolveInheritedFieldsAndMethods(this.getClass(Object.class.getName()));
            resolveRelationsBetweenInheritedEntities();
            resolveInterfaces();
        } catch (InexistentEntityException e) {
            // TODO tomar decisões
            e.printStackTrace();
        }
    }

This method needs refactoring. To reproduce the error, run the unit test ExtractingFromClassFileTest. The error occurs during the extraction of facts.

In this case, the method org.designwizard.design.Design.resolveInheritedFieldsAndMethods() should be called to superclasses (eg: TestCase) in the org.designwizard.design.Design.resolveDependences?

org.designwizard.exception.InexistentEntityException: java.lang.Object
    at org.designwizard.design.Design.getEntity(Design.java:369)
    at org.designwizard.design.Design.getClass(Design.java:380)
    at org.designwizard.design.Design.resolveDependences(Design.java:181)
    at org.designwizard.design.manager.DesignManager.resolveDependences(DesignManager.java:151)
    at org.designwizard.design.manager.DesignManager.extractFactsFromClassFile(DesignManager.java:108)
    at org.designwizard.design.manager.DesignManager.extractFacts(DesignManager.java:86)
    at org.designwizard.api.DesignWizard.<init>(DesignWizard.java:57)