{"action":"created","issue":{"url":"https://api.github.com/repos/scala/scala/issues/4403","labels_url":"https://api.github.com/repos/scala/scala/issues/4403/labels{/name}","comments_url":"https://api.github.com/repos/scala/scala/issues/4403/comments","events_url":"https://api.github.com/repos/scala/scala/issues/4403/events","html_url":"https://github.com/scala/scala/pull/4403","id":64382062,"number":4403,"title":"SI-9239 fix java generic signature when traits extend classes","user":{"login":"gourlaysama","id":733438,"avatar_url":"https://avatars.githubusercontent.com/u/733438?v=3","gravatar_id":"","url":"https://api.github.com/users/gourlaysama","html_url":"https://github.com/gourlaysama","followers_url":"https://api.github.com/users/gourlaysama/followers","following_url":"https://api.github.com/users/gourlaysama/following{/other_user}","gists_url":"https://api.github.com/users/gourlaysama/gists{/gist_id}","starred_url":"https://api.github.com/users/gourlaysama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gourlaysama/subscriptions","organizations_url":"https://api.github.com/users/gourlaysama/orgs","repos_url":"https://api.github.com/users/gourlaysama/repos","events_url":"https://api.github.com/users/gourlaysama/events{/privacy}","received_events_url":"https://api.github.com/users/gourlaysama/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scala/scala/labels/reviewed","name":"reviewed","color":"02e10c"}],"state":"open","locked":false,"assignee":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/48","html_url":"https://github.com/scala/scala/milestones/2.11.7","labels_url":"https://api.github.com/repos/scala/scala/milestones/48/labels","id":985497,"number":48,"title":"2.11.7","description":"Merge to 2.11.x.\r\n","creator":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":53,"state":"open","created_at":"2015-02-19T00:12:20Z","updated_at":"2015-04-09T16:37:43Z","due_on":"2015-06-01T07:00:00Z","closed_at":null},"comments":8,"created_at":"2015-03-25T21:55:49Z","updated_at":"2015-04-09T23:53:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/4403","html_url":"https://github.com/scala/scala/pull/4403","diff_url":"https://github.com/scala/scala/pull/4403.diff","patch_url":"https://github.com/scala/scala/pull/4403.patch"},"body":"Given the following code:\r\n```scala\r\n  class C1[T]\r\n  trait T1[T] extends C1[T]\r\n  class C2[T] extends T1[T]\r\n```\r\nThe generic signature of `C2` changed after ced3ca8 from `\"C1[T], T1[T]\"`\r\nto `\"Object, T1[T]\"`, even though `C1` was still marked as a superclass in\r\nthe bytecode...\r\n\r\n`C1` was removed because a subclass (`T1`) appeared later on, and it was\r\npossible for a trait to cause a class to be evicted. It turns out that\r\nif a class `A` appears in `parents`, it *always* has to stay in the\r\nminimized signature: if a trait later in the list inherits from some class, that\r\nclass has to be a superclass of `A` (per SLS §5.1), or `A` itself, so in\r\nany case, the most specific superclass is `A`, so `A` should stay in the\r\nsignature.\r\n\r\nThus `minimizeParents` now only allows traits/interfaces to be removed\r\nfrom the list (the refactoring in 7552739, moving from `mixinClasses` to\r\n`parents`, makes this much easier to fix).\r\n\r\nThis didn't happen for non-generic signatures because there are two\r\nseparate fields in the classfile for this (one for the superclass,\r\none for interfaces), so interfaces were processed on their own.\r\nThus non-parametrized classes were not affected. Anything that used\r\nerased types at runtime was also fine (like `isInstanceOf` checks),\r\nand anything that used `ScalaSignature` was also unaffected.\r\nMaybe that's why so few things broke...\r\n\r\nSee the test for how this affects Java (hint: badly).\r\n\r\nThis changes very few things when building scala itself, and the\r\nchanges seem sensible:\r\n```\r\n--- sandbox/lib/scala-library.jar#!scala/runtime/NonLocalReturnControl.class\r\n+++ build/pack/lib/scala-library.jar#!scala/runtime/NonLocalReturnControl.class\r\n\r\n- Generic Signature: <T:Ljava/lang/Object;>Ljava/lang/Object;Lscala/util/control/ControlThrowable;\r\n+ Generic Signature: <T:Ljava/lang/Object;>Ljava/lang/Throwable;Lscala/util/control/ControlThrowable;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/mutable/QueueProxy$$anon$1.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/mutable/QueueProxy$$anon$1.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/mutable/QueueProxy<TA;>;\r\n+ Generic Signature: Lscala/collection/mutable/Queue<TA;>;Lscala/collection/mutable/QueueProxy<TA;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/mutable/Iterable$.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/mutable/Iterable$.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/generic/TraversableFactory<Lscala/collection/mutable/Iterable;>;\r\n+ Generic Signature: Lscala/collection/generic/GenTraversableFactory<Lscala/collection/mutable/Iterable;>;Lscala/collection/generic/TraversableFactory<Lscala/collection/mutable/Iterable;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/immutable/Traversable$.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/immutable/Traversable$.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/generic/TraversableFactory<Lscala/collection/immutable/Traversable;>;\r\n+ Generic Signature: Lscala/collection/generic/GenTraversableFactory<Lscala/collection/immutable/Traversable;>;Lscala/collection/generic/TraversableFactory<Lscala/collection/immutable/Traversable;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/immutable/Iterable$.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/immutable/Iterable$.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/generic/TraversableFactory<Lscala/collection/immutable/Iterable;>;\r\n+ Generic Signature: Lscala/collection/generic/GenTraversableFactory<Lscala/collection/immutable/Iterable;>;Lscala/collection/generic/TraversableFactory<Lscala/collection/immutable/Iterable;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/mutable/Traversable$.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/mutable/Traversable$.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/generic/TraversableFactory<Lscala/collection/mutable/Traversable;>;\r\n+ Generic Signature: Lscala/collection/generic/GenTraversableFactory<Lscala/collection/mutable/Traversable;>;Lscala/collection/generic/TraversableFactory<Lscala/collection/mutable/Traversable;>;\r\n--- sandbox/lib/scala-library.jar#!scala/throws.class\r\n+++ build/pack/lib/scala-library.jar#!scala/throws.class\r\n\r\n- Generic Signature: <T:Ljava/lang/Throwable;>Ljava/lang/Object;Lscala/annotation/StaticAnnotation;\r\n+ Generic Signature: <T:Ljava/lang/Throwable;>Lscala/annotation/Annotation;Lscala/annotation/StaticAnnotation;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/mutable/StackProxy$$anon$1.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/mutable/StackProxy$$anon$1.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/mutable/StackProxy<TA;>;\r\n+ Generic Signature: Lscala/collection/mutable/Stack<TA;>;Lscala/collection/mutable/StackProxy<TA;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/convert/Wrappers$IterableWrapper.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/convert/Wrappers$IterableWrapper.class\r\n\r\n- Generic Signature: <A:Ljava/lang/Object;>Ljava/lang/Object;Lscala/collection/convert/Wrappers$IterableWrapperTrait<TA;>;Lscala/Product;Lscala/Serializable;\r\n+ Generic Signature: <A:Ljava/lang/Object;>Ljava/util/AbstractCollection<TA;>;Lscala/collection/convert/Wrappers$IterableWrapperTrait<TA;>;Lscala/Product;Lscala/Serializable;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/Iterable$.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/Iterable$.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/generic/TraversableFactory<Lscala/collection/Iterable;>;\r\n+ Generic Signature: Lscala/collection/generic/GenTraversableFactory<Lscala/collection/Iterable;>;Lscala/collection/generic/TraversableFactory<Lscala/collection/Iterable;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/Traversable$.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/Traversable$.class\r\n\r\n- Generic Signature: Ljava/lang/Object;Lscala/collection/generic/TraversableFactory<Lscala/collection/Traversable;>;\r\n+ Generic Signature: Lscala/collection/generic/GenTraversableFactory<Lscala/collection/Traversable;>;Lscala/collection/generic/TraversableFactory<Lscala/collection/Traversable;>;\r\n--- sandbox/lib/scala-library.jar#!scala/collection/parallel/AdaptiveWorkStealingForkJoinTasks$WrappedTask.class\r\n+++ build/pack/lib/scala-library.jar#!scala/collection/parallel/AdaptiveWorkStealingForkJoinTasks$WrappedTask.class\r\n\r\n- Generic Signature: <R:Ljava/lang/Object;Tp:Ljava/lang/Object;>Ljava/lang/Object;Lscala/collection/parallel/ForkJoinTasks$WrappedTask<TR;TTp;>;Lscala/collection/parallel/AdaptiveWorkStealingTasks$WrappedTask<TR;TTp;>;\r\n+ Generic Signature: <R:Ljava/lang/Object;Tp:Ljava/lang/Object;>Lscala/concurrent/forkjoin/RecursiveAction;Lscala/collection/parallel/ForkJoinTasks$WrappedTask<TR;TTp;>;Lscala/collection/parallel/AdaptiveWorkStealingTasks$WrappedTask<TR;TTp;>;\r\n```"},"comment":{"url":"https://api.github.com/repos/scala/scala/issues/comments/91383384","html_url":"https://github.com/scala/scala/pull/4403#issuecomment-91383384","issue_url":"https://api.github.com/repos/scala/scala/issues/4403","id":91383384,"user":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"created_at":"2015-04-09T23:53:16Z","updated_at":"2015-04-09T23:53:16Z","body":"Excellent work, @gourlaysama!"}}