Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Type Inference bug?
Type Inference bug? [message #1808350] Fri, 21 June 2019 19:45 Go to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Hi,

I tried this repository [1] the other day and noticed that there are many compiler errors in the workspace. They seem to point to some problems with type inference, but I'm not sure if I have miss-configured anything.

I tried in Eclipse as well as in Gitpod which uses jdt-ls under the hood and got the same error messages.

Here's a snapshot to see those errors:
https://gitpod.io#snapshot/c06617e6-e6b5-49e9-b5a0-688bf8c689d9
(after start you need to wait 10 secs for JDT-LS to initialize)

Is that a know issues or am I doing something wrong?

[1] - https://github.com/gdejohn/procrastination

Thanks
Sven
Re: Type Inference bug? [message #1808353 is a reply to message #1808350] Fri, 21 June 2019 20:19 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Can you please show the error in a way that doesn't require me to authorize some app that I've never heard of to read my data?
Re: Type Inference bug? [message #1808354 is a reply to message #1808353] Fri, 21 June 2019 20:36 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
never mind, I cloned the project and see 26 compile errors. Is that the number you are seeing, too?

As a rough estimate, close investigation of those 26 compile errors may keep us busy for one year.

I would greatly help if s.o. could identify a recurring pattern.

Actually, I'm curious if there's one occurrence that does not involve wildcards. This is because all of JLS, javac, ecj are severely struggling when it comes to type inference with wildcards.
Re: Type Inference bug? [message #1808356 is a reply to message #1808354] Fri, 21 June 2019 20:53 Go to previous messageGo to next message
Griffin DeJohn is currently offline Griffin DeJohnFriend
Messages: 1
Registered: June 2019
Junior Member
Hi Stephan,

IntelliJ IDEA doesn't have any issues with the project, and it compiles on the command line using Maven with no errors or warnings.
Re: Type Inference bug? [message #1808368 is a reply to message #1808354] Sat, 22 June 2019 06:18 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Hi Stephan,

thank you for looking into it.
I think the pattern is that type arguments of generics cannot be inferred properly.
Your answer sounds like that's a known issue. javac (and IntelliJ) doesn't complain, though.

Thanks,
Sven
Re: Type Inference bug? [message #1808376 is a reply to message #1808368] Sat, 22 June 2019 17:39 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Sven
thanks for trying but that doesn't help.

Recall: type inference is the process of instantiating type parameters with concrete types. What you are saying would imply that type inference in ecj doesn't work at all, which is obviously wrong. It works perfectly for the vast majority of cases.

The fact that javac accepts this can mean several things. Perhaps accepting is a bug? Perhaps accepting was the intention of the lambda expert group, but JLS fails to provide means for finding a solution? Knowing that javac behaves differently has very little implication on the development of ecj.

If you are at leisure, study chapter 18 of JLS, pick one example from the procrastination library and show what type instantiation should follow from the specification.

Stephan
Re: Type Inference bug? [message #1808491 is a reply to message #1808356] Tue, 25 June 2019 14:57 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Griffin DeJohn wrote on Fri, 21 June 2019 22:53
Hi Stephan,

IntelliJ IDEA doesn't have any issues with the project, and it compiles on the command line using Maven with no errors or warnings.


Both could still be bugs until s.o. understand how JLS requires the compiler to resolve this. Knowing that JLS is incomplete in this area I'm not very optimistic.
Previous Topic:Eclipse: Java was started but returned error code=13 [duplicate]
Next Topic:How to use conditional breakpoint in Eclipse?
Goto Forum:
  


Current Time: Fri Apr 19 19:31:54 GMT 2024

Powered by FUDForum. Page generated in 0.03894 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top