Skip to content
Add API information (since/deprecation) to Android source code as javadoc tags
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
art
gradle/wrapper
src/main/java/ru/noties/enhance Update to include Pie (28) Sep 25, 2018
.gitignore Added enum javadocing Jan 31, 2018
LICENSE
README.md
build.gradle
gradlew
gradlew.bat Initial commit Jan 30, 2018
settings.gradle

README.md

Enhance!

Command line utility to process Android source files distributed via SDK manager and add API version information as javadoc tags:

/**
 * Called by the system when the activity changes from fullscreen mode to multi-window mode and
 * visa-versa.
 *
 * @see android.R.attr#resizeableActivity
 * @param isInMultiWindowMode True if the activity is in multi-window mode.
 * @deprecated Use {@link #onMultiWindowModeChanged(boolean, Configuration)} instead.
 * @since 7.0 Nougat (24)
 * @deprecated 8.0 Oreo (26)
 */
@Deprecated
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
    // Left deliberately empty. There should be no side effects if a direct
    // subclass of Activity does not call super.
}

Ironically allows to actually format processed code with AOSP code style specification (and as google-java-format is used - GOOGLE style is also supported).


Pick the jar file from the latest release.

There are few configuration options:

  • sdk: (required) Android SDK version (for example 25)
  • format: Allows to format processed Java source files. Available options are: aosp and google. Everything else (including empty argument) won't format processed code
  • sp: path to Android SDK
usage: Enhance
 -format <arg>          Format sources. Accepts (aosp|google). Everything
                        else would keep original formatting
 -h,--help              Prints help
 -sdk <arg>             Specify which SDK version to process.
 -sp,--sdk-path <arg>   Path to Android SDK. If not specified
                        'ANDROID_HOME' system variable will be used

Please note that you Android SDK folder must already contain sources for specified sdk version.

So, usage would be like that:

# just add api information to source code, no formatting
java -jar enhance.jar -sdk 26

# also format with AOSP
java -jar enhance.jar -sdk 26 -format aosp

# or GOOGLE
java -jar enhance.jar -sdk 26 -format google

# or with custom SDK path
java -jar enhance.jar -sdk 26 -sp "/Users/not_me/android/sdk"

If you would like to restore unmodified copy of source code you can find it: {your-home-directory}/.enhance-backup/android-{sdk}

Thanks

Big kudos to the maintainers of amazing javaparser!

License

  Copyright 2018 Dimitry Ivanov (mail@dimitryivanov.ru)

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
You can’t perform that action at this time.