yellowstonegames / SquidLib

Useful tools for roguelike, role-playing, strategy, and other grid-based games in Java. Feedback is welcome!
Other
448 stars 46 forks source link

K2 casting warning in copy constructor #181

Closed SquidPony closed 6 years ago

SquidPony commented 6 years ago

There's a warning regarding incompatible types for

    public K2(K2<? extends A, ? extends B> other)
    {
        if(other == null)
        {
            keysA = new Arrangement<>();
            keysB = new Arrangement<>();
        }
        else
        {
            keysA = new Arrangement<>(other.keysA);
            keysB = new Arrangement<>(other.keysB);
        }
    }

which goes away with

    public K2(K2<? extends A, ? extends B> other)
    {
        if(other == null)
        {
            keysA = new Arrangement<>();
            keysB = new Arrangement<>();
        }
        else
        {
            keysA = new Arrangement<A>(other.keysA);
            keysB = new Arrangement<B>(other.keysB);
        }
    }

Because I haven't been inside K2 I'm not sure if this has side effects, so leaving it here as an issue since it also doesn't seem to stop compilation.

tommyettinger commented 6 years ago

This looks like a NetBeans thing; I see no such warning in IDEA. I'll try with mvn at the command line.

tommyettinger commented 6 years ago

I did the command-line build. There's a bunch of javadoc warnings and some notes in one test (that I don't want to modify heavily because it's from OpenJDK, used to test compatibility between OrderedSet and LinkedHahSet). These info/warning things won't go away because the test may rely on them to be accurate:

[INFO] /D:/GitHub/SquidLib/squidlib-util/src/test/java/openjdk/java/util/LinkedHashSetTest.java: Some input files use unchecked or unsafe operations.
[INFO] /D:/GitHub/SquidLib/squidlib-util/src/test/java/openjdk/java/util/LinkedHashSetTest.java: Recompile with -Xlint:unchecked for details.

Beyond those, the command-line build shows no warnings on code compilation. It may be a NetBeans or Java compiler bug.

SquidPony commented 6 years ago

Okay, thanks for checking this out