Closed reprogrammer closed 13 years ago
The problem is that WALA CAst doesn't handle annotation type declarations at the moment. Therefore, we changed com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator
to suppress the exception.
I've reopened this issue because it seems to be causing issue #8.
I filed a bug report on the WALA's bug tracker system for this issue.
It turned out that our patch had fixed this problem but we didn't realize it. Anyways, this problem has been fixed in revision 4020 of com.ibm.wala.cast.java.jdt
.
WALA still fails on Tomcat with the following exception.
edu.illinois.keshmesh.detector.exception.Exceptions$WALAInitializationException: java.lang.NullPointerException at edu.illinois.keshmesh.detector.Main.initAnalysis(Main.java:60) at edu.illinois.keshmesh.detector.Main.initAndPerformAnalysis(Main.java:40) at edu.illinois.keshmesh.ui.findbugs.KeshmeshFindBugsDetector.visitClassContext(KeshmeshFindBugsDetector.java:80) at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:74) at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1109) at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:266) at de.tobject.findbugs.builder.FindBugsWorker.runFindBugs(FindBugsWorker.java:288) at de.tobject.findbugs.builder.FindBugsWorker.work(FindBugsWorker.java:198) at de.tobject.findbugs.actions.FindBugsAction$StartedFromViewJob.runWithProgress(FindBugsAction.java:265) at de.tobject.findbugs.FindBugsJob.run(FindBugsJob.java:61) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: java.lang.NullPointerException at com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.defineType(JavaSourceLoaderImpl.java:456) at com.ibm.wala.cast.java.translator.JavaCAst2IRTranslator.defineType(JavaCAst2IRTranslator.java:322) at com.ibm.wala.cast.ir.translator.AstTranslator.visitTypeEntity(AstTranslator.java:2385) at com.ibm.wala.cast.tree.visit.CAstVisitor.visitEntities(CAstVisitor.java:156) at com.ibm.wala.cast.tree.visit.CAstVisitor.visitScopedEntities(CAstVisitor.java:122) at com.ibm.wala.cast.tree.visit.CAstVisitor.visitScopedEntities(CAstVisitor.java:114) at com.ibm.wala.cast.tree.visit.CAstVisitor.visitEntities(CAstVisitor.java:138) at com.ibm.wala.cast.ir.translator.AstTranslator.walkEntities(AstTranslator.java:3611) at com.ibm.wala.cast.ir.translator.AstTranslator.translate(AstTranslator.java:3682) at com.ibm.wala.cast.java.translator.JavaCAst2IRTranslator.translate(JavaCAst2IRTranslator.java:51) at com.ibm.wala.cast.java.translator.Java2IRTranslator.translate(Java2IRTranslator.java:76) at com.ibm.wala.cast.java.translator.jdt.JDTSourceModuleTranslator$1.acceptAST(JDTSourceModuleTranslator.java:144) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:883) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:577) at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:888) at com.ibm.wala.cast.java.translator.jdt.JDTSourceModuleTranslator.loadAllSources(JDTSourceModuleTranslator.java:140) at com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.loadAllSources(JavaSourceLoaderImpl.java:428) at com.ibm.wala.classLoader.ClassLoaderImpl.init(ClassLoaderImpl.java:478) at com.ibm.wala.cast.java.translator.jdt.JDTClassLoaderFactory.makeNewClassLoader(JDTClassLoaderFactory.java:67) at com.ibm.wala.classLoader.ClassLoaderFactoryImpl.getLoader(ClassLoaderFactoryImpl.java:68) at com.ibm.wala.ipa.cha.ClassHierarchy.(ClassHierarchy.java:229) at com.ibm.wala.ipa.cha.ClassHierarchy. (ClassHierarchy.java:175) at com.ibm.wala.ipa.cha.ClassHierarchy.make(ClassHierarchy.java:1172) at com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine.buildClassHierarchy(JavaSourceAnalysisEngine.java:130) at com.ibm.wala.client.AbstractAnalysisEngine.defaultCallGraphBuilder(AbstractAnalysisEngine.java:292) at com.ibm.wala.client.AbstractAnalysisEngine.buildDefaultCallGraph(AbstractAnalysisEngine.java:301) at edu.illinois.keshmesh.detector.Main.initAnalysis(Main.java:53) ... 10 more
This exception is thrown because com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.fTypeMap
is null
in com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.defineType
even though it's initialized when it's declared because com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.loadAllSources(Set<ModuleEntry>)
sets it to null
.
We've switched from WALA's source front end (CAst) to the byte code front end. So, we no longer need to fix this issue.
When I ran the Keshmesh plugin for Findbugs on the latest version of Tomcat as of Dec 4, 2010, I got the following exception.
It looks like WALA fails to build the call graph for Tomcat.