Skip to content

Commit

Permalink
8289394: Fix warnings: Unlikely argument type
Browse files Browse the repository at this point in the history
Reviewed-by: nlisker, kcr
  • Loading branch information
andy-goryachev-oracle authored and kevinrushforth committed Jul 19, 2022
1 parent e38979b commit cb7460d
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 30 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2014, Oracle and/or its affiliates.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
* This file is available and licensed under the following license:
Expand Down Expand Up @@ -76,7 +76,7 @@ public class TimelineController {
endBtn.setDisable(false);
loopBtn.setDisable(false);
playBtn.setSelected(t.getCurrentRate() != 0);
loopBtn.setSelected(t.getCycleDuration().equals(Timeline.INDEFINITE));
loopBtn.setSelected(t.getCycleCount() == Timeline.INDEFINITE);
t.currentRateProperty().addListener(rateListener);
}
old = t;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -208,6 +208,7 @@ public void testHashCode() {
assertEquals(hc1, hc2);
}

@SuppressWarnings("unlikely-arg-type")
@Test
public void testEquals() {
final BidirectionalBinding golden = BidirectionalBinding.bind(op1, op2);
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -133,6 +133,7 @@ public void testClear() {
mlo.check1AddRemove(list, Arrays.asList("b", "c", "d", "e"), 1, 1);
}

@SuppressWarnings("unlikely-arg-type")
@Test
public void testContains() {
assertTrue(sublist.contains("c"));
Expand All @@ -154,6 +155,7 @@ public void testContainsNull() {
assertTrue(sublist.contains(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test
public void testEqualsOnAnotherType() {
assertFalse(sublist.equals(Integer.valueOf(7)));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -101,7 +101,7 @@ class GetEvent {
}
devices.add(sysPath);
} else if (action.equals("remove")) {
devices.remove(devPath);
devices.remove(sysPath);
}
} catch (IOException | RuntimeException e) {
e.printStackTrace();
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -73,9 +73,15 @@ public Node_cssStyleMap_Test() {

boolean disabled = false;

/**
* @param property - must be a StyleableProperty
* @param map
* @param decls
*/
private void checkFoundStyle(Property<?> property, Map<StyleableProperty<?>, List<Style>> map, List<Declaration> decls) {

List<Style> styles = map.get(property);
assertTrue(property instanceof StyleableProperty);
List<Style> styles = map.get((StyleableProperty<?>)property);
assert (styles != null && !styles.isEmpty());

String pname = ((StyleableProperty<?>)property).getCssMetaData().getProperty();
Expand Down Expand Up @@ -286,18 +292,6 @@ public void testRT_21212() {

}

boolean containsProperty(CssMetaData key, Map<String,List<CascadingStyle>> map) {

if (map.containsKey(key)) return true;
List<CssMetaData> subProperties = key.getSubProperties();
if (subProperties != null && !subProperties.isEmpty()) {
for (CssMetaData subKey: subProperties) {
if (map.containsKey(subKey)) return true;
}
}
return false;
}

@Test
public void testRT_34799() {

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -81,6 +81,7 @@ public class BackgroundFillTest {
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void equalsAgainstRandomObject() {
BackgroundFill a = new BackgroundFill(Color.ORANGE, new CornerRadii(2), new Insets(3));
assertFalse(a.equals("Some random object"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -213,6 +213,7 @@ public void instanceCreationNullImage() {
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void notEquivalentWithRandom() {
BackgroundImage a = new BackgroundImage(IMAGE_1, REPEAT, REPEAT, POS_2, SIZE_2);
assertFalse(a.equals("Some random string"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -148,6 +148,7 @@ public void RIGHTVerticalSideFails() {
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void notEqualWithRandom() {
BackgroundPosition a = new BackgroundPosition(Side.LEFT, 10, false, Side.TOP, 20, false);
assertFalse(a.equals("Random Object"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -241,6 +241,7 @@ public void nanHeightThrowsException() {
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void notEqualToRandom() {
BackgroundSize a = new BackgroundSize(1, .5, true, true, true, false);
assertFalse(a.equals("Some random object"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -341,6 +341,7 @@ public void imagesIsUnmodifiable() {
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void notEqualWithRandom() {
Background a = new Background((BackgroundFill[])null, null);
assertFalse(a.equals("Some random String"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -170,6 +170,7 @@ public void dashArrayIsImmutable() {
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void notEqualWithRandom() {
BorderStrokeStyle a = new BorderStrokeStyle(null, null, null, 10, 0, null);
assertFalse(a.equals("Some random string"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -557,6 +557,7 @@ IMAGE_4, new BorderWidths(3), Insets.EMPTY,
assertFalse(a.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void notEqualWithRandom() {
Border a = new Border((BorderStroke[])null, null);
assertFalse(a.equals("Some random String"));
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -202,6 +202,7 @@ public void cannotSpecifyNegativeLeft2() {
assertFalse(BorderWidths.DEFAULT.equals(null));
}

@SuppressWarnings("unlikely-arg-type")
@Test public void noEqualToRandom() {
assertFalse(BorderWidths.DEFAULT.equals("Some random value"));
}
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -90,6 +90,7 @@ public void testGetStopsCannotChangeGradient() {
returned.set(0, stop2);
}

@SuppressWarnings("unlikely-arg-type")
@Test
public void testEquals() {
LinearGradient basic = new LinearGradient(1, 2, 3, 4, true,
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -91,6 +91,7 @@ public void testGetStopsCannotChangeGradient() {
returned.set(0, stop2);
}

@SuppressWarnings("unlikely-arg-type")
@Test
public void testEquals() {
RadialGradient basic = new RadialGradient(1, 2, 3, 4, 5, true,
Expand Down

1 comment on commit cb7460d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.