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

warning: ChoiceGeneratorBase() in ChoiceGeneratorBase has been deprecated #72

Closed
gayanW opened this issue May 31, 2018 · 1 comment
Closed

Comments

@gayanW
Copy link
Collaborator

gayanW commented May 31, 2018

Compiler warning "[deprecation] ChoiceGeneratorBase() in ChoiceGeneratorBase has been deprecated" when build with JDK 9 and later.

[javac] /home/travis/build/javapathfinder/jpf-core/src/main/gov/nasa/jpf/vm/choice/PermutationCG.java:35: warning: [deprecation] ChoiceGeneratorBase() in ChoiceGeneratorBase has been deprecated
[javac]   public PermutationCG (PermutationGenerator pg){
[javac]                                                 ^

public class PermutationCG extends ChoiceGeneratorBase<int[]>{
protected PermutationGenerator pg;
protected int[] permutation;
public PermutationCG (PermutationGenerator pg){
this.pg = pg;
}
public PermutationCG (String id, PermutationGenerator pg){
super(id);
this.pg = pg;
}

Default constructor of the super class 'gov.nasa.jpf.vm.ChoiceGeneratorBase' is marked deprecated, but the constructor PermutationCG (PermutationGenerator) is not, thus resulting in the warning.

/**
* don't use this since it is not safe for cascaded ChoiceGenerators
* (we need the 'id' to be as context specific as possible)
*/
@Deprecated
protected ChoiceGeneratorBase() {
id = "?";
}
protected ChoiceGeneratorBase(String id) {
this.id = id;
}

Travis log:
https://travis-ci.org/javapathfinder/jpf-core/builds/385707808#L2425-L2427

@cyrille-artho
Copy link
Member

cyrille-artho commented Jun 4, 2018

Actually, neither of the default constructors is used by jpf-core itself (internally).
However, some of the other projects may use it.
I would consider removing the default constructor, but we should give extension writers time to adapt.
Therefore, I'd mark both constructors (PermutationCG and ChoiceGeneratorBase) with
@Deprecated(forRemoval=true)
and would also insert an annotation that suppresses this warning in the constructor of PermutationCG.

gayanW added a commit to gayanW/jpf-core that referenced this issue Jun 5, 2018
Both constructors PermutationCG#PermutationCG(PermutationGenerator),
ChoiceGeneratorBase#ChoiceGeneratorBase() is marked for removal.
PermutationCG is annotated with @SuppressWarnings("removal") to suppress
the warning

    [javac] src/main/gov/nasa/jpf/vm/choice/PermutationCG.java:35:
      warning: [deprecation] ChoiceGeneratorBase() in ChoiceGeneratorBase has been deprecated
    [javac]   public PermutationCG (PermutationGenerator pg){
    [javac]                                                 ^

Fixes: javapathfinder#72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants