public void enterConstructorDeclaration(JavaParser.ConstructorDeclarationContext ctx) { int access = getClassBodyDeclarationAccessFlag(ctx.getParent().getParent()); String paramDescriptors = createParamDescriptors(ctx.formalParameters().formalParameterList()); String descriptor = paramDescriptors + "V"; currentType.getMethods().add(new JavaMethod(currentType, access, "<init>", descriptor)); }
public void enterClassBodyDeclaration(JavaParser.ClassBodyDeclarationContext ctx) { if (ctx.getChildCount() == 2) { ParseTree first = ctx.getChild(0); if (first instanceof TerminalNode) { if (((TerminalNode) first).getSymbol().getType() == JavaParser.STATIC) { currentType .getMethods() .add(new JavaMethod(currentType, JavaType.FLAG_STATIC, "<clinit>", "()V")); } } } }
public void enterMethodDeclaration( ParserRuleContext ctx, TerminalNode identifier, JavaParser.FormalParametersContext formalParameters, JavaParser.TypeContext returnType) { int access = getClassBodyDeclarationAccessFlag(ctx.getParent().getParent()); String name = identifier.getText(); String paramDescriptors = createParamDescriptors(formalParameters.formalParameterList()); String returnDescriptor = createDescriptor(returnType, 0); String descriptor = paramDescriptors + returnDescriptor; currentType.getMethods().add(new JavaMethod(currentType, access, name, descriptor)); }