<commit_before>package com.jetbrains.python.psi.impl;

import com.intellij.psi.*;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.resolve.VariantsProcessor;
import com.jetbrains.python.psi.types.PyType;

/**
 * @author yole
 */
public class PyJavaClassType implements PyType {
  private final PsiClass myClass;

  public PyJavaClassType(final PsiClass aClass) {
    myClass = aClass;
  }

  public PsiElement resolveMember(final String name) {
    final PsiMethod[] methods = myClass.findMethodsByName(name, true);
    if (methods.length > 0) {
      return methods [0]; // TODO[yole]: correct resolve
    }
    final PsiField field = myClass.findFieldByName(name, true);
    if (field != null) return field;
    return null;
  }

  public Object[] getCompletionVariants(final PyReferenceExpression referenceExpression) {
    final VariantsProcessor processor = new VariantsProcessor();
    myClass.processDeclarations(processor, ResolveState.initial(), null, referenceExpression);
    return processor.getResult();
  }

  public String getName() {
    if (myClass != null)
    return myClass.getName();
    else return null;
  }
}
<commit_msg>Re-application of 236134 which was reverted.<commit_after>package com.jetbrains.python.psi.impl;

import com.intellij.psi.*;
import com.intellij.util.ProcessingContext;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.resolve.VariantsProcessor;
import com.jetbrains.python.psi.types.PyType;

/**
 * @author yole
 */
public class PyJavaClassType implements PyType {
  private final PsiClass myClass;

  public PyJavaClassType(final PsiClass aClass) {
    myClass = aClass;
  }

  public PsiElement resolveMember(final String name) {
    final PsiMethod[] methods = myClass.findMethodsByName(name, true);
    if (methods.length > 0) {
      return methods [0]; // TODO[yole]: correct resolve
    }
    final PsiField field = myClass.findFieldByName(name, true);
    if (field != null) return field;
    return null;
  }

  public Object[] getCompletionVariants(final PyReferenceExpression referenceExpression, ProcessingContext context) {
    final VariantsProcessor processor = new VariantsProcessor();
    myClass.processDeclarations(processor, ResolveState.initial(), null, referenceExpression);
    return processor.getResult();
  }

  public String getName() {
    if (myClass != null)
    return myClass.getName();
    else return null;
  }
}

{'fraction_non_alphanumeric': 0.10089141004862237, 'fraction_numerical': 0.004051863857374392, 'mean_word_length': 4.332613390928726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '679082', 'n_tokens_mistral': 733, 'n_tokens_neox': 712, 'n_words': 179}