Beispiel #1
0
  public void test_visitMethodDeclaration_static() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String methodName = "m";
    MethodDeclaration methodDeclaration =
        methodDeclaration(
            Keyword.STATIC,
            null,
            null,
            null,
            identifier(methodName),
            formalParameterList(),
            blockFunctionBody());
    methodDeclaration.accept(builder);
    MethodElement[] methods = holder.getMethods();
    assertLength(1, methods);

    MethodElement method = methods[0];
    assertNotNull(method);
    assertEquals(methodName, method.getName());
    assertLength(0, method.getFunctions());
    assertLength(0, method.getLabels());
    assertLength(0, method.getLocalVariables());
    assertLength(0, method.getParameters());
    assertFalse(method.isAbstract());
    assertTrue(method.isStatic());
    assertFalse(method.isSynthetic());
  }
Beispiel #2
0
  @Override
  public Void visitClassTypeAlias(ClassTypeAlias node) {
    ElementHolder holder = new ElementHolder();
    visitChildren(holder, node);

    SimpleIdentifier className = node.getName();
    ClassElementImpl element = new ClassElementImpl(className);
    element.setAbstract(node.getAbstractKeyword() != null);
    TypeVariableElement[] typeVariables = holder.getTypeVariables();
    element.setTypeVariables(typeVariables);

    InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element);
    int typeVariableCount = typeVariables.length;
    Type[] typeArguments = new Type[typeVariableCount];
    for (int i = 0; i < typeVariableCount; i++) {
      TypeVariableElementImpl typeVariable = (TypeVariableElementImpl) typeVariables[i];
      TypeVariableTypeImpl typeArgument = new TypeVariableTypeImpl(typeVariable);
      typeVariable.setType(typeArgument);
      typeArguments[i] = typeArgument;
    }
    interfaceType.setTypeArguments(typeArguments);
    element.setType(interfaceType);

    currentHolder.addType(element);
    className.setElement(element);
    return null;
  }
Beispiel #3
0
  public void test_visitClassDeclaration_parameterized() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String className = "C";
    String firstVariableName = "E";
    String secondVariableName = "F";
    ClassDeclaration classDeclaration =
        classDeclaration(
            null,
            className,
            typeParameterList(firstVariableName, secondVariableName),
            null,
            null,
            null);
    classDeclaration.accept(builder);
    ClassElement[] types = holder.getTypes();
    assertLength(1, types);

    ClassElement type = types[0];
    assertNotNull(type);
    assertEquals(className, type.getName());
    TypeVariableElement[] typeVariables = type.getTypeVariables();
    assertLength(2, typeVariables);
    assertEquals(firstVariableName, typeVariables[0].getName());
    assertEquals(secondVariableName, typeVariables[1].getName());
    assertFalse(type.isAbstract());
    assertFalse(type.isSynthetic());
  }
Beispiel #4
0
  public void test_visitCatchClause() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String exceptionParameterName = "e";
    String stackParameterName = "s";
    CatchClause clause = catchClause(exceptionParameterName, stackParameterName);
    clause.accept(builder);
    VariableElement[] variables = holder.getVariables();
    assertLength(2, variables);

    VariableElement exceptionVariable = variables[0];
    assertNotNull(exceptionVariable);
    assertEquals(exceptionParameterName, exceptionVariable.getName());
    assertFalse(exceptionVariable.isSynthetic());
    assertFalse(exceptionVariable.isConst());
    assertFalse(exceptionVariable.isFinal());
    assertNull(exceptionVariable.getInitializer());

    VariableElement stackVariable = variables[1];
    assertNotNull(stackVariable);
    assertEquals(stackParameterName, stackVariable.getName());
    assertFalse(stackVariable.isSynthetic());
    assertFalse(stackVariable.isConst());
    assertFalse(stackVariable.isFinal());
    assertNull(stackVariable.getInitializer());
  }
Beispiel #5
0
  public void test_visitTypeAlias_withTypeParameters() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String aliasName = "F";
    String firstTypeParameterName = "A";
    String secondTypeParameterName = "B";
    TypeAlias typeAlias =
        typeAlias(
            null,
            aliasName,
            typeParameterList(firstTypeParameterName, secondTypeParameterName),
            formalParameterList());
    typeAlias.accept(builder);
    TypeAliasElement[] aliases = holder.getTypeAliases();
    assertLength(1, aliases);

    TypeAliasElement alias = aliases[0];
    assertNotNull(alias);
    assertEquals(aliasName, alias.getName());
    assertFalse(alias.isSynthetic());
    VariableElement[] parameters = alias.getParameters();
    assertNotNull(parameters);
    assertLength(0, parameters);
    TypeVariableElement[] typeVariables = alias.getTypeVariables();
    assertLength(2, typeVariables);
    assertEquals(firstTypeParameterName, typeVariables[0].getName());
    assertEquals(secondTypeParameterName, typeVariables[1].getName());
  }
 @Override
 public Void visitFormalParameterList(FormalParameterList node) {
   ElementHolder holder = new ElementHolder();
   visitChildren(holder, node);
   currentHolder.setParameters(holder.getVariables());
   return null;
 }
  @Override
  public Void visitClassTypeAlias(ClassTypeAlias node) {
    ElementHolder holder = new ElementHolder();
    functionTypesToFix = new ArrayList<FunctionTypeImpl>();
    visitChildren(holder, node);

    SimpleIdentifier className = node.getName();
    ClassElementImpl element = new ClassElementImpl(className);
    element.setAbstract(node.getAbstractKeyword() != null);
    element.setTypedef(true);
    TypeParameterElement[] typeParameters = holder.getTypeParameters();
    element.setTypeParameters(typeParameters);

    Type[] typeArguments = createTypeParameterTypes(typeParameters);
    InterfaceTypeImpl interfaceType = new InterfaceTypeImpl(element);
    interfaceType.setTypeArguments(typeArguments);
    element.setType(interfaceType);

    // set default constructor
    element.setConstructors(createDefaultConstructors(interfaceType));

    for (FunctionTypeImpl functionType : functionTypesToFix) {
      functionType.setTypeArguments(typeArguments);
    }
    functionTypesToFix = null;
    currentHolder.addType(element);
    className.setStaticElement(element);
    holder.validate();
    return null;
  }
Beispiel #8
0
  public void test_visitFieldDeclaration() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String firstFieldName = "x";
    String secondFieldName = "y";
    FieldDeclaration fieldDeclaration =
        fieldDeclaration(
            false, null, variableDeclaration(firstFieldName), variableDeclaration(secondFieldName));
    fieldDeclaration.accept(builder);
    FieldElement[] fields = holder.getFields();
    assertLength(2, fields);

    FieldElement firstField = fields[0];
    assertNotNull(firstField);
    assertEquals(firstFieldName, firstField.getName());
    assertNull(firstField.getInitializer());
    assertFalse(firstField.isConst());
    assertFalse(firstField.isFinal());
    assertFalse(firstField.isSynthetic());

    FieldElement secondField = fields[1];
    assertNotNull(secondField);
    assertEquals(secondFieldName, secondField.getName());
    assertNull(secondField.getInitializer());
    assertFalse(secondField.isConst());
    assertFalse(secondField.isFinal());
    assertFalse(secondField.isSynthetic());
  }
Beispiel #9
0
  public void test_visitMethodDeclaration_setter() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String methodName = "m";
    MethodDeclaration methodDeclaration =
        methodDeclaration(
            null,
            null,
            Keyword.SET,
            null,
            identifier(methodName),
            formalParameterList(),
            blockFunctionBody());
    methodDeclaration.accept(builder);
    FieldElement[] fields = holder.getFields();
    assertLength(1, fields);

    FieldElement field = fields[0];
    assertNotNull(field);
    assertEquals(methodName, field.getName());
    assertTrue(field.isSynthetic());
    assertNull(field.getGetter());
    PropertyAccessorElement setter = field.getSetter();
    assertNotNull(setter);
    assertTrue(setter.isSetter());
    assertFalse(setter.isSynthetic());
    assertEquals(methodName, setter.getName());
    assertEquals(field, setter.getField());
    assertLength(0, setter.getFunctions());
    assertLength(0, setter.getLabels());
    assertLength(0, setter.getLocalVariables());
    assertLength(0, setter.getParameters());
  }
Beispiel #10
0
  public void test_visitConstructorDeclaration_unnamed() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String className = "A";
    ConstructorDeclaration constructorDeclaration =
        constructorDeclaration(
            null,
            null,
            identifier(className),
            null,
            formalParameterList(),
            null,
            blockFunctionBody());
    constructorDeclaration.accept(builder);
    ConstructorElement[] constructors = holder.getConstructors();
    assertLength(1, constructors);

    ConstructorElement constructor = constructors[0];
    assertNotNull(constructor);
    assertFalse(constructor.isFactory());
    assertEquals("", constructor.getName());
    assertLength(0, constructor.getFunctions());
    assertLength(0, constructor.getLabels());
    assertLength(0, constructor.getLocalVariables());
    assertLength(0, constructor.getParameters());
    assertSame(constructor, constructorDeclaration.getElement());
  }
Beispiel #11
0
  public void test_visitMethodDeclaration_withMembers() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String methodName = "m";
    String parameterName = "p";
    String localVariableName = "v";
    String labelName = "l";
    String exceptionParameterName = "e";
    MethodDeclaration methodDeclaration =
        methodDeclaration(
            null,
            null,
            null,
            null,
            identifier(methodName),
            formalParameterList(simpleFormalParameter(parameterName)),
            blockFunctionBody(
                variableDeclarationStatement(Keyword.VAR, variableDeclaration(localVariableName)),
                tryStatement(
                    block(labeledStatement(list(label(labelName)), returnStatement())),
                    catchClause(exceptionParameterName))));
    methodDeclaration.accept(builder);
    MethodElement[] methods = holder.getMethods();
    assertLength(1, methods);

    MethodElement method = methods[0];
    assertNotNull(method);
    assertEquals(methodName, method.getName());
    assertFalse(method.isAbstract());
    assertFalse(method.isStatic());
    assertFalse(method.isSynthetic());

    VariableElement[] parameters = method.getParameters();
    assertLength(1, parameters);
    VariableElement parameter = parameters[0];
    assertNotNull(parameter);
    assertEquals(parameterName, parameter.getName());

    VariableElement[] localVariables = method.getLocalVariables();
    assertLength(2, localVariables);
    VariableElement firstVariable = localVariables[0];
    VariableElement secondVariable = localVariables[1];
    assertNotNull(firstVariable);
    assertNotNull(secondVariable);
    assertTrue(
        (firstVariable.getName().equals(localVariableName)
                && secondVariable.getName().equals(exceptionParameterName))
            || (firstVariable.getName().equals(exceptionParameterName)
                && secondVariable.getName().equals(localVariableName)));

    LabelElement[] labels = method.getLabels();
    assertLength(1, labels);
    LabelElement label = labels[0];
    assertNotNull(label);
    assertEquals(labelName, label.getName());
  }
Beispiel #12
0
  public void test_visitClassDeclaration_withMembers() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String className = "C";
    String typeVariableName = "E";
    String fieldName = "f";
    String methodName = "m";
    ClassDeclaration classDeclaration =
        classDeclaration(
            null,
            className,
            typeParameterList(typeVariableName),
            null,
            null,
            null,
            fieldDeclaration(false, null, variableDeclaration(fieldName)),
            methodDeclaration(
                null,
                null,
                null,
                null,
                identifier(methodName),
                formalParameterList(),
                blockFunctionBody()));
    classDeclaration.accept(builder);
    ClassElement[] types = holder.getTypes();
    assertLength(1, types);

    ClassElement type = types[0];
    assertNotNull(type);
    assertEquals(className, type.getName());
    assertFalse(type.isAbstract());
    assertFalse(type.isSynthetic());

    TypeVariableElement[] typeVariables = type.getTypeVariables();
    assertLength(1, typeVariables);
    TypeVariableElement typeVariable = typeVariables[0];
    assertNotNull(typeVariable);
    assertEquals(typeVariableName, typeVariable.getName());

    FieldElement[] fields = type.getFields();
    assertLength(1, fields);
    FieldElement field = fields[0];
    assertNotNull(field);
    assertEquals(fieldName, field.getName());

    MethodElement[] methods = type.getMethods();
    assertLength(1, methods);
    MethodElement method = methods[0];
    assertNotNull(method);
    assertEquals(methodName, method.getName());
  }
  @Override
  public Void visitTypeAlias(TypeAlias node) {
    ElementHolder holder = new ElementHolder();
    visitChildren(holder, node);

    TypeAliasElementImpl element = new TypeAliasElementImpl(node.getName());
    if (holder.getParameters() != null) {
      element.setParameters(holder.getParameters());
    }
    element.setTypeVariables(holder.getTypeVariables());
    currentHolder.addTypeAlias(element);
    return null;
  }
Beispiel #14
0
  @Override
  public Void visitMethodDeclaration(MethodDeclaration node) {
    ElementHolder holder = new ElementHolder();
    visitChildren(holder, node);

    Token property = node.getPropertyKeyword();
    if (property == null) {
      Identifier methodName = node.getName();
      MethodElementImpl element = new MethodElementImpl(methodName);
      Token keyword = node.getModifierKeyword();
      element.setAbstract(matches(keyword, Keyword.ABSTRACT));
      element.setFunctions(holder.getFunctions());
      element.setLabels(holder.getLabels());
      element.setLocalVariables(holder.getVariables());
      element.setParameters(holder.getParameters());
      element.setStatic(matches(keyword, Keyword.STATIC));

      currentHolder.addMethod(element);
      methodName.setElement(element);
    } else {
      Identifier propertyNameNode = node.getName();
      String propertyName = propertyNameNode.getName();
      FieldElementImpl field = (FieldElementImpl) currentHolder.getField(propertyName);
      if (field == null) {
        field = new FieldElementImpl(node.getName().getName());
        field.setFinal(true);
        field.setStatic(matches(node.getModifierKeyword(), Keyword.STATIC));

        currentHolder.addField(field);
      }
      if (matches(property, Keyword.GET)) {
        PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl(propertyNameNode);
        getter.setField(field);
        getter.setGetter(true);
        field.setGetter(getter);

        currentHolder.addAccessor(getter);
        propertyNameNode.setElement(getter);
      } else {
        PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl(propertyNameNode);
        setter.setField(field);
        setter.setSetter(true);
        field.setSetter(setter);
        field.setFinal(false);

        currentHolder.addAccessor(setter);
        propertyNameNode.setElement(setter);
      }
    }
    return null;
  }
Beispiel #15
0
  public void test_visitTypeParameter() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String parameterName = "E";
    TypeParameter typeParameter = typeParameter(parameterName);
    typeParameter.accept(builder);
    TypeVariableElement[] typeVariables = holder.getTypeVariables();
    assertLength(1, typeVariables);

    TypeVariableElement typeVariable = typeVariables[0];
    assertNotNull(typeVariable);
    assertEquals(parameterName, typeVariable.getName());
    assertFalse(typeVariable.isSynthetic());
  }
Beispiel #16
0
  public void test_visitTypeAlias_minimal() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String aliasName = "F";
    TypeAlias typeAlias = typeAlias(null, aliasName, null, null);
    typeAlias.accept(builder);
    TypeAliasElement[] aliases = holder.getTypeAliases();
    assertLength(1, aliases);

    TypeAliasElement alias = aliases[0];
    assertNotNull(alias);
    assertEquals(aliasName, alias.getName());
    assertFalse(alias.isSynthetic());
  }
Beispiel #17
0
  public void test_visitLabeledStatement() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String labelName = "l";
    LabeledStatement statement = labeledStatement(list(label(labelName)), breakStatement());
    statement.accept(builder);
    LabelElement[] labels = holder.getLabels();
    assertLength(1, labels);

    LabelElement label = labels[0];
    assertNotNull(label);
    assertEquals(labelName, label.getName());
    assertFalse(label.isSynthetic());
  }
Beispiel #18
0
  public void test_visitFormalParameterList() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String firstParameterName = "a";
    String secondParameterName = "b";
    FormalParameterList parameterList =
        formalParameterList(
            simpleFormalParameter(firstParameterName), simpleFormalParameter(secondParameterName));
    parameterList.accept(builder);
    ParameterElement[] parameters = holder.getParameters();
    assertLength(2, parameters);

    assertEquals(firstParameterName, parameters[0].getName());

    assertEquals(secondParameterName, parameters[1].getName());
  }
  @Override
  public Void visitCatchClause(CatchClause node) {
    SimpleIdentifier exceptionParameter = node.getExceptionParameter();
    if (exceptionParameter != null) {
      VariableElementImpl exception = new VariableElementImpl(exceptionParameter);
      currentHolder.addVariable(exception);

      SimpleIdentifier stackTraceParameter = node.getStackTraceParameter();
      if (stackTraceParameter != null) {
        VariableElementImpl stackTrace = new VariableElementImpl(stackTraceParameter);
        currentHolder.addVariable(stackTrace);
      }
    }
    node.visitChildren(this);
    return null;
  }
 @Override
 public Void visitSwitchDefault(SwitchDefault node) {
   for (Label label : node.getLabels()) {
     LabelElementImpl element = new LabelElementImpl(label.getLabel(), false, true);
     currentHolder.addLabel(element);
   }
   return null;
 }
Beispiel #21
0
  public void test_visitClassDeclaration_minimal() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String className = "C";
    ClassDeclaration classDeclaration = classDeclaration(null, className, null, null, null, null);
    classDeclaration.accept(builder);
    ClassElement[] types = holder.getTypes();
    assertLength(1, types);

    ClassElement type = types[0];
    assertNotNull(type);
    assertEquals(className, type.getName());
    TypeVariableElement[] typeVariables = type.getTypeVariables();
    assertLength(0, typeVariables);
    assertFalse(type.isAbstract());
    assertFalse(type.isSynthetic());
  }
 @Override
 public Void visitLabeledStatement(LabeledStatement node) {
   boolean onSwitchStatement = node.getStatement() instanceof SwitchStatement;
   for (Label label : node.getLabels()) {
     LabelElementImpl element = new LabelElementImpl(label.getLabel(), onSwitchStatement, false);
     currentHolder.addLabel(element);
   }
   return null;
 }
Beispiel #23
0
  @Override
  public Void visitTypeParameter(TypeParameter node) {
    SimpleIdentifier parameterName = node.getName();
    TypeVariableElementImpl element = new TypeVariableElementImpl(parameterName);

    currentHolder.addTypeVariable(element);
    parameterName.setElement(element);
    return null;
  }
Beispiel #24
0
  public void test_visitSimpleFormalParameter() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String parameterName = "p";
    SimpleFormalParameter formalParameter = simpleFormalParameter(parameterName);
    formalParameter.accept(builder);
    ParameterElement[] parameters = holder.getParameters();
    assertLength(1, parameters);

    ParameterElement parameter = parameters[0];
    assertNotNull(parameter);
    assertEquals(parameterName, parameter.getName());
    assertNull(parameter.getInitializer());
    assertFalse(parameter.isConst());
    assertFalse(parameter.isFinal());
    assertFalse(parameter.isSynthetic());
    assertEquals(ParameterKind.REQUIRED, parameter.getParameterKind());
  }
Beispiel #25
0
  public void test_visitVariableDeclaration_noInitializer() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String variableName = "v";
    VariableDeclaration variableDeclaration = variableDeclaration(variableName, null);
    variableDeclarationList(null, variableDeclaration);
    variableDeclaration.accept(builder);
    VariableElement[] variables = holder.getVariables();
    assertLength(1, variables);

    VariableElement variable = variables[0];
    assertNotNull(variable);
    assertNull(variable.getInitializer());
    assertEquals(variableName, variable.getName());
    assertFalse(variable.isConst());
    assertFalse(variable.isFinal());
    assertFalse(variable.isSynthetic());
  }
Beispiel #26
0
  public void test_visitFunctionExpression() {
    ElementHolder holder = new ElementHolder();
    ElementBuilder builder = new ElementBuilder(holder);
    String functionName = "f";
    FunctionDeclaration declaration =
        functionDeclaration(
            null,
            null,
            functionName,
            functionExpression(formalParameterList(), blockFunctionBody()));
    declaration.accept(builder);
    FunctionElement[] functions = holder.getFunctions();
    assertLength(1, functions);
    FunctionElement function = functions[0];

    assertNotNull(function);
    assertEquals(functionName, function.getName());
    assertFalse(function.isSynthetic());
  }
Beispiel #27
0
  @Override
  public Void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
    SimpleIdentifier parameterName = node.getIdentifier();
    ParameterElementImpl parameter = new ParameterElementImpl(parameterName);
    parameter.setParameterKind(node.getKind());

    currentHolder.addParameter(parameter);
    parameterName.setElement(parameter);
    return null;
  }
Beispiel #28
0
  @Override
  public Void visitFunctionTypeAlias(FunctionTypeAlias node) {
    ElementHolder holder = new ElementHolder();
    visitChildren(holder, node);

    SimpleIdentifier aliasName = node.getName();
    ParameterElement[] parameters = holder.getParameters();
    TypeAliasElementImpl element = new TypeAliasElementImpl(aliasName);
    element.setParameters(parameters);
    element.setTypeVariables(holder.getTypeVariables());

    ArrayList<Type> normalParameterTypes = new ArrayList<Type>();
    ArrayList<Type> optionalParameterTypes = new ArrayList<Type>();
    LinkedHashMap<String, Type> namedParameterTypes = new LinkedHashMap<String, Type>();
    for (ParameterElement parameter : parameters) {
      switch (parameter.getParameterKind()) {
        case REQUIRED:
          normalParameterTypes.add(parameter.getType());
          break;
        case POSITIONAL:
          optionalParameterTypes.add(parameter.getType());
          break;
        case NAMED:
          namedParameterTypes.put(parameter.getName(), parameter.getType());
          break;
      }
    }
    TypeName returnType = node.getReturnType();
    FunctionTypeImpl functionType = new FunctionTypeImpl(element);
    functionType.setNormalParameterTypes(
        normalParameterTypes.toArray(new Type[normalParameterTypes.size()]));
    functionType.setOptionalParameterTypes(
        optionalParameterTypes.toArray(new Type[optionalParameterTypes.size()]));
    functionType.setNamedParameterTypes(namedParameterTypes);
    if (returnType != null) {
      functionType.setReturnType(returnType.getType());
    }
    element.setType(functionType);

    currentHolder.addTypeAlias(element);
    aliasName.setElement(element);
    return null;
  }
  @Override
  public Void visitCatchClause(CatchClause node) {
    SimpleIdentifier exceptionParameter = node.getExceptionParameter();
    if (exceptionParameter != null) {
      LocalVariableElementImpl exception = new LocalVariableElementImpl(exceptionParameter);

      currentHolder.addLocalVariable(exception);
      exceptionParameter.setStaticElement(exception);

      SimpleIdentifier stackTraceParameter = node.getStackTraceParameter();
      if (stackTraceParameter != null) {
        LocalVariableElementImpl stackTrace = new LocalVariableElementImpl(stackTraceParameter);

        currentHolder.addLocalVariable(stackTrace);
        stackTraceParameter.setStaticElement(stackTrace);
      }
    }
    return super.visitCatchClause(node);
  }
Beispiel #30
0
  @Override
  public Void visitSwitchDefault(SwitchDefault node) {
    for (Label label : node.getLabels()) {
      SimpleIdentifier labelName = label.getLabel();
      LabelElementImpl element = new LabelElementImpl(labelName, false, true);

      currentHolder.addLabel(element);
      labelName.setElement(element);
    }
    return null;
  }