Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Code snippet generates a java:MethodDeclaration in semantic mode #104

@juanjux

Description

@juanjux

In Semantic mode, a function that has arguments is of type "java:MethodDeclaration" and if it does not have arguments, its type is "uast:FunctionGroup"

Code:

package pkg;
public class C {
  public void method(final String str) {}
}

As per #104 (comment)

Specifically, removing the final keyword from the parameter declaration of method makes the problem go away.

Initial code reproducing this is in details.

Details
package com.couchbase.client.java;

import com.couchbase.client.core.Core;
import com.couchbase.client.java.env.ClusterEnvironment;

import java.util.function.Function;

import static com.couchbase.client.java.AsyncBucket.DEFAULT_SCOPE;
import static com.couchbase.client.java.AsyncUtils.block;

public class Bucket {

  private final AsyncBucket asyncBucket;
  private final ReactiveBucket reactiveBucket;
  private final Core core;
  private final ClusterEnvironment environment;

  Bucket(AsyncBucket asyncBucket) {
    this.asyncBucket = asyncBucket;
    this.reactiveBucket = new ReactiveBucket(asyncBucket);
    this.core = asyncBucket.core();
    this.environment = asyncBucket.environment();
  }

  public AsyncBucket async() {
    return asyncBucket;
  }

  public ReactiveBucket reactive() {
    return reactiveBucket;
  }

  public Scope scope(final String name) {
    return block(asyncBucket.scope(name)
      .thenApply(asyncScope -> new Scope(asyncScope, asyncBucket.name()))
    );
  }

  public Collection defaultCollection() {
    return scope(DEFAULT_SCOPE).defaultCollection();
  }

  public Collection collection(final String name) {
    return scope(DEFAULT_SCOPE).collection(name);
  }
}

Once fixed, this should be added to the integration tests.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions