Bug 111420 - Disassembler doesn't generate type parameters
Summary: Disassembler doesn't generate type parameters
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-04 06:49 EDT by Jerome Lanneluc CLA
Modified: 2005-10-31 06:12 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 Jerome Lanneluc CLA 2005-10-04 06:49:17 EDT
I20050928 + latest JDT Core

When trying to disassemble in working copy mode the .class file coming from the
following source:
public class Y<W> {
  <T> T foo(T t, String... s) {
    return t;
  }
}

we get:
public class Y extends java.lang.Object {

  public Y() {
  }

  java.lang.Object foo(java.lang.Object arg, java.lang.String... arg) {
    return null;
  }
}

Note that the type parameters are not taken into account.
Comment 1 Jerome Lanneluc CLA 2005-10-04 06:50:08 EDT
Also the name of the method parameters are all 'arg'. Then should be 't' and 's'.
Comment 2 Jerome Lanneluc CLA 2005-10-04 06:53:04 EDT
I disabled ClassFileTests#testWorkingCopy10() for now. Please re-enable when
fixing this bug.
Comment 3 Olivier Thomann CLA 2005-10-04 08:41:19 EDT
The name of the parameter can only be retrieved if the .class file is compiled
with debug attributes (local variable table). With it, it is impossible to know
the name. This is why there is the default 'arg' value. I'll see what I can do
in this case to have arg0, arg1, etc.
The type parameters are in the signature attribute. I don't display them for now
in the output string.
Comment 4 Olivier Thomann CLA 2005-10-04 12:57:18 EDT
I will also get rid of extends java.lang.Object. This isn't required.
Comment 5 Olivier Thomann CLA 2005-10-04 14:42:14 EDT
Fixed and released in HEAD.
I changed the generation of the library to generate local variable table in
order to retrieve the argument's names. I also change the argument name to match
's' instead of 'args'.
I reenabled the test specified in comment 2.
Regression tests added in
org.eclipse.jdt.core.tests.compiler.regression.ClassFileReaderTest.test076/077.
Comment 6 David Audel CLA 2005-10-31 06:12:14 EST
Verified for 3.2 M3 using build I20051031-0010