def enterClassDeclaration(self, ctx: JavaParserLabeled.ClassDeclarationContext): if ctx.IDENTIFIER().getText() == self.class_name: self.implement_token_index = ctx.IDENTIFIER().symbol.tokenIndex if ctx.EXTENDS() is not None: self.implement_state.append(ctx.EXTENDS().getText()) self.implement_token_index = ctx.typeType().stop.tokenIndex if ctx.IMPLEMENTS() is not None: self.implement_state.append(ctx.IMPLEMENTS().getText()) self.implement_token_index = ctx.typeList().typeType()[-1].stop.tokenIndex
def enterClassDeclaration(self, ctx: JavaParserLabeled.ClassDeclarationContext): print("Propagation started, please wait...") class_identifier = ctx.IDENTIFIER().getText() if class_identifier in self.propagated_class_name: self.is_class = True else: self.is_class = False if class_identifier in self.propagated_class_name: self.token_stream_rewriter.replaceRange( from_idx=ctx.start.tokenIndex, to_idx=ctx.typeType().stop.tokenIndex, text=ctx.CLASS().getText() + ' ' + ctx.IDENTIFIER().getText())