Skip to content

Fix #3273: Extend cooking to parent types #3317

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

Merged
merged 3 commits into from
Oct 18, 2017

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 12, 2017

No description provided.

val a = (_: Bar_1.A[AnyRef]).foo()
val b = (_: Bar_1.B[AnyRef]).bar()
def test(x: Bar_1.A[AnyRef]): Bar_1.B[_] = x
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to test these cases under joint compilation, too (usually changes to classfile parser need to be mirrored in JavaParsers)

@retronym
Copy link
Member

I'm guessing some more work will be needed to deal with raw types in type parameter bound position.

Legacy-tests seems to always compile files together, but cooking
only works for Java files read by ClassfileParser. I don't think
it makes sense to change that - if we compile Java files from sources
we should demand that raw types are re-written as wildcard types.

So to fix this we move the offending files to pos-special and compile
them only in CompilationTests.
@smarter
Copy link
Member

smarter commented Oct 13, 2017

From the last commit message:

if we compile Java files from sources we should demand that raw types are re-written as wildcard types.

Unfortunately this isn't always easy, because of .class and .getClass: List.class will return a Class<? extends List> and you cannot directly cast this to a Class<List<?>>, an intermediate cast is necessary:

(Class<List<?>>) (Class<?>) List.class

Something like this was necessary to compile the strawman: #3028

@smarter
Copy link
Member

smarter commented Oct 13, 2017

Of course, it's possible that the 13 years old bug report on this issue will be fixed one day: https://bugs.openjdk.java.net/browse/JDK-6184881 :)

@odersky
Copy link
Contributor Author

odersky commented Oct 13, 2017

I have decided that as far as I am concerned I won't spend anymore cycles on this. If somebody really wants to use raw types in jointly compiled Java code, asking them to do the rewrite is justified even if it might be difficult.

To prevent failure CompilationTests we need an extra nested directory.
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

Successfully merging this pull request may close these issues.

3 participants