New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 707186 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Not on Chrome anymore
Closed: Apr 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature

Blocked on:
issue 607519



Sign in to add a comment

Refine IntDef annotation generation for java_cpp_enum

Project Member Reported by dgn@chromium.org, Mar 31 2017

Issue description

The current generator creates a class with the enum name, with fields that are the int values and a nested interface for the annotation. That creates type names such as `NTPTileType.NTPTileTypeEnum`

An improvement would be to have the outer type be the annotation, and the int values constants under the annotation type, resulting in more compact type names.

Example that is manually created: https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ItemViewType.java?q=ItemViewType&dr=CSs&l=16
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/14f477472e0e8612c98763b68e9a51bcae954c24

commit 14f477472e0e8612c98763b68e9a51bcae954c24
Author: dgn <dgn@chromium.org>
Date: Tue Apr 11 01:38:50 2017

[Android] Simplify naming of generated java enums IntDefs

Allows to use @EnumType as IntDef annotation instead of
@EnumType.EnumTypeEnum

BUG= 707186 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_cronet_tester

Review-Url: https://codereview.chromium.org/2792583002
Cr-Commit-Position: refs/heads/master@{#463490}

[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/android_webview/java/src/org/chromium/android_webview/AwContents.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/android_webview/java/src/org/chromium/android_webview/AwRenderProcessGoneDetail.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/android_webview/java/src/org/chromium/android_webview/AwRendererPriorityManager.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/base/android/java/src/org/chromium/base/ApplicationStatus.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/build/android/gyp/java_cpp_enum.py
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/build/android/gyp/java_cpp_enum_tests.py
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContentSuggestionsNotificationHelper.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsCategoryInfo.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsBridge.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SuggestionsSource.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSites.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/suggestions/MostVisitedSitesBridge.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkUpdateManager.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/ContentSuggestionsTestUtils.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/components/location/android/java/src/org/chromium/components/location/LocationUtils.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/components/offline_items_collection/core/android/java/src/org/chromium/components/offline_items_collection/OfflineItem.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/components/offline_items_collection/core/android/java/src/org/chromium/components/offline_items_collection/OfflineItemBridge.java
[modify] https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24/net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java

Project Member

Comment 2 by bugdroid1@chromium.org, Apr 11 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/clank/internal/apps/+/18e4bc7bf81f408bbde93be7232b89771cd70225

commit 18e4bc7bf81f408bbde93be7232b89771cd70225
Author: Nicolas Dossou-gbete <dgn@chromium.org>
Date: Tue Apr 11 04:25:46 2017

Comment 3 by dgn@chromium.org, Apr 11 2017

Status: Fixed (was: Assigned)
Project Member

Comment 4 by bugdroid1@chromium.org, May 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2b5c5e827022eb7f91ae9036181151576c0ade65

commit 2b5c5e827022eb7f91ae9036181151576c0ade65
Author: dgn <dgn@chromium.org>
Date: Fri May 12 20:33:39 2017

Cleanup definition of ActivityState and ApplicationStatus warnings

Removed the redundant ActivityStateEnum intdef definition and resolved
lint warnings in the ActivityState and ApplicationStatus classes.

Also updated the c++ enum conversion doc about the new IntDef
declaration style that was added in
https://crrev.com/14f477472e0e8612c98763b68e9a51bcae954c24

BUG= 707186 

Review-Url: https://codereview.chromium.org/2877743002
Cr-Commit-Position: refs/heads/master@{#471432}

[modify] https://crrev.com/2b5c5e827022eb7f91ae9036181151576c0ade65/base/android/java/src/org/chromium/base/ActivityState.java
[modify] https://crrev.com/2b5c5e827022eb7f91ae9036181151576c0ade65/base/android/java/src/org/chromium/base/ApplicationStatus.java
[modify] https://crrev.com/2b5c5e827022eb7f91ae9036181151576c0ade65/docs/android_accessing_cpp_enums_in_java.md

Sign in to add a comment