Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deprecation warnings #85

Open
hrldcpr opened this issue Jan 28, 2020 · 3 comments
Open

fix deprecation warnings #85

hrldcpr opened this issue Jan 28, 2020 · 3 comments

Comments

@hrldcpr
Copy link
Owner

hrldcpr commented Jan 28, 2020

mvn clean compile -Dmaven.compiler.showDeprecation=true

…they don't indicate any actual problem, they're just because we have to implement mutators to fulfill Collections interfaces, but we have also deprecated mutators in PCollections so that people get IDE warnings if they try to use them

possibly can suppress the warning with a suppression comment?

@bowbahdoe
Copy link

Since the project is on gradle now exclusively, what command would reproduce this?

@hrldcpr
Copy link
Owner Author

hrldcpr commented Dec 18, 2020

Thanks good point. To see the warnings, add this to the bottom of build.gradle:

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:deprecation"
        }
    }
}

(specifically, as of now the warnings are:

src/main/java/org/pcollections/MapPBag.java:24: warning: [deprecation] addAll(Collection<? extends E>) in PCollection has been deprecated
public final class MapPBag<E> extends AbstractCollection<E> implements PBag<E>, Serializable {
             ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/MapPBag.java:24: warning: [deprecation] add(E) in PCollection has been deprecated
public final class MapPBag<E> extends AbstractCollection<E> implements PBag<E>, Serializable {
             ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/AmortizedPQueue.java:149: warning: [deprecation] poll() in PQueue has been deprecated
  public E poll() {
           ^
  where E is a type-variable:
    E extends Object declared in interface PQueue
src/main/java/org/pcollections/AmortizedPQueue.java:143: warning: [deprecation] offer(E) in PQueue has been deprecated
  public boolean offer(E o) {
                 ^
  where E is a type-variable:
    E extends Object declared in interface PQueue
src/main/java/org/pcollections/AmortizedPQueue.java:22: warning: [deprecation] addAll(Collection<? extends E>) in PCollection has been deprecated
public class AmortizedPQueue<E> extends AbstractQueue<E> implements PQueue<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/AmortizedPQueue.java:22: warning: [deprecation] add(E) in PCollection has been deprecated
public class AmortizedPQueue<E> extends AbstractQueue<E> implements PQueue<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/HashPMap.java:31: warning: [deprecation] putAll(Map<? extends K,? extends V>) in PMap has been deprecated
public final class HashPMap<K, V> extends AbstractMap<K, V> implements PMap<K, V>, Serializable {
             ^
  where K,V are type-variables:
    K extends Object declared in interface PMap
    V extends Object declared in interface PMap
src/main/java/org/pcollections/HashPMap.java:31: warning: [deprecation] put(K,V) in PMap has been deprecated
public final class HashPMap<K, V> extends AbstractMap<K, V> implements PMap<K, V>, Serializable {
             ^
  where K,V are type-variables:
    K extends Object declared in interface PMap
    V extends Object declared in interface PMap
src/main/java/org/pcollections/IntTreePMap.java:37: warning: [deprecation] putAll(Map<? extends K,? extends V>) in PMap has been deprecated
public final class IntTreePMap<V> extends AbstractMap<Integer, V>
             ^
  where K,V are type-variables:
    K extends Object declared in interface PMap
    V extends Object declared in interface PMap
src/main/java/org/pcollections/IntTreePMap.java:37: warning: [deprecation] put(K,V) in PMap has been deprecated
public final class IntTreePMap<V> extends AbstractMap<Integer, V>
             ^
  where K,V are type-variables:
    K extends Object declared in interface PMap
    V extends Object declared in interface PMap
src/main/java/org/pcollections/OrderedPSet.java:14: warning: [deprecation] addAll(Collection<? extends E>) in PCollection has been deprecated
public class OrderedPSet<E> extends AbstractSet<E> implements POrderedSet<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/OrderedPSet.java:14: warning: [deprecation] add(E) in PCollection has been deprecated
public class OrderedPSet<E> extends AbstractSet<E> implements POrderedSet<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/ConsPStack.java:25: warning: [deprecation] add(int,E) in PSequence has been deprecated
public final class ConsPStack<E> extends AbstractSequentialList<E>
             ^
  where E is a type-variable:
    E extends Object declared in interface PSequence
src/main/java/org/pcollections/ConsPStack.java:25: warning: [deprecation] set(int,E) in PSequence has been deprecated
public final class ConsPStack<E> extends AbstractSequentialList<E>
             ^
  where E is a type-variable:
    E extends Object declared in interface PSequence
src/main/java/org/pcollections/ConsPStack.java:25: warning: [deprecation] addAll(int,Collection<? extends E>) in PSequence has been deprecated
public final class ConsPStack<E> extends AbstractSequentialList<E>
             ^
  where E is a type-variable:
    E extends Object declared in interface PSequence
src/main/java/org/pcollections/ConsPStack.java:25: warning: [deprecation] addAll(Collection<? extends E>) in PCollection has been deprecated
public final class ConsPStack<E> extends AbstractSequentialList<E>
             ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/ConsPStack.java:25: warning: [deprecation] add(E) in PCollection has been deprecated
public final class ConsPStack<E> extends AbstractSequentialList<E>
             ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/MapPSet.java:23: warning: [deprecation] addAll(Collection<? extends E>) in PCollection has been deprecated
public final class MapPSet<E> extends AbstractSet<E> implements PSet<E>, Serializable {
             ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/MapPSet.java:23: warning: [deprecation] add(E) in PCollection has been deprecated
public final class MapPSet<E> extends AbstractSet<E> implements PSet<E>, Serializable {
             ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/TreePVector.java:27: warning: [deprecation] add(int,E) in PSequence has been deprecated
public class TreePVector<E> extends AbstractList<E> implements PVector<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PSequence
src/main/java/org/pcollections/TreePVector.java:27: warning: [deprecation] set(int,E) in PSequence has been deprecated
public class TreePVector<E> extends AbstractList<E> implements PVector<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PSequence
src/main/java/org/pcollections/TreePVector.java:27: warning: [deprecation] addAll(int,Collection<? extends E>) in PSequence has been deprecated
public class TreePVector<E> extends AbstractList<E> implements PVector<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PSequence
src/main/java/org/pcollections/TreePVector.java:27: warning: [deprecation] addAll(Collection<? extends E>) in PCollection has been deprecated
public class TreePVector<E> extends AbstractList<E> implements PVector<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
src/main/java/org/pcollections/TreePVector.java:27: warning: [deprecation] add(E) in PCollection has been deprecated
public class TreePVector<E> extends AbstractList<E> implements PVector<E>, Serializable {
       ^
  where E is a type-variable:
    E extends Object declared in interface PCollection
24 warnings

)

@hrldcpr
Copy link
Owner Author

hrldcpr commented Dec 18, 2020

adding @SuppressWarnings("deprecation") above a class seems to fix it, but isn't ideal since that will suppress any other deprecation warnings we might introduce… would be nice to suppress just these specific warnings.

Not marking the methods as deprecated is one solution, but I think those annotations are potentially quite useful for catching bugs, so... 🤔 maybe best to just leave it be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants