Bug 46720 - [compiler] Should default constructors have synthetic attributes
Summary: [compiler] Should default constructors have synthetic attributes
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 46699
  Show dependency tree
 
Reported: 2003-11-14 22:40 EST by Jim des Rivieres CLA
Modified: 2003-11-18 09:20 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim des Rivieres CLA 2003-11-14 22:40:14 EST
JVM Spec (2nd edn) - section 4.7.6 The Synthetic Attribute

"A class member that does not appear in the source code must be marked using a 
Synthetic attribute."

There is nothing in this section that says anything about compiler-generated 
default constructors, so one would assume that these must be marked synthetic 
too.

This PR is to investigate whether we are in fact handling this properly in the 
compiler. What does javac do these days? Does the JCK have a test that covers 
this?
Comment 1 Olivier Thomann CLA 2003-11-17 11:37:16 EST
javac doesn't add the synthetic attribute for the default constructor. So do we.
Comment 2 Olivier Thomann CLA 2003-11-17 11:38:52 EST
jikes is not doing it as well.
Comment 3 Olivier Thomann CLA 2003-11-17 11:45:37 EST
We should run the JCK with a patched version of the batch compiler that sets the
synthetic attribute for default constructor.
Comment 4 Philipe Mulet CLA 2003-11-18 05:40:11 EST
The synthetic attribute got added around innerclass extension. Default 
constructors did exist already, and were therefore not using it. For backward 
compatibility issues, this was never added very likely...

I wouldn't change this assumption at this stage, unless this is officially 
coming from the language owner.

Though it would ease our customer by allowing them to tell when using synthetic 
artifacts.

Moving to later
Comment 5 Olivier Thomann CLA 2003-11-18 08:24:07 EST
From Neal Gafter, the answer is no.
"No. The "synthetic" flag is for things that are an artifact of the
implementaiton and do not affect the API. Default constructors are part of the
API of a class."

So the synthetic attribute will never be used for the default constructor.
I guess we can close this bug as WONTFIX and update the javadoc of the
isSynthetic() method.
Comment 6 Philipe Mulet CLA 2003-11-18 08:57:12 EST
I agree.
Comment 7 Olivier Thomann CLA 2003-11-18 09:20:58 EST
Close as WONTFIX.