Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Backed out 4 changesets (bug 1457255) for kotlin warnings/errors are …
Browse files Browse the repository at this point in the history
…not being parsed by Treeherder a=backout

Backed out changeset 9c42ce50a911 (bug 1457255)
Backed out changeset 524a0f9fb978 (bug 1457255)
Backed out changeset a49833bfd519 (bug 1457255)
Backed out changeset 4eccde5dfbef (bug 1457255)
  • Loading branch information
nerli1 committed May 1, 2018
1 parent d5fb203 commit 7599766
Show file tree
Hide file tree
Showing 35 changed files with 91 additions and 179 deletions.
18 changes: 1 addition & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,7 @@ if ('multi' == System.env.AB_CD) {
}

afterEvaluate {
subprojects { project ->
if (project.name != 'thirdparty') {
tasks.withType(JavaCompile) {
// Add compiler args for all code except third-party code.
options.compilerArgs += [
// Turn on all warnings, except...
"-Xlint:all",
// Deprecation, because we do use deprecated API for compatibility.
"-Xlint:-deprecation",
// Serial, because we don't use Java serialization.
"-Xlint:-serial",
// Turn all remaining warnings into errors,
// unless marked by @SuppressWarnings.
"-Werror"]
}
}

subprojects {
if (!hasProperty('android')) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void testIsClientIdValid() {
"895745d1-f31e-46c3-880e-b4dd72963d4f",
};
for (final String validClientId : validClientIds) {
assertTrue("Client ID, " + validClientId + ", is valid", GeckoProfile.isClientIdValid(validClientId));
assertTrue("Client ID, " + validClientId + ", is valid", profile.isClientIdValid(validClientId));
}

final String[] invalidClientIds = new String[] {
Expand All @@ -173,14 +173,14 @@ public void testIsClientIdValid() {
"905de1c0-0ea6-4a43-95f9-6170035f5a8!", // contains a symbol
};
for (final String invalidClientId : invalidClientIds) {
assertFalse("Client ID, " + invalidClientId + ", is invalid", GeckoProfile.isClientIdValid(invalidClientId));
assertFalse("Client ID, " + invalidClientId + ", is invalid", profile.isClientIdValid(invalidClientId));
}

// We generate client IDs using UUID - better make sure they're valid.
for (int i = 0; i < 30; ++i) {
final String generatedClientId = UUID.randomUUID().toString();
assertTrue("Generated client ID from UUID, " + generatedClientId + ", is valid",
GeckoProfile.isClientIdValid(generatedClientId));
profile.isClientIdValid(generatedClientId));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ public void testMoveToNextIconThrowsException() {
.pageUrl(TEST_PAGE_URL)
.build();

@SuppressWarnings("unchecked")
//noinspection unchecked - Creating a mock of a generic type
final TreeSet<IconDescriptor> icons = (TreeSet<IconDescriptor>) mock(TreeSet.class);
request.icons = icons;
request.icons = (TreeSet<IconDescriptor>) mock(TreeSet.class);

//noinspection SuspiciousMethodCalls
doReturn(false).when(request.icons).remove(anyObject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ protected <T> AutopushClientException assertFailure(RequestDelegate<T> delegate,

@Test
public void testUserAgent() throws Exception {
@SuppressWarnings("unchecked")
final RequestDelegate<RegisterUserAgentResponse> registerDelegate = mock(RequestDelegate.class);
client.registerUserAgent(Utils.generateGuid(), registerDelegate);

Expand All @@ -82,21 +81,18 @@ public void testUserAgent() throws Exception {
Assert.assertNotNull(registerResponse.secret);

// Reregistering with a new GUID should succeed.
@SuppressWarnings("unchecked")
final RequestDelegate<Void> reregisterDelegate = mock(RequestDelegate.class);
client.reregisterUserAgent(registerResponse.uaid, registerResponse.secret, Utils.generateGuid(), reregisterDelegate);

Assert.assertNull(assertSuccess(reregisterDelegate, Void.class));

// Unregistering should succeed.
@SuppressWarnings("unchecked")
final RequestDelegate<Void> unregisterDelegate = mock(RequestDelegate.class);
client.unregisterUserAgent(registerResponse.uaid, registerResponse.secret, unregisterDelegate);

Assert.assertNull(assertSuccess(unregisterDelegate, Void.class));

// Trying to unregister a second time should give a 404.
@SuppressWarnings("unchecked")
final RequestDelegate<Void> reunregisterDelegate = mock(RequestDelegate.class);
client.unregisterUserAgent(registerResponse.uaid, registerResponse.secret, reunregisterDelegate);

Expand All @@ -107,7 +103,6 @@ public void testUserAgent() throws Exception {

@Test
public void testChannel() throws Exception {
@SuppressWarnings("unchecked")
final RequestDelegate<RegisterUserAgentResponse> registerDelegate = mock(RequestDelegate.class);
client.registerUserAgent(Utils.generateGuid(), registerDelegate);

Expand All @@ -117,7 +112,6 @@ public void testChannel() throws Exception {
Assert.assertNotNull(registerResponse.secret);

// We should be able to subscribe to a channel.
@SuppressWarnings("unchecked")
final RequestDelegate<SubscribeChannelResponse> subscribeDelegate = mock(RequestDelegate.class);
client.subscribeChannel(registerResponse.uaid, registerResponse.secret, null, subscribeDelegate);

Expand All @@ -129,15 +123,13 @@ public void testChannel() throws Exception {
Assert.assertThat(subscribeResponse.endpoint, containsString("/v1/"));

// And we should be able to unsubscribe.
@SuppressWarnings("unchecked")
final RequestDelegate<Void> unsubscribeDelegate = mock(RequestDelegate.class);
client.unsubscribeChannel(registerResponse.uaid, registerResponse.secret, subscribeResponse.channelID, unsubscribeDelegate);

Assert.assertNull(assertSuccess(unsubscribeDelegate, Void.class));

// We should be able to create a restricted subscription by specifying
// an ECDSA public key using the P-256 curve.
@SuppressWarnings("unchecked")
final RequestDelegate<SubscribeChannelResponse> subscribeWithKeyDelegate = mock(RequestDelegate.class);
final KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("ECDSA");
keyPairGenerator.initialize(256);
Expand All @@ -154,14 +146,12 @@ public void testChannel() throws Exception {
Assert.assertThat(subscribeWithKeyResponse.endpoint, containsString("/v2/"));

// And we should be able to drop the restricted subscription.
@SuppressWarnings("unchecked")
final RequestDelegate<Void> unsubscribeWithKeyDelegate = mock(RequestDelegate.class);
client.unsubscribeChannel(registerResponse.uaid, registerResponse.secret, subscribeWithKeyResponse.channelID, unsubscribeWithKeyDelegate);

Assert.assertNull(assertSuccess(unsubscribeWithKeyDelegate, Void.class));

// Trying to unsubscribe a second time should give a 410.
@SuppressWarnings("unchecked")
final RequestDelegate<Void> reunsubscribeDelegate = mock(RequestDelegate.class);
client.unsubscribeChannel(registerResponse.uaid, registerResponse.secret, subscribeResponse.channelID, reunsubscribeDelegate);

Expand All @@ -170,7 +160,6 @@ public void testChannel() throws Exception {
Assert.assertTrue(((AutopushClientException.AutopushClientRemoteException) reunsubscribeFailureException).isGone());

// Trying to unsubscribe from a non-existent channel should give a 404. Right now it gives a 401!
@SuppressWarnings("unchecked")
final RequestDelegate<Void> badUnsubscribeDelegate = mock(RequestDelegate.class);
client.unsubscribeChannel(registerResponse.uaid + "BAD", registerResponse.secret, subscribeResponse.channelID, badUnsubscribeDelegate);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public void testGetAndZeroSearchVerifyReturnedData() throws Exception {
final ExtendedJSONObject actual = SearchCountMeasurements.getAndZeroSearch(sharedPrefs);
assertEquals("Returned JSON contains number of items inserted", expected.size(), actual.size());
for (final String key : expected.keySet()) {
assertEquals("Returned JSON contains inserted value", expected.get(key), actual.getIntegerSafely(key));
assertEquals("Returned JSON contains inserted value", expected.get(key), (Integer) actual.getIntegerSafely(key));
}
}

Expand All @@ -158,4 +158,4 @@ public void testGetAndZeroSearchNoData() throws Exception {
private String getEngineSearchCountKey(final String engineWhereStr) {
return SearchCountMeasurements.getEngineSearchCountKey(engineWhereStr);
}
}
}
1 change: 0 additions & 1 deletion mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ public View onCreateView(final View parent, final String name, final Context con
}

@Override
@SuppressWarnings("fallthrough")
public void onTabChanged(Tab tab, TabEvents msg, String data) {
if (!mInitialized) {
super.onTabChanged(tab, msg, data);
Expand Down
2 changes: 0 additions & 2 deletions mobile/android/base/java/org/mozilla/gecko/Tabs.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,6 @@ public void run() {
mGeckoView.coverUntilFirstPaint(color);
}
queuePersistAllTabs();
tab.onChange();
break;
case UNSELECTED:
tab.onChange();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public Builder forTopSite(final TopSite topSite) {
break;
// While we also have a "blank" type, it is not used by Activity Stream.
case BrowserContract.TopSites.TYPE_BLANK:
throw new IllegalStateException("Unknown top site type :" + String.valueOf(topSite.getType()));
throw new IllegalStateException("Unknown top site type :" + (int) topSite.getType());
}

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,6 @@ public Cursor getHighlightCandidates(final SQLiteDatabase db, String limit) {
}

@Override
@SuppressWarnings("fallthrough")
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
final int match = URI_MATCHER.match(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ public Uri insertInTransaction(Uri uri, ContentValues values) {
}

@Override
@SuppressWarnings("fallthrough")
public int updateInTransaction(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
trace("Calling update in transaction on URI: " + uri);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected File getDestinationFile(Context context, DownloadContent content)
} else if (content.isHyphenationDictionary()) {
destinationDirectory = new File(context.getApplicationInfo().dataDir, "hyphenation");
} else {
throw new UnrecoverableDownloadContentException("Can't determine destination for kind: " + content.getKind().toString());
throw new UnrecoverableDownloadContentException("Can't determine destination for kind: " + (String) content.getKind());
}

if (!destinationDirectory.exists() && !destinationDirectory.mkdirs()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void perform(Context context, DownloadContentCatalog catalog) {
}

if (!content.isAssetArchive()) {
Log.e(LOGTAG, "Downloaded content is not of type 'asset-archive': " + content.getType().toString());
Log.e(LOGTAG, "Downloaded content is not of type 'asset-archive': " + (String) content.getType());
temporaryFile.delete();
DownloadContentTelemetry.eventDownloadFailure(content, DownloadContentTelemetry.ERROR_LOGIC);
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,9 @@ public void onTabChanged(Tab tab, Tabs.TabEvents msg, String data) {
break;

case SELECTED:
// Update the selected position.
// Update the selected position, then fall through...
tabStripView.selectTab(tab);
setPrivateMode(tab.isPrivate());
tabStripView.updateTab(tab);
break;

case UNSELECTED:
// We just need to update the style for the unselected tab...
case TITLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ public void restoreTabEditingState(final TabEditingState editingState) {
}

@Override
@SuppressWarnings("fallthrough")
public void onTabChanged(@Nullable Tab tab, Tabs.TabEvents msg, String data) {
Log.d(LOGTAG, "onTabChanged: " + msg);
final Tabs tabs = Tabs.getInstance();
Expand Down
30 changes: 0 additions & 30 deletions mobile/android/geckoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,36 +148,6 @@ android {
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
// Translate Kotlin messages like "w: ..." and "e: ..." into
// "...: warning: ..." and "...: error: ...", to make Treeherder understand.
def listener = {
if (it.startsWith('w: ') || it.startsWith('e: ')) {
def matches = (it =~ /([ew]): (.+): \((\d+), (\d+)\): (.*)/)
if (!matches) {
logger.quiet "kotlinc message format has changed!"
if (it.startsWith('w: ')) {
// For warnings, don't continue because we don't want to throw an
// exception. For errors, we want the exception so that the new error
// message format gets translated properly.
return
}
}
def (_, type, file, line, column, message) = matches[0]
type = (type == 'w') ? 'warning' : 'error'
// Use logger.lifecycle, which does not go through stderr again.
logger.lifecycle "$file:$line:$column: $type: $message"
}
} as StandardOutputListener

doFirst {
logging.addStandardErrorListener(listener)
}
doLast {
logging.removeStandardErrorListener(listener)
}
}

dependencies {
implementation "com.android.support:support-v4:$support_library_version"
implementation "com.android.support:palette-v7:$support_library_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,6 @@ public boolean equals(final Object other) {
return false;
}

@Override
public int hashCode() {
return method.hashCode();
}

/* package */ int getOrder() {
if (requirement == null || currentCount == 0) {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ public static void setHapticFeedbackDelegate(final HapticFeedbackDelegate delega
sHapticFeedbackDelegate = (delegate != null) ? delegate : DEFAULT_LISTENERS;
}

@SuppressWarnings("fallthrough")
@WrapForJNI(calledFrom = "gecko")
private static void enableSensor(int aSensortype) {
final SensorManager sm = (SensorManager)
Expand Down Expand Up @@ -767,7 +766,6 @@ private static void enableSensor(int aSensortype) {
}
}

@SuppressWarnings("fallthrough")
@WrapForJNI(calledFrom = "gecko")
private static void disableSensor(int aSensortype) {
final SensorManager sm = (SensorManager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private native boolean handleMouseEvent(

private boolean handleMotionEvent(MotionEvent event) {
if (!mAttached) {
mQueuedEvents.add(new Pair<>(EVENT_SOURCE_MOTION, event));
mQueuedEvents.add(new Pair(EVENT_SOURCE_MOTION, event));
return false;
}

Expand Down Expand Up @@ -98,7 +98,7 @@ private boolean handleMotionEvent(MotionEvent event) {

private boolean handleScrollEvent(MotionEvent event) {
if (!mAttached) {
mQueuedEvents.add(new Pair<>(EVENT_SOURCE_SCROLL, event));
mQueuedEvents.add(new Pair(EVENT_SOURCE_SCROLL, event));
return false;
}

Expand Down Expand Up @@ -127,7 +127,7 @@ private boolean handleScrollEvent(MotionEvent event) {

private boolean handleMouseEvent(MotionEvent event) {
if (!mAttached) {
mQueuedEvents.add(new Pair<>(EVENT_SOURCE_MOUSE, event));
mQueuedEvents.add(new Pair(EVENT_SOURCE_MOUSE, event));
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ public boolean equals(final Object other) {
mBundle.equals(((GeckoSessionSettings) other).mBundle);
}

@Override
public int hashCode() {
return mBundle.hashCode();
}

private <T> boolean valueChangedLocked(final Key<T> key, T value) {
if (key.initOnly && mSession != null && mSession.isOpen()) {
throw new IllegalStateException("Read-only property");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ private boolean performRootAction(int action, Bundle arguments) {
return mView.performAccessibilityAction(action, arguments);
}

@SuppressWarnings("fallthrough")
private boolean performContentAction(int action, Bundle arguments) {
final GeckoBundle data;
switch (action) {
Expand All @@ -193,7 +192,6 @@ private boolean performContentAction(int action, Bundle arguments) {
if (mLastItem) {
return false;
}
// fall-through
case AccessibilityNodeInfo.ACTION_PREVIOUS_HTML_ELEMENT:
if (arguments != null) {
data = new GeckoBundle(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public DefaultOggSeeker(long startPosition, long endPosition, StreamReader strea
}

@Override
@SuppressWarnings("fallthrough")
public long read(ExtractorInput input) throws IOException, InterruptedException {
switch (state) {
case STATE_IDLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class GeckoViewActivityTest {

@Rule
public ActivityTestRule<GeckoViewActivity> mActivityRule = new ActivityTestRule<>(GeckoViewActivity.class);
public ActivityTestRule<GeckoViewActivity> mActivityRule = new ActivityTestRule(GeckoViewActivity.class);

@Test
public void testA() throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ public String toString() {
}

protected void putRaw(String key, Object value) {
Map<String, Object> map = this.object;
@SuppressWarnings("unchecked")
Map<Object, Object> map = this.object;
map.put(key, value);
}

Expand Down
Loading

0 comments on commit 7599766

Please sign in to comment.