in src/main/java/org/adoptopenjdk/jitwatch/ui/code/JitWatchModelService.java [292:359]
public void processBytecodeAnnotations(PsiFile psiFile, Callback5<PsiElement, IMetaMember, MemberBytecode, BytecodeInstruction, List<LineAnnotation>> callback)
{
JitWatchLanguageSupport<PsiElement, PsiElement> languageSupport = LanguageSupport.forLanguage(psiFile.getLanguage());
if (languageSupport == null) return;
List<PsiElement> allClasses = languageSupport.getAllClasses(psiFile);
for (PsiElement cls : allClasses)
{
MetaClass metaClass = getMetaClass(cls);
if (metaClass == null)
{
continue;
}
ClassBC classBytecode = metaClass.getClassBytecode();
if (classBytecode == null)
{
continue;
}
Map<IMetaMember, BytecodeAnnotations> classAnnotations = bytecodeAnnotations.get(metaClass);
if (classAnnotations == null)
{
continue;
}
List<PsiElement> allMethods = languageSupport.getAllMethods(cls);
for (PsiElement method : allMethods)
{
IMetaMember member = classAnnotations.keySet().stream()
.filter(metaMember -> methodMatchesSignature(method, new PsiMetaMemberWrapper(metaMember)))
.findFirst()
.orElse(null);
if (member == null)
{
continue;
}
BytecodeAnnotations annotations = classAnnotations.get(member);
if (annotations == null)
{
continue;
}
MemberBytecode memberBytecode = classBytecode.getMemberBytecode(member);
if (memberBytecode == null)
{
continue;
}
for (IMetaMember memberWithAnnot : annotations.getMembers())
{
BytecodeAnnotationList annotationList = annotations.getAnnotationList(memberWithAnnot);
for (BytecodeInstruction instruction : memberBytecode.getInstructions())
{
List<LineAnnotation> annotationsForBCI = annotationList.getAnnotationsForBCI(instruction.getOffset());
if (annotationsForBCI == null || annotationsForBCI.isEmpty())
{
continue;
}
callback.call(method, member, memberBytecode, instruction, annotationsForBCI);
}
}
}
}
}