@Override public void storeClass(JavaClass javaClass) { if (DEBUG) { System.out.println("Storing class " + javaClass.getClassName() + " in repository"); } JavaClass previous = nameToClassMap.put(javaClass.getClassName(), javaClass); if (DEBUG && previous != null) { System.out.println("\t==> A previous class was evicted!"); dumpStack(); } Repository tmp = org.apache.bcel.Repository.getRepository(); if (tmp != null && tmp != this) { throw new IllegalStateException("Wrong/multiple BCEL repository"); } if (tmp == null) { org.apache.bcel.Repository.setRepository(this); } }
@Override public JavaClass analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException { try { ClassData classData = analysisCache.getClassAnalysis(ClassData.class, descriptor); JavaClass javaClass = new ClassParser(classData.getInputStream(), descriptor.toResourceName()).parse(); // Make sure that the JavaClass object knows the repository // it was loaded from. javaClass.setRepository(Repository.getRepository()); if (DEBUG_MISSING_CLASSES && !(javaClass.getRepository() instanceof AnalysisCacheToRepositoryAdapter)) { throw new IllegalStateException("this should not happen"); } return javaClass; } catch (RuntimeException e) { throw new RuntimeException("Unable to parse classfile for " + descriptor, e); } catch (IOException e) { throw new ResourceNotFoundException(descriptor.toResourceName(), e); } }
@Override public void storeClass(JavaClass javaClass) { if (DEBUG) { System.out.println("Storing class " + javaClass.getClassName() + " in repository"); } JavaClass previous = nameToClassMap.put(javaClass.getClassName(), javaClass); if (DEBUG && previous != null) { System.out.println("\t==> A previous class was evicted!"); dumpStack(); } Repository tmp = org.apache.bcel.Repository.getRepository(); if (tmp != null && tmp != this) { throw new IllegalStateException("Wrong/multiple BCEL repository"); } if (tmp == null) { org.apache.bcel.Repository.setRepository(this); } }
@Override public JavaClass analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException { try { ClassData classData = analysisCache.getClassAnalysis(ClassData.class, descriptor); JavaClass javaClass = new ClassParser(classData.getInputStream(), descriptor.toResourceName()).parse(); // Make sure that the JavaClass object knows the repository // it was loaded from. javaClass.setRepository(Repository.getRepository()); if (DEBUG_MISSING_CLASSES && !(javaClass.getRepository() instanceof AnalysisCacheToRepositoryAdapter)) { throw new IllegalStateException("this should not happen"); } return javaClass; } catch (RuntimeException e) { throw new RuntimeException("Unable to parse classfile for " + descriptor, e); } catch (IOException e) { throw new ResourceNotFoundException(descriptor.toResourceName(), e); } }