Examples of MethodDeclaration


Examples of com.asakusafw.utils.java.model.syntax.MethodDeclaration

            List<MethodDeclaration> results = Lists.create();
            results.add(createBegin(context.getBeginStatements()));
            results.add(createEnd(context.getEndStatements()));
            for (FlowElementInput input : fragment.getInputPorts()) {
                Segment segment = shuffle.findSegment(input);
                MethodDeclaration port = createPort(
                        PROCESS_PREFIX,
                        segment,
                        argument,
                        context.getProcessStatements(input.getDescription()));
                LOG.debug("セグメント{}のメソッドは{}として作成されます", segment, port.getName());
                results.add(port);
            }
            return results;
        }
View Full Code Here

Examples of com.asakusafw.utils.java.model.syntax.MethodDeclaration

            importer.resolvePackageMember(name);

            List<TypeBodyDeclaration> members = Lists.create();
            members.addAll(createFields());
            ConstructorDeclaration ctor = createConstructor();
            MethodDeclaration method = createBody();
            members.addAll(extraFields);
            members.add(ctor);
            members.add(method);
            return factory.newClassDeclaration(
                    createJavadoc(),
View Full Code Here

Examples of com.asakusafw.utils.java.model.syntax.MethodDeclaration

        FieldDeclaration field = Find.field(type, "out");
        assertThat(Find.modifiers(field), hasItems(PUBLIC, FINAL));
        assertThat(field.getType().toString(), is("Source<CharSequence>"));

        MethodDeclaration method = Find.method(tree, "example");
        assertThat(Find.modifiers(method), hasItem(PUBLIC));
        assertThat(method.getReturnType().toString(), is("SimpleFactory.Example"));
        List<? extends FormalParameterDeclaration> params = method.getFormalParameters();
        assertThat(params.size(), is(2));
        assertThat(params.get(0).getType().toString(), is("Source<String>"));
        assertThat(params.get(0).getName().getToken(), is("in"));
        assertThat(params.get(1).getType().toString(), is("int"));
        assertThat(params.get(1).getName().getToken(), is("param"));
View Full Code Here

Examples of com.dragome.compiler.ast.MethodDeclaration

    MethodDeclaration[] methods= theTypeDecl.getMethods();
    List<String> processedMethods= new ArrayList<String>();

    for (int i= 0; i < methods.length; i++)
    {
      MethodDeclaration method= methods[i];
      currentMethodDeclaration= method;
      try
      {
        String normalizeExpression= normalizeExpression(Project.getSingleton().getSignature(method.getMethodBinding().toString()).relative());

        if (!processedMethods.contains(normalizeExpression))
        {
          processedMethods.add(normalizeExpression);
          method.visit(this);
        }
        else
          System.out.println("duplicado!");
        //    System.out.println("llego!");
      }
View Full Code Here

Examples of com.github.antlrjavaparser.api.body.MethodDeclaration

                        cidBuilder.addField(field);
                    }
                }
                if (member instanceof MethodDeclaration) {
                    final MethodDeclaration castMember = (MethodDeclaration) member;
                    final MethodMetadata method = JavaParserMethodMetadataBuilder
                            .getInstance(declaredByMetadataId, castMember,
                                    compilationUnitServices, typeParameterNames)
                            .build();

                    final CommentStructure commentStructure = new CommentStructure();
                    JavaParserCommentMetadataBuilder.updateCommentsToRoo(
                            commentStructure, member);
                    method.setCommentStructure(commentStructure);

                    cidBuilder.addMethod(method);
                }
                if (member instanceof ConstructorDeclaration) {
                    final ConstructorDeclaration castMember = (ConstructorDeclaration) member;
                    final ConstructorMetadata constructor = JavaParserConstructorMetadataBuilder
                            .getInstance(declaredByMetadataId, castMember,
                                    compilationUnitServices, typeParameterNames)
                            .build();

                    final CommentStructure commentStructure = new CommentStructure();
                    JavaParserCommentMetadataBuilder.updateCommentsToRoo(
                            commentStructure, member);
                    constructor.setCommentStructure(commentStructure);

                    cidBuilder.addConstructor(constructor);
                }
                if (member instanceof TypeDeclaration) {
                    final TypeDeclaration castMember = (TypeDeclaration) member;
                    final JavaType innerType = new JavaType(
                            castMember.getName(), name);
                    final String innerTypeMetadataId = PhysicalTypeIdentifier
                            .createIdentifier(innerType, PhysicalTypeIdentifier
                                    .getPath(declaredByMetadataId));
                    final ClassOrInterfaceTypeDetails cid = new JavaParserClassOrInterfaceTypeDetailsBuilder(
                            compilationUnit, compilationUnitServices,
View Full Code Here

Examples of com.google.dart.engine.ast.MethodDeclaration

    boolean foundError = false;
    HashMap<String, ClassMember> memberHashMap = new HashMap<String, ClassMember>(
        classMembers.size());
    for (ClassMember classMember : classMembers) {
      if (classMember instanceof MethodDeclaration) {
        MethodDeclaration method = (MethodDeclaration) classMember;
        if (method.isStatic()) {
          continue;
        }
        // prepare name
        SimpleIdentifier name = method.getName();
        if (name == null) {
          continue;
        }

        boolean addThisMemberToTheMap = true;

        boolean isGetter = method.isGetter();
        boolean isSetter = method.isSetter();
        boolean isOperator = method.isOperator();
        boolean isMethod = !isGetter && !isSetter && !isOperator;

        // Do lookups in the enclosing class (and the inherited member) if the member is a method or
        // a setter for StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER warning.
        if (isMethod) {
          String setterName = name.getName() + "=";
          Element enclosingElementOfSetter = null;
          ClassMember conflictingSetter = memberHashMap.get(setterName);
          if (conflictingSetter != null) {
            enclosingElementOfSetter = conflictingSetter.getElement().getEnclosingElement();
          } else {
            ExecutableElement elementFromInheritance = inheritanceManager.lookupInheritance(
                enclosingClass,
                setterName);
            if (elementFromInheritance != null) {
              enclosingElementOfSetter = elementFromInheritance.getEnclosingElement();
            }
          }
          if (enclosingElementOfSetter != null) {
            // report problem
            errorReporter.reportErrorForNode(
                StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER,
                name,
                enclosingClass.getDisplayName(),
                name.getName(),
                enclosingElementOfSetter.getDisplayName());
            foundError |= true;
            addThisMemberToTheMap = false;
          }
        } else if (isSetter) {
          String methodName = name.getName();
          ClassMember conflictingMethod = memberHashMap.get(methodName);
          if (conflictingMethod != null && conflictingMethod instanceof MethodDeclaration
              && !((MethodDeclaration) conflictingMethod).isGetter()) {
            // report problem
            errorReporter.reportErrorForNode(
                StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER2,
                name,
                enclosingClass.getDisplayName(),
                name.getName());
            foundError |= true;
            addThisMemberToTheMap = false;
          }
        }

        // Finally, add this member into the HashMap.
        if (addThisMemberToTheMap) {
          if (method.isSetter()) {
            memberHashMap.put(name.getName() + "=", method);
          } else {
            memberHashMap.put(name.getName(), method);
          }
        }
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.tree.Tree.MethodDeclaration

    @Override
    public void visit(AnyMethod that) {
        if (that instanceof MethodDeclaration) {
            //Do not document the return type of method declarations since it's not really in the code.
            MethodDeclaration md = (MethodDeclaration)that;
            if (md.getSpecifierExpression() != null) {
                md.getSpecifierExpression().visit(this);
            }
        }
        else {
            ProducedType t = that.getDeclarationModel().getType();
            if (t!=null) {
View Full Code Here

Examples of com.sun.mirror.declaration.MethodDeclaration

    writer.println(") {");
    writer.println("\t\treturn ");

    boolean first = true;
    while ( methods.hasNext() ) {
      MethodDeclaration method = methods.next();
      if ( method.getAnnotation(Alternate.class) != null )
        continue;

      if ( !first )
        writer.println(" &");
      else
        first = false;

      optional = method.getAnnotation(Optional.class) != null;
      deprecated = method.getAnnotation(DeprecatedGL.class) != null;
      dependent = method.getAnnotation(Dependent.class);

      writer.print("\t\t\t(");
      if ( optional )
        writer.print('(');
      if ( deprecated )
        writer.print("forwardCompatible || ");
      if ( dependent != null ) {
        if ( dependent.value().indexOf(',') == -1 )
          writer.print("!supported_extensions.contains(\"" + dependent.value() + "\") || ");
        else {
          writer.print("!(false");
          for ( String extension : dependent.value().split(",") )
            writer.print(" || supported_extensions.contains(\"" + extension + "\")");
          writer.print(") || ");
        }
      }
      if ( deprecated || dependent != null )
        writer.print('(');
      writer.print(Utils.getFunctionAddressName(d, method) + " = ");
      PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class);
      if ( platform_dependent != null ) {
        EnumSet<Platform> platform_set = EnumSet.copyOf(Arrays.asList(platform_dependent.value()));
        writer.print("GLContext.getPlatformSpecificFunctionAddress(\"");
        writer.print(Platform.ALL.getPrefix() + "\", ");
        writer.print("new String[]{");
        Iterator<Platform> platforms = platform_set.iterator();
        while ( platforms.hasNext() ) {
          writer.print("\"" + platforms.next().getOSPrefix() + "\"");
          if ( platforms.hasNext() )
            writer.print(", ");
        }
        writer.print("}, new String[]{");
        platforms = platform_set.iterator();
        while ( platforms.hasNext() ) {
          writer.print("\"" + platforms.next().getPrefix() + "\"");
          if ( platforms.hasNext() )
            writer.print(", ");
        }
        writer.print("}, ");
      } else if ( aliased ) {
        writer.print("GLContext.getFunctionAddress(new String[] {\"" + method.getSimpleName() + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"})) != 0");
      } else
        writer.print("GLContext.getFunctionAddress(");
      if ( !aliased )
        writer.print("\"" + method.getSimpleName() + "\")) != 0");
      if ( deprecated || dependent != null )
        writer.print(')');
      if ( optional )
        writer.print(" || true)");
    }
View Full Code Here

Examples of com.sun.mirror.declaration.MethodDeclaration

    writer.println("\tprivate static boolean " + getExtensionSupportedName(d.getSimpleName()) + "() {");
    writer.println("\t\treturn ");

    boolean first = true;
    while ( methods.hasNext() ) {
      MethodDeclaration method = methods.next();
      if ( method.getAnnotation(Alternate.class) != null )
        continue;

      if ( !first )
        writer.println(" &");
      else
        first = false;

      final boolean optional = method.getAnnotation(Optional.class) != null;

      writer.print("\t\t\t");
      if ( optional )
        writer.print('(');
      writer.print(Utils.getFunctionAddressName(d, method) + " != 0");
View Full Code Here

Examples of japa.parser.ast.body.MethodDeclaration

        cu.setPackage(new PackageDeclaration(ASTHelper.createNameExpr("cn.shenyanchao.javaparser.test")));
        //create the type declaration
        ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(ModifierSet.PUBLIC, false, "HelloWorld");
        ASTHelper.addTypeDeclaration(cu, type);
        //create a method
        MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC, ASTHelper.VOID_TYPE, "main");
        method.setModifiers(ModifierSet.addModifier(method.getModifiers(), ModifierSet.STATIC));
        ASTHelper.addMember(type, method);

        //add a parameter to the method
        Parameter param = ASTHelper.createParameter(ASTHelper.createReferenceType("String", 1), "args");
//        param.setVarArgs(true);
        ASTHelper.addParameter(method, param);

        //add a body to the method
        BlockStmt block = new BlockStmt();
        method.setBody(block);

        //add a statement do the method body
        NameExpr clazz = new NameExpr("System");
        FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
        MethodCallExpr call = new MethodCallExpr(field, "println");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.