0

In my android project (Windows 7, Android Studio 2.2.3 with java 1.8.0_76-release-b03 amd64, gradle 2.14.1) I tried to deprecate one of my packages using the package-info.java file (as suggested in https://stackoverflow.com/a/23019294) like this:

/**
 * @deprecated As of 22.02.2017 
 */
@Deprecated
package com.x.y;

But got the following compilation error:

PathtoProject\app\src\main\java\com\x\y\package-info.java:5:error: modifier deprecated not allowed here package com.x.y;

Why is this error ocurring? And what's the correct way to make a package deprecated?

Somebody else seemed to have had this problem as well and it didn't get resolved: https://code.google.com/p/android/issues/detail?id=233212

Community
  • 1
  • 1
Ben Em
  • 1
  • 3

1 Answers1

0
  • Package cannot be deprecated only classes can be deprecated see this.

  • Also according to this, packages are meant for managing the classes in an organised way and also to avoid class name collisions.

  • So instead of annotating a package with @Deprecated annotate all public classes of the with @Deprecated