Last active
October 13, 2018 21:50
-
-
Save filiphr/d37eb087360986e6b65184a66a2b4cf1 to your computer and use it in GitHub Desktop.
Differences between javac and tycho-compiler-jdt (1.2.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Animal<ID extends KeyOfAllBeings> extends Identifiable<KeyOfAllBeings> { | |
@Override | |
ID getKey(); | |
void setKey(ID item); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnimalKey extends KeyOfAllBeings { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseAnimal implements Identifiable<KeyOfAllBeings>, Animal<AnimalKey> { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Elephant extends BaseAnimal { | |
private AnimalKey key; | |
@Override | |
public AnimalKey getKey() { | |
return key; | |
} | |
@Override | |
public void setKey(AnimalKey key) { | |
this.key = key; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Identifiable<T extends Key> { | |
T getKey(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Key { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class KeyOfAllBeings extends Key { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
BaseAnimal baseAnimal = new Animal(); | |
// Both work on javac, but not ecj (at least not with tycho-compiler-jdt 1.2.0) | |
AnimalKey key = baseAnimal.getKey(); | |
KeyOfAllBeings key2 = baseAnimal.getKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment