2

I started Android studio (2.1.2) today and when trying to add block comments using /** + enter, it is not generating the entire block with params and return statement.

I'm not sure what is causing this.

I tried googling the issue. But I'm unable to fix as of now with the solutions out there.

Please help me out to fix this issue.

Sufian
  • 6,405
  • 16
  • 66
  • 120
sha
  • 1,410
  • 2
  • 18
  • 37
  • Does [this](http://stackoverflow.com/a/29309454/1276636) help? – Sufian Jun 29 '16 at 00:31
  • It's working now without any fix .. Weird .. Bloody studio .. don't know why.. Sorry guys.. Thanks @Sufian for ur response.. – sha Jun 29 '16 at 00:53

1 Answers1

2

It's a Bug in Android studio.

If it is the last method in the class and you have some commented block comments below it, then you can't generate block comments.

Some thing like this:

{
  ......

    // You can't do a /** + enter here;
    // it won't generate JavaDoc if you do.
    public ViewPager getViewPager() {
        return mViewPager;
    }

    //  /*
    //   * Inner classes, interfaces, enums
    //   */
}

In this case, IDE doesn't generate block comment for getViewPager().

Sufian
  • 6,405
  • 16
  • 66
  • 120
sha
  • 1,410
  • 2
  • 18
  • 37
  • The `/**` autogenerate works only on top of Class Constructors and Methods. And adding `//` to `/***/` seems kinda redundant. I would prefer to use only `/***/` if my comment is as long as paragraph, if it is single line I'll just use `//`. – Enzokie Jun 29 '16 at 06:02
  • Sorry, My explanation might have confused you. But if there is already a commented block comment at the end of class for some reason, then the auto block comment generation doesn't work for last method in the class. – sha Jun 29 '16 at 20:48
  • Why you are adding `//` on `/**`? And basically `/**` has no effect when your methods has no arguments. – Enzokie Jun 30 '16 at 01:12
  • 1
    I'm not adding `//` as well, I just commented there for explaining. :) – sha Jun 30 '16 at 02:11
  • Ah I see. Since your `getViewPager()` has no arguments at all, the `/**` will only provide `@return ViewPager` :) . – Enzokie Jun 30 '16 at 02:15
  • @sha the code snippet now seems all messed up. Why did you remove the `//`? – Sufian Jul 01 '16 at 07:55
  • @sha read [this](http://tools.android.com/filing-bugs) and file this bug. – Sufian Jul 03 '16 at 11:13
  • Thanks @Sufian. Filed a Bug - https://code.google.com/p/android/issues/detail?id=215019 – sha Jul 03 '16 at 21:47
  • Still not fixed. June 2019. I shall send a note to the relevant body after checking if it's Google or IntelliJ. – Tim Maher-De Troyer Jun 13 '19 at 16:31