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

Java 8 language features not accessible #5659

Closed
sjaustirni opened this issue Sep 23, 2018 · 6 comments
Closed

Java 8 language features not accessible #5659

sjaustirni opened this issue Sep 23, 2018 · 6 comments

Comments

@sjaustirni
Copy link

sjaustirni commented Sep 23, 2018

Description

Java 8 lambda feature (and possibly more) not accessible despite being advertised it would.
I have seen #3411, but the response is from 2015 and supposedly Processing now does support Java 8:

Processing 3 uses Java 8. We only support the version of Java 8 that's included with the download. Because Oracle sometimes removes older updates, Processing will usually ship with the most recent update of Java 8 that was available at release time.

On top of that, it can be seen in the Environment section that Processing, indeed, does ship with Java 8.

Expected Behavior

A Java 8 example featuring lambda compiles.

Current Behavior

IDE throws: Lambda expressions are allowed only at source level 1.8 or above.

Steps to Reproduce

interface NumericTest {
  boolean computeTest(int n); 
}

void setup() {
  NumericTest isEven = (n) -> (n % 2) == 0;
}

Your Environment

Windows

  • Processing version: 3.4
  • Operating System and OS version: Windows 10
  • Java version: 1.8.0_181

Linux

  • Processing version: 3.3.7-1
  • Operating System and OS version: x86_64 Linux 4.16.7-1-ARCH
  • Java version: 1.8.0_162

Clearly, there is a discrepancy between the implementation and the documentation. Which one is wrong?

@sjaustirni
Copy link
Author

sjaustirni commented Sep 23, 2018

Upon deeper inspection it seems Processing is using its own Java implementation (#3054).

I would suggest then to reflect it in docs, adding the list of differences between the Processing version and the official specs there (since #3055 is still open and no one seems to be working on it)?

@joelmoniz even identified some features to list there already in #3054:

1. Multi-catch support

2. Support for the diamond operator

3. Underscores in numeric literals (such as `int x = 30_000`)

4. [Strings in switch](https://github.com/processing/processing/issues/3049)

5. Binary literals

6. Support for lambda calculus

@AlvaroHermida
Copy link

Maybe this just requires a minor wiki edition, because just two paragraphs before your quote, there is a response to this relevant and frequently asked question:

We don't yet support any of the Java 7 and Java 8 language features. Please help us fix this. Advanced users (loosely defined as “people who know that these features exist”) can always make use of Java 7 and 8 features from another IDE.

While the call "Please help us fix this" is still open, maybe we could avoid more misunderstandings by slightly rewriting the referred paragraph in the wiki, to make it more clear that Processing uses Java 8, but Processing doesn't fully support the Java 8 specific features, like lambda expressions.

Since english is my second language, I don't dare to take the risk of editing the wiki and become "the man who broke the Processing documentation with his creative english" ;)

So the proposal is to edit the supported platforms page on the wiki adding the text marked with italics:

Java 8

Processing 3 uses Java 8 (but please note that currently we doesn't fully support the Java 8 specific features, like lambda expressions). We only support the version of Java 8 that's included with ...

@sjaustirni
Copy link
Author

I hadn't noticed the above paragraphs before, my eyes went straight to the "Java 8" section.

I feel like your modification suggestion does make things much clearer, but I am not an English native either, so I'll leave it to someone more experienced too.

Thank you for your help 😃

@benfry
Copy link
Contributor

benfry commented Sep 24, 2018

I've made the edit to the wiki. Marking this as a duplicate.

@sjaustirni
Copy link
Author

but again, does not support all Java 8 language features

The current wording suggests that Processing supports some Java 8 features, whilst two paragraphs above it says:

We don't yet support any of the Java 7 and Java 8 language features.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants