aspect Exhibit{ syn lazy boolean BodyDecl.isExhibit() = false; eq ExhibitBodyDecl.isExhibit() = true; syn lazy boolean BodyDecl.isMemberClassDecl() = false; eq MemberClassDecl.isMemberClassDecl() = true; inh lazy Collection CJPPointcutExpr.getExhibitDecls(JPITypeDecl jpiTypeDecl); eq Program.getCompilationUnit().getExhibitDecls(JPITypeDecl jpiTypeDecl){ HashSet set = new HashSet(); ClassDecl classDecl; JPITypeAccess jpiAccess; for(CompilationUnit cu : getCompilationUnits()){ for(TypeDecl typeDecl : cu.getTypeDecls()){ if (!typeDecl.isClassDecl()){ //aspect is considered as a class continue; } classDecl = (ClassDecl)typeDecl; for(BodyDecl bodyDecl : classDecl.getBodyDeclList()){ if (!bodyDecl.isExhibit()){ continue; } jpiAccess = (JPITypeAccess)((ExhibitBodyDecl)bodyDecl).getJPIName(); if (jpiAccess.getID().equals(jpiTypeDecl.getID())){ if (jpiAccess.decl(((ExhibitBodyDecl)bodyDecl).getParameterTypeList()).equals(jpiTypeDecl)){ set.add((ExhibitBodyDecl)bodyDecl); } } } } } return set; } inh lazy Collection CJPPointcutExpr.getAllExhibitDecls(); eq Program.getCompilationUnit().getAllExhibitDecls(){ HashSet set = new HashSet(); ClassDecl classDecl; TypeAccess jpiAccess; for(CompilationUnit cu : getCompilationUnits()){ for(TypeDecl typeDecl : cu.getTypeDecls()){ if (!typeDecl.isClassDecl()){ //aspect is considered as a class continue; } classDecl = (ClassDecl)typeDecl; collectExhibitDecls(classDecl.getBodyDeclList(),set); } } return set; } private void Program.collectExhibitDecls(List bodyDeclList, HashSet set) { for(BodyDecl bodyDecl : bodyDeclList){ if (bodyDecl.isMemberClassDecl()){ collectExhibitDecls(((MemberClassDecl)bodyDecl).getClassDecl().getBodyDeclList(),set); continue; } if (!bodyDecl.isExhibit()){ continue; } set.add((ExhibitBodyDecl)bodyDecl); } } syn SimpleSet ExhibitBodyDecl.localLookupVariable(String name) { for(ParameterDeclaration formalParameter : getParameterList()){ if(formalParameter.name().equals(name)){ return SimpleSet.emptySet.add(formalParameter); } } return SimpleSet.emptySet; } eq ExhibitBodyDecl.getPointcut().lookupVariable(String name){ return localLookupVariable(name); } inh lazy TypeDecl ExhibitBodyDecl.getHostType(); eq TypeDecl.getBodyDecl().getHostType() = hostType(); public String ExhibitBodyDecl.positionInfo() { return "Exhibit "+getHostType().name() + "." + getJPIName().typeName() +" ("+pos().file() +", line "+pos().line()+")"; } }