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

switch on Strings #4034

Closed
ghost opened this Issue Oct 20, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@ghost

ghost commented Oct 20, 2015

Hi,

I've tried to switch on String variables whith Processing 3. According to the documentation, this might not work : it should only be right with int, char or byte. Processing underlines the variable in red. Clicking on the variable, the message "Cannot switch on a value of type String. Only convertible int values, strings or enum variables are permitted." is displayed.

Nevertheless, if I try to lauch the code, it works as expected.

Can you please explain to me :

  • if this is a bug ?
  • if the documentation is right ?
  • what is the precise meaning of the error message ? What is this "string variable" permitted ?

Thanks,
Samuel

EDIT : I use JDK 8, which could explain why it works. If so, shouldn't we update the documentation and/or the software to indicate when it will work ?

JakubValtar added a commit to JakubValtar/processing that referenced this issue Oct 22, 2015

Unify compiler options, set level to Java 7
Does not guarantee support for all Java 7 features (only some), but
warns about lambdas not being available. Lambdas are not supported,
because they make ANTLR angry.

Fixes processing#4034
@JakubValtar

This comment has been minimized.

Show comment
Hide comment
@JakubValtar

JakubValtar Oct 22, 2015

Contributor

Hi @Sam22235, thank you for your report. There was a problem with error checker being set to Java 6 level, but String switches are available since Java 7. Processing uses its own Java, so it does not care if you have Java installed and what version it is.

Contributor

JakubValtar commented Oct 22, 2015

Hi @Sam22235, thank you for your report. There was a problem with error checker being set to Java 6 level, but String switches are available since Java 7. Processing uses its own Java, so it does not care if you have Java installed and what version it is.

@benfry benfry closed this in #4042 Oct 22, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment