Bug 166487 - [ccp] Pasting source should handle more than one public type
Summary: [ccp] Pasting source should handle more than one public type
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-01 09:30 EST by Dani Megert CLA
Modified: 2007-05-31 12:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-12-01 09:30:44 EST
I20061129-1340

Pasting source should handle more than one public type. Currently only one CU is generated which results in compile errors.

NOTE: must also consider enums.
Comment 1 Martin Aeschlimann CLA 2006-12-05 05:21:55 EST
It should already work if you have package statements before each public type. So I'm not sure what you're missing.
Comment 2 Dani Megert CLA 2006-12-10 13:23:09 EST
paste this:

public class foo {
}

public class bar {
}

==> compile error
Comment 3 Markus Keller CLA 2006-12-11 05:54:44 EST
Not trivial, since we cannot simply start a new CU for each occurrence of keyword  "package". Would have to deal with import startements as well, which is even less clear in cases like this:

import java.util.Vector;

public class foo {
}

public class bar {
}

=> Does the import statement belong to the foo alone, or to foo and bar? Do we have to support variants with an additional import structure between foo and bar as well?

I think this will quickly become unpredictable and thus useless for the most common use case (paste code from bugzilla to reproduce a problem from a clearly defined starting state).

I don't think we should support this. Please add your vote to bug 87085.
Comment 4 Markus Keller CLA 2006-12-11 06:10:41 EST
Dani seems to have different common use cases than I have :-). Reopening to support these cases (split text at //--, never repeat import structure from earlier declaration):

public class A {}
//--
public class B {}
-------------------------------------------
import java.util.Vector
public class A {}
//--
public class B {}
-------------------------------------------
import java.util.Vector
public class A {}
//--
import java.util.Map
public class B {}