Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 415846

Summary: [1.8] UI option to control generation of MethodParameters attribute in class files
Product: [Eclipse Project] JDT Reporter: Srikanth Sankaran <srikanth_sankaran>
Component: UIAssignee: Martin Mathew <manju656>
Status: VERIFIED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 4.4Flags: daniel_megert: review+
Target Milestone: BETA J8   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 407297    
Bug Blocks:    
Attachments:
Description Flags
Patch.
none
Updated Patch none

Description Srikanth Sankaran CLA 2013-08-26 03:59:56 EDT
BETA_JAVA8:

JEP 118 provides for storing of method parameter names, flags and such in
a new attribute called MethodParameters. This is to be generated only when
a programmer opts in for it.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=407297 has implemented the
Core changes for this option. See the javadoc for org.eclipse.jdt.core.JavaCore.COMPILER_CODEGEN_METHOD_PARAMETERS_ATTR

ECJ implements -parameters command line option for this purpose.

We need support in the UI for enabling this. TIA.
Comment 1 Martin Mathew CLA 2013-08-28 06:53:24 EDT
Created attachment 234841 [details]
Patch.

Updated compiler preference page to add option to generate method parameter names in class file.
Dani, kindly review.
Comment 2 Dani Megert CLA 2013-08-28 08:53:51 EDT
#updateComplianceDefaultSettings is not setting the new property when following the EE (note that the value might be 'null').
Comment 3 Martin Mathew CLA 2013-09-11 05:00:20 EDT
Created attachment 235378 [details]
Updated Patch

After importing org.eclipse.jdt.launching into my workspace, JavaSE-1.8 EE was available, which helped to test follow EE scenario.
Dani, kindly have a look.
Comment 4 Dani Megert CLA 2013-09-11 12:13:48 EDT
(In reply to Manju Mathew from comment #3)
> Created attachment 235378 [details] [diff]
> Updated Patch
> 
> After importing org.eclipse.jdt.launching into my workspace, JavaSE-1.8 EE
> was available, which helped to test follow EE scenario.

You also need 'org.eclipse.osgi' from http://git.eclipse.org/c/equinox/rt.equinox.framework.git/log/?h=R3_9_maintenance
Comment 5 Martin Mathew CLA 2013-09-13 01:47:00 EDT
JavaSE-1.8.profile was available in the osgi bundle which came with my current Eclipse installation. 
Version: 4.4.0
Build id: I20130903-2000
Hence the profile was set and the compliance properties was loaded from the JavaSE-1.8.profile. Is there any other particular property which will be loaded with the osgi bundle from R3_9_maintenance?
Comment 6 Dani Megert CLA 2013-09-13 02:42:25 EDT
(In reply to Manju Mathew from comment #5)
> JavaSE-1.8.profile was available in the osgi bundle which came with my
> current Eclipse installation. 
> Version: 4.4.0
> Build id: I20130903-2000
> Hence the profile was set and the compliance properties was loaded from the
> JavaSE-1.8.profile. Is there any other particular property which will be
> loaded with the osgi bundle from R3_9_maintenance?

It comes with newer builds / targets but for Java 8 we must use R3.9.x as target and API baseline, hence it would not be available unless you load it from the R3_9_maintenance. Once 3.9.1 is out, we can switch to that one and then we don't need to have that bundle in source anymore.
Comment 7 Dani Megert CLA 2013-09-13 04:51:28 EDT
The patch does not apply on BETA_JAVA8. I suspect that you made it against 'master', or, a dirty copy of the file in your BETA_JAVA8 workspace where you applied the fix for bug 416401?
Comment 8 Martin Mathew CLA 2013-09-13 06:19:30 EDT
(In reply to Dani Megert from comment #7)
> The patch does not apply on BETA_JAVA8. I suspect that you made it against
> 'master', or, a dirty copy of the file in your BETA_JAVA8 workspace where
> you applied the fix for bug 416401?

I have cherry picked the fix for bug 416401 from master and pushed it in BETA_JAVA8. I have tested that this patch can now be applied on BETA_JAVA8.

Dani, kindly have a look.
Comment 10 Markus Keller CLA 2014-01-07 10:40:52 EST
Changed the option name to:

 [] &Store method parameter names (usable via reflection)

The "Preserve unused local variables" option on that page is a bit special, since one could expect that all variables are represented in the class file, but the compiler can eliminate unused ones.

The method parameter names option is not about preserving something, but it's more in line with the "Add ..." options we already have for debug infos. However, parameter names can have an effect at run time, so it's also not just an optional addition. "Store" is the term that's also used in the specs.

http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=466143081ae1cae12c4b4dbb9bd90e6db3bfee55