Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352402 - [1.7][quick fix] Quick fix to change the compliance to 1.7 doesn't trigger a build
Summary: [1.7][quick fix] Quick fix to change the compliance to 1.7 doesn't trigger a ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 352547 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-19 02:01 EDT by Satyam Kandula CLA
Modified: 2011-08-02 11:40 EDT (History)
4 users (show)

See Also:


Attachments
Fix (5.08 KB, patch)
2011-07-27 11:42 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Satyam Kandula CLA 2011-07-19 02:01:46 EDT
Steps to reproduce:
1. Create a Java7 project
2. Paste int a = 1_0; into the package explorer 
3. Just Change the compiler compliance to 1.6 project 
4. There will be an error and a quick fix to change the compliance
5. Apply the quick fix and notice that the class files are not really build.
Comment 1 Dani Megert CLA 2011-07-19 02:28:11 EDT
Can reproduce: the compliance gets changed but no build happens. Maybe because the JRE was already 1.7.

Probably caused by fix for bug 199616.

Also note: the quick fix did not suggest to change the EE (as requested by bug 199616) but to set project compliance and JRE.
Comment 2 Raksha Vasisht CLA 2011-07-19 03:46:22 EDT
I see a similar problem when I use diamond with 1.4

package p;
import java.util.ArrayList;
public class C {
    public static void main(String[] args) {
        new ArrayList<>();
    }
}

1) Remove JRE 1.7 from the list of added JREs , set the EE to 1.4
2) Invoke quick fix 'Change Project compliance and JRE to 1.7'
--> 
I see errors due to unbound JavaSE-1.7 added to build path:

The project cannot be built until build path errors are resolved	_pasted_code_		Unknown	Java Problem

Unbound classpath container: 'JRE System Library [JavaSE-1.7]' in project '_pasted_code_'	_pasted_code_		Build path	Build Path Problem
Comment 3 Srikanth Sankaran CLA 2011-07-19 04:30:56 EDT
I also ran into this while testing switching on strings in 1.6 mode.
(yes I had a JDK7 JRE).

I hovered on some of the error markers and caused the error message
"Cannot switch on ..." to appear in the status bar (bottom of screen)
Having done that I happened to do a clean & rebuild.

This clears all the error markers, but leaves the status line still
showing the error message "Cannot switch on ..."
Comment 4 Dani Megert CLA 2011-07-20 05:04:05 EDT
*** Bug 352547 has been marked as a duplicate of this bug. ***
Comment 5 Markus Keller CLA 2011-07-27 11:42:35 EDT
Created attachment 200459 [details]
Fix

The patch fixes 2 problems:

1. We need to trigger a build if we just changed the compiler compliance but didn't touch the classpath.

2. The additional info didn't tell that the quick fix updates the project JRE if the fix only changed the classpath entry but didn't change the actual VM install that ended up on the classpath (this e.g. happens when you only have a 1.7 JRE installed and the quick fix changes the EE on the classpath from JavaSE-1.6 to JavaSE-1.7).
Comment 6 Markus Keller CLA 2011-07-27 11:43:47 EDT
Fixed in BETA_JAVA7.
Comment 7 Dani Megert CLA 2011-08-02 11:40:29 EDT
Verified in I20110729-1200 and M20110729-1400.