Bug 362554 - Unexpected compiler error:"Cannot switch on a value of type String."
Summary: Unexpected compiler error:"Cannot switch on a value of type String."
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M5   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2011-11-01 05:54 EDT by Christian Schwarz CLA
Modified: 2012-01-23 05:20 EST (History)
5 users (show)

See Also:


Attachments
screenshot with my project preferences (95.38 KB, image/png)
2011-11-01 05:57 EDT, Christian Schwarz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Schwarz CLA 2011-11-01 05:54:51 EDT
Build Identifier: 

On some of my plugin-projects i get an unexpected compiler error : "Cannot switch on a value of type String." when it try to swich on a String. I am using Java 1.7 and eclipse 3.71 so it should work.

In the MANIFEST.MF of my plugin project i have set the execution enviroment to JavaSE-1.7.
There are no project specific compile properties set, i use my workspace preferences. The workspace compiler compliance is set to 1.7 too. 

see -> https://picasaweb.google.com/lh/photo/UsNk4Rp0hetRiHnpd2vrzrTj1UYXjjPWBBLrFWoUKgk?feat=directlink


I use "Eclipse for RCP and RAP Developers" which was updated from 3.7.0 to 3.7.1

Version: Indigo Service Release 1
Build id: 20110916-0149

Reproducible: Couldn't Reproduce
Comment 1 Christian Schwarz CLA 2011-11-01 05:57:20 EDT
Created attachment 206253 [details]
screenshot with my project preferences
Comment 2 Christian Schwarz CLA 2011-11-01 10:30:29 EDT
I found a workaround, just klick on "Update the classpath setting" on the Overview-Tab in the MANIFEST-Editor.

In Folder-".settings" i have now a new "org.eclipse.jdt.core.prefs"-File, it contains:

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7


My ".classpath"-File was changed, instead of:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>

it contains now:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
Comment 3 Satyam Kandula CLA 2011-11-02 07:22:30 EDT
(In reply to comment #2)

> eclipse.preferences.version=1
> org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
> org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
> org.eclipse.jdt.core.compiler.compliance=1.7
> org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
> org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
> org.eclipse.jdt.core.compiler.source=1.7
This is equivalent to specifying project settings. Does it work if you remove this folder? Are you also having 1.6 based plugin projects in the same workspace? Is there anything that you can provide for us to reproduce the behavior?
Comment 4 Ayushman Jain CLA 2011-11-02 07:56:39 EDT
> Version: Indigo Service Release 1
> Build id: 20110916-0149

This isn't really sufficient. Can you please provide the jdt.core bundle version? (Help>About>Installation Details>Plugins>Look up org.eclipse.jdt.core)
Comment 5 Christian Schwarz CLA 2011-11-02 09:25:13 EDT
(In reply to comment #4)
> ...Can you please provide the jdt.core bundle
> version?

3.7.1.v_B76_R37x
Comment 6 Christian Schwarz CLA 2011-11-02 09:41:56 EDT
(In reply to comment #3)
> Does it work if you remove this folder?
Yes! After removing the folder the project can be compiled without errors! It even compiles without errors if i revert the ".classpath" - File.
 
> Are you also having 1.6 based plugin projects in the same workspace? 
Yes, i have many 1.6 and 1.7 plugin projects !

> Is there anything that you can provide for us to reproduce the behavior?
I don't find a way to reproduce it. I only know that it happen to some 1.7 projects with a string-switch not all. After appling the described workaround every everthing is fine.
Comment 7 Srikanth Sankaran CLA 2012-01-13 05:54:20 EST
There is nothing to do here. If you manage to reproduce it
please feel free to reopen with clear instructions.
Comment 8 Jay Arthanareeswaran CLA 2012-01-23 05:20:01 EST
Verified for 3.8M5 using I20120122-2000