Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Annotating a varargs method creates an array-param method #927

Description

@WonderCsabo

Consider the following:

@EActivity
public class MainActivity extends Activity
    @UiThread
    protected void varagsMethod(Object... params) {
        //
    }
}

The generated class will be this:

public class MainActivity_ extends MainActivity
    @Override
    protected void varagsMethod(Object[] params) {
        //
    }
}

This results in the following warning: Varargs methods should only override or be overridden by other varargs methods.

Activity

  1. DayS commented on Mar 4, 2014

    @DayS
    Contributor

    This should be possible to handle this :)
    But it's not a priority

  2. WonderCsabo commented on Aug 22, 2014

    @WonderCsabo
    MemberAuthor

    I found no way to implement this, because we have no information whether it is a vararg or an array parameter. Since it only creates a warning, i am closing this issue.

  3. WonderCsabo commented on Jul 8, 2015

    @WonderCsabo
    MemberAuthor

    It seems this can be implemented:

    • we call isVarArgs() to decide the method has variable argument list or not
    • if it has, we add the last parameter with JMethod.varParam() instead of JMethod.param()
  4. yDelouis commented on Sep 19, 2015

    @yDelouis
    Contributor

    Implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions