@Override public void exitInterfaceDeclaration(@NotNull JavaParser.InterfaceDeclarationContext ctx) { final JavaId id = (JavaId)this.contextStack.pop().getConstructId(); this.isOfExpectedType(id, new JavaId.Type[] { JavaId.Type.INTERFACE }, true); }
@Override public void exitEnumDeclaration(@NotNull JavaParser.EnumDeclarationContext ctx) { final JavaId id = (JavaId)this.contextStack.pop().getConstructId(); this.isOfExpectedType(id, new JavaId.Type[] { JavaId.Type.ENUM }, true); }
@Override public void exitClassBody(@NotNull JavaParser.ClassBodyContext ctx) { final JavaId id = (JavaId) this.contextStack.pop().getConstructId(); this.isOfExpectedType(id, new JavaId.Type[] { JavaId.Type.CLASS }, true); this.constructIdBuilder.resetCurrentDeclarationContext(); }
@Override public void enterConstructorDeclaration(@NotNull JavaParser.ConstructorDeclarationContext ctx) { // Peek JavaId and ensure it is a class or enum final JavaId class_ctx = (JavaId) this.contextStack.peek().getConstructId(); this.isOfExpectedType(class_ctx, new JavaId.Type[] { JavaId.Type.CLASS, JavaId.Type.ENUM }, true); // Build the identifier final JavaId id = new JavaConstructorId((JavaId)class_ctx, this.getParameters(ctx.formalParameters().formalParameterList())); this.contextStack.push(id); this.saveConstruct(id, this.getConstructContent(ctx)); }
@Override public void enterMethodDeclaration(@NotNull JavaParser.MethodDeclarationContext ctx) { // Peek JavaId and ensure it is a class or enum final JavaId class_ctx = (JavaId) this.contextStack.peek().getConstructId(); this.isOfExpectedType(class_ctx, new JavaId.Type[] { JavaId.Type.CLASS, JavaId.Type.ENUM }, true); // Build the identifier final JavaMethodId id = new JavaMethodId((JavaId) class_ctx, ctx.IDENTIFIER().getText(), this.getParameters(ctx.formalParameters().formalParameterList())); this.contextStack.push(id); this.saveConstruct(id, this.getConstructContent(ctx)); }